@internetarchive/bookreader 5.0.0-37 → 5.0.0-38

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"file":"ia-bookreader-bundle.js","mappings":";kQAoDO,SAASA,EAAWC,EAAYC,EAAQC,EAAKC,GAChD,IAA2HC,EAAvHC,EAAIC,UAAUC,OAAQC,EAAIH,EAAI,EAAIJ,EAAkB,OAATE,EAAgBA,EAAOM,OAAOC,yBAAyBT,EAAQC,GAAOC,EACrH,GAAuB,iBAAZQ,SAAoD,mBAArBA,QAAQC,SAAyBJ,EAAIG,QAAQC,SAASZ,EAAYC,EAAQC,EAAKC,QACpH,IAAK,IAAIU,EAAIb,EAAWO,OAAS,EAAGM,GAAK,EAAGA,KAAST,EAAIJ,EAAWa,MAAIL,GAAKH,EAAI,EAAID,EAAEI,GAAKH,EAAI,EAAID,EAAEH,EAAQC,EAAKM,GAAKJ,EAAEH,EAAQC,KAASM,GAChJ,OAAOH,EAAI,GAAKG,GAAKC,OAAOK,eAAeb,EAAQC,EAAKM,GAAIA,MCtDrDO,ECiCAC,YCnCJ,MAAMC,EAETC,WAAWC,GACP,OAAwB,iBAAbA,GACO,UAAbA,GAAqC,MAAbA,IAGtBC,QAAQD,IAKvBF,EAAcI,OAAS,IAAIJ,ECZpB,MAAMK,EAETJ,WAAWC,GACP,GAAwB,iBAAbA,EACP,OAAOA,EACX,GAAwB,kBAAbA,EACP,OACJ,MAAMI,EAAQC,WAAWL,GACzB,OAAIM,OAAOC,MAAMH,QAAjB,EAGOA,GAKfD,EAAaD,OAAS,IAAIC,ECPnB,MAAMK,EAETT,WAAWC,GAEP,OADeG,EAAaD,OACdH,WAAWC,IAKjCQ,EAAWN,OAAS,IAAIM,EClBjB,MAAMC,EAETV,WAAWC,GAEP,OAAOU,KAAKC,YAAYX,IAAaU,KAAKE,iBAAiBZ,GAG/DY,iBAAiBZ,GACb,GAAwB,iBAAbA,EACP,OACJ,MAAMa,EAAYb,EAASc,MAAM,kBACjC,OAAKD,GAAa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Pm0B,OAAYt6C,EAhBVu6C,IAmBAF,IAAiBC,GAKnBh6B,IAGFm6B,SAEqBz6C,IAAjBq6C,GAA8BU,EAAUZ,EAK1C75B,KACwB,IAAf85B,IAYTE,EAAYxS,WAAWuS,EAAel0B,EAAQ7F,OAAuBtgB,IAAjBq6C,EAA6BF,EAAQY,EAAUZ,KAMvG,MAzE0B,kBAAfC,IACTC,EAAevhC,EACfA,EAAWshC,EACXA,OAAap6C,GAoEf06C,EAAQM,OA7ER,WACEP,IACAF,GAAY,GA6EPG,EAuBTpC,EAAQ2C,SAJR,SAAmBd,EAAOe,EAASpiC,GACjC,YAAoB9Y,IAAb8Y,EAAyB8b,EAASulB,EAAOe,GAAS,GAAStmB,EAASulB,EAAOrhC,GAAsB,IAAZoiC,IAI9F5C,EAAQ1jB,SAAWA,EAEnBp3B,OAAOK,eAAey6C,EAAS,aAAc,CAAEh6C,OAAO,IAlJS68C,CAAQ7C","sources":["webpack://@internetarchive/bookreader/./node_modules/tslib/tslib.es6.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/search-service/dist/src/search-service-error.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/search-service/dist/src/search-params.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/field-parsers/dist/src/field-types/boolean.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/field-parsers/dist/src/field-types/number.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/field-parsers/dist/src/field-types/byte.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/field-parsers/dist/src/field-types/date.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/field-parsers/dist/src/field-types/duration.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/field-parsers/dist/src/field-types/mediatype.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/field-parsers/dist/src/field-types/page-progression.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/field-parsers/dist/src/field-types/string.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/search-service/dist/src/models/metadata-fields/metadata-field.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/search-service/dist/src/models/metadata-fields/field-types/boolean.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/search-service/dist/src/models/metadata-fields/field-types/date.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/search-service/dist/src/models/metadata-fields/field-types/duration.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/search-service/dist/src/models/metadata-fields/field-types/number.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/search-service/dist/src/models/metadata-fields/field-types/string.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/search-service/dist/src/models/metadata-fields/field-types/byte.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/search-service/dist/src/models/metadata-fields/field-types/mediatype.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/search-service/dist/src/models/metadata.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/search-service/dist/src/models/file.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/search-service/dist/src/models/review.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/search-service/dist/src/responses/metadata/metadata-response.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/search-service/dist/src/responses/search/search-response-details.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/search-service/dist/src/responses/search/search-response.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/search-service/dist/src/search-service.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/search-service/dist/src/search-backend/default-search-backend.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/ia-menu-slider/src/styles/menu-slider.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-collapse-sidebar/index.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-collapse-sidebar/icon-collapse-sidebar.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/ia-menu-slider/src/styles/menu-button.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/ia-menu-slider/src/menu-button.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/ia-menu-slider/src/ia-menu-slider.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-ellipses/index.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-ellipses/icon-ellipses.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/ia-item-navigator/dist/src/loader.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/ia-item-navigator/dist/src/no-theater-available.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/ia-item-navigator/dist/src/item-navigator.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/ResizeObserverBoxOptions.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/utils/resizeObservers.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/algorithms/deliverResizeLoopError.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/utils/freeze.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/utils/queueMicroTask.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/ResizeObserverSize.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/DOMRectReadOnly.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/utils/element.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/utils/global.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/algorithms/calculateBoxSize.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/ResizeObserverEntry.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/algorithms/calculateDepthForNode.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/algorithms/broadcastActiveObservations.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/algorithms/gatherActiveObservationsAtDepth.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/utils/scheduler.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/utils/queueResizeObserver.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/utils/process.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/algorithms/hasActiveObservations.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/algorithms/hasSkippedObservations.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/ResizeObservation.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/ResizeObserverDetail.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/ResizeObserverController.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/ResizeObserver.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/shared-resize-observer/dist/src/shared-resize-observer.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/modal-manager/dist/src/modal-config.js","webpack://@internetarchive/bookreader/../src/lib/dom.ts","webpack://@internetarchive/bookreader/../src/lib/template.ts","webpack://@internetarchive/bookreader/../src/lib/modify-template.ts","webpack://@internetarchive/bookreader/../src/lib/directive.ts","webpack://@internetarchive/bookreader/../src/lib/part.ts","webpack://@internetarchive/bookreader/../src/lib/template-instance.ts","webpack://@internetarchive/bookreader/../src/lib/template-result.ts","webpack://@internetarchive/bookreader/../src/lib/parts.ts","webpack://@internetarchive/bookreader/../src/lib/template-factory.ts","webpack://@internetarchive/bookreader/../src/lib/render.ts","webpack://@internetarchive/bookreader/../src/lib/default-template-processor.ts","webpack://@internetarchive/bookreader/src/lit-html.ts","webpack://@internetarchive/bookreader/../src/lib/shady-render.ts","webpack://@internetarchive/bookreader/../src/lib/updating-element.ts","webpack://@internetarchive/bookreader/../src/lib/decorators.ts","webpack://@internetarchive/bookreader/../src/lib/css-tag.ts","webpack://@internetarchive/bookreader/src/lit-element.ts","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/ia-activity-indicator/src/ia-activity-indicator.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/ia-activity-indicator/ia-activity-indicator.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/modal-manager/node_modules/@internetarchive/icon-close/index.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/modal-manager/node_modules/@internetarchive/icon-ia-logo/index.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/modal-manager/dist/src/modal-template.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/modal-manager/dist/src/modal-manager-mode.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/modal-manager/dist/src/modal-manager-host-bridge.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/modal-manager/dist/src/modal-manager.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-search/index.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-search/icon-search.js","webpack://@internetarchive/bookreader/../src/directives/unsafe-html.ts","webpack://@internetarchive/bookreader/./src/BookNavigator/search/a-search-result.js","webpack://@internetarchive/bookreader/./src/BookNavigator/assets/icon_checkmark.js","webpack://@internetarchive/bookreader/./src/BookNavigator/assets/icon_close.js","webpack://@internetarchive/bookreader/./src/BookNavigator/assets/button-base.js","webpack://@internetarchive/bookreader/./src/BookNavigator/search/search-results.js","webpack://@internetarchive/bookreader/./src/BookNavigator/search/search-provider.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-dl/index.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-dl/icon-dl.js","webpack://@internetarchive/bookreader/./src/BookNavigator/downloads/downloads.js","webpack://@internetarchive/bookreader/./src/BookNavigator/downloads/downloads-provider.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-visual-adjustment/index.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-visual-adjustment/icon-visual-adjustment.js","webpack://@internetarchive/bookreader/src/directive-helpers.ts","webpack://@internetarchive/bookreader/../src/directives/repeat.ts","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-magnify-minus/index.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-magnify-minus/icon-magnify-minus.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-magnify-plus/index.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-magnify-plus/icon-magnify-plus.js","webpack://@internetarchive/bookreader/./src/BookNavigator/visual-adjustments/visual-adjustments.js","webpack://@internetarchive/bookreader/./src/BookNavigator/visual-adjustments/visual-adjustments-provider.js","webpack://@internetarchive/bookreader/./src/BookNavigator/delete-modal-actions.js","webpack://@internetarchive/bookreader/./src/BookNavigator/bookmarks/bookmark-button.js","webpack://@internetarchive/bookreader/./src/BookNavigator/bookmarks/bookmarks-loginCTA.js","webpack://@internetarchive/bookreader/./src/BookNavigator/bookmarks/ia-bookmarks.js","webpack://@internetarchive/bookreader/./src/BookNavigator/assets/bookmark-colors.js","webpack://@internetarchive/bookreader/./src/BookNavigator/bookmarks/bookmark-edit.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-edit-pencil/index.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-edit-pencil/icon-edit-pencil.js","webpack://@internetarchive/bookreader/./src/BookNavigator/bookmarks/bookmarks-list.js","webpack://@internetarchive/bookreader/./src/BookNavigator/bookmarks/bookmarks-provider.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-bookmark/src/icon-bookmark.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-share/index.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-share/icon-share.js","webpack://@internetarchive/bookreader/../src/directives/class-map.ts","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-link/index.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-link/icon-link.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/ia-sharing-options/src/styles/ia-sharing-options.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-email/index.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-email/icon-email.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/ia-sharing-options/src/providers/provider.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/ia-sharing-options/src/providers/email.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-facebook/index.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-facebook/icon-facebook.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/ia-sharing-options/src/providers/facebook.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-pinterest/index.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-pinterest/icon-pinterest.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/ia-sharing-options/src/providers/pinterest.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-tumblr/index.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-tumblr/icon-tumblr.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/ia-sharing-options/src/providers/tumblr.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-twitter/index.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-twitter/icon-twitter.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/ia-sharing-options/src/providers/twitter.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/ia-sharing-options/src/ia-sharing-options.js","webpack://@internetarchive/bookreader/./src/BookNavigator/sharing.js","webpack://@internetarchive/bookreader/./src/BookNavigator/assets/icon_sort_desc.js","webpack://@internetarchive/bookreader/./src/BookNavigator/assets/icon_sort_asc.js","webpack://@internetarchive/bookreader/./src/BookNavigator/assets/icon_sort_neutral.js","webpack://@internetarchive/bookreader/./src/BookNavigator/assets/icon_volumes.js","webpack://@internetarchive/bookreader/./src/BookNavigator/volumes/volumes.js","webpack://@internetarchive/bookreader/./src/BookNavigator/volumes/volumes-provider.js","webpack://@internetarchive/bookreader/./src/BookNavigator/assets/ia-logo.js","webpack://@internetarchive/bookreader/./src/BookNavigator/book-navigator.js","webpack://@internetarchive/bookreader/./src/ia-bookreader/ia-bookreader.js","webpack://@internetarchive/bookreader/./node_modules/core-js/internals/is-integer.js","webpack://@internetarchive/bookreader/./node_modules/core-js/modules/es.array.reduce-right.js","webpack://@internetarchive/bookreader/./node_modules/core-js/modules/es.number.is-integer.js","webpack://@internetarchive/bookreader/./node_modules/core-js/modules/es.string.match.js","webpack://@internetarchive/bookreader/./node_modules/throttle-debounce/index.umd.js"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nexport var SearchServiceErrorType;\n(function (SearchServiceErrorType) {\n SearchServiceErrorType[\"networkError\"] = \"SearchService.NetworkError\";\n SearchServiceErrorType[\"itemNotFound\"] = \"SearchService.ItemNotFound\";\n SearchServiceErrorType[\"decodingError\"] = \"SearchService.DecodingError\";\n SearchServiceErrorType[\"searchEngineError\"] = \"SearchService.SearchEngineError\";\n})(SearchServiceErrorType || (SearchServiceErrorType = {}));\nexport class SearchServiceError extends Error {\n constructor(type, message, details) {\n super(message);\n this.name = type;\n this.type = type;\n this.details = details;\n }\n}\n//# sourceMappingURL=search-service-error.js.map","export class AggregateSearchParams {\n constructor(searchParams) {\n this.searchParams = searchParams;\n }\n /**\n * Generates a query parameter from the given aggregate search params\n *\n * Example:\n *\n * [\n * {\n * \"terms\": {\n * \"field\": \"collection\",\n * \"size\":10\n * }\n * },\n * {\n * \"terms\": {\n * \"field\": \"subjectSorter\",\n * \"size\": 10\n * }\n * }\n * ]\n *\n * @returns {Record<string, AggregateSearchParam>[]}\n * @memberof AggregateSearchParams\n */\n get asSearchParams() {\n return this.searchParams.map(param => {\n return {\n terms: param,\n };\n });\n }\n}\nexport var SortDirection;\n(function (SortDirection) {\n SortDirection[\"Asc\"] = \"asc\";\n SortDirection[\"Desc\"] = \"desc\";\n})(SortDirection || (SortDirection = {}));\nexport class SortParam {\n constructor(field, direction) {\n this.field = field;\n this.direction = direction;\n }\n get asString() {\n return `${this.field} ${this.direction}`;\n }\n}\n/**\n * SearchParams provides an encapsulation to all of the search parameters\n * available for searching.\n *\n * It also provides an `asUrlSearchParams` method for converting the\n * parameters to an IA-style query string. ie. it converts the `fields` array\n * to `fl=identifier,collection` and `sort` to `sort=date+desc,downloads+asc`\n */\nexport class SearchParams {\n constructor(options) {\n this.query = options.query;\n this.sort = options.sort;\n this.rows = options.rows;\n this.page = options.page;\n this.fields = options.fields;\n this.aggregations = options.aggregations;\n }\n /**\n * Return a URLSearchParams representation of the parameters for use in network requests.\n *\n * @readonly\n * @type {URLSearchParams}\n * @memberof SearchParams\n */\n get asUrlSearchParams() {\n const params = new URLSearchParams();\n params.append('q', this.query);\n params.append('output', 'json');\n if (this.rows) {\n params.append('rows', String(this.rows));\n }\n if (this.page) {\n params.append('page', String(this.page));\n }\n if (this.fields) {\n params.append('fl', this.fields.join(','));\n }\n if (this.sort) {\n const sortStrings = this.sort.map(sort => sort.asString);\n params.append('sort', sortStrings.join(','));\n }\n if (this.aggregations) {\n const searchParams = this.aggregations.asSearchParams;\n const stringified = JSON.stringify(searchParams);\n params.append('user_aggs', stringified);\n }\n return params;\n }\n}\n//# sourceMappingURL=search-params.js.map","export class BooleanParser {\n /** @inheritdoc */\n parseValue(rawValue) {\n if (typeof rawValue === 'string' &&\n (rawValue === 'false' || rawValue === '0')) {\n return false;\n }\n return Boolean(rawValue);\n }\n}\n// use a shared static instance for performance instead of\n// instantiating a new instance for every use\nBooleanParser.shared = new BooleanParser();\n//# sourceMappingURL=boolean.js.map","export class NumberParser {\n /** @inheritdoc */\n parseValue(rawValue) {\n if (typeof rawValue === 'number')\n return rawValue;\n if (typeof rawValue === 'boolean')\n return undefined;\n const value = parseFloat(rawValue);\n if (Number.isNaN(value)) {\n return undefined;\n }\n return value;\n }\n}\n// use a shared static instance for performance instead of\n// instantiating a new instance for every use\nNumberParser.shared = new NumberParser();\n//# sourceMappingURL=number.js.map","import { NumberParser } from './number';\n/**\n * The ByteParser is a unit-specific NumberParser\n * that returns a value in bytes\n *\n * @export\n * @class ByteParser\n * @implements {FieldParserInterface<Byte>}\n */\nexport class ByteParser {\n /** @inheritdoc */\n parseValue(rawValue) {\n const parser = NumberParser.shared;\n return parser.parseValue(rawValue);\n }\n}\n// use a shared static instance for performance instead of\n// instantiating a new instance for every use\nByteParser.shared = new ByteParser();\n//# sourceMappingURL=byte.js.map","export class DateParser {\n /** @inheritdoc */\n parseValue(rawValue) {\n // try different date parsing\n return this.parseJSDate(rawValue) || this.parseBracketDate(rawValue);\n }\n // handles \"[yyyy]\" format\n parseBracketDate(rawValue) {\n if (typeof rawValue !== 'string')\n return undefined;\n const yearMatch = rawValue.match(/\\[([0-9]{4})\\]/);\n if (!yearMatch || yearMatch.length < 2) {\n return undefined;\n }\n return this.parseJSDate(yearMatch[1]);\n }\n parseJSDate(rawValue) {\n if (typeof rawValue !== 'string')\n return undefined;\n let parsedValue = rawValue;\n // fix for Safari not supporting `yyyy-mm-dd HH:MM:SS` format, insert a `T` into the space\n if (parsedValue.match(/^[0-9]{4}-[0-9]{2}-[0-9]{2}\\s{1}[0-9]{2}:[0-9]{2}:[0-9]{2}$/)) {\n parsedValue = parsedValue.replace(' ', 'T');\n }\n const parsed = Date.parse(parsedValue);\n if (Number.isNaN(parsed)) {\n return undefined;\n }\n let date = new Date(parsedValue);\n // the `Date(string)` constructor parses some strings as GMT and some in the local timezone\n // this attempts to detect cases that get parsed as GMT and adjusts accordingly\n const dateWithTimeZone = parsedValue.indexOf('Z') > -1 || // ISO8601 with GMT timezone\n parsedValue.indexOf('+') > -1 || // ISO8601 with positive timezone offset\n parsedValue.match(/^[0-9]{4}$/) || // just the year, ie `2020`\n parsedValue.match(/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/) || // YYYY-MM-DD format\n parsedValue.match(/^.*?-[0-9]{2}:[0-9]{2}$/) || // `YYYY-MM-DDTHH:mm:ss-00:00` format\n parsedValue.match(/^.*?-[0-9]{4}$/); // `YYYY-MM-DDTHH:mm:ss-0000` format\n if (dateWithTimeZone) {\n date = new Date(date.getTime() + date.getTimezoneOffset() * 1000 * 60);\n }\n return date;\n }\n}\n// use a shared static instance for performance instead of\n// instantiating a new instance for every use\nDateParser.shared = new DateParser();\n//# sourceMappingURL=date.js.map","/**\n * Parses duration format to a `Duration` (number of seconds with decimal)\n *\n * Can parse hh:mm:ss.ms, hh:mm:ss, mm:ss, mm:ss.ms, and s.ms formats\n */\nexport class DurationParser {\n /** @inheritdoc */\n parseValue(rawValue) {\n if (typeof rawValue === 'number')\n return rawValue;\n if (typeof rawValue === 'boolean')\n return undefined;\n const componentArray = rawValue.split(':');\n let seconds;\n // if there are no colons in the string, we can assume it's in sss.ms format so just parse it\n if (componentArray.length === 1) {\n seconds = this.parseNumberFormat(componentArray[0]);\n }\n else {\n seconds = this.parseColonSeparatedFormat(componentArray);\n }\n return seconds;\n }\n /**\n * Parse sss.ms format\n *\n * @param rawValue\n * @returns\n */\n parseNumberFormat(rawValue) {\n let seconds = parseFloat(rawValue);\n if (Number.isNaN(seconds))\n seconds = undefined;\n return seconds;\n }\n /**\n * Parse hh:mm:ss.ms format\n *\n * @param componentArray\n * @returns\n */\n parseColonSeparatedFormat(componentArray) {\n // if any of the hh:mm:ss components are NaN, just return undefined\n let hasNaNComponent = false;\n const parsedValue = componentArray\n .map((element, index) => {\n const componentValue = parseFloat(element);\n if (Number.isNaN(componentValue)) {\n hasNaNComponent = true;\n return 0;\n }\n const exponent = componentArray.length - 1 - index;\n const multiplier = 60 ** exponent;\n return componentValue * Math.floor(multiplier);\n })\n .reduce((a, b) => a + b, 0);\n return hasNaNComponent ? undefined : parsedValue;\n }\n}\n// use a shared static instance for performance instead of\n// instantiating a new instance for every use\nDurationParser.shared = new DurationParser();\n//# sourceMappingURL=duration.js.map","export class MediaTypeParser {\n /** @inheritdoc */\n parseValue(rawValue) {\n if (typeof rawValue !== 'string')\n return undefined;\n return rawValue;\n }\n}\n// use a shared static instance for performance instead of\n// instantiating a new instance for every use\nMediaTypeParser.shared = new MediaTypeParser();\n//# sourceMappingURL=mediatype.js.map","export class PageProgressionParser {\n /** @inheritdoc */\n parseValue(rawValue) {\n if (typeof rawValue !== 'string')\n return undefined;\n return rawValue;\n }\n}\n// use a shared static instance for performance instead of\n// instantiating a new instance for every use\nPageProgressionParser.shared = new PageProgressionParser();\n//# sourceMappingURL=page-progression.js.map","export class StringParser {\n /** @inheritdoc */\n parseValue(rawValue) {\n return String(rawValue);\n }\n}\n// use a shared static instance for performance instead of\n// instantiating a new instance for every use\nStringParser.shared = new StringParser();\n//# sourceMappingURL=string.js.map","/**\n * The MetadataField is responsible for three things:\n * 1. Take in some raw data (strings, arrays, numbers, etc)\n * 2. Normalize the input to an array of the input,\n * ie. [string, string], [number, number], [Date, Date], etc\n * 3. Cast the values to their expected `Type`\n *\n * This class gets instiated with a `Type` and a parser of that type. For instance, the\n * `DateField` is a subclass of `MetadataField` with a `Type` of `Date` and a `DateParser`.\n *\n * When using a `DateField`, you can pass it a string date and it will cast it to a javascript Date,\n * ie:\n *\n * ```\n * const dateField = new DateField('2020-02-13')\n * dateField.value = Date(2020-02-13) // native javascript Date object\n * dateField.values = [Date(2020-02-13)] // the normalized array of values\n * dateField.rawValue = '2020-02-13' // the raw string that was passed in\n * ```\n *\n * @class MetadataField\n * @template Type The type of metadata this is (string, number, Date, etc)\n * @template FieldParserInterfaceType The parser for that type (StringParser, NumberParser, etc)\n */\nexport class MetadataField {\n constructor(parser, rawValue) {\n /**\n * The array of all values for the field.\n *\n * Many fields only contain a single value and\n * can be accessed via the `.value` getter\n *\n * @type {Type[]}\n * @memberof MetadataField\n */\n this.values = [];\n this.parser = parser;\n this.rawValue = rawValue;\n this.processRawValue();\n }\n /**\n * The first value if there are multiple or the only value if there is one\n *\n * @readonly\n * @type {(Type | undefined)}\n * @memberof MetadataField\n */\n get value() {\n return this.values.length > 0 ? this.values[0] : undefined;\n }\n processRawValue() {\n if (this.rawValue === undefined) {\n return;\n }\n if (Array.isArray(this.rawValue)) {\n this.rawValue.forEach(value => {\n this.parseAndPersistValue(value);\n });\n }\n else {\n this.parseAndPersistValue(this.rawValue);\n }\n }\n parseAndPersistValue(value) {\n const parsedValue = this.parser.parseValue(value);\n if (parsedValue !== undefined) {\n this.values.push(parsedValue);\n }\n }\n}\n//# sourceMappingURL=metadata-field.js.map","import { BooleanParser } from '@internetarchive/field-parsers';\nimport { MetadataField } from '../metadata-field';\nexport class BooleanField extends MetadataField {\n constructor(rawValue) {\n super(BooleanParser.shared, rawValue);\n }\n}\n//# sourceMappingURL=boolean.js.map","import { DateParser } from '@internetarchive/field-parsers';\nimport { MetadataField } from '../metadata-field';\nexport class DateField extends MetadataField {\n constructor(rawValue) {\n super(DateParser.shared, rawValue);\n }\n}\n//# sourceMappingURL=date.js.map","import { DurationParser } from '@internetarchive/field-parsers';\nimport { MetadataField } from '../metadata-field';\n/**\n * The DurationField parses different duration formats\n * and returns a `Duration`, which is a number in seconds\n * with decimals.\n *\n * @export\n * @class DurationField\n * @extends {MetadataField<Duration, DurationParser>}\n */\nexport class DurationField extends MetadataField {\n constructor(rawValue) {\n super(DurationParser.shared, rawValue);\n }\n}\n//# sourceMappingURL=duration.js.map","import { NumberParser } from '@internetarchive/field-parsers';\nimport { MetadataField } from '../metadata-field';\nexport class NumberField extends MetadataField {\n constructor(rawValue) {\n super(NumberParser.shared, rawValue);\n }\n}\n//# sourceMappingURL=number.js.map","import { StringParser } from '@internetarchive/field-parsers';\nimport { MetadataField } from '../metadata-field';\nexport class StringField extends MetadataField {\n constructor(rawValue) {\n super(StringParser.shared, rawValue);\n }\n}\n//# sourceMappingURL=string.js.map","import { ByteParser } from '@internetarchive/field-parsers';\nimport { MetadataField } from '../metadata-field';\n/**\n * ByteField is a unit-specific number field that\n * returns a value in bytes\n *\n * @export\n * @class ByteField\n * @extends {MetadataField<Byte, ByteParser>}\n */\nexport class ByteField extends MetadataField {\n constructor(rawValue) {\n super(ByteParser.shared, rawValue);\n }\n}\n//# sourceMappingURL=byte.js.map","import { MediaTypeParser } from '@internetarchive/field-parsers';\nimport { MetadataField } from '../metadata-field';\nexport class MediaTypeField extends MetadataField {\n constructor(rawValue) {\n super(MediaTypeParser.shared, rawValue);\n }\n}\n//# sourceMappingURL=mediatype.js.map","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { BooleanField } from './metadata-fields/field-types/boolean';\nimport { DateField } from './metadata-fields/field-types/date';\nimport { DurationField } from './metadata-fields/field-types/duration';\nimport { NumberField } from './metadata-fields/field-types/number';\nimport { StringField } from './metadata-fields/field-types/string';\nimport { ByteField } from './metadata-fields/field-types/byte';\nimport { MediaTypeField } from './metadata-fields/field-types/mediatype';\n/**\n * Metadata is an expansive model that describes an Item.\n *\n * The fields in here get casted to their respective field types. See `metadata-fields/field-type`.\n *\n * Add additional fields as needed.\n *\n * @export\n * @class Metadata\n */\nexport class Metadata {\n constructor(json) {\n this.rawMetadata = json;\n this.identifier = json.identifier;\n this.addeddate = json.addeddate ? new DateField(json.addeddate) : undefined;\n this.publicdate = json.publicdate\n ? new DateField(json.publicdate)\n : undefined;\n this.indexdate = json.indexdate ? new DateField(json.indexdate) : undefined;\n this.audio_codec = json.audio_codec\n ? new StringField(json.audio_codec)\n : undefined;\n this.audio_sample_rate = json.audio_sample_rate\n ? new NumberField(json.audio_sample_rate)\n : undefined;\n this.collection = json.collection\n ? new StringField(json.collection)\n : undefined;\n this.collections_raw = json.collections_raw\n ? new StringField(json.collections_raw)\n : undefined;\n this.collection_size = json.collection_size\n ? new ByteField(json.collection_size)\n : undefined;\n this.contributor = json.contributor\n ? new StringField(json.contributor)\n : undefined;\n this.coverage = json.coverage ? new StringField(json.coverage) : undefined;\n this.creator = json.creator ? new StringField(json.creator) : undefined;\n this.date = json.date ? new DateField(json.date) : undefined;\n this.description = json.description\n ? new StringField(json.description)\n : undefined;\n this.downloads = json.downloads\n ? new NumberField(json.downloads)\n : undefined;\n this.duration = json.duration\n ? new DurationField(json.duration)\n : undefined;\n this.files_count = json.files_count\n ? new NumberField(json.files_count)\n : undefined;\n this.item_count = json.item_count\n ? new NumberField(json.item_count)\n : undefined;\n this.item_size = json.item_size ? new ByteField(json.item_size) : undefined;\n this.language = json.language ? new StringField(json.language) : undefined;\n this.length = json.length ? new DurationField(json.length) : undefined;\n this.lineage = json.lineage ? new StringField(json.lineage) : undefined;\n this.mediatype = json.mediatype\n ? new MediaTypeField(json.mediatype)\n : undefined;\n this.month = json.month ? new NumberField(json.month) : undefined;\n this.noindex = json.noindex ? new BooleanField(json.noindex) : undefined;\n this.notes = json.notes ? new StringField(json.notes) : undefined;\n this.num_favorites = json.num_favorites\n ? new NumberField(json.num_favorites)\n : undefined;\n this.num_reviews = json.num_reviews\n ? new NumberField(json.num_reviews)\n : undefined;\n this.runtime = json.runtime ? new DurationField(json.runtime) : undefined;\n this.scanner = json.scanner ? new StringField(json.scanner) : undefined;\n this.source = json.source ? new StringField(json.source) : undefined;\n this.start_localtime = json.start_localtime\n ? new DateField(json.start_localtime)\n : undefined;\n this.start_time = json.start_time\n ? new DateField(json.start_time)\n : undefined;\n this.stop_time = json.stop_time ? new DateField(json.stop_time) : undefined;\n this.subject = json.subject ? new StringField(json.subject) : undefined;\n this.taper = json.taper ? new StringField(json.taper) : undefined;\n this.title = json.title ? new StringField(json.title) : undefined;\n this.track = json.track ? new NumberField(json.track) : undefined;\n this.transferer = json.transferer\n ? new StringField(json.transferer)\n : undefined;\n this.type = json.type ? new StringField(json.type) : undefined;\n this.uploader = json.uploader ? new StringField(json.uploader) : undefined;\n this.utc_offset = json.utc_offset\n ? new NumberField(json.utc_offset)\n : undefined;\n this.venue = json.venue ? new StringField(json.venue) : undefined;\n this.week = json.week ? new NumberField(json.week) : undefined;\n this.year = json.year ? new DateField(json.year) : undefined;\n }\n}\n//# sourceMappingURL=metadata.js.map","import { ByteParser, DurationParser, NumberParser, } from '@internetarchive/field-parsers';\n/**\n * This represents an Internet Archive File\n *\n * @export\n * @class File\n */\nexport class File {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n constructor(json) {\n this.name = json.name;\n this.source = json.source;\n this.btih = json.btih;\n this.md5 = json.md5;\n this.format = json.format;\n this.mtime = json.mtime;\n this.crc32 = json.crc32;\n this.sha1 = json.sha1;\n this.original = json.original;\n this.title = json.title;\n this.length = json.length\n ? DurationParser.shared.parseValue(json.length)\n : undefined;\n this.size = json.size ? ByteParser.shared.parseValue(json.size) : undefined;\n this.height = json.height\n ? NumberParser.shared.parseValue(json.height)\n : undefined;\n this.width = json.width\n ? NumberParser.shared.parseValue(json.width)\n : undefined;\n this.track = json.track\n ? NumberParser.shared.parseValue(json.track)\n : undefined;\n this.external_identifier = json['external-identifier'];\n this.creator = json.creator;\n this.album = json.album;\n }\n}\n//# sourceMappingURL=file.js.map","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { DateParser } from '@internetarchive/field-parsers';\nexport class Review {\n constructor(json) {\n this.reviewbody = json.reviewbody;\n this.reviewtitle = json.reviewtitle;\n this.reviewer = json.reviewer;\n this.reviewdate = DateParser.shared.parseValue(json.reviewdate);\n this.createdate = DateParser.shared.parseValue(json.createdate);\n this.stars = json.stars ? parseFloat(json.stars) : undefined;\n }\n}\n//# sourceMappingURL=review.js.map","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { File } from '../../models/file';\nimport { Metadata } from '../../models/metadata';\nimport { Review } from '../../models/review';\n/**\n * The main top-level reponse when fetching Metadata\n *\n * @export\n * @class MetadataResponse\n */\nexport class MetadataResponse {\n constructor(json) {\n var _a, _b;\n this.rawResponse = json;\n this.created = json.created;\n this.d1 = json.d1;\n this.d2 = json.d2;\n this.dir = json.dir;\n this.files = (_a = json.files) === null || _a === void 0 ? void 0 : _a.map((file) => new File(file));\n this.files_count = json.files_count;\n this.item_last_updated = json.item_last_updated;\n this.item_size = json.item_size;\n this.metadata = new Metadata(json.metadata);\n this.server = json.server;\n this.uniq = json.uniq;\n this.workable_servers = json.workable_servers;\n this.speech_vs_music_asr = json.speech_vs_music_asr;\n this.reviews = (_b = json.reviews) === null || _b === void 0 ? void 0 : _b.map((entry) => new Review(entry));\n }\n}\n//# sourceMappingURL=metadata-response.js.map","import { Metadata } from '../../models/metadata';\n/**\n * This is the search response details inside the SearchResponse object that contains\n * the search results, under the `docs` key.\n *\n * @export\n * @class Response\n */\nexport class SearchResponseDetails {\n constructor(json) {\n this.numFound = json.numFound;\n this.start = json.start;\n this.docs = json.docs.map((doc) => new Metadata(doc));\n this.aggregations = json.aggregations;\n }\n}\n//# sourceMappingURL=search-response-details.js.map","import { SearchResponseDetails } from './search-response-details';\n/**\n * The top-level response model when retrieving a response from the advanced search endpoint.\n *\n * @export\n * @class SearchResponse\n */\nexport class SearchResponse {\n constructor(json) {\n this.rawResponse = json;\n this.responseHeader = json.responseHeader;\n this.response = new SearchResponseDetails(json.response);\n }\n}\n//# sourceMappingURL=search-response.js.map","import { SearchResponse } from './responses/search/search-response';\nimport { MetadataResponse } from './responses/metadata/metadata-response';\nimport { DefaultSearchBackend } from './search-backend/default-search-backend';\nimport { SearchServiceError, SearchServiceErrorType, } from './search-service-error';\n/**\n * The Search Service is responsible for taking the raw response provided by\n * the Search Backend and modeling it as a `SearchResponse` or `MetadataResponse`\n * object, depending on the type of response.\n */\nexport class SearchService {\n constructor(searchBackend) {\n this.searchBackend = searchBackend;\n }\n /** @inheritdoc */\n async search(params) {\n const rawResponse = await this.searchBackend.performSearch(params);\n if (rawResponse.error) {\n return rawResponse;\n }\n const modeledResponse = new SearchResponse(rawResponse.success);\n return { success: modeledResponse };\n }\n /** @inheritdoc */\n async fetchMetadata(identifier) {\n var _a;\n const rawResponse = await this.searchBackend.fetchMetadata(identifier);\n if (rawResponse.error) {\n return rawResponse;\n }\n if (((_a = rawResponse.success) === null || _a === void 0 ? void 0 : _a.metadata) === undefined) {\n return {\n error: new SearchServiceError(SearchServiceErrorType.itemNotFound),\n };\n }\n const modeledResponse = new MetadataResponse(rawResponse.success);\n return { success: modeledResponse };\n }\n}\nSearchService.default = new SearchService(new DefaultSearchBackend());\n//# sourceMappingURL=search-service.js.map","import { SearchServiceError, SearchServiceErrorType, } from '../search-service-error';\n/**\n * The DefaultSearchBackend performs a `window.fetch` request to archive.org\n */\nexport class DefaultSearchBackend {\n constructor(baseUrl = 'archive.org') {\n this.baseUrl = baseUrl;\n }\n async performSearch(params) {\n const urlSearchParam = params.asUrlSearchParams;\n const queryAsString = urlSearchParam.toString();\n const url = `https://${this.baseUrl}/advancedsearch.php?${queryAsString}`;\n return this.fetchUrl(url);\n }\n async fetchMetadata(identifier) {\n const url = `https://${this.baseUrl}/metadata/${identifier}`;\n return this.fetchUrl(url);\n }\n async fetchUrl(url) {\n let response;\n // first try the fetch and return a networkError if it fails\n try {\n response = await fetch(url);\n }\n catch (err) {\n const message = err instanceof Error ? err.message : err;\n return this.getErrorResult(SearchServiceErrorType.networkError, message);\n }\n // then try json decoding and return a decodingError if it fails\n try {\n const json = await response.json();\n // the advanced search endpoint doesn't return an HTTP Error 400\n // and instead returns an HTTP 200 with an `error` key in the payload\n const error = json['error'];\n if (error) {\n const forensics = json['forensics'];\n return this.getErrorResult(SearchServiceErrorType.searchEngineError, error, forensics);\n }\n else {\n // success\n return { success: json };\n }\n }\n catch (err) {\n const message = err instanceof Error ? err.message : err;\n return this.getErrorResult(SearchServiceErrorType.decodingError, message);\n }\n }\n getErrorResult(errorType, message, details) {\n const error = new SearchServiceError(errorType, message, details);\n const result = { error };\n return result;\n }\n}\n//# sourceMappingURL=default-search-backend.js.map","import { css } from 'lit';\n\nconst menuButtonWidth = css`42px`;\nconst sliderWidth = css`var(--menuWidth, 320px)`;\nconst transitionTiming = css`var(--animationTiming, 200ms)`;\n\nexport default css`\n\n .main {\n overflow: hidden;\n width: 100%;\n height: 100%;\n }\n\n .animate {\n transition: transform ${transitionTiming} ease-out;\n }\n\n .menu {\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n width: ${sliderWidth};\n padding: .5rem .5rem 0 0;\n box-sizing: border-box;\n font-size: 1.4rem;\n color: var(--primaryTextColor);\n background: var(--menuSliderBg);\n transform: translateX(calc(${sliderWidth} * -1));\n }\n\n .menu > button.close {\n right: 0.7rem;\n }\n\n button {\n outline: none;\n cursor: pointer;\n }\n\n header {\n margin: 0 0 .5rem 0;\n }\n\n header * {\n margin: 0;\n display: inline-block;\n }\n header button {\n outline: none;\n cursor: pointer;\n }\n\n header.with-secondary-action .details {\n width: 80%;\n }\n\n header .details {\n font-weight: bold;\n width: 88%;\n }\n\n header .custom-action > *,\n button.close {\n padding: 0;\n background-color: transparent;\n border: 0;\n --iconWidth: var(--menuSliderHeaderIconWidth);\n --iconHeight: var(--menuSliderHeaderIconHeight);\n }\n\n header .custom-action,\n button.close {\n position: absolute;\n }\n button.close {\n right: .5rem;\n }\n\n button.close * {\n float: right;\n }\n\n .content {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: ${menuButtonWidth};\n z-index: 1;\n transform: translateX(calc(${sliderWidth} * -1));\n transition: transform ${transitionTiming} ease-out;\n background: var(--activeButtonBg);\n border-right: .2rem solid;\n border-color: var(--subpanelRightBorderColor);\n padding: .5rem 0 0 .5rem;\n }\n\n .open {\n transform: translateX(0);\n }\n\n .menu-list {\n padding: 0;\n margin: 0;\n list-style: none;\n background: var(--menuSliderBg);\n }\n .menu-list li {\n margin-bottom: .2rem;\n }\n\n .content section {\n height: 100%;\n position: relative;\n width: 100%;\n }\n\n .content .selected-menu {\n overflow: auto;\n height: inherit;\n position: relative;\n }\n\n .content .selected-menu > * {\n display: block;\n padding-bottom: 3rem;\n position: relative;\n }\n`;\n","import { html } from 'lit';\n\nexport default html`\n<svg\n viewBox=\"0 0 18 18\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-labelledby=\"collapseSidebarTitleID collapseSidebarDescID\"\n>\n <title id=\"collapseSidebarTitleID\">Collapse sidebar</title>\n <desc id=\"collapseSidebarDescID\">A circle with a left pointing chevron</desc>\n <path d=\"m9 0c4.9705627 0 9 4.02943725 9 9 0 4.9705627-4.0294373 9-9 9-4.97056275 0-9-4.0294373-9-9 0-4.97056275 4.02943725-9 9-9zm1.6976167 5.28352881c-.365258-.3556459-.9328083-.37581056-1.32099801-.06558269l-.09308988.0844372-3 3.08108108-.08194436.09533317c-.27484337.36339327-.26799482.87009349.01656959 1.22592581l.084491.09308363 3 2.91891889.09533796.0818904c.3633964.2746544.8699472.2677153 1.2256839-.0167901l.093059-.0844712.0818904-.095338c.2746544-.3633964.2677153-.8699472-.0167901-1.2256839l-.0844712-.093059-2.283355-2.2222741 2.3024712-2.36338332.0819252-.09530804c.2997677-.39632298.2644782-.96313393-.1007797-1.31877983z\" fill-rule=\"evenodd\" class=\"fill-color\" />\n</svg>\n`;\n","import icon from './index.js';\nimport { css, LitElement } from 'lit';\n\nclass IAIconCollapseSidebar extends LitElement {\n static get styles() {\n return css`\n :host {\n width: var(--iconWidth, 'auto');\n height: var(--iconHeight, 'auto');\n }\n\n .fill-color {\n fill: var(--iconFillColor);\n }\n\n .stroke-color {\n stroke: var(--iconStrokeColor);\n }\n `;\n }\n\n render() {\n return icon;\n }\n}\n\ncustomElements.define('ia-icon-collapse-sidebar', IAIconCollapseSidebar);\n\nexport default IAIconCollapseSidebar;\n","import { css } from 'lit';\n\nexport default css`\n a {\n display: inline-block;\n text-decoration: none;\n }\n\n .menu-item {\n display: inline-flex;\n width: 100%;\n padding: 0;\n font-size: 1.6rem;\n text-align: left;\n background: transparent;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n border: none;\n cursor: pointer;\n }\n\n button.menu-item {\n -webkit-appearance: none;\n appearance: none;\n border-radius: 0;\n }\n\n .menu-item:focus {\n outline: none;\n }\n\n .label {\n display: var(--menuButtonLabelDisplay, none);\n padding: 0;\n font-weight: 400;\n color: var(--primaryTextColor);\n text-align: left;\n vertical-align: middle;\n margin-left: 1rem;\n }\n\n .menu-details {\n color: var(--primaryTextColor);\n display: inline-block;\n margin-left: .5rem;\n font-style: italic;\n font-size: 1.5rem;\n }\n\n .menu-item > .icon {\n position: relative;\n display: inline-flex;\n z-index: 2;\n min-width: 4.2rem;\n max-width: 4.2rem;\n height: 4.2rem;\n vertical-align: middle;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n }\n\n .menu-item.selected .icon {\n background-color: var(--activeButtonBg);\n border-radius: 1rem 0 0 1rem;\n }\n\n .icon .fill-color {\n fill: #999;\n }\n\n .icon.active .fill-color {\n fill: #fff;\n }\n`;\n","import { html, LitElement } from 'lit';\nimport menuButtonCSS from './styles/menu-button.js';\n\nclass MenuButton extends LitElement {\n static get styles() {\n return menuButtonCSS;\n }\n\n static get properties() {\n return {\n icon: { type: String },\n href: { type: String },\n label: { type: String },\n menuDetails: { type: String },\n id: { type: String },\n selected: { type: Boolean },\n followable: { type: Boolean },\n };\n }\n\n constructor() {\n super();\n this.icon = '';\n this.href = '';\n this.label = '';\n this.menuDetails = '';\n this.id = '';\n this.selected = false;\n this.followable = false;\n }\n\n onClick(e) {\n e.preventDefault();\n this.dispatchMenuTypeSelectedEvent();\n }\n\n dispatchMenuTypeSelectedEvent() {\n this.dispatchEvent(new CustomEvent('menuTypeSelected', {\n bubbles: true,\n composed: true,\n detail: {\n id: this.id,\n },\n }));\n }\n\n get buttonClass() {\n return this.selected ? 'selected' : '';\n }\n\n get iconClass() {\n return this.selected ? 'active' : '';\n }\n\n get menuItem() {\n return html`\n <span class=\"icon ${this.iconClass}\">\n ${this.icon}\n </span>\n <span class=\"label\">${this.label}</span>\n <span class=\"menu-details\">${this.menuDetails}</span>\n `;\n }\n\n get linkButton() {\n return html`\n <a\n href=\"${this.href}\"\n class=\"menu-item ${this.buttonClass}\"\n @click=${this.followable ? undefined : this.onClick}\n >${this.menuItem}</a>\n `;\n }\n\n get clickButton() {\n return html`\n <button\n class=\"menu-item ${this.buttonClass}\"\n @click=${this.onClick}\n >\n ${this.menuItem}\n </button>\n `;\n }\n\n render() {\n return this.href ? this.linkButton : this.clickButton;\n }\n}\n\ncustomElements.define('menu-button', MenuButton);\n","import { nothing } from 'lit/html.js';\nimport { LitElement, html } from 'lit';\nimport menuSliderCSS from './styles/menu-slider.js';\nimport '@internetarchive/icon-collapse-sidebar/icon-collapse-sidebar.js';\nimport './menu-button.js';\n\nconst sliderEvents = {\n closeDrawer: 'menuSliderClosed',\n};\nexport class IAMenuSlider extends LitElement {\n static get styles() {\n return menuSliderCSS;\n }\n\n static get properties() {\n return {\n menus: { type: Array },\n open: { type: Boolean },\n manuallyHandleClose: { type: Boolean },\n selectedMenu: { type: String },\n selectedMenuAction: { type: Object },\n animateMenuOpen: { type: Boolean },\n };\n }\n\n constructor() {\n super();\n\n this.menus = [];\n this.open = false;\n this.selectedMenu = '';\n this.selectedMenuAction = nothing;\n this.animateMenuOpen = false;\n this.manuallyHandleClose = false;\n }\n\n updated() {\n const { actionButton } = this.selectedMenuDetails || {};\n const actionButtonHasChanged = actionButton !== this.selectedMenuAction;\n if (actionButtonHasChanged) {\n this.selectedMenuAction = actionButton || nothing;\n }\n }\n\n /**\n * Event handler, captures state of selected menu\n * @param { CustomEvent } event\n */\n setSelectedMenu({ detail }) {\n const { id } = detail;\n this.selectedMenu = this.selectedMenu === id ? '' : id;\n const { actionButton } = this.selectedMenuDetails || {};\n this.selectedMenuAction = actionButton || nothing;\n }\n\n /**\n * closes menu drawer\n */\n closeMenu() {\n if (!this.manuallyHandleClose) {\n this.open = false;\n }\n const { closeDrawer } = sliderEvents;\n const drawerClosed = new CustomEvent(closeDrawer, {\n detail: this.selectedMenuDetails,\n });\n this.dispatchEvent(drawerClosed);\n }\n\n get selectedMenuDetails() {\n const selectedMenu = this.menus.find(menu => menu.id === this.selectedMenu);\n return selectedMenu;\n }\n\n get selectedMenuComponent() {\n const menuItem = this.selectedMenuDetails;\n return menuItem && menuItem.component ? menuItem.component : html``;\n }\n\n /* render */\n\n get sliderDetailsClass() {\n const animate = this.animateMenuOpen ? 'animate' : '';\n const state = this.open ? 'open' : '';\n return `${animate} ${state}`;\n }\n\n get selectedMenuClass() {\n return this.selectedMenu ? 'open' : '';\n }\n\n get menuItems() {\n return this.menus.map(menu => (\n html`\n <li>\n <menu-button\n @menuTypeSelected=${this.setSelectedMenu}\n .icon=${menu.icon}\n .label=${menu.label}\n .menuDetails=${menu.menuDetails}\n .id=${menu.id}\n .selected=${menu.id === this.selectedMenu}\n .followable=${menu.followable}\n .href=${menu.href}\n ></menu-button>\n </li>\n `\n ));\n }\n\n get renderMenuHeader() {\n const { label = '', menuDetails = '' } = this.selectedMenuDetails || {};\n const headerClass = this.selectedMenuAction ? 'with-secondary-action' : '';\n const actionBlock = this.selectedMenuAction\n ? html`<span class=\"custom-action\">${this.selectedMenuAction}</span>`\n : nothing;\n return html`\n <header class=\"${headerClass}\">\n <div class=\"details\">\n <h3>${label}</h3>\n <span class=\"extra-details\">${menuDetails}</span>\n </div>\n ${actionBlock}\n ${this.closeButton}\n </header>\n `;\n }\n\n get closeButton() {\n return html`\n <button class=\"close\" aria-label=\"Close this menu\" @click=${this.closeMenu}>\n <ia-icon-collapse-sidebar></ia-icon-collapse-sidebar>\n </button>\n `;\n }\n\n /** @inheritdoc */\n render() {\n return html`\n <div class=\"main\">\n <div class=\"menu ${this.sliderDetailsClass}\">\n ${this.closeButton}\n <ul class=\"menu-list\">\n ${this.menuItems}\n </ul>\n <div class=\"content ${this.selectedMenuClass}\" @menuTypeSelected=${this.setSelectedMenu}>\n ${this.renderMenuHeader}\n <section>\n <div class=\"selected-menu\">\n ${this.selectedMenuComponent}\n </div>\n </section>\n </div>\n </div>\n </div>\n `;\n }\n}\n\nwindow.customElements.define('ia-menu-slider', IAMenuSlider);\n","import { html } from 'lit';\n\nexport default html`\n<svg\n viewBox=\"0 0 40 40\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-labelledby=\"ellipsesTitleID ellipsesDescID\"\n>\n <title id=\"ellipsesTitleID\">Ellipses icon</title>\n <desc id=\"ellipsesDescID\">An illustration of text ellipses.</desc>\n <path class=\"fill-color\" d=\"m10.5 17.5c1.3807119 0 2.5 1.1192881 2.5 2.5s-1.1192881 2.5-2.5 2.5c-1.38071187 0-2.5-1.1192881-2.5-2.5s1.11928813-2.5 2.5-2.5zm9.5 0c1.3807119 0 2.5 1.1192881 2.5 2.5s-1.1192881 2.5-2.5 2.5-2.5-1.1192881-2.5-2.5 1.1192881-2.5 2.5-2.5zm9.5 0c1.3807119 0 2.5 1.1192881 2.5 2.5s-1.1192881 2.5-2.5 2.5-2.5-1.1192881-2.5-2.5 1.1192881-2.5 2.5-2.5z\" fill-rule=\"evenodd\"/>\n</svg>\n`;\n","import icon from './index.js';\nimport { css, LitElement } from 'lit';\n\nclass IAIconEllipses extends LitElement {\n static get styles() {\n return css`\n :host {\n width: var(--iconWidth, 'auto');\n height: var(--iconHeight, 'auto');\n }\n\n .fill-color {\n fill: var(--iconFillColor);\n }\n\n .stroke-color {\n stroke: var(--iconStrokeColor);\n }\n `;\n }\n\n render() {\n return icon;\n }\n}\n\ncustomElements.define('ia-icon-ellipses', IAIconEllipses);\n\nexport default IAIconEllipses;\n","import { __decorate } from \"tslib\";\n/* eslint-disable class-methods-use-this */\nimport { css, html, LitElement, svg, nothing } from 'lit';\nimport { customElement } from 'lit/decorators.js';\nlet IAItemNavLoader = class IAItemNavLoader extends LitElement {\n static get properties() {\n return {\n title: { type: String },\n };\n }\n get bookIconSvg() {\n return svg `\n <g class=\"bookIcon\" transform=\"matrix(1 0 0 -1 28 67.362264)\">\n <path d=\"m44.71698 31.6981124v-29.99320678s-18.0956599.30735848-18.6322637-.7171698c-.0633962-.12226414-1.890566-.59207545-2.9745282-.59207545-1.3228302 0-3.5122641 0-4.1286791.74547168-.9707547 1.17452827-18.82811278.71660375-18.82811278.71660375v30.040754l1.83849052.7867924.29094339-28.48188608s15.94981097.15339622 17.09094297-1.10716978c.8145283-.90056602 4.997547-.91641507 5.3450942-.3526415.9611321 1.55716977 14.7101883 1.31716978 17.6077354 1.45981128l.3266038 28.22830118z\"/>\n <path d=\"m40.1129424 33.5957539h-12.8337733c-1.8690565 0-3.1098112-.7545283-3.9299999-1.6279245v-26.70452764l1.2362264-.00792453c.4584906.72962262 3.0922641 1.39415091 3.0922641 1.39415091h10.1298111s1.0381131.01754717 1.5141509.47377357c.5643396.54056602.7913207 1.36981129.7913207 1.36981129z\"/>\n <path d=\"m17.3354713 33.5957539h-12.8337733v-25.37660316s0-.75283017.49358489-1.14113205c.52867924-.41433961 1.3415094-.42849055 1.3415094-.42849055h10.59905631s2.2075471-.52698112 3.0928301-1.39415091l1.2.00792453v26.74245214c-.8201886.8581132-2.0530188 1.59-3.8932074 1.59\"/>\n </g>\n `;\n }\n get icon() {\n return this.bookIconSvg;\n }\n get loader() {\n return svg `\n <svg\n height=\"100\"\n viewBox=\"0 0 100 100\"\n width=\"100\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-labelledby=\"item-loading\"\n >\n <title id=\"item-loading\">Currently loading viewer.</title>\n <desc>Please wait while we load theater.</desc>\n <g fill=\"#333\" fill-rule=\"evenodd\" class=\"book-icon\">\n ${this.icon}\n <path\n class=\"ring\"\n d=\"m17.8618849 11.6970233c18.5864635-15.59603144 45.6875867-15.59603102 64.2740497.000001 1.9271446 1.6170806 2.1785128 4.4902567.5614466 6.4174186-1.6170661 1.9271618-4.4902166 2.1785323-6.4173612.5614517-15.1996922-12.75416882-37.3625282-12.75416916-52.5622206-.000001-15.19969387 12.7541707-19.04823077 34.5805019-9.1273354 51.7641499 9.9208955 17.183646 30.7471499 24.7638499 49.3923323 17.9774983 18.6451823-6.7863521 29.7266014-25.9801026 26.2811129-45.5206248-.436848-2.4775114 1.2174186-4.8400696 3.6949079-5.2769215 2.4774893-.4368518 4.8400264 1.2174296 5.2768744 3.694941 4.2132065 23.8945096-9.3373563 47.3649806-32.137028 55.6634567-22.799672 8.2984758-48.2663986-.9707372-60.39785211-21.9832155-12.1314534-21.012481-7.42539173-47.7021198 11.16107351-63.2981544z\"\n fill-rule=\"nonzero\"\n />\n </g>\n </svg>\n `;\n }\n render() {\n const title = this.title ? html `<h2>${this.title}</h2>` : nothing;\n return html `\n <div class=\"place-holder\">\n ${title} ${this.loader}\n <h3>Loading viewer</h3>\n </div>\n `;\n }\n static get styles() {\n return css `\n .place-holder {\n width: 30%;\n margin: auto;\n text-align: center;\n color: var(--primaryTextColor);\n }\n\n .place-holder {\n position: relative;\n }\n\n .place-holder svg {\n display: block;\n width: 60%;\n max-width: 100px;\n height: auto;\n margin: auto;\n }\n\n svg * {\n fill: var(--primaryTextColor);\n }\n\n svg .ring {\n animation: rotate 1.3s infinite linear;\n transform-origin: 50px 50px;\n transform-box: fill-box;\n display: block; // transform won't work on inline style\n }\n\n @keyframes rotate {\n 0% {\n -moz-transform: rotate(-360deg);\n -webkit-transform: rotate(-360deg);\n transform: rotate(-360deg);\n }\n }\n `;\n }\n};\nIAItemNavLoader = __decorate([\n customElement('ia-itemnav-loader')\n], IAItemNavLoader);\nexport { IAItemNavLoader };\n//# sourceMappingURL=loader.js.map","import { __decorate } from \"tslib\";\nimport { LitElement, html, css, } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nlet IANoTheaterAvailable = class IANoTheaterAvailable extends LitElement {\n constructor() {\n super(...arguments);\n this.identifier = '';\n }\n emitLoaded() {\n this.dispatchEvent(new CustomEvent('loadingStateUpdated', {\n detail: { loaded: true },\n }));\n }\n updated(changed) {\n if (changed.has('identifier')) {\n this.emitLoaded();\n }\n }\n get downloadUrl() {\n return `/download/${this.identifier}`;\n }\n render() {\n return html `\n <section>\n <h2>THERE IS NO PREVIEW AVAILABLE FOR THIS ITEM</h2>\n <p>\n This item does not appear to have any files that can be experienced on\n Archive.org. <br />\n Please download files in this item to interact with them on your\n computer.\n </p>\n <a href=${this.downloadUrl}>Show all files</a>\n </section>\n `;\n }\n static get styles() {\n return css `\n :host {\n color: var(--primaryTextColor, #fff);\n text-align: center;\n }\n section {\n width: 100%;\n margin: 5%;\n padding: 0 5%;\n }\n p {\n font-size: 1.4rem;\n }\n a {\n color: var(--primaryTextColor, #fff);\n background-color: rgb(25, 72, 128);\n min-height: 35px;\n outline: none;\n cursor: pointer;\n line-height: normal;\n border-radius: 0.4rem;\n text-align: center;\n vertical-align: middle;\n font-size: 1.4rem;\n font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;\n display: inline-block;\n padding: 0.85rem 1.2rem;\n border: 1px solid rgb(197, 209, 223);\n white-space: nowrap;\n appearance: auto;\n box-sizing: border-box;\n user-select: none;\n text-decoration: none;\n }\n `;\n }\n};\n__decorate([\n property({ type: String })\n], IANoTheaterAvailable.prototype, \"identifier\", void 0);\nIANoTheaterAvailable = __decorate([\n customElement('ia-no-theater-available')\n], IANoTheaterAvailable);\nexport { IANoTheaterAvailable };\n//# sourceMappingURL=no-theater-available.js.map","import { __decorate } from \"tslib\";\nimport { css, html, LitElement, nothing, } from 'lit';\nimport { customElement, property, state, query } from 'lit/decorators.js';\nimport { MetadataResponse } from '@internetarchive/search-service';\nimport '@internetarchive/ia-menu-slider';\nimport '@internetarchive/icon-ellipses/icon-ellipses';\nimport './loader';\nimport './no-theater-available';\nlet ItemNavigator = class ItemNavigator extends LitElement {\n constructor() {\n super(...arguments);\n this.viewAvailable = true;\n this.baseHost = 'archive.org';\n this.signedIn = false;\n this.menuContents = [];\n this.menuShortcuts = [];\n this.viewportInFullscreen = null;\n this.menuOpened = false;\n this.loaded = null;\n this.openMenuState = 'shift';\n }\n disconnectedCallback() {\n this.removeResizeObserver();\n }\n updated(changed) {\n if (changed.has('sharedObserver')) {\n const oldObserver = changed.get('sharedObserver');\n oldObserver === null || oldObserver === void 0 ? void 0 : oldObserver.removeObserver(this.resizeObserverConfig);\n this.setResizeObserver();\n }\n }\n /** Shared observer */\n handleResize(entry) {\n const { width } = entry.contentRect;\n if (width <= 600) {\n this.openMenuState = 'overlay';\n return;\n }\n this.openMenuState = 'shift';\n }\n setResizeObserver() {\n var _a, _b;\n (_a = this.sharedObserver) === null || _a === void 0 ? void 0 : _a.addObserver(this.resizeObserverConfig);\n (_b = this.sharedObserver) === null || _b === void 0 ? void 0 : _b.addObserver({\n target: this.headerSlot,\n handler: {\n handleResize: ({ contentRect }) => {\n if (contentRect.height) {\n this.requestUpdate();\n }\n },\n },\n });\n }\n removeResizeObserver() {\n var _a;\n (_a = this.sharedObserver) === null || _a === void 0 ? void 0 : _a.removeObserver(this.resizeObserverConfig);\n }\n get resizeObserverConfig() {\n return {\n handler: this,\n target: this.frame,\n };\n }\n /** End shared observer */\n get loaderTitle() {\n return this.viewportInFullscreen ? 'Internet Archive' : '';\n }\n get loadingArea() {\n return html `\n <div class=\"loading-area\">\n <div class=\"loading-view\">\n <ia-itemnav-loader .title=${this.loaderTitle}></ia-itemnav-loader>\n </div>\n </div>\n `;\n }\n slotChange(e, type) {\n var _a;\n const slottedContent = (_a = e.target.assignedNodes()) === null || _a === void 0 ? void 0 : _a[0];\n this.dispatchEvent(new CustomEvent('slotChange', {\n detail: { slot: slottedContent, type },\n }));\n this.requestUpdate();\n }\n render() {\n var _a, _b;\n const displayReaderClass = this.loaded ? '' : 'hidden';\n const headerHeight = ((_b = (_a = this.headerSlot) === null || _a === void 0 ? void 0 : _a.assignedNodes()[0]) === null || _b === void 0 ? void 0 : _b.offsetHeight) || 0;\n return html `\n <div id=\"frame\" class=${this.menuClass}>\n <slot\n name=\"header\"\n style=${`height: ${headerHeight}px`}\n @slotchange=${(e) => this.slotChange(e, 'header')}\n ></slot>\n <div class=\"menu-and-reader\">\n ${this.shouldRenderMenu ? this.renderSideMenu : nothing}\n <div id=\"reader\" class=${displayReaderClass}>\n ${this.renderViewport}\n </div>\n ${!this.loaded ? this.loadingArea : nothing}\n </div>\n </div>\n `;\n }\n get noTheaterView() {\n var _a, _b;\n return html `<ia-no-theater-available\n .identifier=${(_b = (_a = this.item) === null || _a === void 0 ? void 0 : _a.metadata) === null || _b === void 0 ? void 0 : _b.identifier}\n @loadingStateUpdated=${this.loadingStateUpdated}\n ></ia-no-theater-available>`;\n }\n get renderViewport() {\n if (!this.viewAvailable) {\n return this.noTheaterView;\n }\n const slotVisibility = !this.loaded ? 'opacity: 0;' : 'opacity: 1;';\n return html `\n <div slot=\"main\" style=${slotVisibility}>\n <slot\n name=\"main\"\n @slotchange=${(e) => this.slotChange(e, 'main')}\n ></slot>\n </div>\n `;\n }\n loadingStateUpdated(e) {\n const { loaded } = e.detail;\n this.loaded = loaded || null;\n }\n /** Fullscreen Management */\n manageViewportFullscreen(e) {\n const fullscreenStatus = !!e.detail.isFullScreen;\n this.viewportInFullscreen = !fullscreenStatus ? null : fullscreenStatus;\n const event = new CustomEvent('fullscreenToggled', {\n detail: e.detail,\n });\n this.dispatchEvent(event);\n }\n /** End Fullscreen Management */\n /** Side menu */\n get shouldRenderMenu() {\n var _a;\n return !!((_a = this.menuContents) === null || _a === void 0 ? void 0 : _a.length);\n }\n toggleMenu() {\n this.menuOpened = !this.menuOpened;\n }\n closeMenu() {\n this.menuOpened = false;\n }\n setOpenMenu(e) {\n const { id } = e.detail;\n this.openMenu = id !== this.openMenu ? id : undefined;\n }\n setMenuContents(e) {\n const updatedContents = [...e.detail];\n this.menuContents = updatedContents;\n }\n setMenuShortcuts(e) {\n this.menuShortcuts = [...e.detail];\n }\n /** Toggles Side Menu & Sets viewable subpanel */\n manageSideMenuEvents(e) {\n const { menuId, action } = e.detail;\n if (!menuId) {\n return;\n }\n if (action === 'open') {\n this.openShortcut(menuId);\n }\n else if (action === 'toggle') {\n this.openMenu = menuId;\n this.toggleMenu();\n }\n }\n get menuToggleButton() {\n return html `\n <button\n class=\"toggle-menu\"\n @click=${this.toggleMenu}\n title=\"Toggle theater side panels\"\n >\n <div>\n <ia-icon-ellipses\n style=\"width: var(--iconWidth); height: var(--iconHeight);\"\n ></ia-icon-ellipses>\n </div>\n </button>\n `;\n }\n get selectedMenuId() {\n return this.openMenu || '';\n }\n get renderSideMenu() {\n const drawerState = this.menuOpened ? '' : 'hidden';\n return html `\n <nav>\n <div class=\"minimized\">${this.shortcuts} ${this.menuToggleButton}</div>\n <div id=\"menu\" class=${drawerState}>\n <ia-menu-slider\n .menus=${this.menuContents}\n .selectedMenu=${this.selectedMenuId}\n @menuTypeSelected=${this.setOpenMenu}\n @menuSliderClosed=${this.closeMenu}\n manuallyHandleClose\n open\n ></ia-menu-slider>\n </div>\n </nav>\n `;\n }\n /** End Side menu */\n /** Menu Shortcuts */\n openShortcut(selectedMenuId = '') {\n this.openMenu = selectedMenuId;\n this.menuOpened = true;\n }\n get shortcuts() {\n const shortcuts = this.menuShortcuts.map(({ icon, id }) => {\n if (id === 'fullscreen') {\n return html `${icon}`;\n }\n return html `\n <button class=\"shortcut ${id}\" @click=\"${() => this.openShortcut(id)}\">\n ${icon}\n </button>\n `;\n });\n return html `<div class=\"shortcuts\">${shortcuts}</div>`;\n }\n /** End Menu Shortcuts */\n /** Misc Render */\n get menuClass() {\n var _a, _b;\n const hasMenuOrShortcuts = ((_a = this.menuContents) === null || _a === void 0 ? void 0 : _a.length) || ((_b = this.menuShortcuts) === null || _b === void 0 ? void 0 : _b.length);\n const drawerState = this.menuOpened && hasMenuOrShortcuts ? 'open' : '';\n const fullscreenState = this.viewportInFullscreen ? 'fullscreen' : '';\n return `${drawerState} ${fullscreenState} ${this.openMenuState}`;\n }\n static get styles() {\n const subnavWidth = css `var(--menuWidth, 320px)`;\n const transitionTiming = css `var(--animationTiming, 200ms)`;\n const transitionEffect = css `transform ${transitionTiming} ease-out`;\n const menuMargin = css `var(--theaterMenuMargin, 42px)`;\n const theaterBg = css `var(--theaterBgColor, #000)`;\n return css `\n :host,\n #frame,\n .menu-and-reader {\n position: relative;\n overflow: hidden;\n display: block;\n }\n\n :host,\n #frame,\n .loading-area,\n .loading-view {\n min-height: inherit;\n height: inherit;\n }\n\n slot {\n display: block;\n width: 100%;\n }\n\n slot * {\n display: block;\n height: inherit;\n }\n\n #frame {\n background-color: ${theaterBg};\n color-scheme: dark;\n display: flex;\n flex-direction: column;\n }\n\n #frame.fullscreen {\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 9;\n }\n\n .loading-view {\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .loading-area {\n width: 100%;\n }\n\n ia-itemnav-loader {\n display: block;\n width: 100%;\n }\n\n .hidden {\n display: none !important;\n }\n\n button {\n cursor: pointer;\n padding: 0;\n border: 0;\n }\n\n button:focus,\n button:active {\n outline: none;\n }\n\n .menu-and-reader {\n position: relative;\n display: flex;\n flex: 1;\n }\n\n nav button {\n background: none;\n }\n\n nav .minimized {\n background: rgba(0, 0, 0, 0.7);\n padding-top: 6px;\n position: absolute;\n width: ${menuMargin};\n z-index: 2;\n left: 0;\n border-bottom-right-radius: 5%;\n }\n\n nav .minimized button {\n width: var(--iconWidth);\n height: var(--iconHeight);\n margin-bottom: 0.2rem;\n margin: auto;\n display: inline-flex;\n vertical-align: middle;\n -webkit-box-align: center;\n align-items: center;\n -webkit-box-pack: center;\n justify-content: center;\n width: ${menuMargin};\n height: ${menuMargin};\n }\n\n nav .minimized button.toggle-menu > * {\n border: 2px solid var(--iconStrokeColor);\n border-radius: var(--iconWidth);\n width: var(--iconWidth);\n height: var(--iconHeight);\n margin: auto;\n }\n\n ia-icon-ellipses {\n width: var(--iconWidth);\n height: var(--iconHeight);\n }\n\n #menu {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n z-index: 3;\n overflow: hidden;\n transform: translateX(-${subnavWidth});\n width: ${subnavWidth};\n transform: translateX(calc(${subnavWidth} * -1));\n transition: ${transitionEffect};\n }\n\n #reader {\n position: relative;\n z-index: 1;\n transform: translateX(0);\n width: 100%;\n display: flex;\n }\n\n #reader > * {\n width: 100%;\n display: flex;\n flex: 1;\n }\n\n .open.overlay #reader {\n transition: none;\n }\n\n .open #menu {\n width: ${subnavWidth};\n transform: translateX(0);\n transition: ${transitionEffect};\n }\n\n .open.shift #reader {\n width: calc(100% - ${subnavWidth});\n margin-left: ${subnavWidth};\n transition: ${transitionEffect};\n }\n `;\n }\n};\n__decorate([\n property({\n type: Object,\n converter: (value) => {\n if (value && typeof value === 'string') {\n return new MetadataResponse(JSON.parse(atob(value)));\n }\n return value;\n },\n })\n], ItemNavigator.prototype, \"item\", void 0);\n__decorate([\n property({ type: Boolean })\n], ItemNavigator.prototype, \"viewAvailable\", void 0);\n__decorate([\n property({ type: String })\n], ItemNavigator.prototype, \"baseHost\", void 0);\n__decorate([\n property({\n converter: (arg) => {\n if (typeof arg === 'boolean') {\n return arg;\n }\n return arg === 'true';\n },\n })\n], ItemNavigator.prototype, \"signedIn\", void 0);\n__decorate([\n property({ type: Array })\n], ItemNavigator.prototype, \"menuContents\", void 0);\n__decorate([\n property({ type: Array })\n], ItemNavigator.prototype, \"menuShortcuts\", void 0);\n__decorate([\n property({ type: Boolean, reflect: true, attribute: true })\n], ItemNavigator.prototype, \"viewportInFullscreen\", void 0);\n__decorate([\n property({ type: Boolean })\n], ItemNavigator.prototype, \"menuOpened\", void 0);\n__decorate([\n property({ type: String })\n], ItemNavigator.prototype, \"openMenu\", void 0);\n__decorate([\n property({ attribute: false })\n], ItemNavigator.prototype, \"modal\", void 0);\n__decorate([\n property({ attribute: false })\n], ItemNavigator.prototype, \"sharedObserver\", void 0);\n__decorate([\n property({ type: Boolean, reflect: true, attribute: true })\n], ItemNavigator.prototype, \"loaded\", void 0);\n__decorate([\n state()\n], ItemNavigator.prototype, \"openMenuState\", void 0);\n__decorate([\n query('#frame')\n], ItemNavigator.prototype, \"frame\", void 0);\n__decorate([\n query('slot[name=\"header\"]')\n], ItemNavigator.prototype, \"headerSlot\", void 0);\n__decorate([\n query('slot[name=\"main\"]')\n], ItemNavigator.prototype, \"mainSlot\", void 0);\nItemNavigator = __decorate([\n customElement('ia-item-navigator')\n], ItemNavigator);\nexport { ItemNavigator };\n//# sourceMappingURL=item-navigator.js.map","var ResizeObserverBoxOptions;\n(function (ResizeObserverBoxOptions) {\n ResizeObserverBoxOptions[\"BORDER_BOX\"] = \"border-box\";\n ResizeObserverBoxOptions[\"CONTENT_BOX\"] = \"content-box\";\n ResizeObserverBoxOptions[\"DEVICE_PIXEL_CONTENT_BOX\"] = \"device-pixel-content-box\";\n})(ResizeObserverBoxOptions || (ResizeObserverBoxOptions = {}));\nexport { ResizeObserverBoxOptions };\n","var resizeObservers = [];\nexport { resizeObservers };\n","var msg = 'ResizeObserver loop completed with undelivered notifications.';\nvar deliverResizeLoopError = function () {\n var event;\n if (typeof ErrorEvent === 'function') {\n event = new ErrorEvent('error', {\n message: msg\n });\n }\n else {\n event = document.createEvent('Event');\n event.initEvent('error', false, false);\n event.message = msg;\n }\n window.dispatchEvent(event);\n};\nexport { deliverResizeLoopError };\n","export var freeze = function (obj) { return Object.freeze(obj); };\n","var trigger;\nvar callbacks = [];\nvar notify = function () { return callbacks.splice(0).forEach(function (cb) { return cb(); }); };\nvar queueMicroTask = function (callback) {\n if (!trigger) {\n var toggle_1 = 0;\n var el_1 = document.createTextNode('');\n var config = { characterData: true };\n new MutationObserver(function () { return notify(); }).observe(el_1, config);\n trigger = function () { el_1.textContent = \"\" + (toggle_1 ? toggle_1-- : toggle_1++); };\n }\n callbacks.push(callback);\n trigger();\n};\nexport { queueMicroTask };\n","import { freeze } from './utils/freeze';\nvar ResizeObserverSize = (function () {\n function ResizeObserverSize(inlineSize, blockSize) {\n this.inlineSize = inlineSize;\n this.blockSize = blockSize;\n freeze(this);\n }\n return ResizeObserverSize;\n}());\nexport { ResizeObserverSize };\n","import { freeze } from './utils/freeze';\nvar DOMRectReadOnly = (function () {\n function DOMRectReadOnly(x, y, width, height) {\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n this.top = this.y;\n this.left = this.x;\n this.bottom = this.top + this.height;\n this.right = this.left + this.width;\n return freeze(this);\n }\n DOMRectReadOnly.prototype.toJSON = function () {\n var _a = this, x = _a.x, y = _a.y, top = _a.top, right = _a.right, bottom = _a.bottom, left = _a.left, width = _a.width, height = _a.height;\n return { x: x, y: y, top: top, right: right, bottom: bottom, left: left, width: width, height: height };\n };\n DOMRectReadOnly.fromRect = function (rectangle) {\n return new DOMRectReadOnly(rectangle.x, rectangle.y, rectangle.width, rectangle.height);\n };\n return DOMRectReadOnly;\n}());\nexport { DOMRectReadOnly };\n","var isSVG = function (target) { return target instanceof SVGElement && 'getBBox' in target; };\nvar isHidden = function (target) {\n if (isSVG(target)) {\n var _a = target.getBBox(), width = _a.width, height = _a.height;\n return !width && !height;\n }\n var _b = target, offsetWidth = _b.offsetWidth, offsetHeight = _b.offsetHeight;\n return !(offsetWidth || offsetHeight || target.getClientRects().length);\n};\nvar isElement = function (obj) {\n var _a, _b;\n if (obj instanceof Element) {\n return true;\n }\n var scope = (_b = (_a = obj) === null || _a === void 0 ? void 0 : _a.ownerDocument) === null || _b === void 0 ? void 0 : _b.defaultView;\n return !!(scope && obj instanceof scope.Element);\n};\nvar isReplacedElement = function (target) {\n switch (target.tagName) {\n case 'INPUT':\n if (target.type !== 'image') {\n break;\n }\n case 'VIDEO':\n case 'AUDIO':\n case 'EMBED':\n case 'OBJECT':\n case 'CANVAS':\n case 'IFRAME':\n case 'IMG':\n return true;\n }\n return false;\n};\nexport { isSVG, isHidden, isElement, isReplacedElement };\n","export var global = typeof window !== 'undefined' ? window : {};\n","import { ResizeObserverBoxOptions } from '../ResizeObserverBoxOptions';\nimport { ResizeObserverSize } from '../ResizeObserverSize';\nimport { DOMRectReadOnly } from '../DOMRectReadOnly';\nimport { isSVG, isHidden } from '../utils/element';\nimport { freeze } from '../utils/freeze';\nimport { global } from '../utils/global';\nvar cache = new WeakMap();\nvar scrollRegexp = /auto|scroll/;\nvar verticalRegexp = /^tb|vertical/;\nvar IE = (/msie|trident/i).test(global.navigator && global.navigator.userAgent);\nvar parseDimension = function (pixel) { return parseFloat(pixel || '0'); };\nvar size = function (inlineSize, blockSize, switchSizes) {\n if (inlineSize === void 0) { inlineSize = 0; }\n if (blockSize === void 0) { blockSize = 0; }\n if (switchSizes === void 0) { switchSizes = false; }\n return new ResizeObserverSize((switchSizes ? blockSize : inlineSize) || 0, (switchSizes ? inlineSize : blockSize) || 0);\n};\nvar zeroBoxes = freeze({\n devicePixelContentBoxSize: size(),\n borderBoxSize: size(),\n contentBoxSize: size(),\n contentRect: new DOMRectReadOnly(0, 0, 0, 0)\n});\nvar calculateBoxSizes = function (target, forceRecalculation) {\n if (forceRecalculation === void 0) { forceRecalculation = false; }\n if (cache.has(target) && !forceRecalculation) {\n return cache.get(target);\n }\n if (isHidden(target)) {\n cache.set(target, zeroBoxes);\n return zeroBoxes;\n }\n var cs = getComputedStyle(target);\n var svg = isSVG(target) && target.ownerSVGElement && target.getBBox();\n var removePadding = !IE && cs.boxSizing === 'border-box';\n var switchSizes = verticalRegexp.test(cs.writingMode || '');\n var canScrollVertically = !svg && scrollRegexp.test(cs.overflowY || '');\n var canScrollHorizontally = !svg && scrollRegexp.test(cs.overflowX || '');\n var paddingTop = svg ? 0 : parseDimension(cs.paddingTop);\n var paddingRight = svg ? 0 : parseDimension(cs.paddingRight);\n var paddingBottom = svg ? 0 : parseDimension(cs.paddingBottom);\n var paddingLeft = svg ? 0 : parseDimension(cs.paddingLeft);\n var borderTop = svg ? 0 : parseDimension(cs.borderTopWidth);\n var borderRight = svg ? 0 : parseDimension(cs.borderRightWidth);\n var borderBottom = svg ? 0 : parseDimension(cs.borderBottomWidth);\n var borderLeft = svg ? 0 : parseDimension(cs.borderLeftWidth);\n var horizontalPadding = paddingLeft + paddingRight;\n var verticalPadding = paddingTop + paddingBottom;\n var horizontalBorderArea = borderLeft + borderRight;\n var verticalBorderArea = borderTop + borderBottom;\n var horizontalScrollbarThickness = !canScrollHorizontally ? 0 : target.offsetHeight - verticalBorderArea - target.clientHeight;\n var verticalScrollbarThickness = !canScrollVertically ? 0 : target.offsetWidth - horizontalBorderArea - target.clientWidth;\n var widthReduction = removePadding ? horizontalPadding + horizontalBorderArea : 0;\n var heightReduction = removePadding ? verticalPadding + verticalBorderArea : 0;\n var contentWidth = svg ? svg.width : parseDimension(cs.width) - widthReduction - verticalScrollbarThickness;\n var contentHeight = svg ? svg.height : parseDimension(cs.height) - heightReduction - horizontalScrollbarThickness;\n var borderBoxWidth = contentWidth + horizontalPadding + verticalScrollbarThickness + horizontalBorderArea;\n var borderBoxHeight = contentHeight + verticalPadding + horizontalScrollbarThickness + verticalBorderArea;\n var boxes = freeze({\n devicePixelContentBoxSize: size(Math.round(contentWidth * devicePixelRatio), Math.round(contentHeight * devicePixelRatio), switchSizes),\n borderBoxSize: size(borderBoxWidth, borderBoxHeight, switchSizes),\n contentBoxSize: size(contentWidth, contentHeight, switchSizes),\n contentRect: new DOMRectReadOnly(paddingLeft, paddingTop, contentWidth, contentHeight)\n });\n cache.set(target, boxes);\n return boxes;\n};\nvar calculateBoxSize = function (target, observedBox, forceRecalculation) {\n var _a = calculateBoxSizes(target, forceRecalculation), borderBoxSize = _a.borderBoxSize, contentBoxSize = _a.contentBoxSize, devicePixelContentBoxSize = _a.devicePixelContentBoxSize;\n switch (observedBox) {\n case ResizeObserverBoxOptions.DEVICE_PIXEL_CONTENT_BOX:\n return devicePixelContentBoxSize;\n case ResizeObserverBoxOptions.BORDER_BOX:\n return borderBoxSize;\n default:\n return contentBoxSize;\n }\n};\nexport { calculateBoxSize, calculateBoxSizes };\n","import { calculateBoxSizes } from './algorithms/calculateBoxSize';\nimport { freeze } from './utils/freeze';\nvar ResizeObserverEntry = (function () {\n function ResizeObserverEntry(target) {\n var boxes = calculateBoxSizes(target);\n this.target = target;\n this.contentRect = boxes.contentRect;\n this.borderBoxSize = freeze([boxes.borderBoxSize]);\n this.contentBoxSize = freeze([boxes.contentBoxSize]);\n this.devicePixelContentBoxSize = freeze([boxes.devicePixelContentBoxSize]);\n }\n return ResizeObserverEntry;\n}());\nexport { ResizeObserverEntry };\n","import { isHidden } from '../utils/element';\nvar calculateDepthForNode = function (node) {\n if (isHidden(node)) {\n return Infinity;\n }\n var depth = 0;\n var parent = node.parentNode;\n while (parent) {\n depth += 1;\n parent = parent.parentNode;\n }\n return depth;\n};\nexport { calculateDepthForNode };\n","import { resizeObservers } from '../utils/resizeObservers';\nimport { ResizeObserverEntry } from '../ResizeObserverEntry';\nimport { calculateDepthForNode } from './calculateDepthForNode';\nimport { calculateBoxSize } from './calculateBoxSize';\nvar broadcastActiveObservations = function () {\n var shallowestDepth = Infinity;\n var callbacks = [];\n resizeObservers.forEach(function processObserver(ro) {\n if (ro.activeTargets.length === 0) {\n return;\n }\n var entries = [];\n ro.activeTargets.forEach(function processTarget(ot) {\n var entry = new ResizeObserverEntry(ot.target);\n var targetDepth = calculateDepthForNode(ot.target);\n entries.push(entry);\n ot.lastReportedSize = calculateBoxSize(ot.target, ot.observedBox);\n if (targetDepth < shallowestDepth) {\n shallowestDepth = targetDepth;\n }\n });\n callbacks.push(function resizeObserverCallback() {\n ro.callback.call(ro.observer, entries, ro.observer);\n });\n ro.activeTargets.splice(0, ro.activeTargets.length);\n });\n for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) {\n var callback = callbacks_1[_i];\n callback();\n }\n return shallowestDepth;\n};\nexport { broadcastActiveObservations };\n","import { resizeObservers } from '../utils/resizeObservers';\nimport { calculateDepthForNode } from './calculateDepthForNode';\nvar gatherActiveObservationsAtDepth = function (depth) {\n resizeObservers.forEach(function processObserver(ro) {\n ro.activeTargets.splice(0, ro.activeTargets.length);\n ro.skippedTargets.splice(0, ro.skippedTargets.length);\n ro.observationTargets.forEach(function processTarget(ot) {\n if (ot.isActive()) {\n if (calculateDepthForNode(ot.target) > depth) {\n ro.activeTargets.push(ot);\n }\n else {\n ro.skippedTargets.push(ot);\n }\n }\n });\n });\n};\nexport { gatherActiveObservationsAtDepth };\n","import { process } from './process';\nimport { global } from './global';\nimport { queueResizeObserver } from './queueResizeObserver';\nvar watching = 0;\nvar isWatching = function () { return !!watching; };\nvar CATCH_PERIOD = 250;\nvar observerConfig = { attributes: true, characterData: true, childList: true, subtree: true };\nvar events = [\n 'resize',\n 'load',\n 'transitionend',\n 'animationend',\n 'animationstart',\n 'animationiteration',\n 'keyup',\n 'keydown',\n 'mouseup',\n 'mousedown',\n 'mouseover',\n 'mouseout',\n 'blur',\n 'focus'\n];\nvar time = function (timeout) {\n if (timeout === void 0) { timeout = 0; }\n return Date.now() + timeout;\n};\nvar scheduled = false;\nvar Scheduler = (function () {\n function Scheduler() {\n var _this = this;\n this.stopped = true;\n this.listener = function () { return _this.schedule(); };\n }\n Scheduler.prototype.run = function (timeout) {\n var _this = this;\n if (timeout === void 0) { timeout = CATCH_PERIOD; }\n if (scheduled) {\n return;\n }\n scheduled = true;\n var until = time(timeout);\n queueResizeObserver(function () {\n var elementsHaveResized = false;\n try {\n elementsHaveResized = process();\n }\n finally {\n scheduled = false;\n timeout = until - time();\n if (!isWatching()) {\n return;\n }\n if (elementsHaveResized) {\n _this.run(1000);\n }\n else if (timeout > 0) {\n _this.run(timeout);\n }\n else {\n _this.start();\n }\n }\n });\n };\n Scheduler.prototype.schedule = function () {\n this.stop();\n this.run();\n };\n Scheduler.prototype.observe = function () {\n var _this = this;\n var cb = function () { return _this.observer && _this.observer.observe(document.body, observerConfig); };\n document.body ? cb() : global.addEventListener('DOMContentLoaded', cb);\n };\n Scheduler.prototype.start = function () {\n var _this = this;\n if (this.stopped) {\n this.stopped = false;\n this.observer = new MutationObserver(this.listener);\n this.observe();\n events.forEach(function (name) { return global.addEventListener(name, _this.listener, true); });\n }\n };\n Scheduler.prototype.stop = function () {\n var _this = this;\n if (!this.stopped) {\n this.observer && this.observer.disconnect();\n events.forEach(function (name) { return global.removeEventListener(name, _this.listener, true); });\n this.stopped = true;\n }\n };\n return Scheduler;\n}());\nvar scheduler = new Scheduler();\nvar updateCount = function (n) {\n !watching && n > 0 && scheduler.start();\n watching += n;\n !watching && scheduler.stop();\n};\nexport { scheduler, updateCount };\n","import { queueMicroTask } from './queueMicroTask';\nvar queueResizeObserver = function (cb) {\n queueMicroTask(function ResizeObserver() {\n requestAnimationFrame(cb);\n });\n};\nexport { queueResizeObserver };\n","import { hasActiveObservations } from '../algorithms/hasActiveObservations';\nimport { hasSkippedObservations } from '../algorithms/hasSkippedObservations';\nimport { deliverResizeLoopError } from '../algorithms/deliverResizeLoopError';\nimport { broadcastActiveObservations } from '../algorithms/broadcastActiveObservations';\nimport { gatherActiveObservationsAtDepth } from '../algorithms/gatherActiveObservationsAtDepth';\nvar process = function () {\n var depth = 0;\n gatherActiveObservationsAtDepth(depth);\n while (hasActiveObservations()) {\n depth = broadcastActiveObservations();\n gatherActiveObservationsAtDepth(depth);\n }\n if (hasSkippedObservations()) {\n deliverResizeLoopError();\n }\n return depth > 0;\n};\nexport { process };\n","import { resizeObservers } from '../utils/resizeObservers';\nvar hasActiveObservations = function () {\n return resizeObservers.some(function (ro) { return ro.activeTargets.length > 0; });\n};\nexport { hasActiveObservations };\n","import { resizeObservers } from '../utils/resizeObservers';\nvar hasSkippedObservations = function () {\n return resizeObservers.some(function (ro) { return ro.skippedTargets.length > 0; });\n};\nexport { hasSkippedObservations };\n","import { ResizeObserverBoxOptions } from './ResizeObserverBoxOptions';\nimport { calculateBoxSize } from './algorithms/calculateBoxSize';\nimport { isSVG, isReplacedElement } from './utils/element';\nvar skipNotifyOnElement = function (target) {\n return !isSVG(target)\n && !isReplacedElement(target)\n && getComputedStyle(target).display === 'inline';\n};\nvar ResizeObservation = (function () {\n function ResizeObservation(target, observedBox) {\n this.target = target;\n this.observedBox = observedBox || ResizeObserverBoxOptions.CONTENT_BOX;\n this.lastReportedSize = {\n inlineSize: 0,\n blockSize: 0\n };\n }\n ResizeObservation.prototype.isActive = function () {\n var size = calculateBoxSize(this.target, this.observedBox, true);\n if (skipNotifyOnElement(this.target)) {\n this.lastReportedSize = size;\n }\n if (this.lastReportedSize.inlineSize !== size.inlineSize\n || this.lastReportedSize.blockSize !== size.blockSize) {\n return true;\n }\n return false;\n };\n return ResizeObservation;\n}());\nexport { ResizeObservation };\n","var ResizeObserverDetail = (function () {\n function ResizeObserverDetail(resizeObserver, callback) {\n this.activeTargets = [];\n this.skippedTargets = [];\n this.observationTargets = [];\n this.observer = resizeObserver;\n this.callback = callback;\n }\n return ResizeObserverDetail;\n}());\nexport { ResizeObserverDetail };\n","import { scheduler, updateCount } from './utils/scheduler';\nimport { ResizeObservation } from './ResizeObservation';\nimport { ResizeObserverDetail } from './ResizeObserverDetail';\nimport { resizeObservers } from './utils/resizeObservers';\nvar observerMap = new WeakMap();\nvar getObservationIndex = function (observationTargets, target) {\n for (var i = 0; i < observationTargets.length; i += 1) {\n if (observationTargets[i].target === target) {\n return i;\n }\n }\n return -1;\n};\nvar ResizeObserverController = (function () {\n function ResizeObserverController() {\n }\n ResizeObserverController.connect = function (resizeObserver, callback) {\n var detail = new ResizeObserverDetail(resizeObserver, callback);\n observerMap.set(resizeObserver, detail);\n };\n ResizeObserverController.observe = function (resizeObserver, target, options) {\n var detail = observerMap.get(resizeObserver);\n var firstObservation = detail.observationTargets.length === 0;\n if (getObservationIndex(detail.observationTargets, target) < 0) {\n firstObservation && resizeObservers.push(detail);\n detail.observationTargets.push(new ResizeObservation(target, options && options.box));\n updateCount(1);\n scheduler.schedule();\n }\n };\n ResizeObserverController.unobserve = function (resizeObserver, target) {\n var detail = observerMap.get(resizeObserver);\n var index = getObservationIndex(detail.observationTargets, target);\n var lastObservation = detail.observationTargets.length === 1;\n if (index >= 0) {\n lastObservation && resizeObservers.splice(resizeObservers.indexOf(detail), 1);\n detail.observationTargets.splice(index, 1);\n updateCount(-1);\n }\n };\n ResizeObserverController.disconnect = function (resizeObserver) {\n var _this = this;\n var detail = observerMap.get(resizeObserver);\n detail.observationTargets.slice().forEach(function (ot) { return _this.unobserve(resizeObserver, ot.target); });\n detail.activeTargets.splice(0, detail.activeTargets.length);\n };\n return ResizeObserverController;\n}());\nexport { ResizeObserverController };\n","import { ResizeObserverController } from './ResizeObserverController';\nimport { isElement } from './utils/element';\nvar ResizeObserver = (function () {\n function ResizeObserver(callback) {\n if (arguments.length === 0) {\n throw new TypeError(\"Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.\");\n }\n if (typeof callback !== 'function') {\n throw new TypeError(\"Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.\");\n }\n ResizeObserverController.connect(this, callback);\n }\n ResizeObserver.prototype.observe = function (target, options) {\n if (arguments.length === 0) {\n throw new TypeError(\"Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.\");\n }\n if (!isElement(target)) {\n throw new TypeError(\"Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element\");\n }\n ResizeObserverController.observe(this, target, options);\n };\n ResizeObserver.prototype.unobserve = function (target) {\n if (arguments.length === 0) {\n throw new TypeError(\"Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.\");\n }\n if (!isElement(target)) {\n throw new TypeError(\"Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element\");\n }\n ResizeObserverController.unobserve(this, target);\n };\n ResizeObserver.prototype.disconnect = function () {\n ResizeObserverController.disconnect(this);\n };\n ResizeObserver.toString = function () {\n return 'function ResizeObserver () { [polyfill code] }';\n };\n return ResizeObserver;\n}());\nexport { ResizeObserver };\n","import { ResizeObserver as Polyfill } from '@juggle/resize-observer';\nconst ResizeObserver = window.ResizeObserver || Polyfill;\n/** @inheritdoc */\nexport class SharedResizeObserver {\n constructor() {\n /**\n * This is the ResizeObserver that dispatches\n * callbacks to all of the handlers.\n *\n * @private\n * @memberof SharedResizeObserver\n */\n this.resizeObserver = new ResizeObserver(entries => {\n // This requestAnimationFrame is to throttle the refresh rate,\n // otherwise you get a bunch of\n // `ResizeObserver loop completed with undelivered notifications` errors\n // The errors are not harmful, but they happen a lot, see:\n // https://stackoverflow.com/a/58701523\n // https://github.com/souporserious/react-measure/issues/104\n // https://github.com/WICG/resize-observer/issues/38\n window.requestAnimationFrame(() => {\n for (const entry of entries) {\n const handlers = this.resizeHandlers.get(entry.target);\n handlers === null || handlers === void 0 ? void 0 : handlers.forEach(handler => {\n handler.handleResize(entry);\n });\n }\n });\n });\n /**\n * A map of all of the observed elements and their resize handlers\n *\n * @private\n * @type {Map<\n * Element,\n * Set<SharedResizeObserverResizeHandlerInterface>\n * >}\n * @memberof SharedResizeObserver\n */\n this.resizeHandlers = new Map();\n }\n /** @inheritdoc */\n addObserver(options) {\n var _a;\n const handlers = (_a = this.resizeHandlers.get(options.target)) !== null && _a !== void 0 ? _a : new Set();\n handlers.add(options.handler);\n this.resizeHandlers.set(options.target, handlers);\n this.resizeObserver.observe(options.target, options.options);\n }\n /** @inheritdoc */\n removeObserver(options) {\n const handlers = this.resizeHandlers.get(options.target);\n if (!handlers)\n return;\n this.resizeObserver.unobserve(options.target);\n handlers.delete(options.handler);\n if (handlers.size === 0) {\n this.resizeHandlers.delete(options.target);\n }\n }\n}\n//# sourceMappingURL=shared-resize-observer.js.map","/**\n * Configuration to show a modal\n *\n * @export\n * @class ModalConfig\n */\nexport class ModalConfig {\n constructor(options) {\n var _a, _b, _c, _d, _e;\n this.title = options === null || options === void 0 ? void 0 : options.title;\n this.subtitle = options === null || options === void 0 ? void 0 : options.subtitle;\n this.headline = options === null || options === void 0 ? void 0 : options.headline;\n this.message = options === null || options === void 0 ? void 0 : options.message;\n this.headerColor = (_a = options === null || options === void 0 ? void 0 : options.headerColor) !== null && _a !== void 0 ? _a : '#55A183';\n this.showProcessingIndicator = (_b = options === null || options === void 0 ? void 0 : options.showProcessingIndicator) !== null && _b !== void 0 ? _b : false;\n this.processingImageMode = (_c = options === null || options === void 0 ? void 0 : options.processingImageMode) !== null && _c !== void 0 ? _c : 'complete';\n this.showCloseButton = (_d = options === null || options === void 0 ? void 0 : options.showCloseButton) !== null && _d !== void 0 ? _d : true;\n this.closeOnBackdropClick = (_e = options === null || options === void 0 ? void 0 : options.closeOnBackdropClick) !== null && _e !== void 0 ? _e : true;\n }\n}\n//# sourceMappingURL=modal-config.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\ninterface MaybePolyfilledCe extends CustomElementRegistry {\n readonly polyfillWrapFlushCallback?: object;\n}\n\n/**\n * True if the custom elements polyfill is in use.\n */\nexport const isCEPolyfill = typeof window !== 'undefined' &&\n window.customElements != null &&\n (window.customElements as MaybePolyfilledCe).polyfillWrapFlushCallback !==\n undefined;\n\n/**\n * Reparents nodes, starting from `start` (inclusive) to `end` (exclusive),\n * into another container (could be the same container), before `before`. If\n * `before` is null, it appends the nodes to the container.\n */\nexport const reparentNodes =\n (container: Node,\n start: Node|null,\n end: Node|null = null,\n before: Node|null = null): void => {\n while (start !== end) {\n const n = start!.nextSibling;\n container.insertBefore(start!, before);\n start = n;\n }\n };\n\n/**\n * Removes nodes, starting from `start` (inclusive) to `end` (exclusive), from\n * `container`.\n */\nexport const removeNodes =\n (container: Node, start: Node|null, end: Node|null = null): void => {\n while (start !== end) {\n const n = start!.nextSibling;\n container.removeChild(start!);\n start = n;\n }\n };\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {TemplateResult} from './template-result.js';\n\n/**\n * An expression marker with embedded unique key to avoid collision with\n * possible text in templates.\n */\nexport const marker = `{{lit-${String(Math.random()).slice(2)}}}`;\n\n/**\n * An expression marker used text-positions, multi-binding attributes, and\n * attributes with markup-like text values.\n */\nexport const nodeMarker = `<!--${marker}-->`;\n\nexport const markerRegex = new RegExp(`${marker}|${nodeMarker}`);\n\n/**\n * Suffix appended to all bound attribute names.\n */\nexport const boundAttributeSuffix = '$lit$';\n\n/**\n * An updatable Template that tracks the location of dynamic parts.\n */\nexport class Template {\n readonly parts: TemplatePart[] = [];\n readonly element: HTMLTemplateElement;\n\n constructor(result: TemplateResult, element: HTMLTemplateElement) {\n this.element = element;\n\n const nodesToRemove: Node[] = [];\n const stack: Node[] = [];\n // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null\n const walker = document.createTreeWalker(\n element.content,\n 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */,\n null,\n false);\n // Keeps track of the last index associated with a part. We try to delete\n // unnecessary nodes, but we never want to associate two different parts\n // to the same index. They must have a constant node between.\n let lastPartIndex = 0;\n let index = -1;\n let partIndex = 0;\n const {strings, values: {length}} = result;\n while (partIndex < length) {\n const node = walker.nextNode() as Element | Comment | Text | null;\n if (node === null) {\n // We've exhausted the content inside a nested template element.\n // Because we still have parts (the outer for-loop), we know:\n // - There is a template in the stack\n // - The walker will find a nextNode outside the template\n walker.currentNode = stack.pop()!;\n continue;\n }\n index++;\n\n if (node.nodeType === 1 /* Node.ELEMENT_NODE */) {\n if ((node as Element).hasAttributes()) {\n const attributes = (node as Element).attributes;\n const {length} = attributes;\n // Per\n // https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap,\n // attributes are not guaranteed to be returned in document order.\n // In particular, Edge/IE can return them out of order, so we cannot\n // assume a correspondence between part index and attribute index.\n let count = 0;\n for (let i = 0; i < length; i++) {\n if (endsWith(attributes[i].name, boundAttributeSuffix)) {\n count++;\n }\n }\n while (count-- > 0) {\n // Get the template literal section leading up to the first\n // expression in this attribute\n const stringForPart = strings[partIndex];\n // Find the attribute name\n const name = lastAttributeNameRegex.exec(stringForPart)![2];\n // Find the corresponding attribute\n // All bound attributes have had a suffix added in\n // TemplateResult#getHTML to opt out of special attribute\n // handling. To look up the attribute value we also need to add\n // the suffix.\n const attributeLookupName =\n name.toLowerCase() + boundAttributeSuffix;\n const attributeValue =\n (node as Element).getAttribute(attributeLookupName)!;\n (node as Element).removeAttribute(attributeLookupName);\n const statics = attributeValue.split(markerRegex);\n this.parts.push({type: 'attribute', index, name, strings: statics});\n partIndex += statics.length - 1;\n }\n }\n if ((node as Element).tagName === 'TEMPLATE') {\n stack.push(node);\n walker.currentNode = (node as HTMLTemplateElement).content;\n }\n } else if (node.nodeType === 3 /* Node.TEXT_NODE */) {\n const data = (node as Text).data;\n if (data.indexOf(marker) >= 0) {\n const parent = node.parentNode!;\n const strings = data.split(markerRegex);\n const lastIndex = strings.length - 1;\n // Generate a new text node for each literal section\n // These nodes are also used as the markers for node parts\n for (let i = 0; i < lastIndex; i++) {\n let insert: Node;\n let s = strings[i];\n if (s === '') {\n insert = createMarker();\n } else {\n const match = lastAttributeNameRegex.exec(s);\n if (match !== null && endsWith(match[2], boundAttributeSuffix)) {\n s = s.slice(0, match.index) + match[1] +\n match[2].slice(0, -boundAttributeSuffix.length) + match[3];\n }\n insert = document.createTextNode(s);\n }\n parent.insertBefore(insert, node);\n this.parts.push({type: 'node', index: ++index});\n }\n // If there's no text, we must insert a comment to mark our place.\n // Else, we can trust it will stick around after cloning.\n if (strings[lastIndex] === '') {\n parent.insertBefore(createMarker(), node);\n nodesToRemove.push(node);\n } else {\n (node as Text).data = strings[lastIndex];\n }\n // We have a part for each match found\n partIndex += lastIndex;\n }\n } else if (node.nodeType === 8 /* Node.COMMENT_NODE */) {\n if ((node as Comment).data === marker) {\n const parent = node.parentNode!;\n // Add a new marker node to be the startNode of the Part if any of\n // the following are true:\n // * We don't have a previousSibling\n // * The previousSibling is already the start of a previous part\n if (node.previousSibling === null || index === lastPartIndex) {\n index++;\n parent.insertBefore(createMarker(), node);\n }\n lastPartIndex = index;\n this.parts.push({type: 'node', index});\n // If we don't have a nextSibling, keep this node so we have an end.\n // Else, we can remove it to save future costs.\n if (node.nextSibling === null) {\n (node as Comment).data = '';\n } else {\n nodesToRemove.push(node);\n index--;\n }\n partIndex++;\n } else {\n let i = -1;\n while ((i = (node as Comment).data.indexOf(marker, i + 1)) !== -1) {\n // Comment node has a binding marker inside, make an inactive part\n // The binding won't work, but subsequent bindings will\n // TODO (justinfagnani): consider whether it's even worth it to\n // make bindings in comments work\n this.parts.push({type: 'node', index: -1});\n partIndex++;\n }\n }\n }\n }\n\n // Remove text binding nodes after the walk to not disturb the TreeWalker\n for (const n of nodesToRemove) {\n n.parentNode!.removeChild(n);\n }\n }\n}\n\nconst endsWith = (str: string, suffix: string): boolean => {\n const index = str.length - suffix.length;\n return index >= 0 && str.slice(index) === suffix;\n};\n\n/**\n * A placeholder for a dynamic expression in an HTML template.\n *\n * There are two built-in part types: AttributePart and NodePart. NodeParts\n * always represent a single dynamic expression, while AttributeParts may\n * represent as many expressions are contained in the attribute.\n *\n * A Template's parts are mutable, so parts can be replaced or modified\n * (possibly to implement different template semantics). The contract is that\n * parts can only be replaced, not removed, added or reordered, and parts must\n * always consume the correct number of values in their `update()` method.\n *\n * TODO(justinfagnani): That requirement is a little fragile. A\n * TemplateInstance could instead be more careful about which values it gives\n * to Part.update().\n */\nexport type TemplatePart = {\n readonly type: 'node'; index: number;\n}|{\n readonly type: 'attribute';\n index: number;\n readonly name: string;\n readonly strings: ReadonlyArray<string>;\n};\n\nexport const isTemplatePartActive = (part: TemplatePart) => part.index !== -1;\n\n// Allows `document.createComment('')` to be renamed for a\n// small manual size-savings.\nexport const createMarker = () => document.createComment('');\n\n/**\n * This regex extracts the attribute name preceding an attribute-position\n * expression. It does this by matching the syntax allowed for attributes\n * against the string literal directly preceding the expression, assuming that\n * the expression is in an attribute-value position.\n *\n * See attributes in the HTML spec:\n * https://www.w3.org/TR/html5/syntax.html#elements-attributes\n *\n * \" \\x09\\x0a\\x0c\\x0d\" are HTML space characters:\n * https://www.w3.org/TR/html5/infrastructure.html#space-characters\n *\n * \"\\0-\\x1F\\x7F-\\x9F\" are Unicode control characters, which includes every\n * space character except \" \".\n *\n * So an attribute is:\n * * The name: any character except a control character, space character, ('),\n * (\"), \">\", \"=\", or \"/\"\n * * Followed by zero or more space characters\n * * Followed by \"=\"\n * * Followed by zero or more space characters\n * * Followed by:\n * * Any character except space, ('), (\"), \"<\", \">\", \"=\", (`), or\n * * (\") then any non-(\"), or\n * * (') then any non-(')\n */\nexport const lastAttributeNameRegex =\n // eslint-disable-next-line no-control-regex\n /([ \\x09\\x0a\\x0c\\x0d])([^\\0-\\x1F\\x7F-\\x9F \"'>=/]+)([ \\x09\\x0a\\x0c\\x0d]*=[ \\x09\\x0a\\x0c\\x0d]*(?:[^ \\x09\\x0a\\x0c\\x0d\"'`<>=]*|\"[^\"]*|'[^']*))$/;\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {isTemplatePartActive, Template, TemplatePart} from './template.js';\n\nconst walkerNodeFilter = 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */;\n\n/**\n * Removes the list of nodes from a Template safely. In addition to removing\n * nodes from the Template, the Template part indices are updated to match\n * the mutated Template DOM.\n *\n * As the template is walked the removal state is tracked and\n * part indices are adjusted as needed.\n *\n * div\n * div#1 (remove) <-- start removing (removing node is div#1)\n * div\n * div#2 (remove) <-- continue removing (removing node is still div#1)\n * div\n * div <-- stop removing since previous sibling is the removing node (div#1,\n * removed 4 nodes)\n */\nexport function removeNodesFromTemplate(\n template: Template, nodesToRemove: Set<Node>) {\n const {element: {content}, parts} = template;\n const walker =\n document.createTreeWalker(content, walkerNodeFilter, null, false);\n let partIndex = nextActiveIndexInTemplateParts(parts);\n let part = parts[partIndex];\n let nodeIndex = -1;\n let removeCount = 0;\n const nodesToRemoveInTemplate = [];\n let currentRemovingNode: Node|null = null;\n while (walker.nextNode()) {\n nodeIndex++;\n const node = walker.currentNode as Element;\n // End removal if stepped past the removing node\n if (node.previousSibling === currentRemovingNode) {\n currentRemovingNode = null;\n }\n // A node to remove was found in the template\n if (nodesToRemove.has(node)) {\n nodesToRemoveInTemplate.push(node);\n // Track node we're removing\n if (currentRemovingNode === null) {\n currentRemovingNode = node;\n }\n }\n // When removing, increment count by which to adjust subsequent part indices\n if (currentRemovingNode !== null) {\n removeCount++;\n }\n while (part !== undefined && part.index === nodeIndex) {\n // If part is in a removed node deactivate it by setting index to -1 or\n // adjust the index as needed.\n part.index = currentRemovingNode !== null ? -1 : part.index - removeCount;\n // go to the next active part.\n partIndex = nextActiveIndexInTemplateParts(parts, partIndex);\n part = parts[partIndex];\n }\n }\n nodesToRemoveInTemplate.forEach((n) => n.parentNode!.removeChild(n));\n}\n\nconst countNodes = (node: Node) => {\n let count = (node.nodeType === 11 /* Node.DOCUMENT_FRAGMENT_NODE */) ? 0 : 1;\n const walker = document.createTreeWalker(node, walkerNodeFilter, null, false);\n while (walker.nextNode()) {\n count++;\n }\n return count;\n};\n\nconst nextActiveIndexInTemplateParts =\n (parts: TemplatePart[], startIndex = -1) => {\n for (let i = startIndex + 1; i < parts.length; i++) {\n const part = parts[i];\n if (isTemplatePartActive(part)) {\n return i;\n }\n }\n return -1;\n };\n\n/**\n * Inserts the given node into the Template, optionally before the given\n * refNode. In addition to inserting the node into the Template, the Template\n * part indices are updated to match the mutated Template DOM.\n */\nexport function insertNodeIntoTemplate(\n template: Template, node: Node, refNode: Node|null = null) {\n const {element: {content}, parts} = template;\n // If there's no refNode, then put node at end of template.\n // No part indices need to be shifted in this case.\n if (refNode === null || refNode === undefined) {\n content.appendChild(node);\n return;\n }\n const walker =\n document.createTreeWalker(content, walkerNodeFilter, null, false);\n let partIndex = nextActiveIndexInTemplateParts(parts);\n let insertCount = 0;\n let walkerIndex = -1;\n while (walker.nextNode()) {\n walkerIndex++;\n const walkerNode = walker.currentNode as Element;\n if (walkerNode === refNode) {\n insertCount = countNodes(node);\n refNode.parentNode!.insertBefore(node, refNode);\n }\n while (partIndex !== -1 && parts[partIndex].index === walkerIndex) {\n // If we've inserted the node, simply adjust all subsequent parts\n if (insertCount > 0) {\n while (partIndex !== -1) {\n parts[partIndex].index += insertCount;\n partIndex = nextActiveIndexInTemplateParts(parts, partIndex);\n }\n return;\n }\n partIndex = nextActiveIndexInTemplateParts(parts, partIndex);\n }\n }\n}\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {Part} from './part.js';\n\nconst directives = new WeakMap<object, true>();\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type DirectiveFactory = (...args: any[]) => object;\n\nexport type DirectiveFn = (part: Part) => void;\n\n/**\n * Brands a function as a directive factory function so that lit-html will call\n * the function during template rendering, rather than passing as a value.\n *\n * A _directive_ is a function that takes a Part as an argument. It has the\n * signature: `(part: Part) => void`.\n *\n * A directive _factory_ is a function that takes arguments for data and\n * configuration and returns a directive. Users of directive usually refer to\n * the directive factory as the directive. For example, \"The repeat directive\".\n *\n * Usually a template author will invoke a directive factory in their template\n * with relevant arguments, which will then return a directive function.\n *\n * Here's an example of using the `repeat()` directive factory that takes an\n * array and a function to render an item:\n *\n * ```js\n * html`<ul><${repeat(items, (item) => html`<li>${item}</li>`)}</ul>`\n * ```\n *\n * When `repeat` is invoked, it returns a directive function that closes over\n * `items` and the template function. When the outer template is rendered, the\n * return directive function is called with the Part for the expression.\n * `repeat` then performs it's custom logic to render multiple items.\n *\n * @param f The directive factory function. Must be a function that returns a\n * function of the signature `(part: Part) => void`. The returned function will\n * be called with the part object.\n *\n * @example\n *\n * import {directive, html} from 'lit-html';\n *\n * const immutable = directive((v) => (part) => {\n * if (part.value !== v) {\n * part.setValue(v)\n * }\n * });\n */\nexport const directive = <F extends DirectiveFactory>(f: F): F =>\n ((...args: unknown[]) => {\n const d = f(...args);\n directives.set(d, true);\n return d;\n }) as F;\n\nexport const isDirective = (o: unknown): o is DirectiveFn => {\n return typeof o === 'function' && directives.has(o);\n};\n","/**\n * @license\n * Copyright (c) 2018 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * The Part interface represents a dynamic part of a template instance rendered\n * by lit-html.\n */\nexport interface Part {\n readonly value: unknown;\n\n /**\n * Sets the current part value, but does not write it to the DOM.\n * @param value The value that will be committed.\n */\n setValue(value: unknown): void;\n\n /**\n * Commits the current part value, causing it to actually be written to the\n * DOM.\n *\n * Directives are run at the start of `commit`, so that if they call\n * `part.setValue(...)` synchronously that value will be used in the current\n * commit, and there's no need to call `part.commit()` within the directive.\n * If directives set a part value asynchronously, then they must call\n * `part.commit()` manually.\n */\n commit(): void;\n}\n\n/**\n * A sentinel value that signals that a value was handled by a directive and\n * should not be written to the DOM.\n */\nexport const noChange = {};\n\n/**\n * A sentinel value that signals a NodePart to fully clear its content.\n */\nexport const nothing = {};\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {isCEPolyfill} from './dom.js';\nimport {Part} from './part.js';\nimport {RenderOptions} from './render-options.js';\nimport {TemplateProcessor} from './template-processor.js';\nimport {isTemplatePartActive, Template, TemplatePart} from './template.js';\n\n/**\n * An instance of a `Template` that can be attached to the DOM and updated\n * with new values.\n */\nexport class TemplateInstance {\n private readonly __parts: Array<Part|undefined> = [];\n readonly processor: TemplateProcessor;\n readonly options: RenderOptions;\n readonly template: Template;\n\n constructor(\n template: Template, processor: TemplateProcessor,\n options: RenderOptions) {\n this.template = template;\n this.processor = processor;\n this.options = options;\n }\n\n update(values: readonly unknown[]) {\n let i = 0;\n for (const part of this.__parts) {\n if (part !== undefined) {\n part.setValue(values[i]);\n }\n i++;\n }\n for (const part of this.__parts) {\n if (part !== undefined) {\n part.commit();\n }\n }\n }\n\n _clone(): DocumentFragment {\n // There are a number of steps in the lifecycle of a template instance's\n // DOM fragment:\n // 1. Clone - create the instance fragment\n // 2. Adopt - adopt into the main document\n // 3. Process - find part markers and create parts\n // 4. Upgrade - upgrade custom elements\n // 5. Update - set node, attribute, property, etc., values\n // 6. Connect - connect to the document. Optional and outside of this\n // method.\n //\n // We have a few constraints on the ordering of these steps:\n // * We need to upgrade before updating, so that property values will pass\n // through any property setters.\n // * We would like to process before upgrading so that we're sure that the\n // cloned fragment is inert and not disturbed by self-modifying DOM.\n // * We want custom elements to upgrade even in disconnected fragments.\n //\n // Given these constraints, with full custom elements support we would\n // prefer the order: Clone, Process, Adopt, Upgrade, Update, Connect\n //\n // But Safari does not implement CustomElementRegistry#upgrade, so we\n // can not implement that order and still have upgrade-before-update and\n // upgrade disconnected fragments. So we instead sacrifice the\n // process-before-upgrade constraint, since in Custom Elements v1 elements\n // must not modify their light DOM in the constructor. We still have issues\n // when co-existing with CEv0 elements like Polymer 1, and with polyfills\n // that don't strictly adhere to the no-modification rule because shadow\n // DOM, which may be created in the constructor, is emulated by being placed\n // in the light DOM.\n //\n // The resulting order is on native is: Clone, Adopt, Upgrade, Process,\n // Update, Connect. document.importNode() performs Clone, Adopt, and Upgrade\n // in one step.\n //\n // The Custom Elements v1 polyfill supports upgrade(), so the order when\n // polyfilled is the more ideal: Clone, Process, Adopt, Upgrade, Update,\n // Connect.\n\n const fragment = isCEPolyfill ?\n this.template.element.content.cloneNode(true) as DocumentFragment :\n document.importNode(this.template.element.content, true);\n\n const stack: Node[] = [];\n const parts = this.template.parts;\n // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null\n const walker = document.createTreeWalker(\n fragment,\n 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */,\n null,\n false);\n let partIndex = 0;\n let nodeIndex = 0;\n let part: TemplatePart;\n let node = walker.nextNode();\n // Loop through all the nodes and parts of a template\n while (partIndex < parts.length) {\n part = parts[partIndex];\n if (!isTemplatePartActive(part)) {\n this.__parts.push(undefined);\n partIndex++;\n continue;\n }\n\n // Progress the tree walker until we find our next part's node.\n // Note that multiple parts may share the same node (attribute parts\n // on a single element), so this loop may not run at all.\n while (nodeIndex < part.index) {\n nodeIndex++;\n if (node!.nodeName === 'TEMPLATE') {\n stack.push(node!);\n walker.currentNode = (node as HTMLTemplateElement).content;\n }\n if ((node = walker.nextNode()) === null) {\n // We've exhausted the content inside a nested template element.\n // Because we still have parts (the outer for-loop), we know:\n // - There is a template in the stack\n // - The walker will find a nextNode outside the template\n walker.currentNode = stack.pop()!;\n node = walker.nextNode();\n }\n }\n\n // We've arrived at our part's node.\n if (part.type === 'node') {\n const part = this.processor.handleTextExpression(this.options);\n part.insertAfterNode(node!.previousSibling!);\n this.__parts.push(part);\n } else {\n this.__parts.push(...this.processor.handleAttributeExpressions(\n node as Element, part.name, part.strings, this.options));\n }\n partIndex++;\n }\n\n if (isCEPolyfill) {\n document.adoptNode(fragment);\n customElements.upgrade(fragment);\n }\n return fragment;\n }\n}\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * @module lit-html\n */\n\nimport {reparentNodes} from './dom.js';\nimport {TemplateProcessor} from './template-processor.js';\nimport {boundAttributeSuffix, lastAttributeNameRegex, marker, nodeMarker} from './template.js';\n\ndeclare const trustedTypes: typeof window.trustedTypes;\n/**\n * Our TrustedTypePolicy for HTML which is declared using the html template\n * tag function.\n *\n * That HTML is a developer-authored constant, and is parsed with innerHTML\n * before any untrusted expressions have been mixed in. Therefor it is\n * considered safe by construction.\n */\nconst policy = window.trustedTypes &&\n trustedTypes!.createPolicy('lit-html', {createHTML: (s) => s});\n\nconst commentMarker = ` ${marker} `;\n\n/**\n * The return type of `html`, which holds a Template and the values from\n * interpolated expressions.\n */\nexport class TemplateResult {\n readonly strings: TemplateStringsArray;\n readonly values: readonly unknown[];\n readonly type: string;\n readonly processor: TemplateProcessor;\n\n constructor(\n strings: TemplateStringsArray, values: readonly unknown[], type: string,\n processor: TemplateProcessor) {\n this.strings = strings;\n this.values = values;\n this.type = type;\n this.processor = processor;\n }\n\n /**\n * Returns a string of HTML used to create a `<template>` element.\n */\n getHTML(): string {\n const l = this.strings.length - 1;\n let html = '';\n let isCommentBinding = false;\n\n for (let i = 0; i < l; i++) {\n const s = this.strings[i];\n // For each binding we want to determine the kind of marker to insert\n // into the template source before it's parsed by the browser's HTML\n // parser. The marker type is based on whether the expression is in an\n // attribute, text, or comment position.\n // * For node-position bindings we insert a comment with the marker\n // sentinel as its text content, like <!--{{lit-guid}}-->.\n // * For attribute bindings we insert just the marker sentinel for the\n // first binding, so that we support unquoted attribute bindings.\n // Subsequent bindings can use a comment marker because multi-binding\n // attributes must be quoted.\n // * For comment bindings we insert just the marker sentinel so we don't\n // close the comment.\n //\n // The following code scans the template source, but is *not* an HTML\n // parser. We don't need to track the tree structure of the HTML, only\n // whether a binding is inside a comment, and if not, if it appears to be\n // the first binding in an attribute.\n const commentOpen = s.lastIndexOf('<!--');\n // We're in comment position if we have a comment open with no following\n // comment close. Because <-- can appear in an attribute value there can\n // be false positives.\n isCommentBinding = (commentOpen > -1 || isCommentBinding) &&\n s.indexOf('-->', commentOpen + 1) === -1;\n // Check to see if we have an attribute-like sequence preceding the\n // expression. This can match \"name=value\" like structures in text,\n // comments, and attribute values, so there can be false-positives.\n const attributeMatch = lastAttributeNameRegex.exec(s);\n if (attributeMatch === null) {\n // We're only in this branch if we don't have a attribute-like\n // preceding sequence. For comments, this guards against unusual\n // attribute values like <div foo=\"<!--${'bar'}\">. Cases like\n // <!-- foo=${'bar'}--> are handled correctly in the attribute branch\n // below.\n html += s + (isCommentBinding ? commentMarker : nodeMarker);\n } else {\n // For attributes we use just a marker sentinel, and also append a\n // $lit$ suffix to the name to opt-out of attribute-specific parsing\n // that IE and Edge do for style and certain SVG attributes.\n html += s.substr(0, attributeMatch.index) + attributeMatch[1] +\n attributeMatch[2] + boundAttributeSuffix + attributeMatch[3] +\n marker;\n }\n }\n html += this.strings[l];\n return html;\n }\n\n getTemplateElement(): HTMLTemplateElement {\n const template = document.createElement('template');\n let value = this.getHTML();\n if (policy !== undefined) {\n // this is secure because `this.strings` is a TemplateStringsArray.\n // TODO: validate this when\n // https://github.com/tc39/proposal-array-is-template-object is\n // implemented.\n value = policy.createHTML(value) as unknown as string;\n }\n template.innerHTML = value;\n return template;\n }\n}\n\n/**\n * A TemplateResult for SVG fragments.\n *\n * This class wraps HTML in an `<svg>` tag in order to parse its contents in the\n * SVG namespace, then modifies the template to remove the `<svg>` tag so that\n * clones only container the original fragment.\n */\nexport class SVGTemplateResult extends TemplateResult {\n getHTML(): string {\n return `<svg>${super.getHTML()}</svg>`;\n }\n\n getTemplateElement(): HTMLTemplateElement {\n const template = super.getTemplateElement();\n const content = template.content;\n const svgElement = content.firstChild!;\n content.removeChild(svgElement);\n reparentNodes(content, svgElement.firstChild);\n return template;\n }\n}\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {isDirective} from './directive.js';\nimport {removeNodes} from './dom.js';\nimport {noChange, nothing, Part} from './part.js';\nimport {RenderOptions} from './render-options.js';\nimport {TemplateInstance} from './template-instance.js';\nimport {TemplateResult} from './template-result.js';\nimport {createMarker} from './template.js';\n\n// https://tc39.github.io/ecma262/#sec-typeof-operator\nexport type Primitive = null|undefined|boolean|number|string|symbol|bigint;\nexport const isPrimitive = (value: unknown): value is Primitive => {\n return (\n value === null ||\n !(typeof value === 'object' || typeof value === 'function'));\n};\nexport const isIterable = (value: unknown): value is Iterable<unknown> => {\n return Array.isArray(value) ||\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n !!(value && (value as any)[Symbol.iterator]);\n};\n\n/**\n * Writes attribute values to the DOM for a group of AttributeParts bound to a\n * single attribute. The value is only set once even if there are multiple parts\n * for an attribute.\n */\nexport class AttributeCommitter {\n readonly element: Element;\n readonly name: string;\n readonly strings: ReadonlyArray<string>;\n readonly parts: ReadonlyArray<AttributePart>;\n dirty = true;\n\n constructor(element: Element, name: string, strings: ReadonlyArray<string>) {\n this.element = element;\n this.name = name;\n this.strings = strings;\n this.parts = [];\n for (let i = 0; i < strings.length - 1; i++) {\n (this.parts as AttributePart[])[i] = this._createPart();\n }\n }\n\n /**\n * Creates a single part. Override this to create a differnt type of part.\n */\n protected _createPart(): AttributePart {\n return new AttributePart(this);\n }\n\n protected _getValue(): unknown {\n const strings = this.strings;\n const l = strings.length - 1;\n const parts = this.parts;\n\n // If we're assigning an attribute via syntax like:\n // attr=\"${foo}\" or attr=${foo}\n // but not\n // attr=\"${foo} ${bar}\" or attr=\"${foo} baz\"\n // then we don't want to coerce the attribute value into one long\n // string. Instead we want to just return the value itself directly,\n // so that sanitizeDOMValue can get the actual value rather than\n // String(value)\n // The exception is if v is an array, in which case we do want to smash\n // it together into a string without calling String() on the array.\n //\n // This also allows trusted values (when using TrustedTypes) being\n // assigned to DOM sinks without being stringified in the process.\n if (l === 1 && strings[0] === '' && strings[1] === '') {\n const v = parts[0].value;\n if (typeof v === 'symbol') {\n return String(v);\n }\n if (typeof v === 'string' || !isIterable(v)) {\n return v;\n }\n }\n let text = '';\n\n for (let i = 0; i < l; i++) {\n text += strings[i];\n const part = parts[i];\n if (part !== undefined) {\n const v = part.value;\n if (isPrimitive(v) || !isIterable(v)) {\n text += typeof v === 'string' ? v : String(v);\n } else {\n for (const t of v) {\n text += typeof t === 'string' ? t : String(t);\n }\n }\n }\n }\n\n text += strings[l];\n return text;\n }\n\n commit(): void {\n if (this.dirty) {\n this.dirty = false;\n this.element.setAttribute(this.name, this._getValue() as string);\n }\n }\n}\n\n/**\n * A Part that controls all or part of an attribute value.\n */\nexport class AttributePart implements Part {\n readonly committer: AttributeCommitter;\n value: unknown = undefined;\n\n constructor(committer: AttributeCommitter) {\n this.committer = committer;\n }\n\n setValue(value: unknown): void {\n if (value !== noChange && (!isPrimitive(value) || value !== this.value)) {\n this.value = value;\n // If the value is a not a directive, dirty the committer so that it'll\n // call setAttribute. If the value is a directive, it'll dirty the\n // committer if it calls setValue().\n if (!isDirective(value)) {\n this.committer.dirty = true;\n }\n }\n }\n\n commit() {\n while (isDirective(this.value)) {\n const directive = this.value;\n this.value = noChange;\n directive(this);\n }\n if (this.value === noChange) {\n return;\n }\n this.committer.commit();\n }\n}\n\n/**\n * A Part that controls a location within a Node tree. Like a Range, NodePart\n * has start and end locations and can set and update the Nodes between those\n * locations.\n *\n * NodeParts support several value types: primitives, Nodes, TemplateResults,\n * as well as arrays and iterables of those types.\n */\nexport class NodePart implements Part {\n readonly options: RenderOptions;\n startNode!: Node;\n endNode!: Node;\n value: unknown = undefined;\n private __pendingValue: unknown = undefined;\n\n constructor(options: RenderOptions) {\n this.options = options;\n }\n\n /**\n * Appends this part into a container.\n *\n * This part must be empty, as its contents are not automatically moved.\n */\n appendInto(container: Node) {\n this.startNode = container.appendChild(createMarker());\n this.endNode = container.appendChild(createMarker());\n }\n\n /**\n * Inserts this part after the `ref` node (between `ref` and `ref`'s next\n * sibling). Both `ref` and its next sibling must be static, unchanging nodes\n * such as those that appear in a literal section of a template.\n *\n * This part must be empty, as its contents are not automatically moved.\n */\n insertAfterNode(ref: Node) {\n this.startNode = ref;\n this.endNode = ref.nextSibling!;\n }\n\n /**\n * Appends this part into a parent part.\n *\n * This part must be empty, as its contents are not automatically moved.\n */\n appendIntoPart(part: NodePart) {\n part.__insert(this.startNode = createMarker());\n part.__insert(this.endNode = createMarker());\n }\n\n /**\n * Inserts this part after the `ref` part.\n *\n * This part must be empty, as its contents are not automatically moved.\n */\n insertAfterPart(ref: NodePart) {\n ref.__insert(this.startNode = createMarker());\n this.endNode = ref.endNode;\n ref.endNode = this.startNode;\n }\n\n setValue(value: unknown): void {\n this.__pendingValue = value;\n }\n\n commit() {\n if (this.startNode.parentNode === null) {\n return;\n }\n while (isDirective(this.__pendingValue)) {\n const directive = this.__pendingValue;\n this.__pendingValue = noChange;\n directive(this);\n }\n const value = this.__pendingValue;\n if (value === noChange) {\n return;\n }\n if (isPrimitive(value)) {\n if (value !== this.value) {\n this.__commitText(value);\n }\n } else if (value instanceof TemplateResult) {\n this.__commitTemplateResult(value);\n } else if (value instanceof Node) {\n this.__commitNode(value);\n } else if (isIterable(value)) {\n this.__commitIterable(value);\n } else if (value === nothing) {\n this.value = nothing;\n this.clear();\n } else {\n // Fallback, will render the string representation\n this.__commitText(value);\n }\n }\n\n private __insert(node: Node) {\n this.endNode.parentNode!.insertBefore(node, this.endNode);\n }\n\n private __commitNode(value: Node): void {\n if (this.value === value) {\n return;\n }\n this.clear();\n this.__insert(value);\n this.value = value;\n }\n\n private __commitText(value: unknown): void {\n const node = this.startNode.nextSibling!;\n value = value == null ? '' : value;\n // If `value` isn't already a string, we explicitly convert it here in case\n // it can't be implicitly converted - i.e. it's a symbol.\n const valueAsString: string =\n typeof value === 'string' ? value : String(value);\n if (node === this.endNode.previousSibling &&\n node.nodeType === 3 /* Node.TEXT_NODE */) {\n // If we only have a single text node between the markers, we can just\n // set its value, rather than replacing it.\n // TODO(justinfagnani): Can we just check if this.value is primitive?\n (node as Text).data = valueAsString;\n } else {\n this.__commitNode(document.createTextNode(valueAsString));\n }\n this.value = value;\n }\n\n private __commitTemplateResult(value: TemplateResult): void {\n const template = this.options.templateFactory(value);\n if (this.value instanceof TemplateInstance &&\n this.value.template === template) {\n this.value.update(value.values);\n } else {\n // Make sure we propagate the template processor from the TemplateResult\n // so that we use its syntax extension, etc. The template factory comes\n // from the render function options so that it can control template\n // caching and preprocessing.\n const instance =\n new TemplateInstance(template, value.processor, this.options);\n const fragment = instance._clone();\n instance.update(value.values);\n this.__commitNode(fragment);\n this.value = instance;\n }\n }\n\n private __commitIterable(value: Iterable<unknown>): void {\n // For an Iterable, we create a new InstancePart per item, then set its\n // value to the item. This is a little bit of overhead for every item in\n // an Iterable, but it lets us recurse easily and efficiently update Arrays\n // of TemplateResults that will be commonly returned from expressions like:\n // array.map((i) => html`${i}`), by reusing existing TemplateInstances.\n\n // If _value is an array, then the previous render was of an\n // iterable and _value will contain the NodeParts from the previous\n // render. If _value is not an array, clear this part and make a new\n // array for NodeParts.\n if (!Array.isArray(this.value)) {\n this.value = [];\n this.clear();\n }\n\n // Lets us keep track of how many items we stamped so we can clear leftover\n // items from a previous render\n const itemParts = this.value as NodePart[];\n let partIndex = 0;\n let itemPart: NodePart|undefined;\n\n for (const item of value) {\n // Try to reuse an existing part\n itemPart = itemParts[partIndex];\n\n // If no existing part, create a new one\n if (itemPart === undefined) {\n itemPart = new NodePart(this.options);\n itemParts.push(itemPart);\n if (partIndex === 0) {\n itemPart.appendIntoPart(this);\n } else {\n itemPart.insertAfterPart(itemParts[partIndex - 1]);\n }\n }\n itemPart.setValue(item);\n itemPart.commit();\n partIndex++;\n }\n\n if (partIndex < itemParts.length) {\n // Truncate the parts array so _value reflects the current state\n itemParts.length = partIndex;\n this.clear(itemPart && itemPart.endNode);\n }\n }\n\n clear(startNode: Node = this.startNode) {\n removeNodes(\n this.startNode.parentNode!, startNode.nextSibling!, this.endNode);\n }\n}\n\n/**\n * Implements a boolean attribute, roughly as defined in the HTML\n * specification.\n *\n * If the value is truthy, then the attribute is present with a value of\n * ''. If the value is falsey, the attribute is removed.\n */\nexport class BooleanAttributePart implements Part {\n readonly element: Element;\n readonly name: string;\n readonly strings: readonly string[];\n value: unknown = undefined;\n private __pendingValue: unknown = undefined;\n\n constructor(element: Element, name: string, strings: readonly string[]) {\n if (strings.length !== 2 || strings[0] !== '' || strings[1] !== '') {\n throw new Error(\n 'Boolean attributes can only contain a single expression');\n }\n this.element = element;\n this.name = name;\n this.strings = strings;\n }\n\n setValue(value: unknown): void {\n this.__pendingValue = value;\n }\n\n commit() {\n while (isDirective(this.__pendingValue)) {\n const directive = this.__pendingValue;\n this.__pendingValue = noChange;\n directive(this);\n }\n if (this.__pendingValue === noChange) {\n return;\n }\n const value = !!this.__pendingValue;\n if (this.value !== value) {\n if (value) {\n this.element.setAttribute(this.name, '');\n } else {\n this.element.removeAttribute(this.name);\n }\n this.value = value;\n }\n this.__pendingValue = noChange;\n }\n}\n\n/**\n * Sets attribute values for PropertyParts, so that the value is only set once\n * even if there are multiple parts for a property.\n *\n * If an expression controls the whole property value, then the value is simply\n * assigned to the property under control. If there are string literals or\n * multiple expressions, then the strings are expressions are interpolated into\n * a string first.\n */\nexport class PropertyCommitter extends AttributeCommitter {\n readonly single: boolean;\n\n constructor(element: Element, name: string, strings: ReadonlyArray<string>) {\n super(element, name, strings);\n this.single =\n (strings.length === 2 && strings[0] === '' && strings[1] === '');\n }\n\n protected _createPart(): PropertyPart {\n return new PropertyPart(this);\n }\n\n protected _getValue() {\n if (this.single) {\n return this.parts[0].value;\n }\n return super._getValue();\n }\n\n commit(): void {\n if (this.dirty) {\n this.dirty = false;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (this.element as any)[this.name] = this._getValue();\n }\n }\n}\n\nexport class PropertyPart extends AttributePart {}\n\n// Detect event listener options support. If the `capture` property is read\n// from the options object, then options are supported. If not, then the third\n// argument to add/removeEventListener is interpreted as the boolean capture\n// value so we should only pass the `capture` property.\nlet eventOptionsSupported = false;\n\n// Wrap into an IIFE because MS Edge <= v41 does not support having try/catch\n// blocks right into the body of a module\n(() => {\n try {\n const options = {\n get capture() {\n eventOptionsSupported = true;\n return false;\n }\n };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n window.addEventListener('test', options as any, options);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n window.removeEventListener('test', options as any, options);\n } catch (_e) {\n // event options not supported\n }\n})();\n\ntype EventHandlerWithOptions =\n EventListenerOrEventListenerObject&Partial<AddEventListenerOptions>;\nexport class EventPart implements Part {\n readonly element: Element;\n readonly eventName: string;\n readonly eventContext?: EventTarget;\n value: undefined|EventHandlerWithOptions = undefined;\n private __options?: AddEventListenerOptions;\n private __pendingValue: undefined|EventHandlerWithOptions = undefined;\n private readonly __boundHandleEvent: (event: Event) => void;\n\n constructor(element: Element, eventName: string, eventContext?: EventTarget) {\n this.element = element;\n this.eventName = eventName;\n this.eventContext = eventContext;\n this.__boundHandleEvent = (e) => this.handleEvent(e);\n }\n\n setValue(value: undefined|EventHandlerWithOptions): void {\n this.__pendingValue = value;\n }\n\n commit() {\n while (isDirective(this.__pendingValue)) {\n const directive = this.__pendingValue;\n this.__pendingValue = noChange as EventHandlerWithOptions;\n directive(this);\n }\n if (this.__pendingValue === noChange) {\n return;\n }\n\n const newListener = this.__pendingValue;\n const oldListener = this.value;\n const shouldRemoveListener = newListener == null ||\n oldListener != null &&\n (newListener.capture !== oldListener.capture ||\n newListener.once !== oldListener.once ||\n newListener.passive !== oldListener.passive);\n const shouldAddListener =\n newListener != null && (oldListener == null || shouldRemoveListener);\n\n if (shouldRemoveListener) {\n this.element.removeEventListener(\n this.eventName, this.__boundHandleEvent, this.__options);\n }\n if (shouldAddListener) {\n this.__options = getOptions(newListener);\n this.element.addEventListener(\n this.eventName, this.__boundHandleEvent, this.__options);\n }\n this.value = newListener;\n this.__pendingValue = noChange as EventHandlerWithOptions;\n }\n\n handleEvent(event: Event) {\n if (typeof this.value === 'function') {\n this.value.call(this.eventContext || this.element, event);\n } else {\n (this.value as EventListenerObject).handleEvent(event);\n }\n }\n}\n\n// We copy options because of the inconsistent behavior of browsers when reading\n// the third argument of add/removeEventListener. IE11 doesn't support options\n// at all. Chrome 41 only reads `capture` if the argument is an object.\nconst getOptions = (o: AddEventListenerOptions|undefined) => o &&\n (eventOptionsSupported ?\n {capture: o.capture, passive: o.passive, once: o.once} :\n o.capture as AddEventListenerOptions);\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {TemplateResult} from './template-result.js';\nimport {marker, Template} from './template.js';\n\n/**\n * A function type that creates a Template from a TemplateResult.\n *\n * This is a hook into the template-creation process for rendering that\n * requires some modification of templates before they're used, like ShadyCSS,\n * which must add classes to elements and remove styles.\n *\n * Templates should be cached as aggressively as possible, so that many\n * TemplateResults produced from the same expression only do the work of\n * creating the Template the first time.\n *\n * Templates are usually cached by TemplateResult.strings and\n * TemplateResult.type, but may be cached by other keys if this function\n * modifies the template.\n *\n * Note that currently TemplateFactories must not add, remove, or reorder\n * expressions, because there is no way to describe such a modification\n * to render() so that values are interpolated to the correct place in the\n * template instances.\n */\nexport type TemplateFactory = (result: TemplateResult) => Template;\n\n/**\n * The default TemplateFactory which caches Templates keyed on\n * result.type and result.strings.\n */\nexport function templateFactory(result: TemplateResult) {\n let templateCache = templateCaches.get(result.type);\n if (templateCache === undefined) {\n templateCache = {\n stringsArray: new WeakMap<TemplateStringsArray, Template>(),\n keyString: new Map<string, Template>()\n };\n templateCaches.set(result.type, templateCache);\n }\n\n let template = templateCache.stringsArray.get(result.strings);\n if (template !== undefined) {\n return template;\n }\n\n // If the TemplateStringsArray is new, generate a key from the strings\n // This key is shared between all templates with identical content\n const key = result.strings.join(marker);\n\n // Check if we already have a Template for this key\n template = templateCache.keyString.get(key);\n if (template === undefined) {\n // If we have not seen this key before, create a new Template\n template = new Template(result, result.getTemplateElement());\n // Cache the Template for this key\n templateCache.keyString.set(key, template);\n }\n\n // Cache all future queries for this TemplateStringsArray\n templateCache.stringsArray.set(result.strings, template);\n return template;\n}\n\n/**\n * The first argument to JS template tags retain identity across multiple\n * calls to a tag for the same literal, so we can cache work done per literal\n * in a Map.\n *\n * Safari currently has a bug which occasionally breaks this behavior, so we\n * need to cache the Template at two levels. We first cache the\n * TemplateStringsArray, and if that fails, we cache a key constructed by\n * joining the strings array.\n */\nexport interface TemplateCache {\n readonly stringsArray: WeakMap<TemplateStringsArray, Template>;\n readonly keyString: Map<string, Template>;\n}\n\nexport const templateCaches = new Map<string, TemplateCache>();\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {removeNodes} from './dom.js';\nimport {NodePart} from './parts.js';\nimport {RenderOptions} from './render-options.js';\nimport {templateFactory} from './template-factory.js';\n\nexport const parts = new WeakMap<Node, NodePart>();\n\n/**\n * Renders a template result or other value to a container.\n *\n * To update a container with new values, reevaluate the template literal and\n * call `render` with the new result.\n *\n * @param result Any value renderable by NodePart - typically a TemplateResult\n * created by evaluating a template tag like `html` or `svg`.\n * @param container A DOM parent to render to. The entire contents are either\n * replaced, or efficiently updated if the same result type was previous\n * rendered there.\n * @param options RenderOptions for the entire render tree rendered to this\n * container. Render options must *not* change between renders to the same\n * container, as those changes will not effect previously rendered DOM.\n */\nexport const render =\n (result: unknown,\n container: Element|DocumentFragment,\n options?: Partial<RenderOptions>) => {\n let part = parts.get(container);\n if (part === undefined) {\n removeNodes(container, container.firstChild);\n parts.set(container, part = new NodePart({\n templateFactory,\n ...options,\n }));\n part.appendInto(container);\n }\n part.setValue(result);\n part.commit();\n };\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {Part} from './part.js';\nimport {AttributeCommitter, BooleanAttributePart, EventPart, NodePart, PropertyCommitter} from './parts.js';\nimport {RenderOptions} from './render-options.js';\nimport {TemplateProcessor} from './template-processor.js';\n\n/**\n * Creates Parts when a template is instantiated.\n */\nexport class DefaultTemplateProcessor implements TemplateProcessor {\n /**\n * Create parts for an attribute-position binding, given the event, attribute\n * name, and string literals.\n *\n * @param element The element containing the binding\n * @param name The attribute name\n * @param strings The string literals. There are always at least two strings,\n * event for fully-controlled bindings with a single expression.\n */\n handleAttributeExpressions(\n element: Element, name: string, strings: string[],\n options: RenderOptions): ReadonlyArray<Part> {\n const prefix = name[0];\n if (prefix === '.') {\n const committer = new PropertyCommitter(element, name.slice(1), strings);\n return committer.parts;\n }\n if (prefix === '@') {\n return [new EventPart(element, name.slice(1), options.eventContext)];\n }\n if (prefix === '?') {\n return [new BooleanAttributePart(element, name.slice(1), strings)];\n }\n const committer = new AttributeCommitter(element, name, strings);\n return committer.parts;\n }\n /**\n * Create parts for a text-position binding.\n * @param templateFactory\n */\n handleTextExpression(options: RenderOptions) {\n return new NodePart(options);\n }\n}\n\nexport const defaultTemplateProcessor = new DefaultTemplateProcessor();\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n *\n * Main lit-html module.\n *\n * Main exports:\n *\n * - [[html]]\n * - [[svg]]\n * - [[render]]\n *\n * @packageDocumentation\n */\n\n/**\n * Do not remove this comment; it keeps typedoc from misplacing the module\n * docs.\n */\nimport {defaultTemplateProcessor} from './lib/default-template-processor.js';\nimport {SVGTemplateResult, TemplateResult} from './lib/template-result.js';\n\nexport {DefaultTemplateProcessor, defaultTemplateProcessor} from './lib/default-template-processor.js';\nexport {directive, DirectiveFn, isDirective} from './lib/directive.js';\n// TODO(justinfagnani): remove line when we get NodePart moving methods\nexport {removeNodes, reparentNodes} from './lib/dom.js';\nexport {noChange, nothing, Part} from './lib/part.js';\nexport {AttributeCommitter, AttributePart, BooleanAttributePart, EventPart, isIterable, isPrimitive, NodePart, PropertyCommitter, PropertyPart} from './lib/parts.js';\nexport {RenderOptions} from './lib/render-options.js';\nexport {parts, render} from './lib/render.js';\nexport {templateCaches, templateFactory} from './lib/template-factory.js';\nexport {TemplateInstance} from './lib/template-instance.js';\nexport {TemplateProcessor} from './lib/template-processor.js';\nexport {SVGTemplateResult, TemplateResult} from './lib/template-result.js';\nexport {createMarker, isTemplatePartActive, Template} from './lib/template.js';\n\ndeclare global {\n interface Window {\n litHtmlVersions: string[];\n }\n}\n\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for lit-html usage.\n// TODO(justinfagnani): inject version number at build time\nif (typeof window !== 'undefined') {\n (window['litHtmlVersions'] || (window['litHtmlVersions'] = [])).push('1.3.0');\n}\n\n/**\n * Interprets a template literal as an HTML template that can efficiently\n * render to and update a container.\n */\nexport const html = (strings: TemplateStringsArray, ...values: unknown[]) =>\n new TemplateResult(strings, values, 'html', defaultTemplateProcessor);\n\n/**\n * Interprets a template literal as an SVG template that can efficiently\n * render to and update a container.\n */\nexport const svg = (strings: TemplateStringsArray, ...values: unknown[]) =>\n new SVGTemplateResult(strings, values, 'svg', defaultTemplateProcessor);\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * Module to add shady DOM/shady CSS polyfill support to lit-html template\n * rendering. See the [[render]] method for details.\n *\n * @packageDocumentation\n */\n\n/**\n * Do not remove this comment; it keeps typedoc from misplacing the module\n * docs.\n */\nimport {removeNodes} from './dom.js';\nimport {insertNodeIntoTemplate, removeNodesFromTemplate} from './modify-template.js';\nimport {RenderOptions} from './render-options.js';\nimport {parts, render as litRender} from './render.js';\nimport {templateCaches} from './template-factory.js';\nimport {TemplateInstance} from './template-instance.js';\nimport {TemplateResult} from './template-result.js';\nimport {marker, Template} from './template.js';\n\nexport {html, svg, TemplateResult} from '../lit-html.js';\n\n// Get a key to lookup in `templateCaches`.\nconst getTemplateCacheKey = (type: string, scopeName: string) =>\n `${type}--${scopeName}`;\n\nlet compatibleShadyCSSVersion = true;\n\nif (typeof window.ShadyCSS === 'undefined') {\n compatibleShadyCSSVersion = false;\n} else if (typeof window.ShadyCSS.prepareTemplateDom === 'undefined') {\n console.warn(\n `Incompatible ShadyCSS version detected. ` +\n `Please update to at least @webcomponents/webcomponentsjs@2.0.2 and ` +\n `@webcomponents/shadycss@1.3.1.`);\n compatibleShadyCSSVersion = false;\n}\n\n/**\n * Template factory which scopes template DOM using ShadyCSS.\n * @param scopeName {string}\n */\nexport const shadyTemplateFactory = (scopeName: string) =>\n (result: TemplateResult) => {\n const cacheKey = getTemplateCacheKey(result.type, scopeName);\n let templateCache = templateCaches.get(cacheKey);\n if (templateCache === undefined) {\n templateCache = {\n stringsArray: new WeakMap<TemplateStringsArray, Template>(),\n keyString: new Map<string, Template>()\n };\n templateCaches.set(cacheKey, templateCache);\n }\n\n let template = templateCache.stringsArray.get(result.strings);\n if (template !== undefined) {\n return template;\n }\n\n const key = result.strings.join(marker);\n template = templateCache.keyString.get(key);\n if (template === undefined) {\n const element = result.getTemplateElement();\n if (compatibleShadyCSSVersion) {\n window.ShadyCSS!.prepareTemplateDom(element, scopeName);\n }\n template = new Template(result, element);\n templateCache.keyString.set(key, template);\n }\n templateCache.stringsArray.set(result.strings, template);\n return template;\n };\n\nconst TEMPLATE_TYPES = ['html', 'svg'];\n\n/**\n * Removes all style elements from Templates for the given scopeName.\n */\nconst removeStylesFromLitTemplates = (scopeName: string) => {\n TEMPLATE_TYPES.forEach((type) => {\n const templates = templateCaches.get(getTemplateCacheKey(type, scopeName));\n if (templates !== undefined) {\n templates.keyString.forEach((template) => {\n const {element: {content}} = template;\n // IE 11 doesn't support the iterable param Set constructor\n const styles = new Set<Element>();\n Array.from(content.querySelectorAll('style')).forEach((s: Element) => {\n styles.add(s);\n });\n removeNodesFromTemplate(template, styles);\n });\n }\n });\n};\n\nconst shadyRenderSet = new Set<string>();\n\n/**\n * For the given scope name, ensures that ShadyCSS style scoping is performed.\n * This is done just once per scope name so the fragment and template cannot\n * be modified.\n * (1) extracts styles from the rendered fragment and hands them to ShadyCSS\n * to be scoped and appended to the document\n * (2) removes style elements from all lit-html Templates for this scope name.\n *\n * Note, <style> elements can only be placed into templates for the\n * initial rendering of the scope. If <style> elements are included in templates\n * dynamically rendered to the scope (after the first scope render), they will\n * not be scoped and the <style> will be left in the template and rendered\n * output.\n */\nconst prepareTemplateStyles =\n (scopeName: string, renderedDOM: DocumentFragment, template?: Template) => {\n shadyRenderSet.add(scopeName);\n // If `renderedDOM` is stamped from a Template, then we need to edit that\n // Template's underlying template element. Otherwise, we create one here\n // to give to ShadyCSS, which still requires one while scoping.\n const templateElement =\n !!template ? template.element : document.createElement('template');\n // Move styles out of rendered DOM and store.\n const styles = renderedDOM.querySelectorAll('style');\n const {length} = styles;\n // If there are no styles, skip unnecessary work\n if (length === 0) {\n // Ensure prepareTemplateStyles is called to support adding\n // styles via `prepareAdoptedCssText` since that requires that\n // `prepareTemplateStyles` is called.\n //\n // ShadyCSS will only update styles containing @apply in the template\n // given to `prepareTemplateStyles`. If no lit Template was given,\n // ShadyCSS will not be able to update uses of @apply in any relevant\n // template. However, this is not a problem because we only create the\n // template for the purpose of supporting `prepareAdoptedCssText`,\n // which doesn't support @apply at all.\n window.ShadyCSS!.prepareTemplateStyles(templateElement, scopeName);\n return;\n }\n const condensedStyle = document.createElement('style');\n // Collect styles into a single style. This helps us make sure ShadyCSS\n // manipulations will not prevent us from being able to fix up template\n // part indices.\n // NOTE: collecting styles is inefficient for browsers but ShadyCSS\n // currently does this anyway. When it does not, this should be changed.\n for (let i = 0; i < length; i++) {\n const style = styles[i];\n style.parentNode!.removeChild(style);\n condensedStyle.textContent! += style.textContent;\n }\n // Remove styles from nested templates in this scope.\n removeStylesFromLitTemplates(scopeName);\n // And then put the condensed style into the \"root\" template passed in as\n // `template`.\n const content = templateElement.content;\n if (!!template) {\n insertNodeIntoTemplate(template, condensedStyle, content.firstChild);\n } else {\n content.insertBefore(condensedStyle, content.firstChild);\n }\n // Note, it's important that ShadyCSS gets the template that `lit-html`\n // will actually render so that it can update the style inside when\n // needed (e.g. @apply native Shadow DOM case).\n window.ShadyCSS!.prepareTemplateStyles(templateElement, scopeName);\n const style = content.querySelector('style');\n if (window.ShadyCSS!.nativeShadow && style !== null) {\n // When in native Shadow DOM, ensure the style created by ShadyCSS is\n // included in initially rendered output (`renderedDOM`).\n renderedDOM.insertBefore(style.cloneNode(true), renderedDOM.firstChild);\n } else if (!!template) {\n // When no style is left in the template, parts will be broken as a\n // result. To fix this, we put back the style node ShadyCSS removed\n // and then tell lit to remove that node from the template.\n // There can be no style in the template in 2 cases (1) when Shady DOM\n // is in use, ShadyCSS removes all styles, (2) when native Shadow DOM\n // is in use ShadyCSS removes the style if it contains no content.\n // NOTE, ShadyCSS creates its own style so we can safely add/remove\n // `condensedStyle` here.\n content.insertBefore(condensedStyle, content.firstChild);\n const removes = new Set<Node>();\n removes.add(condensedStyle);\n removeNodesFromTemplate(template, removes);\n }\n };\n\nexport interface ShadyRenderOptions extends Partial<RenderOptions> {\n scopeName: string;\n}\n\n/**\n * Extension to the standard `render` method which supports rendering\n * to ShadowRoots when the ShadyDOM (https://github.com/webcomponents/shadydom)\n * and ShadyCSS (https://github.com/webcomponents/shadycss) polyfills are used\n * or when the webcomponentsjs\n * (https://github.com/webcomponents/webcomponentsjs) polyfill is used.\n *\n * Adds a `scopeName` option which is used to scope element DOM and stylesheets\n * when native ShadowDOM is unavailable. The `scopeName` will be added to\n * the class attribute of all rendered DOM. In addition, any style elements will\n * be automatically re-written with this `scopeName` selector and moved out\n * of the rendered DOM and into the document `<head>`.\n *\n * It is common to use this render method in conjunction with a custom element\n * which renders a shadowRoot. When this is done, typically the element's\n * `localName` should be used as the `scopeName`.\n *\n * In addition to DOM scoping, ShadyCSS also supports a basic shim for css\n * custom properties (needed only on older browsers like IE11) and a shim for\n * a deprecated feature called `@apply` that supports applying a set of css\n * custom properties to a given location.\n *\n * Usage considerations:\n *\n * * Part values in `<style>` elements are only applied the first time a given\n * `scopeName` renders. Subsequent changes to parts in style elements will have\n * no effect. Because of this, parts in style elements should only be used for\n * values that will never change, for example parts that set scope-wide theme\n * values or parts which render shared style elements.\n *\n * * Note, due to a limitation of the ShadyDOM polyfill, rendering in a\n * custom element's `constructor` is not supported. Instead rendering should\n * either done asynchronously, for example at microtask timing (for example\n * `Promise.resolve()`), or be deferred until the first time the element's\n * `connectedCallback` runs.\n *\n * Usage considerations when using shimmed custom properties or `@apply`:\n *\n * * Whenever any dynamic changes are made which affect\n * css custom properties, `ShadyCSS.styleElement(element)` must be called\n * to update the element. There are two cases when this is needed:\n * (1) the element is connected to a new parent, (2) a class is added to the\n * element that causes it to match different custom properties.\n * To address the first case when rendering a custom element, `styleElement`\n * should be called in the element's `connectedCallback`.\n *\n * * Shimmed custom properties may only be defined either for an entire\n * shadowRoot (for example, in a `:host` rule) or via a rule that directly\n * matches an element with a shadowRoot. In other words, instead of flowing from\n * parent to child as do native css custom properties, shimmed custom properties\n * flow only from shadowRoots to nested shadowRoots.\n *\n * * When using `@apply` mixing css shorthand property names with\n * non-shorthand names (for example `border` and `border-width`) is not\n * supported.\n */\nexport const render =\n (result: unknown,\n container: Element|DocumentFragment|ShadowRoot,\n options: ShadyRenderOptions) => {\n if (!options || typeof options !== 'object' || !options.scopeName) {\n throw new Error('The `scopeName` option is required.');\n }\n const scopeName = options.scopeName;\n const hasRendered = parts.has(container);\n const needsScoping = compatibleShadyCSSVersion &&\n container.nodeType === 11 /* Node.DOCUMENT_FRAGMENT_NODE */ &&\n !!(container as ShadowRoot).host;\n // Handle first render to a scope specially...\n const firstScopeRender = needsScoping && !shadyRenderSet.has(scopeName);\n // On first scope render, render into a fragment; this cannot be a single\n // fragment that is reused since nested renders can occur synchronously.\n const renderContainer =\n firstScopeRender ? document.createDocumentFragment() : container;\n litRender(\n result,\n renderContainer,\n {templateFactory: shadyTemplateFactory(scopeName), ...options} as\n RenderOptions);\n // When performing first scope render,\n // (1) We've rendered into a fragment so that there's a chance to\n // `prepareTemplateStyles` before sub-elements hit the DOM\n // (which might cause them to render based on a common pattern of\n // rendering in a custom element's `connectedCallback`);\n // (2) Scope the template with ShadyCSS one time only for this scope.\n // (3) Render the fragment into the container and make sure the\n // container knows its `part` is the one we just rendered. This ensures\n // DOM will be re-used on subsequent renders.\n if (firstScopeRender) {\n const part = parts.get(renderContainer)!;\n parts.delete(renderContainer);\n // ShadyCSS might have style sheets (e.g. from `prepareAdoptedCssText`)\n // that should apply to `renderContainer` even if the rendered value is\n // not a TemplateInstance. However, it will only insert scoped styles\n // into the document if `prepareTemplateStyles` has already been called\n // for the given scope name.\n const template = part.value instanceof TemplateInstance ?\n part.value.template :\n undefined;\n prepareTemplateStyles(\n scopeName, renderContainer as DocumentFragment, template);\n removeNodes(container, container.firstChild);\n container.appendChild(renderContainer);\n parts.set(container, part);\n }\n // After elements have hit the DOM, update styling if this is the\n // initial render to this container.\n // This is needed whenever dynamic changes are made so it would be\n // safest to do every render; however, this would regress performance\n // so we leave it up to the user to call `ShadyCSS.styleElement`\n // for dynamic changes.\n if (!hasRendered && needsScoping) {\n window.ShadyCSS!.styleElement((container as ShadowRoot).host);\n }\n };\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * Use this module if you want to create your own base class extending\n * [[UpdatingElement]].\n * @packageDocumentation\n */\n\n/*\n * When using Closure Compiler, JSCompiler_renameProperty(property, object) is\n * replaced at compile time by the munged name for object[property]. We cannot\n * alias this function, so we have to use a small shim that has the same\n * behavior when not compiling.\n */\nwindow.JSCompiler_renameProperty =\n <P extends PropertyKey>(prop: P, _obj: unknown): P => prop;\n\ndeclare global {\n var JSCompiler_renameProperty: <P extends PropertyKey>(\n prop: P, _obj: unknown) => P;\n\n interface Window {\n JSCompiler_renameProperty: typeof JSCompiler_renameProperty;\n }\n}\n\n/**\n * Converts property values to and from attribute values.\n */\nexport interface ComplexAttributeConverter<Type = unknown, TypeHint = unknown> {\n /**\n * Function called to convert an attribute value to a property\n * value.\n */\n fromAttribute?(value: string|null, type?: TypeHint): Type;\n\n /**\n * Function called to convert a property value to an attribute\n * value.\n *\n * It returns unknown instead of string, to be compatible with\n * https://github.com/WICG/trusted-types (and similar efforts).\n */\n toAttribute?(value: Type, type?: TypeHint): unknown;\n}\n\ntype AttributeConverter<Type = unknown, TypeHint = unknown> =\n ComplexAttributeConverter<Type>|\n ((value: string|null, type?: TypeHint) => Type);\n\n/**\n * Defines options for a property accessor.\n */\nexport interface PropertyDeclaration<Type = unknown, TypeHint = unknown> {\n /**\n * Indicates how and whether the property becomes an observed attribute.\n * If the value is `false`, the property is not added to `observedAttributes`.\n * If true or absent, the lowercased property name is observed (e.g. `fooBar`\n * becomes `foobar`). If a string, the string value is observed (e.g\n * `attribute: 'foo-bar'`).\n */\n readonly attribute?: boolean|string;\n\n /**\n * Indicates the type of the property. This is used only as a hint for the\n * `converter` to determine how to convert the attribute\n * to/from a property.\n */\n readonly type?: TypeHint;\n\n /**\n * Indicates how to convert the attribute to/from a property. If this value\n * is a function, it is used to convert the attribute value a the property\n * value. If it's an object, it can have keys for `fromAttribute` and\n * `toAttribute`. If no `toAttribute` function is provided and\n * `reflect` is set to `true`, the property value is set directly to the\n * attribute. A default `converter` is used if none is provided; it supports\n * `Boolean`, `String`, `Number`, `Object`, and `Array`. Note,\n * when a property changes and the converter is used to update the attribute,\n * the property is never updated again as a result of the attribute changing,\n * and vice versa.\n */\n readonly converter?: AttributeConverter<Type, TypeHint>;\n\n /**\n * Indicates if the property should reflect to an attribute.\n * If `true`, when the property is set, the attribute is set using the\n * attribute name determined according to the rules for the `attribute`\n * property option and the value of the property converted using the rules\n * from the `converter` property option.\n */\n readonly reflect?: boolean;\n\n /**\n * A function that indicates if a property should be considered changed when\n * it is set. The function should take the `newValue` and `oldValue` and\n * return `true` if an update should be requested.\n */\n hasChanged?(value: Type, oldValue: Type): boolean;\n\n /**\n * Indicates whether an accessor will be created for this property. By\n * default, an accessor will be generated for this property that requests an\n * update when set. If this flag is `true`, no accessor will be created, and\n * it will be the user's responsibility to call\n * `this.requestUpdate(propertyName, oldValue)` to request an update when\n * the property changes.\n */\n readonly noAccessor?: boolean;\n}\n\n/**\n * Map of properties to PropertyDeclaration options. For each property an\n * accessor is made, and the property is processed according to the\n * PropertyDeclaration options.\n */\nexport interface PropertyDeclarations {\n readonly [key: string]: PropertyDeclaration;\n}\n\ntype PropertyDeclarationMap = Map<PropertyKey, PropertyDeclaration>;\n\ntype AttributeMap = Map<string, PropertyKey>;\n\n/**\n * Map of changed properties with old values. Takes an optional generic\n * interface corresponding to the declared element properties.\n */\n// tslint:disable-next-line:no-any\nexport type PropertyValues<T = any> =\n keyof T extends PropertyKey ? Map<keyof T, unknown>: never;\n\nexport const defaultConverter: ComplexAttributeConverter = {\n\n toAttribute(value: unknown, type?: unknown): unknown {\n switch (type) {\n case Boolean:\n return value ? '' : null;\n case Object:\n case Array:\n // if the value is `null` or `undefined` pass this through\n // to allow removing/no change behavior.\n return value == null ? value : JSON.stringify(value);\n }\n return value;\n },\n\n fromAttribute(value: string|null, type?: unknown) {\n switch (type) {\n case Boolean:\n return value !== null;\n case Number:\n return value === null ? null : Number(value);\n case Object:\n case Array:\n // Type assert to adhere to Bazel's \"must type assert JSON parse\" rule.\n return JSON.parse(value!) as unknown;\n }\n return value;\n }\n\n};\n\nexport interface HasChanged {\n (value: unknown, old: unknown): boolean;\n}\n\n/**\n * Change function that returns true if `value` is different from `oldValue`.\n * This method is used as the default for a property's `hasChanged` function.\n */\nexport const notEqual: HasChanged = (value: unknown, old: unknown): boolean => {\n // This ensures (old==NaN, value==NaN) always returns false\n return old !== value && (old === old || value === value);\n};\n\nconst defaultPropertyDeclaration: PropertyDeclaration = {\n attribute: true,\n type: String,\n converter: defaultConverter,\n reflect: false,\n hasChanged: notEqual\n};\n\nconst STATE_HAS_UPDATED = 1;\nconst STATE_UPDATE_REQUESTED = 1 << 2;\nconst STATE_IS_REFLECTING_TO_ATTRIBUTE = 1 << 3;\nconst STATE_IS_REFLECTING_TO_PROPERTY = 1 << 4;\ntype UpdateState = typeof STATE_HAS_UPDATED|typeof STATE_UPDATE_REQUESTED|\n typeof STATE_IS_REFLECTING_TO_ATTRIBUTE|\n typeof STATE_IS_REFLECTING_TO_PROPERTY;\n\n/**\n * The Closure JS Compiler doesn't currently have good support for static\n * property semantics where \"this\" is dynamic (e.g.\n * https://github.com/google/closure-compiler/issues/3177 and others) so we use\n * this hack to bypass any rewriting by the compiler.\n */\nconst finalized = 'finalized';\n\n/**\n * Base element class which manages element properties and attributes. When\n * properties change, the `update` method is asynchronously called. This method\n * should be supplied by subclassers to render updates as desired.\n * @noInheritDoc\n */\nexport abstract class UpdatingElement extends HTMLElement {\n /*\n * Due to closure compiler ES6 compilation bugs, @nocollapse is required on\n * all static methods and properties with initializers. Reference:\n * - https://github.com/google/closure-compiler/issues/1776\n */\n\n /**\n * Maps attribute names to properties; for example `foobar` attribute to\n * `fooBar` property. Created lazily on user subclasses when finalizing the\n * class.\n */\n private static _attributeToPropertyMap: AttributeMap;\n\n /**\n * Marks class as having finished creating properties.\n */\n protected static[finalized] = true;\n\n /**\n * Memoized list of all class properties, including any superclass properties.\n * Created lazily on user subclasses when finalizing the class.\n */\n private static _classProperties?: PropertyDeclarationMap;\n\n /**\n * User-supplied object that maps property names to `PropertyDeclaration`\n * objects containing options for configuring the property.\n */\n static properties: PropertyDeclarations;\n\n /**\n * Returns a list of attributes corresponding to the registered properties.\n * @nocollapse\n */\n static get observedAttributes() {\n // note: piggy backing on this to ensure we're finalized.\n this.finalize();\n const attributes: string[] = [];\n // Use forEach so this works even if for/of loops are compiled to for loops\n // expecting arrays\n this._classProperties!.forEach((v, p) => {\n const attr = this._attributeNameForProperty(p, v);\n if (attr !== undefined) {\n this._attributeToPropertyMap.set(attr, p);\n attributes.push(attr);\n }\n });\n return attributes;\n }\n\n /**\n * Ensures the private `_classProperties` property metadata is created.\n * In addition to `finalize` this is also called in `createProperty` to\n * ensure the `@property` decorator can add property metadata.\n */\n /** @nocollapse */\n private static _ensureClassProperties() {\n // ensure private storage for property declarations.\n if (!this.hasOwnProperty(\n JSCompiler_renameProperty('_classProperties', this))) {\n this._classProperties = new Map();\n // NOTE: Workaround IE11 not supporting Map constructor argument.\n const superProperties: PropertyDeclarationMap =\n Object.getPrototypeOf(this)._classProperties;\n if (superProperties !== undefined) {\n superProperties.forEach(\n (v: PropertyDeclaration, k: PropertyKey) =>\n this._classProperties!.set(k, v));\n }\n }\n }\n\n /**\n * Creates a property accessor on the element prototype if one does not exist\n * and stores a PropertyDeclaration for the property with the given options.\n * The property setter calls the property's `hasChanged` property option\n * or uses a strict identity check to determine whether or not to request\n * an update.\n *\n * This method may be overridden to customize properties; however,\n * when doing so, it's important to call `super.createProperty` to ensure\n * the property is setup correctly. This method calls\n * `getPropertyDescriptor` internally to get a descriptor to install.\n * To customize what properties do when they are get or set, override\n * `getPropertyDescriptor`. To customize the options for a property,\n * implement `createProperty` like this:\n *\n * static createProperty(name, options) {\n * options = Object.assign(options, {myOption: true});\n * super.createProperty(name, options);\n * }\n *\n * @nocollapse\n */\n static createProperty(\n name: PropertyKey,\n options: PropertyDeclaration = defaultPropertyDeclaration) {\n // Note, since this can be called by the `@property` decorator which\n // is called before `finalize`, we ensure storage exists for property\n // metadata.\n this._ensureClassProperties();\n this._classProperties!.set(name, options);\n // Do not generate an accessor if the prototype already has one, since\n // it would be lost otherwise and that would never be the user's intention;\n // Instead, we expect users to call `requestUpdate` themselves from\n // user-defined accessors. Note that if the super has an accessor we will\n // still overwrite it\n if (options.noAccessor || this.prototype.hasOwnProperty(name)) {\n return;\n }\n const key = typeof name === 'symbol' ? Symbol() : `__${name}`;\n const descriptor = this.getPropertyDescriptor(name, key, options);\n if (descriptor !== undefined) {\n Object.defineProperty(this.prototype, name, descriptor);\n }\n }\n\n /**\n * Returns a property descriptor to be defined on the given named property.\n * If no descriptor is returned, the property will not become an accessor.\n * For example,\n *\n * class MyElement extends LitElement {\n * static getPropertyDescriptor(name, key, options) {\n * const defaultDescriptor =\n * super.getPropertyDescriptor(name, key, options);\n * const setter = defaultDescriptor.set;\n * return {\n * get: defaultDescriptor.get,\n * set(value) {\n * setter.call(this, value);\n * // custom action.\n * },\n * configurable: true,\n * enumerable: true\n * }\n * }\n * }\n *\n * @nocollapse\n */\n protected static getPropertyDescriptor(\n name: PropertyKey, key: string|symbol, options: PropertyDeclaration) {\n return {\n // tslint:disable-next-line:no-any no symbol in index\n get(): any {\n return (this as {[key: string]: unknown})[key as string];\n },\n set(this: UpdatingElement, value: unknown) {\n const oldValue =\n (this as {} as {[key: string]: unknown})[name as string];\n (this as {} as {[key: string]: unknown})[key as string] = value;\n (this as unknown as UpdatingElement)\n .requestUpdateInternal(name, oldValue, options);\n },\n configurable: true,\n enumerable: true\n };\n }\n\n /**\n * Returns the property options associated with the given property.\n * These options are defined with a PropertyDeclaration via the `properties`\n * object or the `@property` decorator and are registered in\n * `createProperty(...)`.\n *\n * Note, this method should be considered \"final\" and not overridden. To\n * customize the options for a given property, override `createProperty`.\n *\n * @nocollapse\n * @final\n */\n protected static getPropertyOptions(name: PropertyKey) {\n return this._classProperties && this._classProperties.get(name) ||\n defaultPropertyDeclaration;\n }\n\n /**\n * Creates property accessors for registered properties and ensures\n * any superclasses are also finalized.\n * @nocollapse\n */\n protected static finalize() {\n // finalize any superclasses\n const superCtor = Object.getPrototypeOf(this);\n if (!superCtor.hasOwnProperty(finalized)) {\n superCtor.finalize();\n }\n this[finalized] = true;\n this._ensureClassProperties();\n // initialize Map populated in observedAttributes\n this._attributeToPropertyMap = new Map();\n // make any properties\n // Note, only process \"own\" properties since this element will inherit\n // any properties defined on the superClass, and finalization ensures\n // the entire prototype chain is finalized.\n if (this.hasOwnProperty(JSCompiler_renameProperty('properties', this))) {\n const props = this.properties;\n // support symbols in properties (IE11 does not support this)\n const propKeys = [\n ...Object.getOwnPropertyNames(props),\n ...(typeof Object.getOwnPropertySymbols === 'function') ?\n Object.getOwnPropertySymbols(props) :\n []\n ];\n // This for/of is ok because propKeys is an array\n for (const p of propKeys) {\n // note, use of `any` is due to TypeSript lack of support for symbol in\n // index types\n // tslint:disable-next-line:no-any no symbol in index\n this.createProperty(p, (props as any)[p]);\n }\n }\n }\n\n /**\n * Returns the property name for the given attribute `name`.\n * @nocollapse\n */\n private static _attributeNameForProperty(\n name: PropertyKey, options: PropertyDeclaration) {\n const attribute = options.attribute;\n return attribute === false ?\n undefined :\n (typeof attribute === 'string' ?\n attribute :\n (typeof name === 'string' ? name.toLowerCase() : undefined));\n }\n\n /**\n * Returns true if a property should request an update.\n * Called when a property value is set and uses the `hasChanged`\n * option for the property if present or a strict identity check.\n * @nocollapse\n */\n private static _valueHasChanged(\n value: unknown, old: unknown, hasChanged: HasChanged = notEqual) {\n return hasChanged(value, old);\n }\n\n /**\n * Returns the property value for the given attribute value.\n * Called via the `attributeChangedCallback` and uses the property's\n * `converter` or `converter.fromAttribute` property option.\n * @nocollapse\n */\n private static _propertyValueFromAttribute(\n value: string|null, options: PropertyDeclaration) {\n const type = options.type;\n const converter = options.converter || defaultConverter;\n const fromAttribute =\n (typeof converter === 'function' ? converter : converter.fromAttribute);\n return fromAttribute ? fromAttribute(value, type) : value;\n }\n\n /**\n * Returns the attribute value for the given property value. If this\n * returns undefined, the property will *not* be reflected to an attribute.\n * If this returns null, the attribute will be removed, otherwise the\n * attribute will be set to the value.\n * This uses the property's `reflect` and `type.toAttribute` property options.\n * @nocollapse\n */\n private static _propertyValueToAttribute(\n value: unknown, options: PropertyDeclaration) {\n if (options.reflect === undefined) {\n return;\n }\n const type = options.type;\n const converter = options.converter;\n const toAttribute =\n converter && (converter as ComplexAttributeConverter).toAttribute ||\n defaultConverter.toAttribute;\n return toAttribute!(value, type);\n }\n\n private _updateState!: UpdateState;\n private _instanceProperties?: PropertyValues;\n // Initialize to an unresolved Promise so we can make sure the element has\n // connected before first update.\n private _updatePromise!: Promise<unknown>;\n private _enableUpdatingResolver: ((r?: unknown) => void)|undefined;\n\n /**\n * Map with keys for any properties that have changed since the last\n * update cycle with previous values.\n */\n private _changedProperties!: PropertyValues;\n\n /**\n * Map with keys of properties that should be reflected when updated.\n */\n private _reflectingProperties?: Map<PropertyKey, PropertyDeclaration>;\n\n constructor() {\n super();\n this.initialize();\n }\n\n /**\n * Performs element initialization. By default captures any pre-set values for\n * registered properties.\n */\n protected initialize() {\n this._updateState = 0;\n this._updatePromise =\n new Promise((res) => this._enableUpdatingResolver = res);\n this._changedProperties = new Map();\n this._saveInstanceProperties();\n // ensures first update will be caught by an early access of\n // `updateComplete`\n this.requestUpdateInternal();\n }\n\n /**\n * Fixes any properties set on the instance before upgrade time.\n * Otherwise these would shadow the accessor and break these properties.\n * The properties are stored in a Map which is played back after the\n * constructor runs. Note, on very old versions of Safari (<=9) or Chrome\n * (<=41), properties created for native platform properties like (`id` or\n * `name`) may not have default values set in the element constructor. On\n * these browsers native properties appear on instances and therefore their\n * default value will overwrite any element default (e.g. if the element sets\n * this.id = 'id' in the constructor, the 'id' will become '' since this is\n * the native platform default).\n */\n private _saveInstanceProperties() {\n // Use forEach so this works even if for/of loops are compiled to for loops\n // expecting arrays\n (this.constructor as typeof UpdatingElement)\n ._classProperties!.forEach((_v, p) => {\n if (this.hasOwnProperty(p)) {\n const value = this[p as keyof this];\n delete this[p as keyof this];\n if (!this._instanceProperties) {\n this._instanceProperties = new Map();\n }\n this._instanceProperties.set(p, value);\n }\n });\n }\n\n /**\n * Applies previously saved instance properties.\n */\n private _applyInstanceProperties() {\n // Use forEach so this works even if for/of loops are compiled to for loops\n // expecting arrays\n // tslint:disable-next-line:no-any\n this._instanceProperties!.forEach((v, p) => (this as any)[p] = v);\n this._instanceProperties = undefined;\n }\n\n connectedCallback() {\n // Ensure first connection completes an update. Updates cannot complete\n // before connection.\n this.enableUpdating();\n }\n\n protected enableUpdating() {\n if (this._enableUpdatingResolver !== undefined) {\n this._enableUpdatingResolver();\n this._enableUpdatingResolver = undefined;\n }\n }\n\n /**\n * Allows for `super.disconnectedCallback()` in extensions while\n * reserving the possibility of making non-breaking feature additions\n * when disconnecting at some point in the future.\n */\n disconnectedCallback() {\n }\n\n /**\n * Synchronizes property values when attributes change.\n */\n attributeChangedCallback(name: string, old: string|null, value: string|null) {\n if (old !== value) {\n this._attributeToProperty(name, value);\n }\n }\n\n private _propertyToAttribute(\n name: PropertyKey, value: unknown,\n options: PropertyDeclaration = defaultPropertyDeclaration) {\n const ctor = (this.constructor as typeof UpdatingElement);\n const attr = ctor._attributeNameForProperty(name, options);\n if (attr !== undefined) {\n const attrValue = ctor._propertyValueToAttribute(value, options);\n // an undefined value does not change the attribute.\n if (attrValue === undefined) {\n return;\n }\n // Track if the property is being reflected to avoid\n // setting the property again via `attributeChangedCallback`. Note:\n // 1. this takes advantage of the fact that the callback is synchronous.\n // 2. will behave incorrectly if multiple attributes are in the reaction\n // stack at time of calling. However, since we process attributes\n // in `update` this should not be possible (or an extreme corner case\n // that we'd like to discover).\n // mark state reflecting\n this._updateState = this._updateState | STATE_IS_REFLECTING_TO_ATTRIBUTE;\n if (attrValue == null) {\n this.removeAttribute(attr);\n } else {\n this.setAttribute(attr, attrValue as string);\n }\n // mark state not reflecting\n this._updateState = this._updateState & ~STATE_IS_REFLECTING_TO_ATTRIBUTE;\n }\n }\n\n private _attributeToProperty(name: string, value: string|null) {\n // Use tracking info to avoid deserializing attribute value if it was\n // just set from a property setter.\n if (this._updateState & STATE_IS_REFLECTING_TO_ATTRIBUTE) {\n return;\n }\n const ctor = (this.constructor as typeof UpdatingElement);\n // Note, hint this as an `AttributeMap` so closure clearly understands\n // the type; it has issues with tracking types through statics\n // tslint:disable-next-line:no-unnecessary-type-assertion\n const propName = (ctor._attributeToPropertyMap as AttributeMap).get(name);\n if (propName !== undefined) {\n const options = ctor.getPropertyOptions(propName);\n // mark state reflecting\n this._updateState = this._updateState | STATE_IS_REFLECTING_TO_PROPERTY;\n this[propName as keyof this] =\n // tslint:disable-next-line:no-any\n ctor._propertyValueFromAttribute(value, options) as any;\n // mark state not reflecting\n this._updateState = this._updateState & ~STATE_IS_REFLECTING_TO_PROPERTY;\n }\n }\n\n /**\n * This protected version of `requestUpdate` does not access or return the\n * `updateComplete` promise. This promise can be overridden and is therefore\n * not free to access.\n */\n protected requestUpdateInternal(\n name?: PropertyKey, oldValue?: unknown, options?: PropertyDeclaration) {\n let shouldRequestUpdate = true;\n // If we have a property key, perform property update steps.\n if (name !== undefined) {\n const ctor = this.constructor as typeof UpdatingElement;\n options = options || ctor.getPropertyOptions(name);\n if (ctor._valueHasChanged(\n this[name as keyof this], oldValue, options.hasChanged)) {\n if (!this._changedProperties.has(name)) {\n this._changedProperties.set(name, oldValue);\n }\n // Add to reflecting properties set.\n // Note, it's important that every change has a chance to add the\n // property to `_reflectingProperties`. This ensures setting\n // attribute + property reflects correctly.\n if (options.reflect === true &&\n !(this._updateState & STATE_IS_REFLECTING_TO_PROPERTY)) {\n if (this._reflectingProperties === undefined) {\n this._reflectingProperties = new Map();\n }\n this._reflectingProperties.set(name, options);\n }\n } else {\n // Abort the request if the property should not be considered changed.\n shouldRequestUpdate = false;\n }\n }\n if (!this._hasRequestedUpdate && shouldRequestUpdate) {\n this._updatePromise = this._enqueueUpdate();\n }\n }\n\n /**\n * Requests an update which is processed asynchronously. This should\n * be called when an element should update based on some state not triggered\n * by setting a property. In this case, pass no arguments. It should also be\n * called when manually implementing a property setter. In this case, pass the\n * property `name` and `oldValue` to ensure that any configured property\n * options are honored. Returns the `updateComplete` Promise which is resolved\n * when the update completes.\n *\n * @param name {PropertyKey} (optional) name of requesting property\n * @param oldValue {any} (optional) old value of requesting property\n * @returns {Promise} A Promise that is resolved when the update completes.\n */\n requestUpdate(name?: PropertyKey, oldValue?: unknown) {\n this.requestUpdateInternal(name, oldValue);\n return this.updateComplete;\n }\n\n /**\n * Sets up the element to asynchronously update.\n */\n private async _enqueueUpdate() {\n this._updateState = this._updateState | STATE_UPDATE_REQUESTED;\n try {\n // Ensure any previous update has resolved before updating.\n // This `await` also ensures that property changes are batched.\n await this._updatePromise;\n } catch (e) {\n // Ignore any previous errors. We only care that the previous cycle is\n // done. Any error should have been handled in the previous update.\n }\n const result = this.performUpdate();\n // If `performUpdate` returns a Promise, we await it. This is done to\n // enable coordinating updates with a scheduler. Note, the result is\n // checked to avoid delaying an additional microtask unless we need to.\n if (result != null) {\n await result;\n }\n return !this._hasRequestedUpdate;\n }\n\n private get _hasRequestedUpdate() {\n return (this._updateState & STATE_UPDATE_REQUESTED);\n }\n\n protected get hasUpdated() {\n return (this._updateState & STATE_HAS_UPDATED);\n }\n\n /**\n * Performs an element update. Note, if an exception is thrown during the\n * update, `firstUpdated` and `updated` will not be called.\n *\n * You can override this method to change the timing of updates. If this\n * method is overridden, `super.performUpdate()` must be called.\n *\n * For instance, to schedule updates to occur just before the next frame:\n *\n * ```\n * protected async performUpdate(): Promise<unknown> {\n * await new Promise((resolve) => requestAnimationFrame(() => resolve()));\n * super.performUpdate();\n * }\n * ```\n */\n protected performUpdate(): void|Promise<unknown> {\n // Abort any update if one is not pending when this is called.\n // This can happen if `performUpdate` is called early to \"flush\"\n // the update.\n if (!this._hasRequestedUpdate) {\n return;\n }\n // Mixin instance properties once, if they exist.\n if (this._instanceProperties) {\n this._applyInstanceProperties();\n }\n let shouldUpdate = false;\n const changedProperties = this._changedProperties;\n try {\n shouldUpdate = this.shouldUpdate(changedProperties);\n if (shouldUpdate) {\n this.update(changedProperties);\n } else {\n this._markUpdated();\n }\n } catch (e) {\n // Prevent `firstUpdated` and `updated` from running when there's an\n // update exception.\n shouldUpdate = false;\n // Ensure element can accept additional updates after an exception.\n this._markUpdated();\n throw e;\n }\n if (shouldUpdate) {\n if (!(this._updateState & STATE_HAS_UPDATED)) {\n this._updateState = this._updateState | STATE_HAS_UPDATED;\n this.firstUpdated(changedProperties);\n }\n this.updated(changedProperties);\n }\n }\n\n private _markUpdated() {\n this._changedProperties = new Map();\n this._updateState = this._updateState & ~STATE_UPDATE_REQUESTED;\n }\n\n /**\n * Returns a Promise that resolves when the element has completed updating.\n * The Promise value is a boolean that is `true` if the element completed the\n * update without triggering another update. The Promise result is `false` if\n * a property was set inside `updated()`. If the Promise is rejected, an\n * exception was thrown during the update.\n *\n * To await additional asynchronous work, override the `_getUpdateComplete`\n * method. For example, it is sometimes useful to await a rendered element\n * before fulfilling this Promise. To do this, first await\n * `super._getUpdateComplete()`, then any subsequent state.\n *\n * @returns {Promise} The Promise returns a boolean that indicates if the\n * update resolved without triggering another update.\n */\n get updateComplete() {\n return this._getUpdateComplete();\n }\n\n /**\n * Override point for the `updateComplete` promise.\n *\n * It is not safe to override the `updateComplete` getter directly due to a\n * limitation in TypeScript which means it is not possible to call a\n * superclass getter (e.g. `super.updateComplete.then(...)`) when the target\n * language is ES5 (https://github.com/microsoft/TypeScript/issues/338).\n * This method should be overridden instead. For example:\n *\n * class MyElement extends LitElement {\n * async _getUpdateComplete() {\n * await super._getUpdateComplete();\n * await this._myChild.updateComplete;\n * }\n * }\n * @deprecated Override `getUpdateComplete()` instead for forward\n * compatibility with `lit-element` 3.0 / `@lit/reactive-element`.\n */\n protected _getUpdateComplete() {\n return this.getUpdateComplete();\n }\n\n /**\n * Override point for the `updateComplete` promise.\n *\n * It is not safe to override the `updateComplete` getter directly due to a\n * limitation in TypeScript which means it is not possible to call a\n * superclass getter (e.g. `super.updateComplete.then(...)`) when the target\n * language is ES5 (https://github.com/microsoft/TypeScript/issues/338).\n * This method should be overridden instead. For example:\n *\n * class MyElement extends LitElement {\n * async getUpdateComplete() {\n * await super.getUpdateComplete();\n * await this._myChild.updateComplete;\n * }\n * }\n */\n protected getUpdateComplete() {\n return this._updatePromise;\n }\n\n /**\n * Controls whether or not `update` should be called when the element requests\n * an update. By default, this method always returns `true`, but this can be\n * customized to control when to update.\n *\n * @param _changedProperties Map of changed properties with old values\n */\n protected shouldUpdate(_changedProperties: PropertyValues): boolean {\n return true;\n }\n\n /**\n * Updates the element. This method reflects property values to attributes.\n * It can be overridden to render and keep updated element DOM.\n * Setting properties inside this method will *not* trigger\n * another update.\n *\n * @param _changedProperties Map of changed properties with old values\n */\n protected update(_changedProperties: PropertyValues) {\n if (this._reflectingProperties !== undefined &&\n this._reflectingProperties.size > 0) {\n // Use forEach so this works even if for/of loops are compiled to for\n // loops expecting arrays\n this._reflectingProperties.forEach(\n (v, k) => this._propertyToAttribute(k, this[k as keyof this], v));\n this._reflectingProperties = undefined;\n }\n this._markUpdated();\n }\n\n /**\n * Invoked whenever the element is updated. Implement to perform\n * post-updating tasks via DOM APIs, for example, focusing an element.\n *\n * Setting properties inside this method will trigger the element to update\n * again after this update cycle completes.\n *\n * @param _changedProperties Map of changed properties with old values\n */\n protected updated(_changedProperties: PropertyValues) {\n }\n\n /**\n * Invoked when the element is first updated. Implement to perform one time\n * work on the element after update.\n *\n * Setting properties inside this method will trigger the element to update\n * again after this update cycle completes.\n *\n * @param _changedProperties Map of changed properties with old values\n */\n protected firstUpdated(_changedProperties: PropertyValues) {\n }\n}\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure Compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\n\nimport {LitElement} from '../lit-element.js';\n\nimport {PropertyDeclaration, UpdatingElement} from './updating-element.js';\n\nexport type Constructor<T> = {\n // tslint:disable-next-line:no-any\n new (...args: any[]): T\n};\n\n// From the TC39 Decorators proposal\ninterface ClassDescriptor {\n kind: 'class';\n elements: ClassElement[];\n finisher?: <T>(clazz: Constructor<T>) => undefined | Constructor<T>;\n}\n\n// From the TC39 Decorators proposal\ninterface ClassElement {\n kind: 'field'|'method';\n key: PropertyKey;\n placement: 'static'|'prototype'|'own';\n initializer?: Function;\n extras?: ClassElement[];\n finisher?: <T>(clazz: Constructor<T>) => undefined | Constructor<T>;\n descriptor?: PropertyDescriptor;\n}\n\nconst legacyCustomElement =\n (tagName: string, clazz: Constructor<HTMLElement>) => {\n window.customElements.define(tagName, clazz);\n // Cast as any because TS doesn't recognize the return type as being a\n // subtype of the decorated class when clazz is typed as\n // `Constructor<HTMLElement>` for some reason.\n // `Constructor<HTMLElement>` is helpful to make sure the decorator is\n // applied to elements however.\n // tslint:disable-next-line:no-any\n return clazz as any;\n };\n\nconst standardCustomElement =\n (tagName: string, descriptor: ClassDescriptor) => {\n const {kind, elements} = descriptor;\n return {\n kind,\n elements,\n // This callback is called once the class is otherwise fully defined\n finisher(clazz: Constructor<HTMLElement>) {\n window.customElements.define(tagName, clazz);\n }\n };\n };\n\n/**\n * Class decorator factory that defines the decorated class as a custom element.\n *\n * ```\n * @customElement('my-element')\n * class MyElement {\n * render() {\n * return html``;\n * }\n * }\n * ```\n * @category Decorator\n * @param tagName The name of the custom element to define.\n */\nexport const customElement = (tagName: string) =>\n (classOrDescriptor: Constructor<HTMLElement>|ClassDescriptor) =>\n (typeof classOrDescriptor === 'function') ?\n legacyCustomElement(tagName, classOrDescriptor) :\n standardCustomElement(tagName, classOrDescriptor);\n\nconst standardProperty =\n (options: PropertyDeclaration, element: ClassElement) => {\n // When decorating an accessor, pass it through and add property metadata.\n // Note, the `hasOwnProperty` check in `createProperty` ensures we don't\n // stomp over the user's accessor.\n if (element.kind === 'method' && element.descriptor &&\n !('value' in element.descriptor)) {\n return {\n ...element,\n finisher(clazz: typeof UpdatingElement) {\n clazz.createProperty(element.key, options);\n }\n };\n } else {\n // createProperty() takes care of defining the property, but we still\n // must return some kind of descriptor, so return a descriptor for an\n // unused prototype field. The finisher calls createProperty().\n return {\n kind: 'field',\n key: Symbol(),\n placement: 'own',\n descriptor: {},\n // When @babel/plugin-proposal-decorators implements initializers,\n // do this instead of the initializer below. See:\n // https://github.com/babel/babel/issues/9260 extras: [\n // {\n // kind: 'initializer',\n // placement: 'own',\n // initializer: descriptor.initializer,\n // }\n // ],\n initializer(this: {[key: string]: unknown}) {\n if (typeof element.initializer === 'function') {\n this[element.key as string] = element.initializer.call(this);\n }\n },\n finisher(clazz: typeof UpdatingElement) {\n clazz.createProperty(element.key, options);\n }\n };\n }\n };\n\nconst legacyProperty =\n (options: PropertyDeclaration, proto: Object, name: PropertyKey) => {\n (proto.constructor as typeof UpdatingElement)\n .createProperty(name, options);\n };\n\n/**\n * A property decorator which creates a LitElement property which reflects a\n * corresponding attribute value. A [[`PropertyDeclaration`]] may optionally be\n * supplied to configure property features.\n *\n * This decorator should only be used for public fields. Private or protected\n * fields should use the [[`internalProperty`]] decorator.\n *\n * @example\n * ```ts\n * class MyElement {\n * @property({ type: Boolean })\n * clicked = false;\n * }\n * ```\n * @category Decorator\n * @ExportDecoratedItems\n */\nexport function property(options?: PropertyDeclaration) {\n // tslint:disable-next-line:no-any decorator\n return (protoOrDescriptor: Object|ClassElement, name?: PropertyKey): any =>\n (name !== undefined) ?\n legacyProperty(options!, protoOrDescriptor as Object, name) :\n standardProperty(options!, protoOrDescriptor as ClassElement);\n}\n\nexport interface InternalPropertyDeclaration<Type = unknown> {\n /**\n * A function that indicates if a property should be considered changed when\n * it is set. The function should take the `newValue` and `oldValue` and\n * return `true` if an update should be requested.\n */\n hasChanged?(value: Type, oldValue: Type): boolean;\n}\n\n/**\n * Declares a private or protected property that still triggers updates to the\n * element when it changes.\n *\n * Properties declared this way must not be used from HTML or HTML templating\n * systems, they're solely for properties internal to the element. These\n * properties may be renamed by optimization tools like the Closure Compiler.\n * @category Decorator\n * @deprecated `internalProperty` has been renamed to `state` in lit-element\n * 3.0. Please update to `state` now to be compatible with 3.0.\n */\nexport function internalProperty(options?: InternalPropertyDeclaration) {\n return property({attribute: false, hasChanged: options?.hasChanged});\n}\n\n/**\n * Declares a private or protected property that still triggers updates to the\n * element when it changes.\n *\n * Properties declared this way must not be used from HTML or HTML templating\n * systems, they're solely for properties internal to the element. These\n * properties may be renamed by optimization tools like the Closure Compiler.\n * @category Decorator\n */\nexport const state = (options?: InternalPropertyDeclaration) =>\n internalProperty(options);\n\n/**\n * A property decorator that converts a class property into a getter that\n * executes a querySelector on the element's renderRoot.\n *\n * @param selector A DOMString containing one or more selectors to match.\n * @param cache An optional boolean which when true performs the DOM query only\n * once and caches the result.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector\n *\n * @example\n *\n * ```ts\n * class MyElement {\n * @query('#first')\n * first;\n *\n * render() {\n * return html`\n * <div id=\"first\"></div>\n * <div id=\"second\"></div>\n * `;\n * }\n * }\n * ```\n * @category Decorator\n */\nexport function query(selector: string, cache?: boolean) {\n return (protoOrDescriptor: Object|ClassElement,\n // tslint:disable-next-line:no-any decorator\n name?: PropertyKey): any => {\n const descriptor = {\n get(this: LitElement) {\n return this.renderRoot.querySelector(selector);\n },\n enumerable: true,\n configurable: true,\n };\n if (cache) {\n const prop =\n name !== undefined ? name : (protoOrDescriptor as ClassElement).key;\n const key = typeof prop === 'symbol' ? Symbol() : `__${prop}`;\n descriptor.get = function(this: LitElement) {\n if ((this as unknown as\n {[key: string]: Element | null})[key as string] === undefined) {\n ((this as unknown as {[key: string]: Element | null})[key as string] =\n this.renderRoot.querySelector(selector));\n }\n return (\n this as unknown as {[key: string]: Element | null})[key as string];\n };\n }\n return (name !== undefined) ?\n legacyQuery(descriptor, protoOrDescriptor as Object, name) :\n standardQuery(descriptor, protoOrDescriptor as ClassElement);\n };\n}\n\n// Note, in the future, we may extend this decorator to support the use case\n// where the queried element may need to do work to become ready to interact\n// with (e.g. load some implementation code). If so, we might elect to\n// add a second argument defining a function that can be run to make the\n// queried element loaded/updated/ready.\n/**\n * A property decorator that converts a class property into a getter that\n * returns a promise that resolves to the result of a querySelector on the\n * element's renderRoot done after the element's `updateComplete` promise\n * resolves. When the queried property may change with element state, this\n * decorator can be used instead of requiring users to await the\n * `updateComplete` before accessing the property.\n *\n * @param selector A DOMString containing one or more selectors to match.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector\n *\n * @example\n * ```ts\n * class MyElement {\n * @queryAsync('#first')\n * first;\n *\n * render() {\n * return html`\n * <div id=\"first\"></div>\n * <div id=\"second\"></div>\n * `;\n * }\n * }\n *\n * // external usage\n * async doSomethingWithFirst() {\n * (await aMyElement.first).doSomething();\n * }\n * ```\n * @category Decorator\n */\nexport function queryAsync(selector: string) {\n return (protoOrDescriptor: Object|ClassElement,\n // tslint:disable-next-line:no-any decorator\n name?: PropertyKey): any => {\n const descriptor = {\n async get(this: LitElement) {\n await this.updateComplete;\n return this.renderRoot.querySelector(selector);\n },\n enumerable: true,\n configurable: true,\n };\n return (name !== undefined) ?\n legacyQuery(descriptor, protoOrDescriptor as Object, name) :\n standardQuery(descriptor, protoOrDescriptor as ClassElement);\n };\n}\n\n/**\n * A property decorator that converts a class property into a getter\n * that executes a querySelectorAll on the element's renderRoot.\n *\n * @param selector A DOMString containing one or more selectors to match.\n *\n * See:\n * https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll\n *\n * @example\n * ```ts\n * class MyElement {\n * @queryAll('div')\n * divs;\n *\n * render() {\n * return html`\n * <div id=\"first\"></div>\n * <div id=\"second\"></div>\n * `;\n * }\n * }\n * ```\n * @category Decorator\n */\nexport function queryAll(selector: string) {\n return (protoOrDescriptor: Object|ClassElement,\n // tslint:disable-next-line:no-any decorator\n name?: PropertyKey): any => {\n const descriptor = {\n get(this: LitElement) {\n return this.renderRoot.querySelectorAll(selector);\n },\n enumerable: true,\n configurable: true,\n };\n return (name !== undefined) ?\n legacyQuery(descriptor, protoOrDescriptor as Object, name) :\n standardQuery(descriptor, protoOrDescriptor as ClassElement);\n };\n}\n\nconst legacyQuery =\n (descriptor: PropertyDescriptor, proto: Object, name: PropertyKey) => {\n Object.defineProperty(proto, name, descriptor);\n };\n\nconst standardQuery = (descriptor: PropertyDescriptor, element: ClassElement) =>\n ({\n kind: 'method',\n placement: 'prototype',\n key: element.key,\n descriptor,\n });\n\nconst standardEventOptions =\n (options: AddEventListenerOptions, element: ClassElement) => {\n return {\n ...element,\n finisher(clazz: typeof UpdatingElement) {\n Object.assign(\n clazz.prototype[element.key as keyof UpdatingElement], options);\n }\n };\n };\n\nconst legacyEventOptions =\n // tslint:disable-next-line:no-any legacy decorator\n (options: AddEventListenerOptions, proto: any, name: PropertyKey) => {\n Object.assign(proto[name], options);\n };\n\n/**\n * Adds event listener options to a method used as an event listener in a\n * lit-html template.\n *\n * @param options An object that specifies event listener options as accepted by\n * `EventTarget#addEventListener` and `EventTarget#removeEventListener`.\n *\n * Current browsers support the `capture`, `passive`, and `once` options. See:\n * https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Parameters\n *\n * @example\n * ```ts\n * class MyElement {\n * clicked = false;\n *\n * render() {\n * return html`\n * <div @click=${this._onClick}`>\n * <button></button>\n * </div>\n * `;\n * }\n *\n * @eventOptions({capture: true})\n * _onClick(e) {\n * this.clicked = true;\n * }\n * }\n * ```\n * @category Decorator\n */\nexport function eventOptions(options: AddEventListenerOptions) {\n // Return value typed as any to prevent TypeScript from complaining that\n // standard decorator function signature does not match TypeScript decorator\n // signature\n // TODO(kschaaf): unclear why it was only failing on this decorator and not\n // the others\n return ((protoOrDescriptor: Object|ClassElement, name?: string) =>\n (name !== undefined) ?\n legacyEventOptions(options, protoOrDescriptor as Object, name) :\n standardEventOptions(\n options, protoOrDescriptor as ClassElement)) as\n // tslint:disable-next-line:no-any decorator\n any;\n}\n\n// x-browser support for matches\n// tslint:disable-next-line:no-any\nconst ElementProto = Element.prototype as any;\nconst legacyMatches =\n ElementProto.msMatchesSelector || ElementProto.webkitMatchesSelector;\n\n/**\n * A property decorator that converts a class property into a getter that\n * returns the `assignedNodes` of the given named `slot`. Note, the type of\n * this property should be annotated as `NodeListOf<HTMLElement>`.\n *\n * @param slotName A string name of the slot.\n * @param flatten A boolean which when true flattens the assigned nodes,\n * meaning any assigned nodes that are slot elements are replaced with their\n * assigned nodes.\n * @param selector A string which filters the results to elements that match\n * the given css selector.\n *\n * * @example\n * ```ts\n * class MyElement {\n * @queryAssignedNodes('list', true, '.item')\n * listItems;\n *\n * render() {\n * return html`\n * <slot name=\"list\"></slot>\n * `;\n * }\n * }\n * ```\n * @category Decorator\n */\nexport function queryAssignedNodes(\n slotName = '', flatten = false, selector = '') {\n return (protoOrDescriptor: Object|ClassElement,\n // tslint:disable-next-line:no-any decorator\n name?: PropertyKey): any => {\n const descriptor = {\n get(this: LitElement) {\n const slotSelector =\n `slot${slotName ? `[name=${slotName}]` : ':not([name])'}`;\n const slot = this.renderRoot.querySelector(slotSelector);\n let nodes = slot && (slot as HTMLSlotElement).assignedNodes({flatten});\n if (nodes && selector) {\n nodes = nodes.filter(\n (node) => node.nodeType === Node.ELEMENT_NODE &&\n // tslint:disable-next-line:no-any testing existence on older browsers\n ((node as any).matches ?\n (node as Element).matches(selector) :\n legacyMatches.call(node as Element, selector)));\n }\n return nodes;\n },\n enumerable: true,\n configurable: true,\n };\n return (name !== undefined) ?\n legacyQuery(descriptor, protoOrDescriptor as Object, name) :\n standardQuery(descriptor, protoOrDescriptor as ClassElement);\n };\n}\n","/**\n@license\nCopyright (c) 2019 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at\nhttp://polymer.github.io/LICENSE.txt The complete set of authors may be found at\nhttp://polymer.github.io/AUTHORS.txt The complete set of contributors may be\nfound at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as\npart of the polymer project is also subject to an additional IP rights grant\nfound at http://polymer.github.io/PATENTS.txt\n*/\n\n/**\n * Whether the current browser supports `adoptedStyleSheets`.\n */\nexport const supportsAdoptingStyleSheets = (window.ShadowRoot) &&\n (window.ShadyCSS === undefined || window.ShadyCSS.nativeShadow) &&\n ('adoptedStyleSheets' in Document.prototype) &&\n ('replace' in CSSStyleSheet.prototype);\n\nconst constructionToken = Symbol();\n\nexport class CSSResult {\n _styleSheet?: CSSStyleSheet|null;\n\n readonly cssText: string;\n\n constructor(cssText: string, safeToken: symbol) {\n if (safeToken !== constructionToken) {\n throw new Error(\n 'CSSResult is not constructable. Use `unsafeCSS` or `css` instead.');\n }\n\n this.cssText = cssText;\n }\n\n // Note, this is a getter so that it's lazy. In practice, this means\n // stylesheets are not created until the first element instance is made.\n get styleSheet(): CSSStyleSheet|null {\n if (this._styleSheet === undefined) {\n // Note, if `supportsAdoptingStyleSheets` is true then we assume\n // CSSStyleSheet is constructable.\n if (supportsAdoptingStyleSheets) {\n this._styleSheet = new CSSStyleSheet();\n this._styleSheet.replaceSync(this.cssText);\n } else {\n this._styleSheet = null;\n }\n }\n return this._styleSheet;\n }\n\n toString(): string {\n return this.cssText;\n }\n}\n\n/**\n * Wrap a value for interpolation in a [[`css`]] tagged template literal.\n *\n * This is unsafe because untrusted CSS text can be used to phone home\n * or exfiltrate data to an attacker controlled site. Take care to only use\n * this with trusted input.\n */\nexport const unsafeCSS = (value: unknown) => {\n return new CSSResult(String(value), constructionToken);\n};\n\nconst textFromCSSResult = (value: CSSResult|number) => {\n if (value instanceof CSSResult) {\n return value.cssText;\n } else if (typeof value === 'number') {\n return value;\n } else {\n throw new Error(\n `Value passed to 'css' function must be a 'css' function result: ${\n value}. Use 'unsafeCSS' to pass non-literal values, but\n take care to ensure page security.`);\n }\n};\n\n/**\n * Template tag which which can be used with LitElement's [[LitElement.styles |\n * `styles`]] property to set element styles. For security reasons, only literal\n * string values may be used. To incorporate non-literal values [[`unsafeCSS`]]\n * may be used inside a template string part.\n */\nexport const css =\n (strings: TemplateStringsArray, ...values: (CSSResult|number)[]) => {\n const cssText = values.reduce(\n (acc, v, idx) => acc + textFromCSSResult(v) + strings[idx + 1],\n strings[0]);\n return new CSSResult(cssText, constructionToken);\n };\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * The main LitElement module, which defines the [[`LitElement`]] base class and\n * related APIs.\n *\n * LitElement components can define a template and a set of observed\n * properties. Changing an observed property triggers a re-render of the\n * element.\n *\n * Import [[`LitElement`]] and [[`html`]] from this module to create a\n * component:\n *\n * ```js\n * import {LitElement, html} from 'lit-element';\n *\n * class MyElement extends LitElement {\n *\n * // Declare observed properties\n * static get properties() {\n * return {\n * adjective: {}\n * }\n * }\n *\n * constructor() {\n * this.adjective = 'awesome';\n * }\n *\n * // Define the element's template\n * render() {\n * return html`<p>your ${adjective} template here</p>`;\n * }\n * }\n *\n * customElements.define('my-element', MyElement);\n * ```\n *\n * `LitElement` extends [[`UpdatingElement`]] and adds lit-html templating.\n * The `UpdatingElement` class is provided for users that want to build\n * their own custom element base classes that don't use lit-html.\n *\n * @packageDocumentation\n */\nimport {render, ShadyRenderOptions} from 'lit-html/lib/shady-render.js';\n\nimport {PropertyValues, UpdatingElement} from './lib/updating-element.js';\n\nexport * from './lib/updating-element.js';\nexport {UpdatingElement as ReactiveElement} from './lib/updating-element.js';\nexport * from './lib/decorators.js';\nexport {html, svg, TemplateResult, SVGTemplateResult} from 'lit-html/lit-html.js';\nimport {supportsAdoptingStyleSheets, CSSResult, unsafeCSS} from './lib/css-tag.js';\nexport * from './lib/css-tag.js';\n\ndeclare global {\n interface Window {\n litElementVersions: string[];\n }\n}\n\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for LitElement usage.\n// TODO(justinfagnani): inject version number at build time\n(window['litElementVersions'] || (window['litElementVersions'] = []))\n .push('2.5.1');\n\nexport type CSSResultOrNative = CSSResult|CSSStyleSheet;\n\nexport interface CSSResultArray extends\n Array<CSSResultOrNative|CSSResultArray> {}\n\nexport type CSSResultGroup = CSSResultOrNative|CSSResultArray;\n\n/**\n * Sentinal value used to avoid calling lit-html's render function when\n * subclasses do not implement `render`\n */\nconst renderNotImplemented = {};\n\n/**\n * Base element class that manages element properties and attributes, and\n * renders a lit-html template.\n *\n * To define a component, subclass `LitElement` and implement a\n * `render` method to provide the component's template. Define properties\n * using the [[`properties`]] property or the [[`property`]] decorator.\n */\nexport class LitElement extends UpdatingElement {\n /**\n * Ensure this class is marked as `finalized` as an optimization ensuring\n * it will not needlessly try to `finalize`.\n *\n * Note this property name is a string to prevent breaking Closure JS Compiler\n * optimizations. See updating-element.ts for more information.\n */\n protected static['finalized'] = true;\n\n /**\n * Reference to the underlying library method used to render the element's\n * DOM. By default, points to the `render` method from lit-html's shady-render\n * module.\n *\n * **Most users will never need to touch this property.**\n *\n * This property should not be confused with the `render` instance method,\n * which should be overridden to define a template for the element.\n *\n * Advanced users creating a new base class based on LitElement can override\n * this property to point to a custom render method with a signature that\n * matches [shady-render's `render`\n * method](https://lit-html.polymer-project.org/api/modules/shady_render.html#render).\n *\n * @nocollapse\n */\n static render:\n (result: unknown, container: Element|DocumentFragment,\n options: ShadyRenderOptions) => void = render;\n\n /**\n * Array of styles to apply to the element. The styles should be defined\n * using the [[`css`]] tag function or via constructible stylesheets.\n */\n static styles?: CSSResultGroup;\n\n /** @nocollapse */\n static shadowRootOptions: ShadowRootInit = {mode: 'open'};\n\n private static _styles: Array<CSSResultOrNative|CSSResult>|undefined;\n\n /**\n * Return the array of styles to apply to the element.\n * Override this method to integrate into a style management system.\n *\n * @nocollapse\n */\n static getStyles(): CSSResultGroup|undefined {\n return this.styles;\n }\n\n /** @nocollapse */\n private static _getUniqueStyles() {\n // Only gather styles once per class\n if (this.hasOwnProperty(JSCompiler_renameProperty('_styles', this))) {\n return;\n }\n // Take care not to call `this.getStyles()` multiple times since this\n // generates new CSSResults each time.\n // TODO(sorvell): Since we do not cache CSSResults by input, any\n // shared styles will generate new stylesheet objects, which is wasteful.\n // This should be addressed when a browser ships constructable\n // stylesheets.\n const userStyles = this.getStyles();\n\n if (Array.isArray(userStyles)) {\n // De-duplicate styles preserving the _last_ instance in the set.\n // This is a performance optimization to avoid duplicated styles that can\n // occur especially when composing via subclassing.\n // The last item is kept to try to preserve the cascade order with the\n // assumption that it's most important that last added styles override\n // previous styles.\n const addStyles = (styles: CSSResultArray, set: Set<CSSResultOrNative>):\n Set<CSSResultOrNative> => styles.reduceRight(\n (set: Set<CSSResultOrNative>, s) =>\n // Note: On IE set.add() does not return the set\n Array.isArray(s) ? addStyles(s, set) : (set.add(s), set),\n set);\n // Array.from does not work on Set in IE, otherwise return\n // Array.from(addStyles(userStyles, new Set<CSSResult>())).reverse()\n const set = addStyles(userStyles, new Set<CSSResultOrNative>());\n const styles: CSSResultOrNative[] = [];\n set.forEach((v) => styles.unshift(v));\n this._styles = styles;\n } else {\n this._styles = userStyles === undefined ? [] : [userStyles];\n }\n\n // Ensure that there are no invalid CSSStyleSheet instances here. They are\n // invalid in two conditions.\n // (1) the sheet is non-constructible (`sheet` of a HTMLStyleElement), but\n // this is impossible to check except via .replaceSync or use\n // (2) the ShadyCSS polyfill is enabled (:. supportsAdoptingStyleSheets is\n // false)\n this._styles = this._styles.map((s) => {\n if (s instanceof CSSStyleSheet && !supportsAdoptingStyleSheets) {\n // Flatten the cssText from the passed constructible stylesheet (or\n // undetectable non-constructible stylesheet). The user might have\n // expected to update their stylesheets over time, but the alternative\n // is a crash.\n const cssText = Array.prototype.slice.call(s.cssRules)\n .reduce((css, rule) => css + rule.cssText, '');\n return unsafeCSS(cssText);\n }\n return s;\n });\n }\n\n private _needsShimAdoptedStyleSheets?: boolean;\n\n /**\n * Node or ShadowRoot into which element DOM should be rendered. Defaults\n * to an open shadowRoot.\n */\n readonly renderRoot!: Element|DocumentFragment;\n\n /**\n * Performs element initialization. By default this calls\n * [[`createRenderRoot`]] to create the element [[`renderRoot`]] node and\n * captures any pre-set values for registered properties.\n */\n protected initialize() {\n super.initialize();\n (this.constructor as typeof LitElement)._getUniqueStyles();\n (this as {\n renderRoot: Element|DocumentFragment;\n }).renderRoot = this.createRenderRoot();\n // Note, if renderRoot is not a shadowRoot, styles would/could apply to the\n // element's getRootNode(). While this could be done, we're choosing not to\n // support this now since it would require different logic around de-duping.\n if (window.ShadowRoot && this.renderRoot instanceof window.ShadowRoot) {\n this.adoptStyles();\n }\n }\n\n /**\n * Returns the node into which the element should render and by default\n * creates and returns an open shadowRoot. Implement to customize where the\n * element's DOM is rendered. For example, to render into the element's\n * childNodes, return `this`.\n * @returns {Element|DocumentFragment} Returns a node into which to render.\n */\n protected createRenderRoot(): Element|ShadowRoot {\n return this.attachShadow(\n (this.constructor as typeof LitElement).shadowRootOptions);\n }\n\n /**\n * Applies styling to the element shadowRoot using the [[`styles`]]\n * property. Styling will apply using `shadowRoot.adoptedStyleSheets` where\n * available and will fallback otherwise. When Shadow DOM is polyfilled,\n * ShadyCSS scopes styles and adds them to the document. When Shadow DOM\n * is available but `adoptedStyleSheets` is not, styles are appended to the\n * end of the `shadowRoot` to [mimic spec\n * behavior](https://wicg.github.io/construct-stylesheets/#using-constructed-stylesheets).\n */\n protected adoptStyles() {\n const styles = (this.constructor as typeof LitElement)._styles!;\n if (styles.length === 0) {\n return;\n }\n // There are three separate cases here based on Shadow DOM support.\n // (1) shadowRoot polyfilled: use ShadyCSS\n // (2) shadowRoot.adoptedStyleSheets available: use it\n // (3) shadowRoot.adoptedStyleSheets polyfilled: append styles after\n // rendering\n if (window.ShadyCSS !== undefined && !window.ShadyCSS.nativeShadow) {\n window.ShadyCSS.ScopingShim!.prepareAdoptedCssText(\n styles.map((s) => (s as CSSResult).cssText), this.localName);\n } else if (supportsAdoptingStyleSheets) {\n (this.renderRoot as ShadowRoot).adoptedStyleSheets =\n styles.map((s) => s instanceof CSSStyleSheet ? s : s.styleSheet!);\n } else {\n // This must be done after rendering so the actual style insertion is done\n // in `update`.\n this._needsShimAdoptedStyleSheets = true;\n }\n }\n\n connectedCallback() {\n super.connectedCallback();\n // Note, first update/render handles styleElement so we only call this if\n // connected after first update.\n if (this.hasUpdated && window.ShadyCSS !== undefined) {\n window.ShadyCSS.styleElement(this);\n }\n }\n\n /**\n * Updates the element. This method reflects property values to attributes\n * and calls `render` to render DOM via lit-html. Setting properties inside\n * this method will *not* trigger another update.\n * @param _changedProperties Map of changed properties with old values\n */\n protected update(changedProperties: PropertyValues) {\n // Setting properties in `render` should not trigger an update. Since\n // updates are allowed after super.update, it's important to call `render`\n // before that.\n const templateResult = this.render();\n super.update(changedProperties);\n // If render is not implemented by the component, don't call lit-html render\n if (templateResult !== renderNotImplemented) {\n (this.constructor as typeof LitElement)\n .render(\n templateResult,\n this.renderRoot,\n {scopeName: this.localName, eventContext: this});\n }\n // When native Shadow DOM is used but adoptedStyles are not supported,\n // insert styling after rendering to ensure adoptedStyles have highest\n // priority.\n if (this._needsShimAdoptedStyleSheets) {\n this._needsShimAdoptedStyleSheets = false;\n (this.constructor as typeof LitElement)._styles!.forEach((s) => {\n const style = document.createElement('style');\n style.textContent = (s as CSSResult).cssText;\n this.renderRoot.appendChild(style);\n });\n }\n }\n\n /**\n * Invoked on each update to perform rendering tasks. This method may return\n * any value renderable by lit-html's `NodePart` - typically a\n * `TemplateResult`. Setting properties inside this method will *not* trigger\n * the element to update.\n */\n protected render(): unknown {\n return renderNotImplemented;\n }\n}\n","import { LitElement, html, css } from 'lit-element';\n\nconst IAActivityIndicatorMode = Object.freeze({\n processing: 'processing',\n complete: 'complete',\n});\n\nclass IAActivityIndicator extends LitElement {\n static get properties() {\n return {\n mode: { type: String },\n };\n }\n\n constructor() {\n super();\n this.mode = IAActivityIndicatorMode.processing;\n }\n\n render() {\n return html`\n <div class=\"${this.mode}\">\n <svg\n viewBox=\"0 0 120 120\"\n preserveAspectRatio=\"none\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n aria-labelledby=\"indicatorTitle indicatorDescription\"\n >\n <title id=\"indicatorTitle\">Activity Indicator</title>\n <desc id=\"indicatorDescription\">\n A rotating activity indicator with three dots in the middle.\n </desc>\n <g\n id=\"icons/check-ring---squared\"\n stroke=\"none\"\n stroke-width=\"1\"\n fill=\"none\"\n fill-rule=\"evenodd\"\n >\n <path\n id=\"completed-ring\"\n class=\"loaded-indicator\"\n d=\"M60,10 C70.5816709,10 80.3955961,13.2871104 88.4763646,18.8959201 L78.3502633,29.0214223 C72.9767592,25.8315427 66.7022695,24 60,24 C40.117749,24 24,40.117749 24,60 C24,79.882251 40.117749,96 60,96 C79.882251,96 96,79.882251 96,60 L95.995,59.46 L108.327675,47.128668 C109.350926,50.9806166 109.925886,55.015198 109.993301,59.1731586 L110,60 C110,87.6142375 87.6142375,110 60,110 C32.3857625,110 10,87.6142375 10,60 C10,32.3857625 32.3857625,10 60,10 Z\"\n ></path>\n <polygon\n id=\"check\"\n class=\"loaded-indicator\"\n transform=\"translate(75.000000, 41.500000) rotate(44.000000) translate(-75.000000, -41.500000) \"\n points=\"96 85 54 85 54 65 76 64.999 76 -2 96 -2\"\n ></polygon>\n <path\n id=\"activity-ring\"\n class=\"activity-indicator\"\n d=\"M60,10 C69.8019971,10 78.9452178,12.8205573 86.6623125,17.6943223 L76.4086287,27.9484118 C71.4880919,25.4243078 65.9103784,24 60,24 C40.117749,24 24,40.117749 24,60 C24,79.882251 40.117749,96 60,96 C79.882251,96 96,79.882251 96,60 C96,53.3014663 94.1704984,47.0302355 90.9839104,41.6587228 L101.110332,31.5326452 C106.715332,39.6116982 110,49.4222615 110,60 C110,87.6142375 87.6142375,110 60,110 C32.3857625,110 10,87.6142375 10,60 C10,32.3857625 32.3857625,10 60,10 Z\"\n ></path>\n <g\n id=\"activity-dots\"\n class=\"activity-indicator\"\n transform=\"translate(40.000000, 55.000000)\"\n >\n <circle id=\"left-dot\" cx=\"5\" cy=\"5\" r=\"5\"></circle>\n <circle id=\"middle-dot\" cx=\"20\" cy=\"5\" r=\"5\"></circle>\n <circle id=\"right-dot\" cx=\"35\" cy=\"5\" r=\"5\"></circle>\n </g>\n </g>\n </svg>\n </div>\n `;\n }\n\n static get styles() {\n const checkmarkColorCss = css`var(--activityIndicatorCheckmarkColor, #31A481)`;\n const completedRingColorCss = css`var(--activityIndicatorCompletedRingColor, #31A481)`;\n const loadingRingColorCss = css`var(--activityIndicatorLoadingRingColor, #333333)`;\n const loadingDotColorCss = css`var(--activityIndicatorLoadingDotColor, #333333)`;\n\n return css`\n #completed-ring {\n fill: ${completedRingColorCss};\n }\n\n #check {\n fill: ${checkmarkColorCss};\n }\n\n #activity-ring {\n fill: ${loadingRingColorCss};\n }\n\n #activity-dots {\n fill: ${loadingDotColorCss};\n }\n\n .activity-indicator {\n opacity: 0;\n transition: opacity 0.25s ease-out;\n }\n\n .processing .activity-indicator {\n opacity: 1;\n }\n\n .loaded-indicator {\n opacity: 1;\n transition: opacity 0.25s ease-out;\n }\n\n .processing .loaded-indicator {\n opacity: 0;\n }\n\n .image {\n border: 1px solid red;\n display: inline-block;\n }\n\n .processing #activity-ring {\n animation: rotate 1.3s infinite linear;\n transform-origin: 50px 50px;\n transform-box: fill-box;\n }\n\n .processing #left-dot {\n opacity: 0;\n animation: dot 1.3s infinite;\n animation-delay: 0.2s;\n }\n\n .processing #middle-dot {\n opacity: 0;\n animation: dot 1.3s infinite;\n animation-delay: 0.4s;\n }\n\n .processing #right-dot {\n opacity: 0;\n animation: dot 1.3s infinite;\n animation-delay: 0.6s;\n }\n\n @keyframes rotate {\n 0% {\n transform: rotate(-360deg);\n }\n }\n\n @keyframes dot {\n 0% {\n opacity: 0;\n }\n 25% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n `;\n }\n}\n\nexport { IAActivityIndicator, IAActivityIndicatorMode };\n","import { IAActivityIndicator } from './src/ia-activity-indicator.js';\n\nwindow.customElements.define('ia-activity-indicator', IAActivityIndicator);\n","import { html } from 'lit-html';\n\nexport default html`\n <svg\n viewBox=\"0 0 40 40\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-labelledby=\"closeTitleID closeDescID\"\n >\n <title id=\"closeTitleID\">Close icon</title>\n <desc id=\"closeDescID\">A line drawing of an X</desc>\n <path d=\"m29.1923882 10.8076118c.5857864.5857865.5857864 1.535534 0 2.1213204l-7.0711162 7.0703398 7.0711162 7.0717958c.5857864.5857864.5857864 1.5355339 0 2.1213204-.5857865.5857864-1.535534.5857864-2.1213204 0l-7.0717958-7.0711162-7.0703398 7.0711162c-.5857864.5857864-1.5355339.5857864-2.1213204 0-.5857864-.5857865-.5857864-1.535534 0-2.1213204l7.0706602-7.0717958-7.0706602-7.0703398c-.5857864-.5857864-.5857864-1.5355339 0-2.1213204.5857865-.5857864 1.535534-.5857864 2.1213204 0l7.0703398 7.0706602 7.0717958-7.0706602c.5857864-.5857864 1.5355339-.5857864 2.1213204 0z\" class=\"fill-color\" fill-rule=\"evenodd\"/>\n </svg>\n`;\n","import { html } from 'lit-html';\n\nexport default html`\n <svg\n class=\"ia-logo\"\n viewBox=\"0 0 27 30\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-labelledby=\"logoTitleID logoDescID\"\n >\n <title id=\"logoTitleID\">Internet Archive logo</title>\n <desc id=\"logoDescID\">A line drawing of the Internet Archive headquarters building façade.</desc>\n <g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n <mask id=\"mask-2\" class=\"fill-color\">\n <path d=\"M26.6666667,28.6046512 L26.6666667,30 L0,30 L0.000283687943,28.6046512 L26.6666667,28.6046512 Z M25.6140351,26.5116279 L25.6140351,28.255814 L1.05263158,28.255814 L1.05263158,26.5116279 L25.6140351,26.5116279 Z M3.62469203,7.6744186 L3.91746909,7.82153285 L4.0639977,10.1739544 L4.21052632,13.9963932 L4.21052632,17.6725617 L4.0639977,22.255044 L4.03962296,25.3421929 L3.62469203,25.4651163 L2.16024641,25.4651163 L1.72094074,25.3421929 L1.55031755,22.255044 L1.40350877,17.6970339 L1.40350877,14.0211467 L1.55031755,10.1739544 L1.68423854,7.80887484 L1.98962322,7.6744186 L3.62469203,7.6744186 Z M24.6774869,7.6744186 L24.9706026,7.82153285 L25.1168803,10.1739544 L25.2631579,13.9963932 L25.2631579,17.6725617 L25.1168803,22.255044 L25.0927809,25.3421929 L24.6774869,25.4651163 L23.2130291,25.4651163 L22.7736357,25.3421929 L22.602418,22.255044 L22.4561404,17.6970339 L22.4561404,14.0211467 L22.602418,10.1739544 L22.7369262,7.80887484 L23.0420916,7.6744186 L24.6774869,7.6744186 Z M9.94042303,7.6744186 L10.2332293,7.82153285 L10.3797725,10.1739544 L10.5263158,13.9963932 L10.5263158,17.6725617 L10.3797725,22.255044 L10.3556756,25.3421929 L9.94042303,25.4651163 L8.47583122,25.4651163 L8.0362015,25.3421929 L7.86556129,22.255044 L7.71929825,17.6970339 L7.71929825,14.0211467 L7.86556129,10.1739544 L8.00005604,7.80887484 L8.30491081,7.6744186 L9.94042303,7.6744186 Z M18.0105985,7.6744186 L18.3034047,7.82153285 L18.449948,10.1739544 L18.5964912,13.9963932 L18.5964912,17.6725617 L18.449948,22.255044 L18.425851,25.3421929 L18.0105985,25.4651163 L16.5460067,25.4651163 L16.1066571,25.3421929 L15.9357367,22.255044 L15.7894737,17.6970339 L15.7894737,14.0211467 L15.9357367,10.1739544 L16.0702315,7.80887484 L16.3753664,7.6744186 L18.0105985,7.6744186 Z M25.6140351,4.53488372 L25.6140351,6.97674419 L1.05263158,6.97674419 L1.05263158,4.53488372 L25.6140351,4.53488372 Z M13.0806755,0 L25.9649123,2.93331338 L25.4484139,3.8372093 L0.771925248,3.8372093 L0,3.1041615 L13.0806755,0 Z\" id=\"path-1\"></path>\n </mask>\n <use class=\"fill-color\" xlink:href=\"#path-1\"></use>\n <g mask=\"url(#mask-2)\" class=\"fill-color\">\n <path d=\"M0,0 L26.6666667,0 L26.6666667,30 L0,30 L0,0 Z\" id=\"swatch\"></path>\n </g>\n </g>\n </svg>\n`;\n","import { __decorate } from \"tslib\";\nimport { LitElement, html, css, customElement, property, } from 'lit-element';\nimport '@internetarchive/ia-activity-indicator/ia-activity-indicator';\nimport closeIcon from '@internetarchive/icon-close';\nimport iaLogo from '@internetarchive/icon-ia-logo';\nimport { ModalConfig } from './modal-config';\nlet ModalTemplate = class ModalTemplate extends LitElement {\n constructor() {\n super(...arguments);\n /**\n * The ModalConfig that displayed the template\n *\n * @type {ModalConfig}\n * @memberof ModalTemplate\n */\n this.config = new ModalConfig();\n }\n /** @inheritdoc */\n render() {\n return html `\n <div class=\"modal-wrapper\">\n <div class=\"modal-container\">\n <header style=\"background-color: ${this.config.headerColor}\">\n ${this.config.showCloseButton ? this.closeButtonTemplate : ''}\n <div class=\"logo-icon\">\n ${iaLogo}\n </div>\n ${this.config.title\n ? html `<h1 class=\"title\">${this.config.title}</h1>`\n : ''}\n ${this.config.subtitle\n ? html `<h2 class=\"subtitle\">${this.config.subtitle}</h2>`\n : ''}\n </header>\n <section class=\"modal-body\">\n <div class=\"content\">\n <div\n class=\"processing-logo ${this.config.showProcessingIndicator\n ? ''\n : 'hidden'}\"\n >\n <ia-activity-indicator\n .mode=${this.config.processingImageMode}\n ></ia-activity-indicator>\n </div>\n\n ${this.config.headline\n ? html ` <h1 class=\"headline\">${this.config.headline}</h1> `\n : ''}\n ${this.config.message\n ? html ` <p class=\"message\">${this.config.message}</p> `\n : ''}\n\n <div class=\"slot-container\">\n <slot> </slot>\n </div>\n </div>\n </section>\n </div>\n </div>\n `;\n }\n /**\n * Dispatch the `closeButtonPressed` event to the consumer\n *\n * @private\n * @memberof ModalTemplate\n */\n handleCloseButton() {\n const event = new Event('closeButtonPressed');\n this.dispatchEvent(event);\n }\n /**\n * The close button template\n *\n * @readonly\n * @private\n * @type {TemplateResult}\n * @memberof ModalTemplate\n */\n get closeButtonTemplate() {\n return html `\n <button\n type=\"button\"\n class=\"close-button\"\n tabindex=\"0\"\n @click=${this.handleCloseButton}\n >\n ${closeIcon}\n </button>\n `;\n }\n /** @inheritdoc */\n static get styles() {\n const modalLogoSize = css `var(--modalLogoSize, 6.5rem)`;\n const processingImageSize = css `var(--processingImageSize, 7.5rem)`;\n const modalCornerRadius = css `var(--modalCornerRadius, 1rem)`;\n const modalBorder = css `var(--modalBorder, 2px solid black)`;\n // if the content of the modal is too big to fit on screen, this sets the bottom margin\n // it's not exact, but a close estimation\n const modalBottomMarginCss = css `var(--modalBottomMargin, 2.5rem)`;\n const modalTopMarginCss = css `var(--modalTopMargin, 5rem)`;\n const modalHeaderBottomPaddingCss = css `var(--modalHeaderBottomPadding, 0.5em)`;\n const modalBottomPadding = css `var(--modalBottomPadding, 2rem)`;\n const scrollOffset = css `var(--modalScrollOffset, 5px)`;\n const titleFontSize = css `var(--modalTitleFontSize, 1.8rem)`;\n const subtitleFontSize = css `var(--modalSubtitleFontSize, 1.4rem)`;\n const headlineFontSize = css `var(--modalHeadlineFontSize, 1.6rem)`;\n const messageFontSize = css `var(--modalMessageFontSize, 1.4rem)`;\n const titleLineHeight = css `var(--modalTitleLineHeight, normal)`;\n const subtitleLineHeight = css `var(--modalSubtitleLineHeight, normal)`;\n const headlineLineHeight = css `var(--modalHeadlineLineHeight, normal)`;\n const messageLineHeight = css `var(--modalMessageLineHeight, normal)`;\n return css `\n .processing-logo {\n margin: auto;\n width: ${processingImageSize};\n height: ${processingImageSize};\n }\n\n .processing-logo.hidden {\n height: 1rem;\n }\n\n .processing-logo.hidden ia-activity-indicator {\n display: none;\n }\n\n .modal-wrapper {\n outline: none;\n }\n\n .modal-container {\n border-radius: ${modalCornerRadius};\n width: 100%;\n margin-top: ${modalTopMarginCss};\n }\n\n header {\n position: relative;\n background-color: #36a483;\n color: white;\n border-radius: calc(${modalCornerRadius}) calc(${modalCornerRadius}) 0 0;\n border: ${modalBorder};\n border-bottom: 0;\n text-align: center;\n padding-bottom: ${modalHeaderBottomPaddingCss};\n }\n\n .title {\n margin: 0;\n padding: 0;\n font-size: ${titleFontSize};\n font-weight: bold;\n line-height: ${titleLineHeight};\n }\n\n .subtitle {\n margin: 0;\n padding: 0;\n font-weight: normal;\n padding-top: 0;\n font-size: ${subtitleFontSize};\n line-height: ${subtitleLineHeight};\n }\n\n .modal-body {\n background-color: #f5f5f7;\n border-radius: 0 0 calc(${modalCornerRadius}) calc(${modalCornerRadius});\n border: ${modalBorder};\n border-top: 0;\n padding: 0 1rem calc(${modalBottomPadding} - ${scrollOffset}) 1rem;\n color: #333;\n margin-bottom: 2.5rem;\n min-height: 5rem;\n }\n\n .content {\n overflow-y: auto;\n max-height: calc(100vh - (16.5rem + ${modalBottomMarginCss}));\n min-height: 5rem;\n padding: 0 0 calc(${scrollOffset}) 0;\n }\n\n .headline {\n font-size: ${headlineFontSize};\n font-weight: bold;\n text-align: center;\n line-height: ${headlineLineHeight};\n margin: 0;\n padding: 0;\n }\n\n .message {\n margin: 1rem 0 0 0;\n text-align: center;\n font-size: ${messageFontSize};\n line-height: ${messageLineHeight};\n }\n\n .logo-icon {\n border-radius: 100%;\n border: 3px solid #fff;\n box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18),\n 0 2px 2px 0 rgba(0, 0, 0, 0.08);\n width: ${modalLogoSize};\n height: ${modalLogoSize};\n margin: -2.9rem auto 0.5rem auto;\n background-color: black;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n\n .logo-icon svg {\n width: calc(${modalLogoSize} * 0.65);\n height: calc(${modalLogoSize} * 0.65);\n }\n\n .logo-icon svg .fill-color {\n fill: white;\n }\n\n .logo-icon svg .stroke-color {\n stroke: red;\n }\n\n .close-button {\n position: absolute;\n right: 1.2rem;\n top: 1.2rem;\n width: 2rem;\n height: 2rem;\n border-radius: 100%;\n border: 0;\n padding: 0;\n cursor: pointer;\n background-color: white;\n box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18),\n 0 4px 4px 0 rgba(0, 0, 0, 0.08);\n }\n `;\n }\n};\n__decorate([\n property({ type: Object })\n], ModalTemplate.prototype, \"config\", void 0);\nModalTemplate = __decorate([\n customElement('modal-template')\n], ModalTemplate);\nexport { ModalTemplate };\n//# sourceMappingURL=modal-template.js.map","/**\n * Various modes the modal can be in\n *\n * @export\n * @enum {number}\n */\nexport var ModalManagerMode;\n(function (ModalManagerMode) {\n ModalManagerMode[\"Open\"] = \"open\";\n ModalManagerMode[\"Closed\"] = \"closed\";\n})(ModalManagerMode || (ModalManagerMode = {}));\n//# sourceMappingURL=modal-manager-mode.js.map","import { throttle } from 'throttle-debounce';\nimport { ModalManagerMode } from './modal-manager-mode';\n/**\n * The `ModalManagerHostBridge` is a bridge between the `ModalManager` and the\n * host that sets up environment-specific changes when the modal opens and closes.\n *\n * For instance, when the modal opens, this adds a class to the `<body>` tag for styling\n * and adds a `resize` listener to fix a Safari shadow root issue.\n *\n * Consumers can create their own `ModalManagerHostBridgeInterface` classes and pass\n * them into the `ModalManager` if this one does not work for their environment.\n *\n * @export\n * @class ModalManagerHostBridge\n * @implements {ModalManagerHostBridgeInterface}\n */\nexport class ModalManagerHostBridge {\n constructor(modalManager) {\n this.windowResizeThrottler = throttle(100, false, this.updateModalContainerHeight).bind(this);\n this.modalManager = modalManager;\n }\n /**\n * Handle the mode change\n *\n * @private\n * @memberof ModalManager\n */\n handleModeChange(mode) {\n switch (mode) {\n case ModalManagerMode.Open:\n this.startResizeListener();\n this.stopDocumentScroll();\n break;\n case ModalManagerMode.Closed:\n this.stopResizeListener();\n this.resumeDocumentScroll();\n break;\n }\n }\n // This is a workaround for Safari. Safari does not update shadowRoot elements calculated\n // based on the viewport size (ie. `calc(100vh - 10px)`). It does an initial calculation correctly,\n // but resizing the window does not cause the calculation to update. Firefox and Chrome both handle\n // this correctly.\n // It doesn't matter what css variable you set, it is just forcing Safari to do an update.\n // Also note that the value has to change on each update for Safari to do the update,\n // ie. you can't just set a static value.\n updateModalContainerHeight() {\n this.modalManager.style.setProperty('--containerHeight', `${window.innerHeight}px`);\n }\n stopDocumentScroll() {\n document.body.classList.add('modal-manager-open');\n }\n resumeDocumentScroll() {\n document.body.classList.remove('modal-manager-open');\n }\n startResizeListener() {\n window.addEventListener('resize', this.windowResizeThrottler);\n }\n stopResizeListener() {\n window.removeEventListener('resize', this.windowResizeThrottler);\n }\n}\n//# sourceMappingURL=modal-manager-host-bridge.js.map","import { __awaiter, __decorate } from \"tslib\";\nimport { LitElement, html, css, customElement, property, query, } from 'lit-element';\nimport './modal-template';\nimport { ModalManagerHostBridge } from './modal-manager-host-bridge';\nimport { ModalManagerMode } from './modal-manager-mode';\nlet ModalManager = class ModalManager extends LitElement {\n constructor() {\n super(...arguments);\n /**\n * The current mode of the ModalManager\n *\n * Current options are `modal` or `closed`\n *\n * @type {ModalManagerMode}\n * @memberof ModalManager\n */\n this.mode = ModalManagerMode.Closed;\n /**\n * Thie hostBridge handles environmental-specific interactions such as adding classes\n * to the body tag or event listeners needed to support the modal manager in the host environment.\n *\n * There is a default `ModalManagerHostBridge`, but consumers can override it with a custom\n * `ModalManagerHostBridgeInterface`\n *\n * @type {ModalManagerHostBridgeInterface}\n * @memberof ModalManager\n */\n this.hostBridge = new ModalManagerHostBridge(this);\n /**\n * Whether the modal should close if the user taps on the backdrop\n *\n * @private\n * @memberof ModalManager\n */\n this.closeOnBackdropClick = true;\n }\n /** @inheritdoc */\n render() {\n return html `\n <div class=\"container\">\n <div class=\"backdrop\" @click=${this.backdropClicked}></div>\n <modal-template\n @closeButtonPressed=${this.closeButtonPressed}\n tabindex=\"0\"\n >\n ${this.customModalContent}\n </modal-template>\n </div>\n `;\n }\n /** @inheritdoc */\n getMode() {\n return this.mode;\n }\n /** @inheritdoc */\n closeModal() {\n this.mode = ModalManagerMode.Closed;\n }\n /**\n * Call the userClosedModalCallback and reset it if it exists\n *\n * @private\n * @memberof ModalManager\n */\n callUserClosedModalCallback() {\n // we assign the callback to a temp var and undefine it before calling it\n // otherwise, we run into the potential for an infinite loop if the\n // callback triggers another `showModal()`, which would execute `userClosedModalCallback`\n const callback = this.userClosedModalCallback;\n this.userClosedModalCallback = undefined;\n if (callback)\n callback();\n }\n /** @inheritdoc */\n showModal(options) {\n return __awaiter(this, void 0, void 0, function* () {\n this.closeOnBackdropClick = options.config.closeOnBackdropClick;\n this.userClosedModalCallback = options.userClosedModalCallback;\n this.modalTemplate.config = options.config;\n this.customModalContent = options.customModalContent;\n this.mode = ModalManagerMode.Open;\n yield this.modalTemplate.updateComplete;\n this.modalTemplate.focus();\n });\n }\n /** @inheritdoc */\n updated(changed) {\n /* istanbul ignore else */\n if (changed.has('mode')) {\n this.handleModeChange();\n }\n }\n /**\n * Called when the backdrop is clicked\n *\n * @private\n * @memberof ModalManager\n */\n backdropClicked() {\n if (this.closeOnBackdropClick) {\n this.closeModal();\n this.callUserClosedModalCallback();\n }\n }\n /**\n * Handle the mode change\n *\n * @private\n * @memberof ModalManager\n */\n handleModeChange() {\n this.hostBridge.handleModeChange(this.mode);\n this.emitModeChangeEvent();\n }\n /**\n * Emit a modeChange event\n *\n * @private\n * @memberof ModalManager\n */\n emitModeChangeEvent() {\n const event = new CustomEvent('modeChanged', {\n detail: { mode: this.mode },\n });\n this.dispatchEvent(event);\n }\n /**\n * Called when the modal close button is pressed. Closes the modal.\n *\n * @private\n * @memberof ModalManager\n */\n closeButtonPressed() {\n this.closeModal();\n this.callUserClosedModalCallback();\n }\n /** @inheritdoc */\n static get styles() {\n const modalBackdropColor = css `var(--modalBackdropColor, rgba(10, 10, 10, 0.9))`;\n const modalBackdropZindex = css `var(--modalBackdropZindex, 1000)`;\n const modalWidth = css `var(--modalWidth, 32rem)`;\n const modalMaxWidth = css `var(--modalMaxWidth, 95%)`;\n const modalZindex = css `var(--modalZindex, 2000)`;\n return css `\n .container {\n width: 100%;\n height: 100%;\n }\n\n .backdrop {\n position: fixed;\n top: 0;\n left: 0;\n background-color: ${modalBackdropColor};\n width: 100%;\n height: 100%;\n z-index: ${modalBackdropZindex};\n }\n\n modal-template {\n outline: 0;\n position: fixed;\n top: 0;\n left: 50%;\n transform: translate(-50%, 0);\n z-index: ${modalZindex};\n width: ${modalWidth};\n max-width: ${modalMaxWidth};\n }\n `;\n }\n};\n__decorate([\n property({ type: String, reflect: true })\n], ModalManager.prototype, \"mode\", void 0);\n__decorate([\n property({ type: Object })\n], ModalManager.prototype, \"customModalContent\", void 0);\n__decorate([\n property({ type: Object })\n], ModalManager.prototype, \"hostBridge\", void 0);\n__decorate([\n query('modal-template')\n], ModalManager.prototype, \"modalTemplate\", void 0);\nModalManager = __decorate([\n customElement('modal-manager')\n], ModalManager);\nexport { ModalManager };\n//# sourceMappingURL=modal-manager.js.map","import { html } from 'lit-html';\n\nexport default html`\n<svg\n viewBox=\"0 0 18 18\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-labelledby=\"searchTitleID searchDescID\"\n>\n <title id=\"searchTitleID\">Search icon</title>\n <desc id=\"searchDescID\">Search for something.</desc>\n <path\n class=\"fill-color\"\n fill=\"none\"\n d=\"m7 0c3.854149 0 7 3.1458514 7 7 0 1.5717634-.529107 3.020558-1.410156 4.191406.0416324.03077.0808125.0647264.117187.101563l4.335938 4.335937c.3904239.3905071.3904239 1.0235559 0 1.414063-.3905071.3904239-1.0235559.3904239-1.414063 0l-4.335937-4.335938c-.0362414-.0370712-.0695452-.0769047-.09961-.11914-1.171224.882043-2.6206167 1.412109-4.193359 1.412109-3.8541486 0-7-3.145851-7-7 0-3.8541486 3.1458514-7 7-7zm0 2c-2.7732684 0-5 2.2267316-5 5s2.2267316 5 5 5 5-2.2267316 5-5-2.2267316-5-5-5z\" />\n</svg>\n`;\n","import icon from './index.js';\nimport { css, LitElement } from 'lit-element';\n\nclass IAIconSearch extends LitElement {\n static get styles() {\n return css`\n :host {\n width: var(--iconWidth, 'auto');\n height: var(--iconHeight, 'auto');\n }\n\n .fill-color {\n fill: var(--iconFillColor);\n }\n\n .stroke-color {\n stroke: var(--iconStrokeColor);\n }\n `;\n }\n\n render() {\n return icon;\n }\n}\n\ncustomElements.define('ia-icon-search', IAIconSearch);\n\nexport default IAIconSearch;","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {nothing, TemplateResult, noChange} from '../lit-html.js';\nimport {directive, Directive, PartInfo, PartType} from '../directive.js';\n\nconst HTML_RESULT = 1;\n\nexport class UnsafeHTMLDirective extends Directive {\n static directiveName = 'unsafeHTML';\n static resultType = HTML_RESULT;\n\n private _value: unknown = nothing;\n private _templateResult?: TemplateResult;\n\n constructor(partInfo: PartInfo) {\n super(partInfo);\n if (partInfo.type !== PartType.CHILD) {\n throw new Error(\n `${\n (this.constructor as typeof UnsafeHTMLDirective).directiveName\n }() can only be used in child bindings`\n );\n }\n }\n\n render(value: string | typeof nothing | typeof noChange | undefined | null) {\n if (value === nothing || value == null) {\n this._templateResult = undefined;\n return (this._value = value);\n }\n if (value === noChange) {\n return value;\n }\n if (typeof value != 'string') {\n throw new Error(\n `${\n (this.constructor as typeof UnsafeHTMLDirective).directiveName\n }() called with a non-string value`\n );\n }\n if (value === this._value) {\n return this._templateResult;\n }\n this._value = value;\n const strings = [value] as unknown as TemplateStringsArray;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (strings as any).raw = strings;\n // WARNING: impersonating a TemplateResult like this is extremely\n // dangerous. Third-party directives should not do this.\n return (this._templateResult = {\n // Cast to a known set of integers that satisfy ResultType so that we\n // don't have to export ResultType and possibly encourage this pattern.\n // This property needs to remain unminified.\n ['_$litType$']: (this.constructor as typeof UnsafeHTMLDirective)\n .resultType as 1 | 2,\n strings,\n values: [],\n });\n }\n}\n\n/**\n * Renders the result as HTML, rather than text.\n *\n * The values `undefined`, `null`, and `nothing`, will all result in no content\n * (empty string) being rendered.\n *\n * Note, this is unsafe to use with any user-provided input that hasn't been\n * sanitized or escaped, as it may lead to cross-site-scripting\n * vulnerabilities.\n */\nexport const unsafeHTML = directive(UnsafeHTMLDirective);\n","import { html, LitElement, nothing } from 'lit';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\n\nexport class BookSearchResult extends LitElement {\n static get properties() {\n return {\n match: { type: Object },\n };\n }\n\n constructor() {\n super();\n\n this.matchRegex = new RegExp('{{{(.+?)}}}', 'g');\n }\n\n createRenderRoot() {\n return this;\n }\n\n highlightedHit(hit) {\n return html`\n <p>${unsafeHTML(hit.replace(this.matchRegex, '<mark>$1</mark>'))}</p>\n `;\n }\n\n resultSelected() {\n this.dispatchEvent(new CustomEvent('resultSelected', {\n bubbles: true,\n composed: true,\n detail: {\n match: this.match,\n },\n }));\n }\n\n render() {\n const { match } = this;\n const { par = [] } = match;\n const [resultDetails = {}] = par;\n const pageNumber = Number.isInteger(resultDetails.page)\n ? html`<p class=\"page-num\">Page -${resultDetails.page}-</p>` : nothing;\n const coverImage = html`<img src=\"${match.cover}\" />`;\n return html`\n <li @click=${this.resultSelected}>\n ${match.cover ? coverImage : nothing}\n <h4>${match.title || nothing}</h4>\n ${pageNumber}\n ${this.highlightedHit(match.text)}\n </li>\n `;\n }\n}\ncustomElements.define('book-search-result', BookSearchResult);\n","import { css } from 'lit';\n\n// Original SVG object for reference\n// <svg height=\"10\" viewBox=\"0 0 13 10\" width=\"13\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"m4.33333333 10-4.33333333-4.16666667 1.73333333-1.66666666 2.6 2.5 6.93333337-6.66666667 1.7333333 1.66666667z\" fill=\"#fff\" fill-rule=\"evenodd\"/></svg>\n\nexport default css`data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjEwIiB2aWV3Qm94PSIwIDAgMTMgMTAiIHdpZHRoPSIxMyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJtNC4zMzMzMzMzMyAxMC00LjMzMzMzMzMzLTQuMTY2NjY2NjcgMS43MzMzMzMzMy0xLjY2NjY2NjY2IDIuNiAyLjUgNi45MzMzMzMzNy02LjY2NjY2NjY3IDEuNzMzMzMzMyAxLjY2NjY2NjY3eiIgZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIi8+PC9zdmc+`;\n","import { css } from 'lit';\n\nexport default css`data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgNDAgNDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgYXJpYS1sYWJlbGxlZGJ5PSJjbG9zZVRpdGxlSUQgY2xvc2VEZXNjSUQiPjxwYXRoIGQ9Ik0yOS4xOTIgMTAuODA4YTEuNSAxLjUgMCAwMTAgMi4xMkwyMi4xMjIgMjBsNy4wNyA3LjA3MmExLjUgMS41IDAgMDEtMi4xMiAyLjEyMWwtNy4wNzMtNy4wNy03LjA3IDcuMDdhMS41IDEuNSAwIDAxLTIuMTIxLTIuMTJsNy4wNy03LjA3My03LjA3LTcuMDdhMS41IDEuNSAwIDAxMi4xMi0yLjEyMUwyMCAxNy44NzhsNy4wNzItNy4wN2ExLjUgMS41IDAgMDEyLjEyMSAweiIgY2xhc3M9ImZpbGwtY29sb3IiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==`;\n","import { css } from 'lit';\n\nexport default css`\n .ia-button {\n min-height: 3rem;\n border: none;\n outline: none;\n cursor: pointer;\n color: var(--primaryTextColor);\n line-height: normal;\n border-radius: .4rem;\n text-align: center;\n vertical-align: middle;\n font-size: 1.4rem;\n display: inline-block;\n padding: .6rem 1.2rem;\n border: 1px solid transparent;\n\n white-space: nowrap;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n -o-user-select: none;\n user-select: none;\n }\n\n .ia-button.link,\n .ia-button.external {\n min-height: unset;\n text-decoration: none;\n }\n\n .ia-button:disabled,\n .ia-button.disabled {\n cursor: not-allowed;\n opacity: 0.5;\n }\n\n .ia-button.transparent {\n background-color: transparent;\n }\n \n .ia-button.slim {\n padding: 0;\n }\n\n .ia-button.primary {\n background-color: var(--primaryCTAFill);\n border-color: var(--primaryCTABorder);\n }\n\n .ia-button.cancel {\n background-color: var(--primaryErrorCTAFill);\n border-color: var(--primaryErrorCTABorder);\n }\n\n .ia-button.external {\n background: var(--secondaryCTAFill);\n border-color: var(--secondaryCTABorder);\n }\n`;\n","/* eslint-disable class-methods-use-this */\nimport { css, html, LitElement, nothing } from 'lit';\nimport '@internetarchive/ia-activity-indicator/ia-activity-indicator';\nimport './a-search-result.js';\nimport checkmarkIcon from '../assets/icon_checkmark.js';\nimport closeIcon from '../assets/icon_close.js';\nimport buttonCSS from '../assets/button-base.js';\n\n\nexport class IABookSearchResults extends LitElement {\n static get properties() {\n return {\n results: { type: Array },\n query: { type: String },\n queryInProgress: { type: Boolean },\n renderHeader: { type: Boolean },\n renderSearchAllFiles: { type: Boolean },\n displayResultImages: { type: Boolean },\n errorMessage: { type: String },\n };\n }\n\n constructor() {\n super();\n\n this.results = [];\n this.query = '';\n this.queryInProgress = false;\n this.renderHeader = false;\n this.renderSearchAllFields = false;\n this.displayResultImages = false;\n this.errorMessage = '';\n\n this.bindBookReaderListeners();\n }\n\n /** @inheritdoc */\n updated() {\n this.focusOnInputIfNecessary();\n }\n\n bindBookReaderListeners() {\n document.addEventListener('BookReader:SearchCallback', this.setResults.bind(this));\n }\n\n /**\n * Provide immediate input focus if there aren't any results displayed\n */\n focusOnInputIfNecessary() {\n if (this.results.length) {\n return;\n }\n const searchInput = this.shadowRoot.querySelector('input[type=\\'search\\']');\n searchInput.focus();\n }\n\n setResults({ detail }) {\n this.results = detail.results;\n }\n\n setQuery(e) {\n this.query = e.currentTarget.value;\n }\n\n performSearch(e) {\n e.preventDefault();\n const input = e.currentTarget.querySelector('input[type=\"search\"]');\n if (!input || !input.value) {\n return;\n }\n this.dispatchEvent(new CustomEvent('bookSearchInitiated', {\n bubbles: true,\n composed: true,\n detail: {\n query: this.query,\n },\n }));\n }\n\n selectResult() {\n this.dispatchEvent(new CustomEvent('closeMenu', {\n bubbles: true,\n composed: true,\n }));\n }\n\n cancelSearch() {\n this.queryInProgress = false;\n this.dispatchSearchCanceled();\n }\n\n dispatchSearchCanceled() {\n this.dispatchEvent(new Event('bookSearchCanceled'));\n }\n\n get resultsCount() {\n const count = this.results.length;\n return count ? html`<p>(${count} result${count > 1 ? 's' : ''})</p>` : nothing;\n }\n\n get headerSection() {\n const header = html`<header>\n <h3>Search inside</h3>\n ${this.resultsCount}\n </header>`;\n return this.renderHeader ? header : nothing;\n }\n\n get searchMultipleControls() {\n const controls = html`\n <input name=\"all_files\" id=\"all_files\" type=\"checkbox\" />\n <label class=\"checkbox\" for=\"all_files\">Search all files</label>\n `;\n return this.renderSearchAllFiles ? controls : nothing;\n }\n\n get loadingIndicator() {\n return html`\n <div class=\"loading\">\n <ia-activity-indicator mode=\"processing\"></ia-activity-indicator>\n <p>Searching</p>\n <button class=\"ia-button external cancel-search\" @click=${this.cancelSearch}>Cancel</button>\n </div>\n `;\n }\n\n get resultsSet() {\n const resultsClass = this.displayResultImages ? 'show-image' : '';\n return html`\n <ul class=\"results ${resultsClass}\">\n ${this.results.map(match => html`\n <book-search-result\n .match=${match}\n @resultSelected=${this.selectResult}\n ></book-search-result>\n `)}\n </ul>\n `;\n }\n\n get searchForm() {\n return html`\n <form action=\"\" method=\"get\" @submit=${this.performSearch}>\n <fieldset>\n ${this.searchMultipleControls}\n <input\n type=\"search\"\n name=\"query\"\n alt=\"Search inside this book.\"\n @keyup=${this.setQuery}\n .value=${this.query}\n />\n </fieldset>\n </form>\n `;\n }\n\n get setErrorMessage() {\n return html`\n <p class=\"error-message\">${this.errorMessage}</p>\n `;\n }\n\n get searchCTA() {\n return html`<p class=\"search-cta\"><em>Please enter text to search for</em></p>`;\n }\n\n render() {\n const showSearchCTA = (!this.queryInProgress && !this.errorMessage)\n && (!this.queryInProgress && !this.results.length);\n return html`\n ${this.headerSection}\n ${this.searchForm}\n <div class=\"results-container\">\n ${this.queryInProgress ? this.loadingIndicator : nothing}\n ${this.errorMessage ? this.setErrorMessage : nothing}\n ${this.results.length ? this.resultsSet : nothing}\n ${showSearchCTA ? this.searchCTA : nothing}\n </div>\n `;\n }\n\n static get styles() {\n const searchResultText = css`var(--searchResultText, #adaedc)`;\n const searchResultBg = css`var(--searchResultBg, #272958)`;\n const searchResultBorder = css`var(--searchResultBorder, #adaedc)`;\n const activeButtonBg = css`(--tertiaryBGColor, #333)`;\n\n const mainCSS = css`\n :host {\n display: block;\n height: 100%;\n padding: 1.5rem 1rem 2rem 0;\n overflow-y: auto;\n font-size: 1.4rem;\n box-sizing: border-box;\n }\n\n mark {\n padding: 0 .2rem;\n color: ${searchResultText};\n background: ${searchResultBg};\n border: 1px solid ${searchResultBorder};\n border-radius: 2px;\n }\n\n h3 {\n padding: 0;\n margin: 0 1rem 0 0;\n font-size: 2rem;\n }\n\n header {\n display: flex;\n align-items: center;\n padding: 0 2rem 0 0;\n }\n header p {\n padding: 0;\n margin: 0;\n font-size: 1.2rem;\n font-weight: bold;\n font-style: italic;\n }\n\n fieldset {\n padding: 0 0 1rem 0;\n border: none;\n }\n\n [type=\"checkbox\"] {\n display: none;\n }\n\n label {\n display: block;\n text-align: center;\n }\n\n label.checkbox {\n padding-bottom: .5rem;\n font-size: 1.6rem;\n line-height: 150%;\n vertical-align: middle;\n }\n\n label.checkbox:after {\n display: inline-block;\n width: 14px;\n height: 14px;\n margin-left: .7rem;\n content: \"\";\n border-radius: 2px;\n }\n :checked + label.checkbox:after {\n background-image: url('${checkmarkIcon}');\n }\n\n label.checkbox[for=\"all_files\"]:after {\n background: ${activeButtonBg} 50% 50% no-repeat;\n border: 1px solid var(--primaryTextColor);\n }\n\n [type=\"search\"] {\n color: var(--primaryTextColor);\n border: 1px solid var(--primaryTextColor);\n -webkit-appearance: textfield;\n width: 100%;\n height: 3rem;\n padding: 0 1.5rem;\n box-sizing: border-box;\n font: normal 1.6rem \"Helvetica qNeue\", Helvetica, Arial, sans-serif;\n border-radius: 1.5rem;\n background: transparent;\n }\n [type=\"search\"]:focus {\n outline: none;\n }\n [type=\"search\"]::-webkit-search-cancel-button {\n width: 18px;\n height: 18px;\n -webkit-appearance: none;\n appearance: none;\n -webkit-mask: url('${closeIcon}') 0 0 no-repeat;\n mask: url('${closeIcon}') 0 0 no-repeat;\n -webkit-mask-size: 100%;\n mask-size: 100%;\n background: #fff;\n }\n\n p.page-num {\n font-weight: bold;\n padding-bottom: 0;\n }\n\n p.search-cta {\n text-align: center;\n }\n\n .results-container {\n padding-bottom: 2rem;\n }\n\n ul {\n padding: 0 0 2rem 0;\n margin: 0;\n list-style: none;\n }\n\n ul.show-image li {\n display: grid;\n }\n\n li {\n cursor: pointer;\n grid-template-columns: 30px 1fr;\n grid-gap: 0 .5rem;\n }\n\n li img {\n display: block;\n width: 100%;\n }\n\n li h4 {\n grid-column: 2 / 3;\n padding: 0 0 2rem 0;\n margin: 0;\n font-weight: normal;\n }\n\n li p {\n grid-column: 2 / 3;\n padding: 0 0 1.5rem 0;\n margin: 0;\n font-size: 1.2rem;\n }\n\n .loading {\n text-align: center;\n }\n\n .loading p {\n padding: 0 0 1rem 0;\n margin: 0;\n font-size: 1.2rem;\n }\n\n ia-activity-indicator {\n display: block;\n width: 40px;\n height: 40px;\n margin: 0 auto;\n }\n `;\n return [buttonCSS, mainCSS];\n }\n}\ncustomElements.define('ia-book-search-results', IABookSearchResults);\n","import { html, nothing } from 'lit';\nimport '@internetarchive/icon-search/icon-search';\nimport './search-results';\n\nlet searchState = {\n query: '',\n results: [],\n resultsCount: 0,\n queryInProgress: false,\n errorMessage: '',\n};\nexport default class SearchProvider {\n constructor({\n onProviderChange,\n bookreader\n }) {\n /* search menu events */\n this.onBookSearchInitiated = this.onBookSearchInitiated.bind(this);\n /* bookreader search events */\n this.onSearchStarted = this.onSearchStarted.bind(this);\n this.onSearchRequestError = this.onSearchRequestError.bind(this);\n this.onSearchResultsClicked = this.onSearchResultsClicked.bind(this);\n this.onSearchResultsChange = this.onSearchResultsChange.bind(this);\n this.onSearchResultsCleared = this.onSearchResultsCleared.bind(this);\n this.searchCanceledInMenu = this.searchCanceledInMenu.bind(this);\n\n /* class methods */\n this.bindEventListeners = this.bindEventListeners.bind(this);\n this.getMenuDetails = this.getMenuDetails.bind(this);\n this.getComponent = this.getComponent.bind(this);\n this.advanceToPage = this.advanceToPage.bind(this);\n this.updateMenu = this.updateMenu.bind(this);\n\n this.onProviderChange = onProviderChange;\n this.bookreader = bookreader;\n this.icon = html`<ia-icon-search style=\"width: var(--iconWidth); height: var(--iconHeight);\"></ia-icon-search>`;\n this.label = 'Search inside';\n this.menuDetails = this.getMenuDetails();\n this.id = 'search';\n this.component = this.getComponent();\n this.bindEventListeners();\n }\n\n getMenuDetails() {\n const { resultsCount, query, queryInProgress } = searchState;\n if (queryInProgress || !query) { return nothing; }\n const unit = resultsCount === 1 ? 'result' : 'results';\n return html`(${resultsCount} ${unit})`;\n }\n\n bindEventListeners() {\n window.addEventListener('BookReader:SearchStarted', this.onSearchStarted);\n window.addEventListener('BookReader:SearchCallback', this.onSearchResultsChange);\n window.addEventListener('BookReader:SearchCallbackEmpty', (event) => { this.onSearchRequestError(event, 'noResults'); });\n window.addEventListener('BookReader:SearchCallbackNotIndexed', (event) => { this.onSearchRequestError(event, 'notIndexed'); });\n window.addEventListener('BookReader:SearchCallbackError', (event) => { this.onSearchRequestError(event); });\n window.addEventListener('BookReader:SearchResultsCleared', () => { this.onSearchResultsCleared(); });\n window.addEventListener('BookReader:SearchCanceled', (e) => { this.onSearchCanceled(e); });\n }\n\n /**\n * Cancel search handler\n * resets `searchState`\n */\n onSearchCanceled() {\n searchState = {\n query: '',\n results: [],\n resultsCount: 0,\n queryInProgress: false,\n errorMessage: '',\n };\n const updateMenuFor = {\n searchCanceled: true\n };\n this.updateMenu(updateMenuFor);\n }\n\n onSearchStarted(e) {\n const { term = '', instance } = e.detail.props;\n if (instance) {\n this.bookreader = instance;\n }\n searchState.query = term;\n searchState.results = [];\n searchState.resultsCount = 0;\n searchState.queryInProgress = true;\n searchState.errorMessage = '';\n this.updateMenu();\n }\n\n onBookSearchInitiated({ detail }) {\n searchState.query = detail.query;\n this.bookreader.search(searchState.query);\n }\n\n onSearchRequestError(event, errorType = 'default') {\n const { detail: { props = {} } } = event;\n const { instance = null } = props;\n if (instance) {\n /* keep bookreader instance reference up-to-date */\n this.bookreader = instance;\n }\n const errorMessages = {\n noResults: '0 results',\n notIndexed: `This book hasn't been indexed for searching yet. We've just started indexing it,\n so search should be available soon. Please try again later. Thanks!`,\n default: 'Sorry, there was an error with your search. Please try again.',\n };\n\n const messageToShow = errorMessages[errorType] ?? errorMessages.default;\n searchState.query = instance?.searchResults?.q || '';\n searchState.results = [];\n searchState.resultsCount = 0;\n searchState.queryInProgress = false;\n searchState.errorMessage = html`<p class=\"error\">${messageToShow}</p>`;\n this.updateMenu();\n }\n\n onSearchResultsChange({ detail: { props = {} } }) {\n const { instance = null, results: searchResults = [] } = props;\n if (instance) {\n /* keep bookreader instance reference up-to-date */\n this.bookreader = instance;\n }\n const results = searchResults.matches || [];\n const resultsCount = results.length;\n const query = searchResults.q;\n const queryInProgress = false;\n searchState = { results, resultsCount, query, queryInProgress, errorMessage: '' };\n this.updateMenu();\n }\n\n searchCanceledInMenu() {\n this.bookreader?.cancelSearchRequest();\n }\n\n onSearchResultsCleared() {\n searchState = {\n query: '',\n results: [],\n resultsCount: 0,\n queryInProgress: false,\n errorMessage: '',\n };\n this.updateMenu({ openMenu: false });\n this.bookreader?.searchView?.clearSearchFieldAndResults(false);\n }\n\n /**\n * Relays how to update side menu given the context of a search update\n @param {{searchCanceled: boolean}} searchUpdates\n */\n updateMenu(searchUpdates = {}) {\n this.menuDetails = this.getMenuDetails();\n this.component = this.getComponent();\n this.onProviderChange(this.bookreader, searchUpdates);\n }\n\n getComponent() {\n const { query, results, queryInProgress, errorMessage } = searchState;\n return html`\n <ia-book-search-results\n .query=${query}\n .results=${results}\n .errorMessage=${errorMessage}\n ?queryInProgress=${queryInProgress}\n ?renderSearchAllFiles=${false}\n @resultSelected=${this.onSearchResultsClicked}\n @bookSearchInitiated=${this.onBookSearchInitiated}\n @bookSearchResultsCleared=${this.onSearchResultsCleared}\n @bookSearchCanceled=${this.searchCanceledInMenu}\n ></ia-book-search-results>\n `;\n }\n\n onSearchResultsClicked({ detail }) {\n const page = detail.match.par[0].page;\n this.advanceToPage(page);\n }\n\n advanceToPage(leaf) {\n const page = this.bookreader.leafNumToIndex(leaf);\n this.bookreader._searchPluginGoToResult(page);\n }\n}\n","import { html } from 'lit-html';\n\nexport default html`\n<svg\n viewBox=\"0 0 24 24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-labelledby=\"downloadTitleID downloadDescID\"\n>\n <title id=\"downloadTitleID\">Download icon</title>\n <desc id=\"downloadDescID\">An arrow pointing downward at an empty document tray</desc>\n <g class=\"fill-color\" fill-rule=\"nonzero\">\n <path d=\"m1.04347826 22c-.57629713 0-1.04347826.4477153-1.04347826 1s.46718113 1 1.04347826 1h21.91304344c.5762972 0 1.0434783-.4477153 1.0434783-1s-.4671811-1-1.0434783-1z\"/>\n <path d=\"m12 0c-.8284271 0-1.5.67526574-1.5 1.50824823v8.0007855h-4.75l6.25 10.49096627 6.25-10.49096627h-4.75v-8.0007855c0-.83298249-.6715729-1.50824823-1.5-1.50824823z\"/>\n </g>\n</svg>\n`;\n","import icon from './index.js';\nimport { css, LitElement } from 'lit-element';\n\nclass IAIconDl extends LitElement {\n static get styles() {\n return css`\n :host {\n width: var(--iconWidth, 'auto');\n height: var(--iconHeight, 'auto');\n }\n\n .fill-color {\n fill: var(--iconFillColor);\n }\n\n .stroke-color {\n stroke: var(--iconStrokeColor);\n }\n `;\n }\n\n render() {\n return icon;\n }\n}\n\ncustomElements.define('ia-icon-dl', IAIconDl);\n\nexport default IAIconDl;","import { css, html, LitElement, nothing } from 'lit';\nimport buttonStyles from '../assets/button-base.js';\nexport class IABookDownloads extends LitElement {\n static get properties() {\n return {\n downloads: { type: Array },\n expiration: { type: Number },\n renderHeader: { type: Boolean },\n isBookProtected: { type: Boolean },\n };\n }\n\n constructor() {\n super();\n this.downloads = [];\n this.expiration = 0;\n this.renderHeader = false;\n this.isBookProtected = false;\n }\n\n get formatsCount() {\n const count = this.downloads.length;\n return count ? html`<p>${count} format${count > 1 ? 's' : ''}</p>` : html``;\n }\n\n get loanExpiryMessage() {\n return this.expiration\n ? html`<h2>These files will expire in ${this.expiration} days.</h2>`\n : html``;\n }\n\n renderDownloadOptions() {\n return this.downloads.map(option => (\n html`\n <li>\n <a class=\"ia-button link primary\" href=\"${option.url}\">Get ${option.type}</a>\n ${option.note ? html`<p>${option.note}</p>` : html``}\n </li>\n `\n ));\n }\n\n get header() {\n if (!this.renderHeader) {\n return nothing;\n }\n return html`\n <header>\n <h3>Downloadable files</h3>\n ${this.formatsCount}\n </header>\n `;\n }\n\n get accessProtectedBook() {\n return html`\n <p>To access downloaded books, you need Adobe-compliant software on your device. The Internet Archive will administer this loan, but Adobe may also collect some information.</p>\n <a class=\"ia-button external primary\" href=\"https://www.adobe.com/solutions/ebook/digital-editions/download.html\" rel=\"noopener noreferrer\" target=\"_blank\">Install Adobe Digital Editions</a>\n `;\n }\n\n render() {\n return html`\n ${this.header}\n ${this.loanExpiryMessage}\n <ul>${this.renderDownloadOptions()}</ul>\n ${this.isBookProtected ? this.accessProtectedBook : nothing}\n `;\n }\n\n static get styles() {\n const mainCss = css`\n :host {\n display: block;\n height: 100%;\n padding: 1.5rem 0;\n overflow-y: auto;\n font-size: 1.4rem;\n box-sizing: border-box;\n }\n\n a.close ia-icon {\n --iconWidth: 18px;\n --iconHeight: 18px;\n }\n a.close {\n justify-self: end;\n }\n\n header {\n display: flex;\n align-items: center;\n padding: 0 2rem;\n }\n header p {\n padding: 0;\n margin: 0;\n font-size: 1.2rem;\n font-weight: bold;\n font-style: italic;\n }\n header div {\n display: flex;\n align-items: baseline;\n } \n\n h2 {\n font-size: 1.6rem;\n }\n\n h3 {\n padding: 0;\n margin: 0 1rem 0 0;\n font-size: 1.4rem;\n }\n\n ul {\n padding: 0;\n margin: 0;\n list-style: none;\n }\n\n p {\n margin: .3rem 0 0 0;\n }\n\n li,\n ul + p {\n padding-bottom: 1.2rem;\n font-size: 1.2rem;\n line-height: 140%;\n }\n `;\n\n return [buttonStyles, mainCss];\n }\n}\ncustomElements.define('ia-book-downloads', IABookDownloads);\n","import { html } from 'lit';\nimport '@internetarchive/icon-dl/icon-dl';\nimport './downloads';\n\nconst menuBase = {\n pdf: {\n type: 'Encrypted Adobe PDF',\n url: '#',\n note: 'PDF files contain high quality images of pages.',\n },\n epub: {\n type: 'Encrypted Adobe ePub',\n url: '#',\n note: 'ePub files are smaller in size, but may contain errors.',\n }\n};\n\nconst publicMenuBase = {\n pdf: \"PDF\",\n epub: \"ePub\"\n};\n\nexport default class DownloadsProvider {\n\n constructor({ bookreader }) {\n this.icon = html`<ia-icon-dl style=\"width: var(--iconWidth); height: var(--iconHeight);\"></ia-icon-dl>`;\n this.label = 'Downloadable files';\n this.menuDetails = '';\n this.downloads = [];\n this.id = 'downloads';\n this.component = '';\n this.isBookProtected = bookreader?.options?.isProtected || false;\n\n this.computeAvailableTypes = this.computeAvailableTypes.bind(this);\n this.update = this.update.bind(this);\n }\n\n update(downloadTypes) {\n this.computeAvailableTypes(downloadTypes);\n this.component = this.menu;\n this.component.isBookProtected = this.isBookProtected;\n\n const ending = this.downloads.length === 1 ? '' : 's';\n this.menuDetails = `(${this.downloads.length} format${ending})`;\n }\n\n /**\n * Generates Download Menu Info for available types\n * sets global `downloads`\n * @param availableTypes\n */\n computeAvailableTypes(availableTypes = []) {\n const menuData = availableTypes.reduce((found, incoming = []) => {\n const [ type = '', link = '' ] = incoming;\n const formattedType = type.toLowerCase();\n const downloadOption = menuBase[formattedType] || null;\n\n if (downloadOption) {\n const menuButtonText = this.isBookProtected ? menuBase[formattedType].type : publicMenuBase[formattedType];\n const menuInfo = Object.assign({}, downloadOption, { url: link, type: menuButtonText});\n found.push(menuInfo);\n }\n return found;\n }, []);\n\n this.downloads = menuData;\n }\n\n get menu () {\n return html`<ia-book-downloads .downloads=${this.downloads}></ia-book-downloads>`;\n }\n}\n","import { html } from 'lit';\n\nexport default html`\n<svg\n viewBox=\"0 0 24 24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-labelledby=\"visualAdjustmentTitleID visualAdjustmentDescID\"\n>\n <title id=\"visualAdjustmentTitleID\">Visual adjustment</title>\n <desc id=\"visualAdjustmentDescID\">A circle with its left hemisphere filled</desc>\n <path class=\"fill-color\" d=\"m12 0c6.627417 0 12 5.372583 12 12s-5.372583 12-12 12-12-5.372583-12-12 5.372583-12 12-12zm0 2v20l.2664041-.0034797c5.399703-.1412166 9.7335959-4.562751 9.7335959-9.9965203 0-5.5228475-4.4771525-10-10-10z\" fill-rule=\"evenodd\" />\n</svg>\n`;\n","import { css, LitElement } from 'lit';\nimport icon from './index.js';\n\nclass IAIconVisualAdjustment extends LitElement {\n static get styles() {\n return css`\n :host {\n width: var(--iconWidth, 'auto');\n height: var(--iconHeight, 'auto');\n }\n\n .fill-color {\n fill: var(--iconFillColor);\n }\n\n .stroke-color {\n stroke: var(--iconStrokeColor);\n }\n `;\n }\n\n render() {\n return icon;\n }\n}\n\ncustomElements.define('ia-icon-visual-adjustment', IAIconVisualAdjustment);\n\nexport default IAIconVisualAdjustment;\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {_$LH, Part, DirectiveParent, TemplateResult} from './lit-html.js';\nimport {\n DirectiveResult,\n DirectiveClass,\n PartInfo,\n AttributePartInfo,\n} from './directive.js';\ntype Primitive = null | undefined | boolean | number | string | symbol | bigint;\n\nconst {_ChildPart: ChildPart} = _$LH;\n\ntype ChildPart = InstanceType<typeof ChildPart>;\n\nconst ENABLE_SHADYDOM_NOPATCH = true;\n\nconst wrap =\n ENABLE_SHADYDOM_NOPATCH &&\n window.ShadyDOM?.inUse &&\n window.ShadyDOM?.noPatch === true\n ? window.ShadyDOM!.wrap\n : (node: Node) => node;\n\n/**\n * Tests if a value is a primitive value.\n *\n * See https://tc39.github.io/ecma262/#sec-typeof-operator\n */\nexport const isPrimitive = (value: unknown): value is Primitive =>\n value === null || (typeof value != 'object' && typeof value != 'function');\n\nexport const TemplateResultType = {\n HTML: 1,\n SVG: 2,\n} as const;\n\nexport type TemplateResultType =\n typeof TemplateResultType[keyof typeof TemplateResultType];\n\n/**\n * Tests if a value is a TemplateResult.\n */\nexport const isTemplateResult = (\n value: unknown,\n type?: TemplateResultType\n): value is TemplateResult =>\n type === undefined\n ? // This property needs to remain unminified.\n (value as TemplateResult)?.['_$litType$'] !== undefined\n : (value as TemplateResult)?.['_$litType$'] === type;\n\n/**\n * Tests if a value is a DirectiveResult.\n */\nexport const isDirectiveResult = (value: unknown): value is DirectiveResult =>\n // This property needs to remain unminified.\n (value as DirectiveResult)?.['_$litDirective$'] !== undefined;\n\n/**\n * Retrieves the Directive class for a DirectiveResult\n */\nexport const getDirectiveClass = (value: unknown): DirectiveClass | undefined =>\n // This property needs to remain unminified.\n (value as DirectiveResult)?.['_$litDirective$'];\n\n/**\n * Tests whether a part has only a single-expression with no strings to\n * interpolate between.\n *\n * Only AttributePart and PropertyPart can have multiple expressions.\n * Multi-expression parts have a `strings` property and single-expression\n * parts do not.\n */\nexport const isSingleExpression = (part: PartInfo) =>\n (part as AttributePartInfo).strings === undefined;\n\nconst createMarker = () => document.createComment('');\n\n/**\n * Inserts a ChildPart into the given container ChildPart's DOM, either at the\n * end of the container ChildPart, or before the optional `refPart`.\n *\n * This does not add the part to the containerPart's committed value. That must\n * be done by callers.\n *\n * @param containerPart Part within which to add the new ChildPart\n * @param refPart Part before which to add the new ChildPart; when omitted the\n * part added to the end of the `containerPart`\n * @param part Part to insert, or undefined to create a new part\n */\nexport const insertPart = (\n containerPart: ChildPart,\n refPart?: ChildPart,\n part?: ChildPart\n): ChildPart => {\n const container = wrap(containerPart._$startNode).parentNode!;\n\n const refNode =\n refPart === undefined ? containerPart._$endNode : refPart._$startNode;\n\n if (part === undefined) {\n const startNode = wrap(container).insertBefore(createMarker(), refNode);\n const endNode = wrap(container).insertBefore(createMarker(), refNode);\n part = new ChildPart(\n startNode,\n endNode,\n containerPart,\n containerPart.options\n );\n } else {\n const endNode = wrap(part._$endNode!).nextSibling;\n const oldParent = part._$parent;\n const parentChanged = oldParent !== containerPart;\n if (parentChanged) {\n part._$reparentDisconnectables?.(containerPart);\n // Note that although `_$reparentDisconnectables` updates the part's\n // `_$parent` reference after unlinking from its current parent, that\n // method only exists if Disconnectables are present, so we need to\n // unconditionally set it here\n part._$parent = containerPart;\n // Since the _$isConnected getter is somewhat costly, only\n // read it once we know the subtree has directives that need\n // to be notified\n let newConnectionState;\n if (\n part._$notifyConnectionChanged !== undefined &&\n (newConnectionState = containerPart._$isConnected) !==\n oldParent!._$isConnected\n ) {\n part._$notifyConnectionChanged(newConnectionState);\n }\n }\n if (endNode !== refNode || parentChanged) {\n let start: Node | null = part._$startNode;\n while (start !== endNode) {\n const n: Node | null = wrap(start!).nextSibling;\n wrap(container).insertBefore(start!, refNode);\n start = n;\n }\n }\n }\n\n return part;\n};\n\n/**\n * Sets the value of a Part.\n *\n * Note that this should only be used to set/update the value of user-created\n * parts (i.e. those created using `insertPart`); it should not be used\n * by directives to set the value of the directive's container part. Directives\n * should return a value from `update`/`render` to update their part state.\n *\n * For directives that require setting their part value asynchronously, they\n * should extend `AsyncDirective` and call `this.setValue()`.\n *\n * @param part Part to set\n * @param value Value to set\n * @param index For `AttributePart`s, the index to set\n * @param directiveParent Used internally; should not be set by user\n */\nexport const setChildPartValue = <T extends ChildPart>(\n part: T,\n value: unknown,\n directiveParent: DirectiveParent = part\n): T => {\n part._$setValue(value, directiveParent);\n return part;\n};\n\n// A sentinal value that can never appear as a part value except when set by\n// live(). Used to force a dirty-check to fail and cause a re-render.\nconst RESET_VALUE = {};\n\n/**\n * Sets the committed value of a ChildPart directly without triggering the\n * commit stage of the part.\n *\n * This is useful in cases where a directive needs to update the part such\n * that the next update detects a value change or not. When value is omitted,\n * the next update will be guaranteed to be detected as a change.\n *\n * @param part\n * @param value\n */\nexport const setCommittedValue = (part: Part, value: unknown = RESET_VALUE) =>\n (part._$committedValue = value);\n\n/**\n * Returns the committed value of a ChildPart.\n *\n * The committed value is used for change detection and efficient updates of\n * the part. It can differ from the value set by the template or directive in\n * cases where the template value is transformed before being commited.\n *\n * - `TemplateResult`s are committed as a `TemplateInstance`\n * - Iterables are committed as `Array<ChildPart>`\n * - All other types are committed as the template value or value returned or\n * set by a directive.\n *\n * @param part\n */\nexport const getCommittedValue = (part: ChildPart) => part._$committedValue;\n\n/**\n * Removes a ChildPart from the DOM, including any of its content.\n *\n * @param part The Part to remove\n */\nexport const removePart = (part: ChildPart) => {\n part._$notifyConnectionChanged?.(false, true);\n let start: ChildNode | null = part._$startNode;\n const end: ChildNode | null = wrap(part._$endNode!).nextSibling;\n while (start !== end) {\n const n: ChildNode | null = wrap(start!).nextSibling;\n (wrap(start!) as ChildNode).remove();\n start = n;\n }\n};\n\nexport const clearPart = (part: ChildPart) => {\n part._$clear();\n};\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {ChildPart, noChange} from '../lit-html.js';\nimport {directive, Directive, PartInfo, PartType} from '../directive.js';\nimport {\n insertPart,\n getCommittedValue,\n removePart,\n setCommittedValue,\n setChildPartValue,\n} from '../directive-helpers.js';\n\nexport type KeyFn<T> = (item: T, index: number) => unknown;\nexport type ItemTemplate<T> = (item: T, index: number) => unknown;\n\n// Helper for generating a map of array item to its index over a subset\n// of an array (used to lazily generate `newKeyToIndexMap` and\n// `oldKeyToIndexMap`)\nconst generateMap = (list: unknown[], start: number, end: number) => {\n const map = new Map<unknown, number>();\n for (let i = start; i <= end; i++) {\n map.set(list[i], i);\n }\n return map;\n};\n\nclass RepeatDirective extends Directive {\n private _itemKeys?: unknown[];\n\n constructor(partInfo: PartInfo) {\n super(partInfo);\n if (partInfo.type !== PartType.CHILD) {\n throw new Error('repeat() can only be used in text expressions');\n }\n }\n\n private _getValuesAndKeys<T>(\n items: Iterable<T>,\n keyFnOrTemplate: KeyFn<T> | ItemTemplate<T>,\n template?: ItemTemplate<T>\n ) {\n let keyFn: KeyFn<T> | undefined;\n if (template === undefined) {\n template = keyFnOrTemplate;\n } else if (keyFnOrTemplate !== undefined) {\n keyFn = keyFnOrTemplate as KeyFn<T>;\n }\n const keys = [];\n const values = [];\n let index = 0;\n for (const item of items) {\n keys[index] = keyFn ? keyFn(item, index) : index;\n values[index] = template!(item, index);\n index++;\n }\n return {\n values,\n keys,\n };\n }\n\n render<T>(items: Iterable<T>, template: ItemTemplate<T>): Array<unknown>;\n render<T>(\n items: Iterable<T>,\n keyFn: KeyFn<T> | ItemTemplate<T>,\n template: ItemTemplate<T>\n ): Array<unknown>;\n render<T>(\n items: Iterable<T>,\n keyFnOrTemplate: KeyFn<T> | ItemTemplate<T>,\n template?: ItemTemplate<T>\n ) {\n return this._getValuesAndKeys(items, keyFnOrTemplate, template).values;\n }\n\n override update<T>(\n containerPart: ChildPart,\n [items, keyFnOrTemplate, template]: [\n Iterable<T>,\n KeyFn<T> | ItemTemplate<T>,\n ItemTemplate<T>\n ]\n ) {\n // Old part & key lists are retrieved from the last update (which may\n // be primed by hydration)\n const oldParts = getCommittedValue(\n containerPart\n ) as Array<ChildPart | null>;\n const {values: newValues, keys: newKeys} = this._getValuesAndKeys(\n items,\n keyFnOrTemplate,\n template\n );\n\n // We check that oldParts, the committed value, is an Array as an\n // indicator that the previous value came from a repeat() call. If\n // oldParts is not an Array then this is the first render and we return\n // an array for lit-html's array handling to render, and remember the\n // keys.\n if (!Array.isArray(oldParts)) {\n this._itemKeys = newKeys;\n return newValues;\n }\n\n // In SSR hydration it's possible for oldParts to be an arrray but for us\n // to not have item keys because the update() hasn't run yet. We set the\n // keys to an empty array. This will cause all oldKey/newKey comparisons\n // to fail and execution to fall to the last nested brach below which\n // reuses the oldPart.\n const oldKeys = (this._itemKeys ??= []);\n\n // New part list will be built up as we go (either reused from\n // old parts or created for new keys in this update). This is\n // saved in the above cache at the end of the update.\n const newParts: ChildPart[] = [];\n\n // Maps from key to index for current and previous update; these\n // are generated lazily only when needed as a performance\n // optimization, since they are only required for multiple\n // non-contiguous changes in the list, which are less common.\n let newKeyToIndexMap!: Map<unknown, number>;\n let oldKeyToIndexMap!: Map<unknown, number>;\n\n // Head and tail pointers to old parts and new values\n let oldHead = 0;\n let oldTail = oldParts.length - 1;\n let newHead = 0;\n let newTail = newValues.length - 1;\n\n // Overview of O(n) reconciliation algorithm (general approach\n // based on ideas found in ivi, vue, snabbdom, etc.):\n //\n // * We start with the list of old parts and new values (and\n // arrays of their respective keys), head/tail pointers into\n // each, and we build up the new list of parts by updating\n // (and when needed, moving) old parts or creating new ones.\n // The initial scenario might look like this (for brevity of\n // the diagrams, the numbers in the array reflect keys\n // associated with the old parts or new values, although keys\n // and parts/values are actually stored in parallel arrays\n // indexed using the same head/tail pointers):\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, 2, 3, 4, 5, 6]\n // newParts: [ , , , , , , ]\n // newKeys: [0, 2, 1, 4, 3, 7, 6] <- reflects the user's new\n // item order\n // newHead ^ ^ newTail\n //\n // * Iterate old & new lists from both sides, updating,\n // swapping, or removing parts at the head/tail locations\n // until neither head nor tail can move.\n //\n // * Example below: keys at head pointers match, so update old\n // part 0 in-place (no need to move it) and record part 0 in\n // the `newParts` list. The last thing we do is advance the\n // `oldHead` and `newHead` pointers (will be reflected in the\n // next diagram).\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, 2, 3, 4, 5, 6]\n // newParts: [0, , , , , , ] <- heads matched: update 0\n // newKeys: [0, 2, 1, 4, 3, 7, 6] and advance both oldHead\n // & newHead\n // newHead ^ ^ newTail\n //\n // * Example below: head pointers don't match, but tail\n // pointers do, so update part 6 in place (no need to move\n // it), and record part 6 in the `newParts` list. Last,\n // advance the `oldTail` and `oldHead` pointers.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, 2, 3, 4, 5, 6]\n // newParts: [0, , , , , , 6] <- tails matched: update 6\n // newKeys: [0, 2, 1, 4, 3, 7, 6] and advance both oldTail\n // & newTail\n // newHead ^ ^ newTail\n //\n // * If neither head nor tail match; next check if one of the\n // old head/tail items was removed. We first need to generate\n // the reverse map of new keys to index (`newKeyToIndexMap`),\n // which is done once lazily as a performance optimization,\n // since we only hit this case if multiple non-contiguous\n // changes were made. Note that for contiguous removal\n // anywhere in the list, the head and tails would advance\n // from either end and pass each other before we get to this\n // case and removals would be handled in the final while loop\n // without needing to generate the map.\n //\n // * Example below: The key at `oldTail` was removed (no longer\n // in the `newKeyToIndexMap`), so remove that part from the\n // DOM and advance just the `oldTail` pointer.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, 2, 3, 4, 5, 6]\n // newParts: [0, , , , , , 6] <- 5 not in new map: remove\n // newKeys: [0, 2, 1, 4, 3, 7, 6] 5 and advance oldTail\n // newHead ^ ^ newTail\n //\n // * Once head and tail cannot move, any mismatches are due to\n // either new or moved items; if a new key is in the previous\n // \"old key to old index\" map, move the old part to the new\n // location, otherwise create and insert a new part. Note\n // that when moving an old part we null its position in the\n // oldParts array if it lies between the head and tail so we\n // know to skip it when the pointers get there.\n //\n // * Example below: neither head nor tail match, and neither\n // were removed; so find the `newHead` key in the\n // `oldKeyToIndexMap`, and move that old part's DOM into the\n // next head position (before `oldParts[oldHead]`). Last,\n // null the part in the `oldPart` array since it was\n // somewhere in the remaining oldParts still to be scanned\n // (between the head and tail pointers) so that we know to\n // skip that old part on future iterations.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, -, 3, 4, 5, 6]\n // newParts: [0, 2, , , , , 6] <- stuck: update & move 2\n // newKeys: [0, 2, 1, 4, 3, 7, 6] into place and advance\n // newHead\n // newHead ^ ^ newTail\n //\n // * Note that for moves/insertions like the one above, a part\n // inserted at the head pointer is inserted before the\n // current `oldParts[oldHead]`, and a part inserted at the\n // tail pointer is inserted before `newParts[newTail+1]`. The\n // seeming asymmetry lies in the fact that new parts are\n // moved into place outside in, so to the right of the head\n // pointer are old parts, and to the right of the tail\n // pointer are new parts.\n //\n // * We always restart back from the top of the algorithm,\n // allowing matching and simple updates in place to\n // continue...\n //\n // * Example below: the head pointers once again match, so\n // simply update part 1 and record it in the `newParts`\n // array. Last, advance both head pointers.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, -, 3, 4, 5, 6]\n // newParts: [0, 2, 1, , , , 6] <- heads matched: update 1\n // newKeys: [0, 2, 1, 4, 3, 7, 6] and advance both oldHead\n // & newHead\n // newHead ^ ^ newTail\n //\n // * As mentioned above, items that were moved as a result of\n // being stuck (the final else clause in the code below) are\n // marked with null, so we always advance old pointers over\n // these so we're comparing the next actual old value on\n // either end.\n //\n // * Example below: `oldHead` is null (already placed in\n // newParts), so advance `oldHead`.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, -, 3, 4, 5, 6] <- old head already used:\n // newParts: [0, 2, 1, , , , 6] advance oldHead\n // newKeys: [0, 2, 1, 4, 3, 7, 6]\n // newHead ^ ^ newTail\n //\n // * Note it's not critical to mark old parts as null when they\n // are moved from head to tail or tail to head, since they\n // will be outside the pointer range and never visited again.\n //\n // * Example below: Here the old tail key matches the new head\n // key, so the part at the `oldTail` position and move its\n // DOM to the new head position (before `oldParts[oldHead]`).\n // Last, advance `oldTail` and `newHead` pointers.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, -, 3, 4, 5, 6]\n // newParts: [0, 2, 1, 4, , , 6] <- old tail matches new\n // newKeys: [0, 2, 1, 4, 3, 7, 6] head: update & move 4,\n // advance oldTail & newHead\n // newHead ^ ^ newTail\n //\n // * Example below: Old and new head keys match, so update the\n // old head part in place, and advance the `oldHead` and\n // `newHead` pointers.\n //\n // oldHead v oldTail\n // oldKeys: [0, 1, -, 3, 4, 5, 6]\n // newParts: [0, 2, 1, 4, 3, ,6] <- heads match: update 3\n // newKeys: [0, 2, 1, 4, 3, 7, 6] and advance oldHead &\n // newHead\n // newHead ^ ^ newTail\n //\n // * Once the new or old pointers move past each other then all\n // we have left is additions (if old list exhausted) or\n // removals (if new list exhausted). Those are handled in the\n // final while loops at the end.\n //\n // * Example below: `oldHead` exceeded `oldTail`, so we're done\n // with the main loop. Create the remaining part and insert\n // it at the new head position, and the update is complete.\n //\n // (oldHead > oldTail)\n // oldKeys: [0, 1, -, 3, 4, 5, 6]\n // newParts: [0, 2, 1, 4, 3, 7 ,6] <- create and insert 7\n // newKeys: [0, 2, 1, 4, 3, 7, 6]\n // newHead ^ newTail\n //\n // * Note that the order of the if/else clauses is not\n // important to the algorithm, as long as the null checks\n // come first (to ensure we're always working on valid old\n // parts) and that the final else clause comes last (since\n // that's where the expensive moves occur). The order of\n // remaining clauses is is just a simple guess at which cases\n // will be most common.\n //\n // * Note, we could calculate the longest\n // increasing subsequence (LIS) of old items in new position,\n // and only move those not in the LIS set. However that costs\n // O(nlogn) time and adds a bit more code, and only helps\n // make rare types of mutations require fewer moves. The\n // above handles removes, adds, reversal, swaps, and single\n // moves of contiguous items in linear time, in the minimum\n // number of moves. As the number of multiple moves where LIS\n // might help approaches a random shuffle, the LIS\n // optimization becomes less helpful, so it seems not worth\n // the code at this point. Could reconsider if a compelling\n // case arises.\n\n while (oldHead <= oldTail && newHead <= newTail) {\n if (oldParts[oldHead] === null) {\n // `null` means old part at head has already been used\n // below; skip\n oldHead++;\n } else if (oldParts[oldTail] === null) {\n // `null` means old part at tail has already been used\n // below; skip\n oldTail--;\n } else if (oldKeys[oldHead] === newKeys[newHead]) {\n // Old head matches new head; update in place\n newParts[newHead] = setChildPartValue(\n oldParts[oldHead]!,\n newValues[newHead]\n );\n oldHead++;\n newHead++;\n } else if (oldKeys[oldTail] === newKeys[newTail]) {\n // Old tail matches new tail; update in place\n newParts[newTail] = setChildPartValue(\n oldParts[oldTail]!,\n newValues[newTail]\n );\n oldTail--;\n newTail--;\n } else if (oldKeys[oldHead] === newKeys[newTail]) {\n // Old head matches new tail; update and move to new tail\n newParts[newTail] = setChildPartValue(\n oldParts[oldHead]!,\n newValues[newTail]\n );\n insertPart(containerPart, newParts[newTail + 1], oldParts[oldHead]!);\n oldHead++;\n newTail--;\n } else if (oldKeys[oldTail] === newKeys[newHead]) {\n // Old tail matches new head; update and move to new head\n newParts[newHead] = setChildPartValue(\n oldParts[oldTail]!,\n newValues[newHead]\n );\n insertPart(containerPart, oldParts[oldHead]!, oldParts[oldTail]!);\n oldTail--;\n newHead++;\n } else {\n if (newKeyToIndexMap === undefined) {\n // Lazily generate key-to-index maps, used for removals &\n // moves below\n newKeyToIndexMap = generateMap(newKeys, newHead, newTail);\n oldKeyToIndexMap = generateMap(oldKeys, oldHead, oldTail);\n }\n if (!newKeyToIndexMap.has(oldKeys[oldHead])) {\n // Old head is no longer in new list; remove\n removePart(oldParts[oldHead]!);\n oldHead++;\n } else if (!newKeyToIndexMap.has(oldKeys[oldTail])) {\n // Old tail is no longer in new list; remove\n removePart(oldParts[oldTail]!);\n oldTail--;\n } else {\n // Any mismatches at this point are due to additions or\n // moves; see if we have an old part we can reuse and move\n // into place\n const oldIndex = oldKeyToIndexMap.get(newKeys[newHead]);\n const oldPart = oldIndex !== undefined ? oldParts[oldIndex] : null;\n if (oldPart === null) {\n // No old part for this value; create a new one and\n // insert it\n const newPart = insertPart(containerPart, oldParts[oldHead]!);\n setChildPartValue(newPart, newValues[newHead]);\n newParts[newHead] = newPart;\n } else {\n // Reuse old part\n newParts[newHead] = setChildPartValue(oldPart, newValues[newHead]);\n insertPart(containerPart, oldParts[oldHead]!, oldPart);\n // This marks the old part as having been used, so that\n // it will be skipped in the first two checks above\n oldParts[oldIndex as number] = null;\n }\n newHead++;\n }\n }\n }\n // Add parts for any remaining new values\n while (newHead <= newTail) {\n // For all remaining additions, we insert before last new\n // tail, since old pointers are no longer valid\n const newPart = insertPart(containerPart, newParts[newTail + 1]);\n setChildPartValue(newPart, newValues[newHead]);\n newParts[newHead++] = newPart;\n }\n // Remove any remaining unused old parts\n while (oldHead <= oldTail) {\n const oldPart = oldParts[oldHead++];\n if (oldPart !== null) {\n removePart(oldPart);\n }\n }\n\n // Save order of new parts for next round\n this._itemKeys = newKeys;\n // Directly set part value, bypassing it's dirty-checking\n setCommittedValue(containerPart, newParts);\n return noChange;\n }\n}\n\nexport interface RepeatDirectiveFn {\n <T>(\n items: Iterable<T>,\n keyFnOrTemplate: KeyFn<T> | ItemTemplate<T>,\n template?: ItemTemplate<T>\n ): unknown;\n <T>(items: Iterable<T>, template: ItemTemplate<T>): unknown;\n <T>(\n items: Iterable<T>,\n keyFn: KeyFn<T> | ItemTemplate<T>,\n template: ItemTemplate<T>\n ): unknown;\n}\n\n/**\n * A directive that repeats a series of values (usually `TemplateResults`)\n * generated from an iterable, and updates those items efficiently when the\n * iterable changes based on user-provided `keys` associated with each item.\n *\n * Note that if a `keyFn` is provided, strict key-to-DOM mapping is maintained,\n * meaning previous DOM for a given key is moved into the new position if\n * needed, and DOM will never be reused with values for different keys (new DOM\n * will always be created for new keys). This is generally the most efficient\n * way to use `repeat` since it performs minimum unnecessary work for insertions\n * and removals.\n *\n * The `keyFn` takes two parameters, the item and its index, and returns a unique key value.\n *\n * ```js\n * html`\n * <ol>\n * ${repeat(this.items, (item) => item.id, (item, index) => {\n * return html`<li>${index}: ${item.name}</li>`;\n * })}\n * </ol>\n * `\n * ```\n *\n * **Important**: If providing a `keyFn`, keys *must* be unique for all items in a\n * given call to `repeat`. The behavior when two or more items have the same key\n * is undefined.\n *\n * If no `keyFn` is provided, this directive will perform similar to mapping\n * items to values, and DOM will be reused against potentially different items.\n */\nexport const repeat = directive(RepeatDirective) as RepeatDirectiveFn;\n\n/**\n * The type of the class that powers this directive. Necessary for naming the\n * directive's return type.\n */\nexport type {RepeatDirective};\n","import { html } from 'lit-html';\n\nexport default html`\n<svg\n viewBox=\"0 0 18 18\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-labelledby=\"magnify-minusTitleID magnify-minusDescID\"\n>\n <title id=\"magnify-minusTitleID\">Zoom out</title>\n <desc id=\"magnify-minusDescID\">Take a look further.</desc>\n <g\n class=\"fill-color\"\n fill=\"none\"\n fill-rule=\"nonzero\"\n >\n <path d=\"m7 0c3.854149 0 7 3.1458514 7 7 0 1.5717634-.529107 3.020558-1.410156 4.191406.0416324.03077.0808125.0647264.117187.101563l4.335938 4.335937c.3904239.3905071.3904239 1.0235559 0 1.414063-.3905071.3904239-1.0235559.3904239-1.414063 0l-4.335937-4.335938c-.0362414-.0370712-.0695452-.0769047-.09961-.11914-1.171224.882043-2.6206167 1.412109-4.193359 1.412109-3.8541486 0-7-3.145851-7-7 0-3.8541486 3.1458514-7 7-7zm0 2c-2.7732684 0-5 2.2267316-5 5s2.2267316 5 5 5 5-2.2267316 5-5-2.2267316-5-5-5z\"/>\n <path d=\"m10 7.75v-1.5h-6v1.5z\"/>\n </g>\n</svg>\n`;\n","import icon from './index.js';\nimport { css, LitElement } from 'lit-element';\n\nclass IAIconMagnifyMinus extends LitElement {\n static get styles() {\n return css`\n :host {\n width: var(--iconWidth, 'auto');\n height: var(--iconHeight, 'auto');\n }\n\n .fill-color {\n fill: var(--iconFillColor);\n }\n\n .stroke-color {\n stroke: var(--iconStrokeColor);\n }\n `;\n }\n\n render() {\n return icon;\n }\n}\n\ncustomElements.define('ia-icon-magnify-minus', IAIconMagnifyMinus);\n\nexport default IAIconMagnifyMinus;","import { html } from 'lit-html';\n\nexport default html`\n<svg\n viewBox=\"0 0 18 18\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-labelledby=\"magnify-plusTitleID magnify-plusDescID\"\n>\n <title id=\"magnify-plusTitleID\">Zoom in</title>\n <desc id=\"magnify-plusDescID\">Take a look closer.</desc>\n <g\n class=\"fill-color\"\n fill=\"none\"\n fill-rule=\"nonzero\"\n >\n <path d=\"m7 0c3.854149 0 7 3.1458514 7 7 0 1.5717634-.529107 3.020558-1.410156 4.191406.0416324.03077.0808125.0647264.117187.101563l4.335938 4.335937c.3904239.3905071.3904239 1.0235559 0 1.414063-.3905071.3904239-1.0235559.3904239-1.414063 0l-4.335937-4.335938c-.0362414-.0370712-.0695452-.0769047-.09961-.11914-1.171224.882043-2.6206167 1.412109-4.193359 1.412109-3.8541486 0-7-3.145851-7-7 0-3.8541486 3.1458514-7 7-7zm0 2c-2.7732684 0-5 2.2267316-5 5s2.2267316 5 5 5 5-2.2267316 5-5-2.2267316-5-5-5z\"/>\n <path d=\"m7.75 4v2.25h2.25v1.5h-2.25v2.25h-1.5v-2.25h-2.25v-1.5h2.25v-2.25z\"/>\n </g>\n</svg>\n`;\n","import icon from './index.js';\nimport { css, LitElement } from 'lit-element';\n\nclass IAIconMagnifyPlus extends LitElement {\n static get styles() {\n return css`\n :host {\n width: var(--iconWidth, 'auto');\n height: var(--iconHeight, 'auto');\n }\n\n .fill-color {\n fill: var(--iconFillColor);\n }\n\n .stroke-color {\n stroke: var(--iconStrokeColor);\n }\n `;\n }\n\n render() {\n return icon;\n }\n}\n\ncustomElements.define('ia-icon-magnify-plus', IAIconMagnifyPlus);\n\nexport default IAIconMagnifyPlus;","import { css, html, LitElement } from \"lit\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { nothing } from \"lit\";\nimport checkmarkIcon from '../assets/icon_checkmark.js';\nimport \"@internetarchive/icon-magnify-minus/icon-magnify-minus\";\nimport \"@internetarchive/icon-magnify-plus/icon-magnify-plus\";\n\nconst namespacedEvent = (eventName) => `visualAdjustment${eventName}`;\n\nconst events = {\n optionChange: namespacedEvent(\"OptionChanged\"),\n zoomIn: namespacedEvent(\"ZoomIn\"),\n zoomOut: namespacedEvent(\"ZoomOut\"),\n};\n\nexport class IABookVisualAdjustments extends LitElement {\n static get properties() {\n return {\n activeCount: { type: Number },\n options: { type: Array },\n renderHeader: { type: Boolean },\n showZoomControls: { type: Boolean },\n };\n }\n\n constructor() {\n super();\n\n this.activeCount = 0;\n this.options = [];\n this.renderHeader = false;\n this.showZoomControls = true;\n }\n\n firstUpdated() {\n this.activeCount = this.activeOptions.length;\n this.emitOptionChangedEvent();\n }\n\n /** Gets list of active options\n * @return array\n */\n get activeOptions() {\n return this.options.reduce(\n (results, option) => (option.active ? [...results, option.id] : results),\n []\n );\n }\n\n /**\n * Returns blob that will be emitted by event\n */\n prepareEventDetails(changedOptionId = \"\") {\n return {\n options: this.options,\n activeCount: this.activeCount,\n changedOptionId,\n };\n }\n\n /**\n * Fires custom event when options change\n * Provides state details: { options, activeCount, changedOptionId }\n *\n * @param { string } changedOptionId\n */\n emitOptionChangedEvent(changedOptionId = \"\") {\n const detail = this.prepareEventDetails(changedOptionId);\n this.dispatchEvent(\n new CustomEvent(events.optionChange, {\n bubbles: true,\n composed: true,\n detail,\n })\n );\n }\n\n emitZoomIn() {\n this.dispatchEvent(new CustomEvent(events.zoomIn));\n }\n\n emitZoomOut() {\n this.dispatchEvent(new CustomEvent(events.zoomOut));\n }\n\n /**\n * Updates adjustment & component state\n * updates params of available ajdustment options list\n * updates active adjustment count\n * triggers custom event\n * @param { string } optionName\n */\n changeActiveStateFor(optionName) {\n const updatedOptions = [...this.options];\n const checkedOption = updatedOptions.find(\n (option) => option.id === optionName\n );\n checkedOption.active = !checkedOption.active;\n this.options = updatedOptions;\n this.activeCount = this.activeOptions.length;\n this.emitOptionChangedEvent(checkedOption.id);\n }\n\n setRangeValue(id, value) {\n const updatedOptions = [...this.options];\n updatedOptions.find((o) => o.id === id).value = value;\n this.options = [...updatedOptions];\n }\n\n /* render */\n rangeSlider(option) {\n return html`\n <div class=${`range${option.active ? \" visible\" : \"\"}`}>\n <input\n type=\"range\"\n name=\"${option.id}_range\"\n min=${option.min || 0}\n max=${option.max || 100}\n step=${option.step || 1}\n .value=${option.value}\n @input=${(e) => this.setRangeValue(option.id, e.target.value)}\n @change=${() => this.emitOptionChangedEvent()}\n />\n <p>${option.value}%</p>\n </div>\n `;\n }\n\n adjustmentCheckbox(option) {\n const formID = `adjustment_${option.id}`;\n return html`<li>\n <label for=\"${formID}\">\n <span class=\"name\">${option.name}</span>\n <input\n type=\"checkbox\"\n name=\"${formID}\"\n id=\"${formID}\"\n @change=${() => this.changeActiveStateFor(option.id)}\n ?checked=${option.active}\n />\n <span class=\"icon\"></span>\n </label>\n ${option.value !== undefined ? this.rangeSlider(option) : nothing}\n </li>`;\n }\n\n get headerSection() {\n const activeAdjustments = this.activeCount\n ? html`<p>(${this.activeCount} active)</p>`\n : nothing;\n const header = html`<header>\n <h3>Visual adjustments</h3>\n ${activeAdjustments}\n </header>`;\n return this.renderHeader ? header : nothing;\n }\n\n get zoomControls() {\n return html`\n <h4>Zoom</h4>\n <button class=\"zoom_out\" @click=${this.emitZoomOut} title=\"zoom out\">\n <ia-icon-magnify-minus></ia-icon-magnify-minus>\n </button>\n <button class=\"zoom_in\" @click=${this.emitZoomIn} title=\"zoom in\">\n <ia-icon-magnify-plus></ia-icon-magnify-plus>\n </button>\n `;\n }\n\n /** @inheritdoc */\n render() {\n return html`\n ${this.headerSection}\n <ul>\n ${repeat(this.options, (option) => option.id, this.adjustmentCheckbox.bind(this))}\n </ul>\n ${this.showZoomControls ? this.zoomControls : nothing}\n `;\n }\n\n static get styles() {\n return css`\n :host {\n display: block;\n height: 100%;\n overflow-y: auto;\n font-size: 1.4rem;\n box-sizing: border-box;\n }\n\n header {\n display: flex;\n align-items: baseline;\n }\n\n h3 {\n padding: 0;\n margin: 0 1rem 0 0;\n font-size: 1.6rem;\n }\n\n header p {\n padding: 0;\n margin: 0;\n font-size: 1.2rem;\n font-weight: bold;\n font-style: italic;\n }\n\n ul {\n padding: 1rem 2rem 0 0;\n list-style: none;\n margin-top: 0;\n }\n\n [type=\"checkbox\"] {\n display: none;\n }\n\n label {\n display: flex;\n justify-content: space-between;\n align-items: baseline;\n font-size: 1.4rem;\n font-weight: bold;\n line-height: 150%;\n vertical-align: middle;\n }\n\n .icon {\n display: inline-block;\n width: 14px;\n height: 14px;\n margin-left: .7rem;\n border: 1px solid var(--primaryTextColor);\n border-radius: 2px;\n background: var(--activeButtonBg) 50% 50% no-repeat;\n }\n :checked + .icon {\n background-image: url('${checkmarkIcon}');\n }\n\n .range {\n display: none;\n padding-top: .5rem;\n }\n .range.visible {\n display: flex;\n }\n\n .range p {\n margin-left: 1rem;\n }\n\n h4 {\n padding: 1rem 0;\n margin: 0;\n font-size: 1.4rem;\n }\n\n button {\n -webkit-appearance: none;\n appearance: none;\n border: none;\n border-radius: 0;\n background: transparent;\n outline: none;\n cursor: pointer;\n --iconFillColor: var(--primaryTextColor);\n --iconStrokeColor: var(--primaryTextColor);\n height: 4rem;\n width: 4rem;\n }\n\n button * {\n display: inline-block;\n }`;\n }\n}\ncustomElements.define('ia-book-visual-adjustments', IABookVisualAdjustments);\n","import { html } from 'lit';\nimport '@internetarchive/icon-visual-adjustment/icon-visual-adjustment';\nimport './visual-adjustments';\n\nconst visualAdjustmentOptions = [{\n id: 'brightness',\n name: 'Adjust brightness',\n active: false,\n min: 0,\n max: 150,\n step: 1,\n value: 100,\n}, {\n id: 'contrast',\n name: 'Adjust contrast',\n active: false,\n min: 0,\n max: 150,\n step: 1,\n value: 100,\n}, {\n id: 'invert',\n name: 'Inverted colors (dark mode)',\n active: false,\n}, {\n id: 'grayscale',\n name: 'Grayscale',\n active: false,\n}];\n\nexport default class VisualAdjustmentsProvider {\n constructor(options) {\n const { onProviderChange, bookreader } = options;\n this.onProviderChange = onProviderChange;\n this.bookContainer = bookreader.refs.$brContainer;\n this.bookreader = bookreader;\n\n this.onAdjustmentChange = this.onAdjustmentChange.bind(this);\n this.optionUpdateComplete = this.optionUpdateComplete.bind(this);\n this.updateOptionsCount = this.updateOptionsCount.bind(this);\n this.onZoomIn = this.onZoomIn.bind(this);\n this.onZoomOut = this.onZoomOut.bind(this);\n\n this.activeCount = 0;\n this.icon = html`<ia-icon-visual-adjustment style=\"width: var(--iconWidth); height: var(--iconHeight);\"></ia-icon-visual-adjustment>`;\n this.label = 'Visual Adjustments';\n this.menuDetails = this.updateOptionsCount();\n this.id = 'adjustment';\n this.component = html`\n <ia-book-visual-adjustments\n .options=${visualAdjustmentOptions}\n @visualAdjustmentOptionChanged=${this.onAdjustmentChange}\n @visualAdjustmentZoomIn=${this.onZoomIn}\n @visualAdjustmentZoomOut=${this.onZoomOut}\n ></ia-book-visual-adjustments>\n `;\n }\n\n onZoomIn() {\n this.bookreader.zoom(1);\n }\n\n onZoomOut() {\n this.bookreader.zoom(-1);\n }\n\n onAdjustmentChange(event) {\n const { detail } = event;\n const adjustments = {\n brightness: (value) => `brightness(${value}%)`,\n contrast: (value) => `contrast(${value}%)`,\n grayscale: () => 'grayscale(100%)',\n invert: () => 'invert(100%)',\n };\n const filters = detail.options.reduce((values, option) => {\n const newValue = `${option.active ? adjustments[option.id](option.value) : ''}`;\n return newValue ? [...values, newValue] : values;\n }, []).join(' ');\n\n this.bookContainer.css('filter', filters);\n\n this.optionUpdateComplete(event);\n }\n\n optionUpdateComplete(event) {\n this.activeCount = event.detail.activeCount;\n this.updateOptionsCount(event);\n this.onProviderChange();\n }\n\n updateOptionsCount() {\n this.menuDetails = `(${this.activeCount} active)`;\n }\n}\n","import { LitElement, html, css } from 'lit';\n\nexport default class DeleteModalActions extends LitElement {\n static get styles() {\n return css`\n div {\n display: flex;\n justify-content: center;\n padding-top: 2rem;\n }\n\n button {\n appearance: none;\n padding: 0.5rem 1rem;\n margin: 0 .5rem;\n box-sizing: border-box;\n font: 1.3rem \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n color: var(--primaryTextColor);\n border: none;\n border-radius: 4px;\n cursor: pointer;\n background: var(--primaryCTAFill);\n }\n\n .delete {\n background: var(--primaryErrorCTAFill);\n }\n `;\n }\n\n static get properties() {\n return {\n cancelAction: { type: Function },\n deleteAction: { type: Function },\n pageID: { type: String },\n };\n }\n\n render() {\n return html`\n <div>\n <button class=\"delete\" @click=${() => this.deleteAction({ detail: { id: `${this.pageID}` } })}>Delete</button>\n <button @click=${() => this.cancelAction()}>Cancel</button>\n </div>\n `;\n }\n}\n\ncustomElements.define('delete-modal-actions', DeleteModalActions);\n","import { LitElement, html, css } from 'lit';\n\nexport default class BookmarkButton extends LitElement {\n static get styles() {\n return css`\n button {\n -webkit-appearance: none;\n appearance: none;\n outline: 0;\n border: none;\n padding: 0;\n height: 4rem;\n width: 4rem;\n background: transparent;\n cursor: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 0 16 24' width='16'%3E%3Cg fill='%23333' fill-rule='evenodd'%3E%3Cpath d='m15 0c.5522847 0 1 .44771525 1 1v23l-8-5.4545455-8 5.4545455v-23c0-.55228475.44771525-1 1-1zm-2 2h-10c-.51283584 0-.93550716.38604019-.99327227.88337887l-.00672773.11662113v18l6-4.3181818 6 4.3181818v-18c0-.51283584-.3860402-.93550716-.8833789-.99327227z'/%3E%3Cpath d='m8.75 6v2.25h2.25v1.5h-2.25v2.25h-1.5v-2.25h-2.25v-1.5h2.25v-2.25z' fill-rule='nonzero'/%3E%3C/g%3E%3C/svg%3E\"), pointer;\n position: relative;\n }\n button > * {\n display: block;\n position: absolute;\n top: 0.2rem;\n }\n button.left > * {\n left: 0.2rem;\n }\n\n button.right > * {\n right: 0.2rem;\n }\n `;\n }\n\n static get properties() {\n return {\n side: { type: String },\n state: { type: String },\n };\n }\n\n constructor() {\n super();\n this.state = 'hollow';\n this.side = undefined;\n }\n\n handleClick(e) {\n e.preventDefault();\n this.dispatchEvent(new CustomEvent('bookmarkButtonClicked'));\n }\n\n get title() {\n return `${this.state === 'hollow' ? 'Add' : 'Remove'} bookmark`;\n }\n\n render() {\n const position = this.side || 'right';\n return html`\n <button title=${this.title} @click=${this.handleClick} class=${position}>\n <icon-bookmark state=${this.state}></icon-bookmark>\n </button>\n `;\n }\n}\n\ncustomElements.define('bookmark-button', BookmarkButton);\n","import { LitElement, html } from 'lit';\nimport buttonStyles from '../assets/button-base.js';\n\nclass BookmarksLogin extends LitElement {\n static get properties() {\n return {\n url: { type: String }\n };\n }\n\n static get styles() {\n return buttonStyles;\n }\n\n constructor() {\n super();\n this.url = 'https://archive.org/account/login';\n }\n render() {\n\n return html`\n <p>A free account is required to save and access bookmarks.</p>\n <a class=\"ia-button link primary\" href=\"${this.url}\">Log in</a>\n `;\n }\n}\n\ncustomElements.define('bookmarks-login', BookmarksLogin);\n","import { LitElement, html, css, render } from 'lit';\n// eslint-disable-next-line no-unused-vars\nimport { ModalConfig, ModalManager } from '@internetarchive/modal-manager';\nimport buttonStyles from '../assets/button-base.js';\nimport './bookmarks-loginCTA.js';\n\nconst api = {\n endpoint: '/services/bookmarks.php',\n headers: {\n 'Content-Type': 'application/json',\n },\n delete(page) {\n return fetch(`${this.endpoint}?identifier=${this.identifier}&page_num=${page}`, {\n credentials: 'same-origin',\n method: 'DELETE',\n headers: this.headers,\n });\n },\n get(page) {\n return fetch(`${this.endpoint}?identifier=${this.identifier}&page_num=${page}`, {\n credentials: 'same-origin',\n method: 'GET',\n headers: this.headers,\n });\n },\n getAll() {\n return fetch(`${this.endpoint}?identifier=${this.identifier}`, {\n credentials: 'same-origin',\n method: 'GET',\n headers: this.headers,\n });\n },\n post(bookmark) {\n return this.sendBookmarkData(bookmark, 'POST');\n },\n put(bookmark) {\n return this.sendBookmarkData(bookmark, 'POST');\n },\n sendBookmarkData(bookmark, method) {\n const notes = {\n note: bookmark.note,\n color: bookmark.color,\n };\n return fetch(`${this.endpoint}?identifier=${this.identifier}&page_num=${bookmark.id}`, {\n credentials: 'same-origin',\n method,\n headers: this.headers,\n body: JSON.stringify({\n notes,\n }),\n });\n },\n};\n\nclass IABookmarks extends LitElement {\n static get properties() {\n return {\n activeBookmarkID: { type: String },\n bookmarks: { type: Array },\n bookreader: { type: Object },\n displayMode: { type: String },\n editedBookmark: { type: Object },\n deleteModalConfig: { type: Object},\n modal: { attribute: false },\n loginOptions: { type: Object, attribute: false }\n };\n }\n\n static get styles() {\n const mainCss = css`\n .bookmarks {\n height: 100%;\n overflow: hidden;\n padding-bottom: 20px;\n }\n\n .list ia-bookmark-edit {\n display: none;\n }\n\n .edit ia-bookmarks-list {\n display: none;\n }\n `;\n\n return [buttonStyles, mainCss];\n }\n\n static formatPage(page) {\n return isNaN(+page) ? `(${page.replace(/\\D/g, '')})` : page;\n }\n\n constructor() {\n super();\n this.bookmarks = [];\n this.bookreader = {};\n this.editedBookmark = {};\n /** @type {ModalManager} */\n this.modal = undefined;\n this.loginOptions = {\n loginClicked: () => {},\n loginUrl: '',\n };\n /**\n * Toggles display to either bookmarks or login cta\n * @param {('bookmarks'|'login')} displayMode\n */\n this.displayMode = 'bookmarks';\n\n this.bookmarkColors = [{\n id: 0,\n className: 'red',\n }, {\n id: 1,\n className: 'blue',\n }, {\n id: 2,\n className: 'green',\n }];\n\n // eslint-disable-next-line\n this.defaultColor = this.bookmarkColors[0];\n this.api = api;\n this.deleteModalConfig = new ModalConfig({\n title: 'Delete Bookmark',\n headline: 'This bookmark contains a note. Deleting it will permanently delete the note. Are you sure?',\n headerColor: '#194880',\n });\n }\n\n updated(changed) {\n if (changed.has('displayMode')) {\n this.updateDisplay();\n }\n\n this.emitBookmarksChanged();\n }\n\n setup() {\n this.api.identifier = this.bookreader.bookId;\n if (this.displayMode === 'login') {\n return;\n }\n this.fetchUserBookmarks();\n this.setBREventListeners();\n }\n\n updateDisplay() {\n if (this.displayMode === 'bookmarks') {\n this.fetchUserBookmarks();\n }\n }\n\n async fetchUserBookmarks() {\n if (!this.api.identifier) {\n return;\n }\n await this.fetchBookmarks();\n this.initializeBookmarks();\n }\n\n setBREventListeners() {\n ['3PageViewSelected'].forEach((event) => {\n window.addEventListener(`BookReader:${event}`, (e) => {\n setTimeout(() => {\n // wait a lil bit so bookreader can draw its DOM to attach onto\n this.renderBookmarkButtons();\n }, 100);\n });\n });\n ['pageChanged', '1PageViewSelected', '2PageViewSelected'].forEach((event) => {\n window.addEventListener(`BookReader:${event}`, (e) => {\n setTimeout(() => {\n // wait a lil bit so bookreader can draw its DOM to attach onto\n this.renderBookmarkButtons();\n this.markActiveBookmark();\n }, 100);\n });\n });\n ['zoomOut', 'zoomIn', 'resize'].forEach((event) => {\n window.addEventListener(`BookReader:${event}`, () => {\n this.renderBookmarkButtons();\n });\n });\n }\n\n initializeBookmarks() {\n this.renderBookmarkButtons();\n this.markActiveBookmark(true);\n this.emitBookmarksChanged();\n }\n\n /**\n * @typedef {object} Bookmark\n * @property {number} id - bookreader page index, becomes key store\n * @property {number} color - color number\n * @property {string} page - bookmark's page label to display\n * @property {string} note - optional, note that one can add\n * @property {string} thumbnail - optional, image url\n */\n /**\n * Formats bookmark view model\n * @param {Object} bookmarkAttrs\n * @param {number} bookmarkAttrs.leafNum\n * @param {string} bookmarkAttrs.notes\n *\n * @returns Bookmark\n */\n formatBookmark({ leafNum = '', notes = {} }) {\n const { note = '', color } = notes;\n const nomalizedParams = {\n note,\n color: this.getBookmarkColor(color) ? color : this.defaultColor.id,\n };\n\n const page = IABookmarks.formatPage(this.bookreader.getPageNum(leafNum));\n const thumbnail = this.bookreader.getPageURI(`${leafNum}`.replace(/\\D/g, ''), 32); // Request thumbnail 1/32 the size of original image\n const bookmark = {\n ...nomalizedParams,\n id: leafNum,\n leafNum,\n page,\n thumbnail,\n };\n\n return bookmark;\n }\n\n async fetchBookmarks() {\n const resText = await this.api.getAll().then(r=> r.text());\n let parsedResponse;\n try {\n parsedResponse = JSON.parse(resText);\n } catch (e) {\n parsedResponse = {error : e.message};\n }\n\n const {\n success,\n error = 'Something happened while fetching bookmarks.',\n value: bkmrks = [],\n } = parsedResponse;\n\n if (!success) {\n console?.warn('Error fetching bookmarks', error);\n }\n\n const bookmarks = {};\n Object.keys(bkmrks).forEach((leafNum) => {\n const bookmark = bkmrks[leafNum];\n const formattedLeafNum = parseInt(leafNum, 10);\n const formattedBookmark = this.formatBookmark({ ...bookmark, leafNum: formattedLeafNum });\n bookmarks[leafNum] = formattedBookmark;\n });\n\n this.bookmarks = bookmarks;\n return bookmarks;\n }\n\n emitBookmarksChanged() {\n this.dispatchEvent(new CustomEvent('bookmarksChanged', {\n bubbles: true,\n composed: true,\n detail: {\n bookmarks: this.bookmarks,\n },\n }));\n }\n\n emitBookmarkButtonClicked() {\n this.dispatchEvent(new CustomEvent('bookmarkButtonClicked', {\n bubbles: true,\n composed: true,\n detail: {\n editedBookmark: this.editedBookmark,\n },\n }));\n }\n\n bookmarkButtonClicked(pageID) {\n if (this.getBookmark(pageID)) {\n this.confirmDeletion(pageID);\n } else {\n this.createBookmark(pageID);\n }\n }\n\n renderBookmarkButtons() {\n const pages = this.bookreader.$('.BRpagecontainer').not('.BRemptypage').get();\n\n pages.forEach((pageEl) => {\n const existingButton = pageEl.querySelector('.bookmark-button');\n if (existingButton) {\n existingButton.remove();\n }\n const pageID = +pageEl.classList.value.match(/pagediv\\d+/)[0].replace(/\\D/g, '');\n const pageBookmark = this.getBookmark(pageID);\n const bookmarkState = pageBookmark ? 'filled' : 'hollow';\n // eslint-disable-next-line\n const pageData = this.bookreader._models.book.getPage(pageID);\n const { isViewable } = pageData;\n\n if (!isViewable) { return; }\n\n const bookmarkButton = document.createElement('div');\n ['mousedown', 'mouseup'].forEach((event) => {\n bookmarkButton.addEventListener(event, (e) => e.stopPropagation());\n });\n bookmarkButton.classList.add('bookmark-button', bookmarkState);\n if (pageBookmark) {\n bookmarkButton.classList.add(this.getBookmarkColor(pageBookmark.color));\n }\n const pageSide = (pageEl.getAttribute('data-side') === 'L' && this.bookreader.mode === this.bookreader.constMode2up)\n ? 'left' : 'right';\n\n render(html`\n <bookmark-button\n @bookmarkButtonClicked=${() => this.bookmarkButtonClicked(pageID)}\n state=${bookmarkState}\n side=${pageSide}\n ></bookmark-button>`, bookmarkButton);\n pageEl.appendChild(bookmarkButton);\n });\n }\n\n /**\n * Notes which bookmark is active\n *\n * @param {boolean} atSetup - denotes the first time this is fired\n */\n markActiveBookmark(atSetup = false) {\n const { mode, constMode2up, constModeThumb } = this.bookreader;\n const currentIndex = this.bookreader.currentIndex();\n\n if (mode === constModeThumb) {\n // keep active bookmark the same\n // no syncing until we can verify when a bookmark is \"in view\"\n const requestedPageHasBookmark = this.bookmarks[currentIndex];\n if (atSetup && requestedPageHasBookmark) {\n this.activeBookmarkID = currentIndex;\n }\n return;\n }\n // In 2up, we prefer the right side of the page to bookmark\n // so let's make sure we light that one up.\n if (mode === constMode2up) {\n const pagesInView = this.bookreader.displayedIndices;\n const pagesHaveActiveBookmark = pagesInView.includes(+this.activeBookmarkID);\n if (pagesHaveActiveBookmark) {\n return;\n }\n }\n\n // If a bookmark exists with the current index, set it as active\n if (this.bookmarks[currentIndex]) {\n this.activeBookmarkID = currentIndex;\n return;\n }\n\n // No bookmark for this page\n this.activeBookmarkID = '';\n }\n\n bookmarkEdited({ detail }) {\n const closeEdit = detail.bookmark.id === this.editedBookmark.id;\n this.editedBookmark = closeEdit ? {} : detail.bookmark;\n }\n\n /**\n * Gets bookmark by pageindex\n * @param {number} id\n */\n getBookmark(id) {\n return this.bookmarks[id];\n }\n\n getBookmarkColor(id) {\n return this.bookmarkColors.find((m) => m.id === id)?.className;\n }\n\n /**\n * Adds bookmark for current page\n */\n addBookmark() {\n let pageID = this.bookreader.currentIndex();\n if (this.bookreader.mode === this.bookreader.constMode2up) {\n const pagesInView = this.bookreader.displayedIndices;\n\n // add bookmark to right hand page\n pageID = pagesInView[pagesInView.length - 1];\n }\n this.createBookmark(pageID);\n }\n\n /**\n * Creates bookmark for a given page\n * @param {number} pageID\n */\n createBookmark(pageID) {\n const existingBookmark = this.getBookmark(pageID);\n if (existingBookmark) {\n this.bookmarkEdited({ detail: { bookmark: existingBookmark } });\n this.emitBookmarkButtonClicked();\n return;\n }\n\n this.editedBookmark = this.formatBookmark({ leafNum: pageID });\n\n this.api.post(this.editedBookmark);\n\n this.bookmarks[pageID] = this.editedBookmark;\n this.activeBookmarkID = pageID;\n this.disableAddBookmarkButton = true;\n this.renderBookmarkButtons();\n this.emitBookmarkButtonClicked();\n }\n\n bookmarkSelected({ detail }) {\n const { leafNum } = detail.bookmark;\n this.bookreader.jumpToPage(`${this.bookreader.getPageNum(`${leafNum}`.replace(/\\D/g, ''))}`);\n this.activeBookmarkID = leafNum;\n }\n\n saveBookmark({ detail }) {\n const existingBookmark = this.bookmarks[detail.bookmark.id];\n Object.assign(existingBookmark, detail.bookmark);\n this.api.put(existingBookmark);\n this.editedBookmark = {};\n this.renderBookmarkButtons();\n }\n\n confirmDeletion(pageID) {\n const existingBookmark = this.getBookmark(pageID);\n if (existingBookmark.note) {\n this.displayDeletionModal(pageID);\n return;\n }\n this.deleteBookmark({ detail: { id: `${pageID}` } });\n }\n\n displayDeletionModal(pageID) {\n const customModalContent = html`\n <delete-modal-actions\n .deleteAction=${() => this.deleteBookmark({ detail: { id: `${pageID}` } })}\n .cancelAction=${() => this.modal.closeModal()}\n .pageID=${pageID}\n ></delete-modal-actions>\n `;\n\n\n this.modal.showModal({\n config: this.deleteModalConfig,\n customModalContent,\n });\n }\n\n deleteBookmark({ detail }) {\n const { id } = detail;\n const currBookmarks = this.bookmarks;\n delete currBookmarks[id];\n this.bookmarks = { ...currBookmarks };\n\n this.api.delete(detail.id);\n this.editedBookmark = {};\n this.modal.closeModal();\n this.renderBookmarkButtons();\n }\n\n /**\n * Tells us if we should allow user to add bookmark via menu panel\n * returns { Boolean }\n */\n get shouldEnableAddBookmarkButton() {\n const pageToCheck = this.bookreader.mode === this.bookreader.constMode2up\n ? this.bookreader.displayedIndices[this.bookreader.displayedIndices.length - 1]\n : this.bookreader.currentIndex();\n const pageHasBookmark = this.getBookmark(pageToCheck);\n return !!pageHasBookmark;\n }\n\n\n get allowAddingBookmark() {\n return this.bookreader.mode !== this.bookreader.constModeThumb;\n }\n\n get addBookmarkButton() {\n return html`\n <button\n class=\"ia-button primary\"\n tabindex=\"-1\"\n ?disabled=${this.shouldEnableAddBookmarkButton}\n @click=${this.addBookmark}>\n Add bookmark\n </button>\n `;\n }\n\n get bookmarksList() {\n return html`\n <ia-bookmarks-list\n @bookmarkEdited=${this.bookmarkEdited}\n @bookmarkSelected=${this.bookmarkSelected}\n @saveBookmark=${this.saveBookmark}\n @deleteBookmark=${this.deleteBookmark}\n .editedBookmark=${this.editedBookmark}\n .bookmarks=${{ ...this.bookmarks }}\n .activeBookmarkID=${this.activeBookmarkID}\n .bookmarkColors=${this.bookmarkColors}\n .defaultBookmarkColor=${this.defaultColor}>\n </ia-bookmarks-list>\n `;\n }\n\n get bookmarkHelperMessage() {\n return html`<p>Please use 1up or 2up view modes to add bookmark.</p>`;\n }\n\n render() {\n const bookmarks = html`\n ${this.bookmarksList}\n ${this.allowAddingBookmark ? this.addBookmarkButton : this.bookmarkHelperMessage}\n `;\n return html`\n <section class=\"bookmarks\">\n ${ this.displayMode === 'login'\n ? html`<bookmarks-login\n @click=${() => this.loginOptions.loginClicked()}\n .url=${this.loginOptions.loginUrl}></bookmarks-login>`\n : bookmarks\n }\n </section>\n `;\n }\n}\n\ncustomElements.define('ia-bookmarks', IABookmarks);\n","import { css } from 'lit';\n\nexport default css`\n .blue {\n --iconFillColor: var(--blueBookmarkColor, #0023f5);\n }\n\n .red {\n --iconFillColor: var(--redBookmarkColor, #eb3223);\n }\n\n .green {\n --iconFillColor: var(--greenBookmarkColor, #75ef4c);\n }\n`;\n","import { repeat } from 'lit/directives/repeat.js';\nimport { css, html, LitElement, nothing } from 'lit';\nimport bookmarkColorsCSS from '../assets/bookmark-colors.js';\nimport buttonCSS from '../assets/button-base.js';\n\nexport class IABookmarkEdit extends LitElement {\n static get properties() {\n return {\n bookmark: { type: Object },\n bookmarkColors: { type: Array },\n renderHeader: { type: Boolean },\n showBookmark: { type: Boolean },\n };\n }\n\n constructor() {\n super();\n this.bookmark = {};\n this.bookmarkColors = [];\n this.renderHeader = false;\n this.showBookmark = true;\n }\n\n emitSaveEvent(e) {\n e.preventDefault();\n this.dispatchEvent(new CustomEvent('saveBookmark', {\n detail: {\n bookmark: this.bookmark,\n },\n }));\n }\n\n emitDeleteEvent() {\n this.dispatchEvent(new CustomEvent('deleteBookmark', {\n detail: {\n id: this.bookmark.id,\n },\n }));\n }\n\n emitColorChangedEvent(colorId) {\n this.dispatchEvent(new CustomEvent('bookmarkColorChanged', {\n detail: {\n bookmarkId: this.bookmark.id,\n colorId,\n },\n }));\n }\n\n changeColorTo(id) {\n this.bookmark.color = id;\n this.emitColorChangedEvent(id);\n }\n\n updateNote(e) {\n this.bookmark.note = e.currentTarget.value;\n }\n\n static get headerSection() {\n return html`<header>\n <h3>Edit Bookmark</h3>\n </header>`;\n }\n\n bookmarkColor(color) {\n return html`\n <li>\n <input type=\"radio\" name=\"color\" id=\"color_${color.id}\" .value=${color.id} @change=${() => this.changeColorTo(color.id)} ?checked=${this.bookmark.color === color.id}>\n <label for=\"color_${color.id}\">\n <icon-bookmark class=${color.className}></icon-bookmark>\n </label>\n </li>\n `;\n }\n\n get bookmarkTemplate() {\n return html`\n <div class=\"bookmark\">\n <img src=${this.bookmark.thumbnail} />\n <h4>Page ${this.bookmark.page}</h4>\n </div>\n `;\n }\n\n render() {\n return html`\n ${this.renderHeader ? IABookmarkEdit.headerSection : nothing}\n ${this.showBookmark ? this.bookmarkTemplate : nothing}\n <form action=\"\" method=\"put\" @submit=${this.emitSaveEvent}>\n <fieldset>\n <label for=\"note\">Note <small>(optional)</small></label>\n <textarea rows=\"4\" cols=\"80\" name=\"note\" id=\"note\" @change=${this.updateNote}>${this.bookmark.note}</textarea>\n <label for=\"color\">Bookmark color</label>\n <ul>\n ${repeat(this.bookmarkColors, color => color.id, this.bookmarkColor.bind(this))}\n </ul>\n <div class=\"actions\">\n <button type=\"button\" class=\"ia-button cancel\" @click=${this.emitDeleteEvent}>Delete</button>\n <input class=\"ia-button\" type=\"submit\" value=\"Save\">\n </div>\n </fieldset>\n </form>\n `;\n }\n\n static get styles() {\n const bookmarkEditCSS = css`\n :host {\n display: block;\n padding: 0 1rem 2rem 1rem;\n color: var(--primaryTextColor);\n }\n\n small {\n font-style: italic;\n }\n\n .bookmark {\n display: grid;\n grid-template-columns: 37px 1fr;\n grid-gap: 0 1rem;\n align-items: center;\n }\n\n h4 {\n margin: 0;\n font-size: 1.4rem;\n }\n\n fieldset {\n padding: 2rem 0 0 0;\n border: none;\n }\n\n label {\n display: block;\n font-weight: bold;\n }\n\n p {\n padding: 0;\n margin: .5rem 0;\n font-size: 1.2rem;\n line-height: 120%;\n }\n\n textarea {\n width: 100%;\n margin-bottom: 2rem;\n box-sizing: border-box;\n font: normal 1.4rem \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n resize: vertical;\n }\n\n ul {\n display: grid;\n grid-template-columns: repeat(3, auto);\n grid-gap: 0 2rem;\n justify-content: start;\n padding: 1rem 0 0 0;\n margin: 0 0 2rem 0;\n list-style: none;\n }\n\n li input {\n display: none;\n }\n\n li label {\n display: block;\n min-width: 50px;\n padding-top: .4rem;\n text-align: center;\n border: 1px solid transparent;\n border-radius: 4px;\n cursor: pointer;\n }\n\n li input:checked + label {\n border-color: var(--primaryTextColor);\n }\n\n input[type=\"submit\"] {\n background: var(--primaryCTAFill);\n border-color: var(--primaryCTABorder);\n }\n\n button {\n background: var(--primaryErrorCTAFill);\n border-color: var(--primaryErrorCTABorder);\n }\n\n .button {\n -webkit-appearance: none;\n appearance: none;\n padding: .5rem 1rem;\n box-sizing: border-box;\n color: var(--primaryTextColor);\n border: none;\n border-radius: 4px;\n cursor: pointer;\n }\n\n .actions {\n display: grid;\n grid-template-columns: auto auto;\n grid-gap: 0 1rem;\n justify-items: stretch;\n }\n `;\n return [buttonCSS, bookmarkColorsCSS, bookmarkEditCSS];\n }\n}\ncustomElements.define('ia-bookmark-edit', IABookmarkEdit);\n","import { html } from 'lit';\n\nexport default html`\n<svg height=\"20\" viewBox=\"0 0 20 20\" width=\"20\" xmlns=\"http://www.w3.org/2000/svg\" aria-labelledby=\"editPencilTitleID editPencilDescID\"><title id=\"editPencilTitleID\">Pencil icon</title><desc id=\"editPencilDescID\">An illustration of a pencil, used to represent an edit action</desc><path class=\"fill-color\" d=\"m15.6111048 9.3708338-9.52237183 9.5222966-5.14363353 1.0897111c-.42296707.0896082-.83849202-.1806298-.92810097-.6035935-.02266463-.1069795-.02266463-.2175207 0-.3245001l1.08971974-5.1435929 9.52237189-9.52229656zm-10.89310224 5.9110366-2.78094924-.5403869-.67567462 3.166657.83033407.8303275 3.16668096-.6756703zm14.82724244-12.05935921c.6114418.61143705.6055516 1.6086709-.0131615 2.22737904l-2.2405581 2.24054036-4.9820147-4.98197536 2.2405581-2.24054036c.618713-.61870814 1.6159506-.62460252 2.2273925-.01316547z\" fill-rule=\"evenodd\"/></svg>\n`;\n","import icon from './index.js';\nimport { css, LitElement } from 'lit';\n\nclass IAIconEditPencil extends LitElement {\n static get styles() {\n return css`\n :host {\n width: var(--iconWidth, 'auto');\n height: var(--iconHeight, 'auto');\n }\n\n .fill-color {\n fill: var(--iconFillColor);\n }\n\n .stroke-color {\n stroke: var(--iconStrokeColor);\n }\n `;\n }\n\n render() {\n return icon;\n }\n}\n\ncustomElements.define('ia-icon-edit-pencil', IAIconEditPencil);\n\nexport default IAIconEditPencil;\n","import { repeat } from 'lit/directives/repeat.js';\nimport { css, html, LitElement, nothing } from 'lit';\nimport './bookmark-edit.js';\nimport '@internetarchive/icon-edit-pencil/icon-edit-pencil.js';\nimport bookmarkColorsCSS from '../assets/bookmark-colors.js';\n\nexport class IABookmarksList extends LitElement {\n static get properties() {\n return {\n activeBookmarkID: { type: Number },\n bookmarkColors: { type: Array },\n defaultBookmarkColor: { type: Object },\n bookmarks: { type: Object },\n editedBookmark: { type: Object },\n renderHeader: { type: Boolean },\n };\n }\n\n constructor() {\n super();\n this.activeBookmarkID = undefined;\n this.bookmarkColors = [];\n this.defaultBookmarkColor = {};\n this.bookmarks = {};\n this.editedBookmark = {};\n this.renderHeader = false;\n }\n\n emitEditEvent(e, bookmark) {\n this.dispatchEvent(new CustomEvent('bookmarkEdited', {\n detail: {\n bookmark,\n },\n }));\n }\n\n emitSelectedEvent(bookmark) {\n this.activeBookmarkID = bookmark.id;\n this.dispatchEvent(new CustomEvent('bookmarkSelected', {\n detail: {\n bookmark,\n },\n }));\n }\n\n emitSaveBookmark(bookmark) {\n this.dispatchEvent(new CustomEvent('saveBookmark', {\n detail: {\n bookmark,\n },\n }));\n }\n\n emitDeleteBookmark(id) {\n this.dispatchEvent(new CustomEvent('deleteBookmark', {\n detail: {\n id,\n },\n }));\n }\n\n emitBookmarkColorChanged({ detail }) {\n const { bookmarkId, colorId } = detail;\n this.dispatchEvent(new CustomEvent('bookmarkColorChanged', {\n detail: {\n bookmarkId,\n colorId,\n },\n }));\n }\n\n emitAddBookmark() {\n this.dispatchEvent(new CustomEvent('addBookmark'));\n }\n\n editBookmark(e, bookmark) {\n this.emitEditEvent(e, bookmark);\n this.editedBookmark = this.editedBookmark === bookmark ? {} : bookmark;\n }\n\n saveBookmark({ detail }) {\n const { bookmark } = detail;\n this.editedBookmark = {};\n this.emitSaveBookmark(bookmark);\n }\n\n deleteBookmark({ detail }) {\n const { id } = detail;\n this.editedBookmark = {};\n this.emitDeleteBookmark(id);\n }\n\n bookmarkColorInfo(colorVal = 0) {\n return this.bookmarkColors.find(labelInfo => labelInfo?.id === colorVal);\n }\n\n bookmarkItem(bookmark) {\n const editMode = this.editedBookmark.id === bookmark.id;\n const { className } = this.bookmarkColorInfo(bookmark.color);\n const activeClass = bookmark.id === this.activeBookmarkID ? 'active' : '';\n return html`\n <li\n @click=${() => this.emitSelectedEvent(bookmark)}\n tabindex=\"0\"\n data-pageIndex=${bookmark.id}\n >\n <div class=\"separator\"></div>\n <div class=\"content ${activeClass}\">\n <button\n class=\"edit\"\n @click=${e => this.editBookmark(e, bookmark)}\n title=\"Edit this bookmark\"\n >\n <ia-icon-edit-pencil></ia-icon-edit-pencil>\n </button>\n <h4>\n <icon-bookmark class=${className}></icon-bookmark>\n <span> Page ${bookmark.page}</span>\n </h4>\n ${!editMode && bookmark.note ? html`<p>${bookmark.note}</p>` : nothing}\n ${editMode ? this.editBookmarkComponent : nothing}\n </div>\n </li>\n `;\n }\n\n get editBookmarkComponent() {\n const showBookmark = false;\n return html`\n <ia-bookmark-edit\n .bookmark=${this.editedBookmark}\n .bookmarkColors=${this.bookmarkColors}\n .defaultBookmarkColor=${this.defaultBookmarkColor}\n .showBookmark=${showBookmark}\n @saveBookmark=${this.saveBookmark}\n @deleteBookmark=${this.deleteBookmark}\n @bookmarkColorChanged=${this.emitBookmarkColorChanged}\n ></ia-bookmark-edit>\n `;\n }\n\n sortBookmarks() {\n const sortedKeys = Object.keys(this.bookmarks).sort((a, b) => {\n if (+a > +b) { return 1; }\n if (+a < +b) { return -1; }\n return 0;\n });\n const sortedBookmarks = sortedKeys.map(key => this.bookmarks[key]);\n return sortedBookmarks;\n }\n\n get bookmarksCount() {\n const count = this.bookmarks.length;\n return html`<small>(${count})</small>`;\n }\n\n get headerSection() {\n return html`<header>\n <h3>\n Bookmarks\n ${this.bookmarks.length ? this.bookmarksCount : nothing}\n </h3>\n </header>`;\n }\n\n get bookmarkslist() {\n const sortedBookmarks = this.sortBookmarks();\n const bookmarks = repeat(sortedBookmarks, bookmark => bookmark?.id, this.bookmarkItem.bind(this));\n return html`\n <ul>\n ${bookmarks}\n <div class=\"separator\"></div>\n </ul>\n `;\n }\n\n render() {\n return html`\n ${this.renderHeader ? this.headerSection : nothing}\n ${Object.keys(this.bookmarks).length ? this.bookmarkslist : nothing}\n `;\n }\n\n static get styles() {\n const main = css`\n :host {\n display: block;\n overflow-y: auto;\n box-sizing: border-box;\n color: var(--primaryTextColor);\n margin-bottom: 2rem;\n --activeBorderWidth: 2px;\n }\n\n icon-bookmark {\n width: 16px;\n height: 24px;\n }\n\n .separator {\n background-color: var(--secondaryBGColor);\n width: 98%;\n margin: 1px auto;\n height: 1px;\n }\n\n small {\n font-style: italic;\n }\n\n h4 {\n margin: 0;\n font-size: 1.4rem;\n }\n h4 * {\n display: inline-block;\n }\n h4 icon-bookmark {\n vertical-align: bottom;\n }\n h4 span {\n vertical-align: top;\n padding-top: 1%;\n }\n\n p {\n padding: 0;\n margin: 5px 0 0 0;\n width: 98%;\n overflow-wrap: break-word;\n }\n\n ia-bookmark-edit {\n margin: 5px 5px 3px 6px;\n }\n\n ul {\n padding: 0;\n list-style: none;\n margin: var(--activeBorderWidth) 0.5rem 1rem 0;\n }\n ul > li:first-child .separator {\n display: none;\n }\n li {\n cursor: pointer;\n outline: none;\n position: relative;\n }\n li .content {\n padding: 2px 0 4px 2px;\n border: var(--activeBorderWidth) solid transparent;\n padding: .2rem 0 .4rem .2rem;\n }\n li .content.active {\n border: var(--activeBorderWidth) solid #538bc5;\n }\n li button.edit {\n padding: 5px 2px 0 0;\n background: transparent;\n cursor: pointer;\n height: 40px;\n width: 40px;\n position: absolute;\n right: 2px;\n top: 2px;\n text-align: right;\n -webkit-appearance: none;\n appearance: none;\n outline: none;\n box-sizing: border-box;\n border: none;\n }\n li button.edit > * {\n display: block;\n height: 100%;\n width: 100%;\n }\n `;\n\n return [main, bookmarkColorsCSS];\n }\n}\ncustomElements.define('ia-bookmarks-list', IABookmarksList);\n","import { html } from 'lit';\nimport '../delete-modal-actions.js';\nimport './bookmark-button.js';\nimport './ia-bookmarks.js';\n\nimport './bookmark-edit.js';\nimport './bookmarks-list.js';\nimport { IAIconBookmark } from '@internetarchive/icon-bookmark';\n\ncustomElements.define('icon-bookmark', IAIconBookmark);\n\nexport default class BookmarksProvider {\n constructor(options) {\n const {\n baseHost,\n signedIn,\n bookreader,\n modal,\n onProviderChange,\n } = options;\n\n const referrerStr = `referer=${encodeURIComponent(location.href)}`;\n const loginUrl = `https://${baseHost}/account/login?${referrerStr}`;\n\n this.component = document.createElement('ia-bookmarks');\n this.component.bookreader = bookreader;\n this.component.displayMode = signedIn ? 'bookmarks' : 'login';\n this.component.modal = modal;\n this.component.loginOptions = {\n loginClicked: this.bookmarksLoginClicked,\n loginUrl\n };\n this.bindEvents();\n\n this.icon = html`<icon-bookmark state=\"hollow\" style=\"--iconWidth: 16px; --iconHeight: 24px;\"></icon-bookmark>`;\n this.label = 'Bookmarks';\n this.id = 'bookmarks';\n this.onProviderChange = onProviderChange;\n this.component.setup();\n this.updateMenu(this.component.bookmarks.length);\n }\n\n updateMenu(count) {\n this.menuDetails = `(${count})`;\n }\n\n bindEvents() {\n this.component.addEventListener('bookmarksChanged', this.bookmarksChanged.bind(this));\n }\n\n bookmarksChanged({ detail }) {\n const bookmarksLength = Object.keys(detail.bookmarks).length;\n this.updateMenu(bookmarksLength);\n this.onProviderChange(detail.bookmarks, detail.showSidePanel);\n }\n\n bookmarksLoginClicked() {\n if (window.archive_analytics) {\n window.archive_analytics?.send_event_no_sampling(\n 'BookReader',\n `BookmarksLogin`,\n window.location.path,\n );\n }\n }\n}\n","import { html, css, LitElement } from 'lit-element';\n\nclass IAIconBookmark extends LitElement {\n static get styles() {\n return css`\n :host {\n width: var(--iconWidth, 'auto');\n height: var(--iconHeight, 'auto');\n }\n\n #hollow,\n #plus,\n #minus {\n display: none;\n }\n\n .hollow #filled,\n .plus #filled,\n .minus #filled {\n display: none;\n }\n\n .hollow #hollow,\n .plus #hollow,\n .minus #hollow {\n display: block;\n }\n\n .plus #plus {\n display: block;\n }\n\n .minus #minus {\n display: block;\n }\n\n .fill-color {\n fill: var(--iconFillColor);\n }\n\n .stroke-color {\n stroke: var(--iconStrokeColor);\n }\n `;\n }\n\n static get properties() {\n return {\n state: { type: String },\n };\n }\n\n render() {\n return html`\n <div class=${this.state}>\n <svg height=\"24\" viewBox=\"0 0 16 24\" width=\"16\" xmlns=\"http://www.w3.org/2000/svg\" aria-labelledby=\"bookmarkTitleID bookmarDescID\"><title id=\"bookmarkTitleID\">Bookmark icon</title><desc id=\"bookmarkDescID\">An outline of the shape of a bookmark</desc><path id=\"filled\" d=\"m1 0h14c.5522847 0 1 .44771525 1 1v23l-8-5.4545455-8 5.4545455v-23c0-.55228475.44771525-1 1-1z\" class=\"fill-color\" fill-rule=\"evenodd\"/><g class=\"fill-color\" fill-rule=\"evenodd\"><path id=\"hollow\" d=\"m15 0c.5522847 0 1 .44771525 1 1v23l-8-5.4545455-8 5.4545455v-23c0-.55228475.44771525-1 1-1zm-2 2h-10c-.51283584 0-.93550716.38604019-.99327227.88337887l-.00672773.11662113v18l6-4.3181818 6 4.3181818v-18c0-.51283584-.3860402-.93550716-.8833789-.99327227z\"/><path id=\"plus\" d=\"m8.75 6v2.25h2.25v1.5h-2.25v2.25h-1.5v-2.25h-2.25v-1.5h2.25v-2.25z\" fill-rule=\"nonzero\"/><path id=\"minus\" d=\"m11 8.25v1.5h-6v-1.5z\" fill-rule=\"nonzero\"/></g></svg>\n </div>\n `;\n }\n}\n\nexport { IAIconBookmark };\n","import { html } from 'lit';\n\nexport default html`\n<svg\n viewBox=\"0 0 24 24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-labelledby=\"shareTitleID shareDescID\"\n>\n <title id=\"shareTitleID\">Share icon</title>\n <desc id=\"shareDescID\">A square with an arrow arcing out from the center of the square</desc>\n <g class=\"fill-color\">\n <path d=\"m0 6.765625v17.143466h23.996455v-12.820312c0-.6024929-.564349-1.0909095-1.26051-1.0909095-.696159 0-1.260509.4884166-1.260509 1.0909095v10.638494h-18.9544172v-12.7798301h4.7793938c.6961602 0 1.2605092-.4884166 1.2605092-1.0909091 0-.6024924-.564349-1.0909088-1.2605092-1.0909088z\"/>\n <path d=\"m23.97066.18118436-10.372158.62642052 1.587358 2.76562492c-.632399.5111771-1.204137 1.0741171-1.700285 1.6981534-1.40286 1.7644678-2.279987 4.0202049-2.712357 6.6775568-.144711.891238.459803 1.731264 1.350853 1.87713.428345.07012.866999-.03282 1.21944-.286164.35244-.253341.589789-.636328.659821-1.064688.366789-2.2542958 1.073357-3.946915 2.043324-5.1669026.237573-.298812.501471-.5831095.792613-.8522728l1.40625 2.4502844z\"/>\n </g>\n</svg>\n`;\n","import icon from './index.js';\nimport { css, LitElement } from 'lit';\n\nclass IAIconShare extends LitElement {\n static get styles() {\n return css`\n :host {\n width: var(--iconWidth, 'auto');\n height: var(--iconHeight, 'auto');\n }\n\n .fill-color {\n fill: var(--iconFillColor);\n }\n\n .stroke-color {\n stroke: var(--iconStrokeColor);\n }\n `;\n }\n\n render() {\n return icon;\n }\n}\n\ncustomElements.define('ia-icon-share', IAIconShare);\n\nexport default IAIconShare;\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {AttributePart, noChange} from '../lit-html.js';\nimport {\n directive,\n Directive,\n DirectiveParameters,\n PartInfo,\n PartType,\n} from '../directive.js';\n\n/**\n * A key-value set of class names to truthy values.\n */\nexport interface ClassInfo {\n readonly [name: string]: string | boolean | number;\n}\n\nclass ClassMapDirective extends Directive {\n /**\n * Stores the ClassInfo object applied to a given AttributePart.\n * Used to unset existing values when a new ClassInfo object is applied.\n */\n private _previousClasses?: Set<string>;\n private _staticClasses?: Set<string>;\n\n constructor(partInfo: PartInfo) {\n super(partInfo);\n if (\n partInfo.type !== PartType.ATTRIBUTE ||\n partInfo.name !== 'class' ||\n (partInfo.strings?.length as number) > 2\n ) {\n throw new Error(\n '`classMap()` can only be used in the `class` attribute ' +\n 'and must be the only part in the attribute.'\n );\n }\n }\n\n render(classInfo: ClassInfo) {\n // Add spaces to ensure separation from static classes\n return (\n ' ' +\n Object.keys(classInfo)\n .filter((key) => classInfo[key])\n .join(' ') +\n ' '\n );\n }\n\n override update(part: AttributePart, [classInfo]: DirectiveParameters<this>) {\n // Remember dynamic classes on the first render\n if (this._previousClasses === undefined) {\n this._previousClasses = new Set();\n if (part.strings !== undefined) {\n this._staticClasses = new Set(\n part.strings\n .join(' ')\n .split(/\\s/)\n .filter((s) => s !== '')\n );\n }\n for (const name in classInfo) {\n if (classInfo[name] && !this._staticClasses?.has(name)) {\n this._previousClasses.add(name);\n }\n }\n return this.render(classInfo);\n }\n\n const classList = part.element.classList;\n\n // Remove old classes that no longer apply\n // We use forEach() instead of for-of so that we don't require down-level\n // iteration.\n this._previousClasses.forEach((name) => {\n if (!(name in classInfo)) {\n classList.remove(name);\n this._previousClasses!.delete(name);\n }\n });\n\n // Add or remove classes based on their classMap value\n for (const name in classInfo) {\n // We explicitly want a loose truthy check of `value` because it seems\n // more convenient that '' and 0 are skipped.\n const value = !!classInfo[name];\n if (\n value !== this._previousClasses.has(name) &&\n !this._staticClasses?.has(name)\n ) {\n if (value) {\n classList.add(name);\n this._previousClasses.add(name);\n } else {\n classList.remove(name);\n this._previousClasses.delete(name);\n }\n }\n }\n return noChange;\n }\n}\n\n/**\n * A directive that applies dynamic CSS classes.\n *\n * This must be used in the `class` attribute and must be the only part used in\n * the attribute. It takes each property in the `classInfo` argument and adds\n * the property name to the element's `classList` if the property value is\n * truthy; if the property value is falsey, the property name is removed from\n * the element's `class`.\n *\n * For example `{foo: bar}` applies the class `foo` if the value of `bar` is\n * truthy.\n *\n * @param classInfo\n */\nexport const classMap = directive(ClassMapDirective);\n\n/**\n * The type of the class that powers this directive. Necessary for naming the\n * directive's return type.\n */\nexport type {ClassMapDirective};\n","import { html } from 'lit';\n\nexport default html`\n<svg viewBox=\"0 0 34 34\" xmlns=\"http://www.w3.org/2000/svg\" aria-labelledby=\"linkTitleID linkDescID\">\n <title id=\"linkTitleID\">Link icon</title>\n <desc id=\"linkDescID\">Two chain links linked together</desc>\n <path d=\"m7.80511706 12.3659763c1.2669254-2.2579539 4.09819784-2.9949938 6.41200864-1.7733458l.2295791.12871 1.6067188.9559859 3.5467013-6.31849361c1.2682451-2.26030597 4.104098-2.99652769 6.4192376-1.76952182l.2223501.12488594 3.2168204 1.91103915c2.2770002 1.3527136 3.1866331 4.21502324 2.0564431 6.51290984l-.1198433.2278304-5.2002499 9.2680474c-1.2669254 2.2579539-4.0981978 2.9949938-6.4120086 1.7733458l-.2295791-.12871-1.6096554-.9558482-3.5437647 6.3183559c-1.2682451 2.260306-4.104098 2.9965277-6.41923761 1.7695218l-.22235013-.1248859-3.21682032-1.9110392c-2.27700024-1.3527136-3.18663314-4.2150232-2.05644312-6.5129098l.11984332-.2278304zm13.93955474-5.73311741-3.563271 6.35055051c1.889633 1.4530595 2.5776248 4.0429866 1.5410255 6.156875l-.1223014.2328355-.4183304.7430134 1.6096554.9558483c1.1431442.6791157 2.5155496.3977368 3.1667361-.5628389l.0921501-.1491451 5.2002498-9.2680474c.5752467-1.0252226.2110342-2.4011579-.8559335-3.14755806l-.1742742-.11247814-3.2168203-1.91103915c-1.1402863-.67741793-2.5086889-.39913772-3.1618387.55564729zm-11.79500786 7.00714351-5.20024982 9.2680474c-.57524673 1.0252226-.21103426 2.4011579.85593348 3.1475581l.17427416.1124781 3.21682032 1.9110392c1.14028632.6774179 2.50868892.3991377 3.16183872-.5556473l.0970474-.1563368 3.5622708-6.3513198c-1.8888875-1.4532134-2.5764504-4.042623-1.5400057-6.1561456l.1222818-.2327956.4153938-.7428758-1.6067188-.9559859c-1.1431442-.6791157-2.5155496-.3977368-3.1667361.5628389zm6.97653866 1.5796652-.3817806.6812386c-.5117123.9119895-.2800268 2.1014993.528439 2.8785267l.382717-.6803391c.5119098-.9123415.2798478-2.1024176-.5293754-2.8794262z\" class=\"fill-color\" />\n</svg>\n`;\n","import icon from './index.js';\nimport { css, LitElement } from 'lit';\n\nclass IAIconLink extends LitElement {\n static get styles() {\n return css`\n :host {\n width: var(--iconWidth, 'auto');\n height: var(--iconHeight, 'auto');\n }\n\n .fill-color {\n fill: var(--iconFillColor);\n }\n\n .stroke-color {\n stroke: var(--iconStrokeColor);\n }\n `;\n }\n\n render() {\n return icon;\n }\n}\n\ncustomElements.define('ia-icon-link', IAIconLink);\n\nexport default IAIconLink;\n","import { css } from 'lit';\n\nexport default css`\n:host {\n display: block;\n height: 100%;\n overflow-y: auto;\n font-size: 1.4rem;\n box-sizing: border-box;\n}\n\nheader {\n display: flex;\n align-items: baseline;\n}\n\nh3 {\n padding: 0;\n margin: 0 1rem 0 0;\n font-size: 1.6rem;\n}\n\nh4 {\n font-size: 1.4rem;\n}\n\nul {\n padding: 0 0 2rem 0;\n list-style: none;\n}\n\nli {\n padding: 0 0 1rem 0;\n}\n\nli a {\n font-size: 1.6rem;\n text-decoration: none;\n color: var(--shareLinkColor);\n}\n\nli a * {\n display: inline-block;\n padding: .2rem;\n margin-right: 1rem;\n vertical-align: middle;\n border: 1px solid var(--shareIconBorder);\n border-radius: 7px;\n background: var(--shareIconBg);\n}\n\n.embed {\n display: none;\n}\n.embed.visible {\n display: block;\n width: 95%;\n}\n\n.embed a {\n color: var(--shareLinkColor);\n}\n\n.code {\n position: relative;\n}\n\ntextarea {\n display: block;\n width: 100%;\n height: 120px;\n padding: .8rem 1rem;\n box-sizing: border-box;\n resize: none;\n cursor: pointer;\n font: normal 1.4rem \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n color: var(--textareaColor, #fff);\n background: var(--textareaBg, #151515);\n}\n\nsmall {\n position: absolute;\n bottom: 0;\n left: 0;\n height: 3rem;\n padding: .5rem 1rem;\n box-sizing: border-box;\n font: normal 1.2rem/2rem \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n color: var(--textareaBg, #151515);\n background: var(--textareaColor, #fff);\n opacity: 0;\n transition: opacity 300ms linear;\n}\nsmall.visible {\n opacity: 1;\n}\n`;\n","import { html } from 'lit';\n\nexport default html`\n<svg viewBox=\"0 0 34 34\" xmlns=\"http://www.w3.org/2000/svg\" aria-labelledby=\"emailTitleID emailDescID\">\n <title id=\"emailTitleID\">Email icon</title>\n <desc id=\"emailDescID\">An illustration of an envelope</desc>\n <path d=\"m32 7.04156803v19.91686397c0 .5752421-.4763773 1.041568-1.0640184 1.041568h-27.87196316c-.58764116 0-1.06401844-.4663259-1.06401844-1.041568v-19.91686397c0-.57524214.47637728-1.04156803 1.06401844-1.04156803h27.87196316c.5876411 0 1.0640184.46632589 1.0640184 1.04156803zm-26.25039901 1.19676167 10.04327011 10.1323738c.5135662.4194048.8817166.6291071 1.1044511.6291071.1198794 0 .2695514-.0503424.4490158-.1510273.1794644-.100685.3291364-.2013699.4490158-.3020548l.1798191-.1510273 10.1198794-10.15841306zm16.77212271 9.7303286 6.8831353 6.7889404v-13.5778809zm-17.92871075-6.6379131v13.350819l6.78098955-6.6629107zm22.09008685 14.2059464-5.9074304-5.8588202-.9757049.9551179-.3594018.3295984c-.0342324.0304241-.0665646.0587822-.0969964.0850743l-.1597867.1329606c-.0684912.0540844-.1198794.0895749-.1541644.1064714-.6674943.3687151-1.3523675.5530727-2.0546196.5530727-.65047 0-1.3782586-.218035-2.1833659-.6541048l-.6682036-.4520405-1.0278418-1.0311524-5.95850326 5.832781z\" class=\"fill-color\" />\n</svg>\n`;\n","import icon from './index.js';\nimport { css, LitElement } from 'lit';\n\nclass IAIconEmail extends LitElement {\n static get styles() {\n return css`\n :host {\n width: var(--iconWidth, 'auto');\n height: var(--iconHeight, 'auto');\n }\n\n .fill-color {\n fill: var(--iconFillColor);\n }\n\n .stroke-color {\n stroke: var(--iconStrokeColor);\n }\n `;\n }\n\n render() {\n return icon;\n }\n}\n\ncustomElements.define('ia-icon-email', IAIconEmail);\n\nexport default IAIconEmail;\n","/* eslint-disable class-methods-use-this */\nexport default class {\n constructor(params) {\n this.promoCopy = ' : Free Download, Borrow, and Streaming : Internet Archive';\n Object.assign(this, params);\n }\n\n get encodedDescription() {\n return this.encodeString(this.description);\n }\n\n get encodedCreator() {\n return this.encodeString(this.creator);\n }\n\n get encodedPromoCopy() {\n return this.encodeString(this.promoCopy);\n }\n\n get itemPath() {\n const encodedFileSubPrefix = this.fileSubPrefix ? encodeURIComponent(this.fileSubPrefix) : '';\n return encodedFileSubPrefix ? `${this.identifier}/${encodedFileSubPrefix}` : this.identifier;\n }\n\n encodeString(str) {\n return encodeURIComponent(str.replace(/\\s/g, '+')).replace(/%2B/g, '+');\n }\n}\n","import '@internetarchive/icon-email/icon-email';\nimport { html } from 'lit';\nimport Provider from './provider.js';\n\nexport default class extends Provider {\n constructor(params) {\n super(params);\n this.name = 'Email';\n this.icon = html`<ia-icon-email></ia-icon-email>`;\n this.class = 'email';\n }\n\n get url() {\n return `mailto:?body=https://${this.baseHost}/details/${this.itemPath}&subject=${this.description} : ${this.creator}${this.promoCopy}`;\n }\n}\n","import { html } from 'lit';\n\nexport default html`\n<svg viewBox=\"0 0 34 34\" xmlns=\"http://www.w3.org/2000/svg\" aria-labelledby=\"facebookTitleID facebookDescID\">\n <title id=\"facebookTitleID\">Facebook icon</title>\n <desc id=\"facebookDescID\">A lowercase f</desc>\n <path d=\"m30.91057 19.2442068.2670004-5.3339402h-5.7329237c-.0890001-3.4962895.25183-5.42243459 1.0224903-5.77843514.3560005-.17800028.8004955-.28925046 1.333485-.33375053s1.0442346-.0520853 1.5337353-.02275571c.4895008.02932959 1.045246.01466479 1.6672356-.04399439.0890001-1.59997977.1335002-3.24445961.1335002-4.93343953-2.1633102-.20732987-3.6742898-.28115953-4.5329389-.22148898-2.8146294.17800028-4.7847688 1.25965538-5.9104183 3.2449653-.1780003.3256596-.3261653.68873971-.444495 1.08924034-.1183298.40050062-.2144095.76358074-.2882391 1.08924034-.0738297.32565959-.125915.7848194-.1562559 1.37747942-.030341.59266002-.052591 1.04474028-.0667501 1.35624078-.0141592.3115005-.0217444.8449956-.0227558 1.6004854v1.5777298h-3.8229605v5.3339401h3.8669549v14.622824h5.8224296c0-.3560006-.0146648-1.6819003-.0439944-3.9776994-.0293296-2.295799-.0515796-4.2957737-.0667501-5.9999241s-.0075853-3.2525506.0227557-4.6452005h5.4219289z\" class=\"fill-color\" />\n</svg>\n`;\n","import icon from './index.js';\nimport { css, LitElement } from 'lit';\n\nclass IAIconFacebook extends LitElement {\n static get styles() {\n return css`\n :host {\n width: var(--iconWidth, 'auto');\n height: var(--iconHeight, 'auto');\n }\n\n .fill-color {\n fill: var(--iconFillColor);\n }\n\n .stroke-color {\n stroke: var(--iconStrokeColor);\n }\n `;\n }\n\n render() {\n return icon;\n }\n}\n\ncustomElements.define('ia-icon-facebook', IAIconFacebook);\n\nexport default IAIconFacebook;\n","import '@internetarchive/icon-facebook/icon-facebook';\nimport { html } from 'lit';\nimport Provider from './provider.js';\n\nexport default class extends Provider {\n constructor(params) {\n super(params);\n this.name = 'Facebook';\n this.icon = html`<ia-icon-facebook></ia-icon-facebook>`;\n this.class = 'facebook';\n }\n\n get url() {\n return `https://www.facebook.com/sharer/sharer.php?u=https://${this.baseHost}/details/${this.itemPath}`;\n }\n}\n","import { html } from 'lit';\n\nexport default html`\n<svg viewBox=\"0 0 34 34\" xmlns=\"http://www.w3.org/2000/svg\" aria-labelledby=\"pinterestTitleID pinterestDescID\">\n <title id=\"pinterestTitleID\">Pinterest icon</title>\n <desc id=\"pinterestDescID\">A stylized letter p</desc>\n <path d=\"m11.9051049 30.5873434.653491-1.0742755.4207845-.839975c.2805229-.591861.5371377-1.2533214.7698443-1.9843813.2327065-.7310599.4659444-1.6029125.6997135-2.6155579.2337692-1.0126455.4128151-1.752206.5371377-2.2186817.0308151.030815.0775689.0855382.1402615.1641697.0626927.0786314.1094465.1333547.1402615.1641697.1243227.1870153.2178304.311338.280523.372968 1.1210293.964829 2.3817888 1.4631823 3.7822785 1.4950599 1.4939973 0 2.8790795-.3426843 4.1552465-1.0280529 2.1166733-1.1826593 3.6733633-3.1128487 4.6700699-5.7905679.4048457-1.1518444.6848374-2.5996192.8399751-4.3433245.1243226-1.587505-.0781002-3.0974411-.6072685-4.5298084-.903199-2.36638128-2.5528653-4.20306294-4.948999-5.51004497-1.276167-.65349101-2.5990879-1.05833667-3.9687625-1.21453696-1.525875-.21783034-3.1293188-.17107651-4.8103315.14026149-2.7701643.52916833-5.02709913 1.743174-6.77080442 3.64201699-1.99235065 2.14748836-2.98852598 4.62225355-2.98852598 7.42429545 0 2.9571797.9494215 5.0584455 2.84826449 6.3037975l.83997504.4207845c.12432268 0 .22526845.0154075.3028373.0462225s.1551377.0074381.23270656-.0701308c.07756885-.0775688.13229208-.1243226.16416969-.1402614s.07066204-.0860696.11635328-.2103923c.04569124-.1243226.07703756-.2098609.09403895-.2566147.01700139-.0467539.04834771-.1476996.09403895-.3028373s.06906816-.2486454.07013074-.280523l.14026149-.5132295c.06269263-.311338.09403895-.5291684.09403895-.653491-.03081502-.1243227-.12432268-.2799917-.28052297-.467007-.15620029-.1870154-.23376915-.2959305-.23270656-.3267455-.62267599-.8096914-.9494215-1.7904592-.98023652-2.9423035-.03081502-1.55669.28052297-2.9731185.93401399-4.24928547 1.18265932-2.45882635 3.17501002-3.93741618 5.97705192-4.43576949 1.6183201-.311338 3.1356943-.25661476 4.5521228.16416969 1.4164285.42078446 2.5135496 1.09765239 3.2913633 2.03060379.8405063 1.02752164 1.3229208 2.28828114 1.4472435 3.78227848.1243227 1.4004897-.0313463 2.9725872-.467007 4.7162925-.3740306 1.3696746-.9186065 2.5528653-1.6337275 3.5495719-.9967066 1.245352-2.0863896 1.8834355-3.269049 1.9142505-1.7118277.0626926-2.7547568-.6375522-3.1287874-2.1007345-.0935077-.4664757 0-1.2134744.2805229-2.240996.7469987-2.5842117 1.1359055-3.9384788 1.1667206-4.0628015.1870153-1.0275216.2024228-1.7904591.0462225-2.2888124-.1870153-.65349104-.5759222-1.15928246-1.1667205-1.51737429-.5907984-.35809182-1.2756357-.39687625-2.054512-.11635327-1.1826594.43566067-1.9610044 1.40048968-2.335035 2.89448706-.311338 1.306982-.2491767 2.6299028.186484 3.9687625 0 .0626926.0313463.1402615.094039.2327065.0626926.0924451.0940389.1700139.0940389.2327066 0 .0935076-.0313463.2491766-.0940389.467007-.0626927.2178303-.094039.3580918-.094039.4207844-.0935076.4356607-.3038999 1.3308903-.6311767 2.6856887-.3272768 1.3547985-.5838915 2.3897582-.7698443 3.1048793-.7778136 3.2068876-1.12049796 5.5881451-1.02805289 7.1437725l.37296809 2.7558194c.653491-.591861 1.2294131-1.2299445 1.7277664-1.9142505z\" class=\"fill-color\" />\n</svg>\n`;\n","import { css, LitElement } from 'lit';\nimport icon from './index.js';\n\nclass IAIconPinterest extends LitElement {\n static get styles() {\n return css`\n :host {\n width: var(--iconWidth, 'auto');\n height: var(--iconHeight, 'auto');\n }\n\n .fill-color {\n fill: var(--iconFillColor);\n }\n\n .stroke-color {\n stroke: var(--iconStrokeColor);\n }\n `;\n }\n\n render() {\n return icon;\n }\n}\n\ncustomElements.define('ia-icon-pinterest', IAIconPinterest);\n\nexport default IAIconPinterest;\n","import '@internetarchive/icon-pinterest/icon-pinterest';\nimport { html } from 'lit';\nimport Provider from './provider.js';\n\nexport default class extends Provider {\n constructor(params) {\n super(params);\n this.name = 'Pinterest';\n this.icon = html`<ia-icon-pinterest></ia-icon-pinterest>`;\n this.class = 'pinterest';\n }\n\n get url() {\n return `http://www.pinterest.com/pin/create/button/?url=https://${this.baseHost}/details/${this.itemPath}&description=${this.encodedDescription}+%3A+${this.encodedCreator}${this.encodedPromoCopy}`;\n }\n}\n","import { html } from 'lit';\n\nexport default html`\n<svg viewBox=\"0 0 34 34\" xmlns=\"http://www.w3.org/2000/svg\" aria-labelledby=\"tumblrTitleID tumblrDescID\">\n <title id=\"tumblrTitleID\">Tumblr icon</title>\n <desc id=\"tumblrDescID\">A lowercase letter t</desc>\n <path d=\"m8.50321407 8.54544475v5.32088575c.15641786.0310693.6819176.0310693 1.57649923 0 .8945816-.0310693 1.3574071.0160703 1.3884764.1414189.0942792 1.5695354.1333837 3.2253149.1173133 4.9673385-.0160703 1.7420236-.0316049 3.3426283-.0466039 4.8018141s.2046288 2.824628.6588835 4.0963267c.4542546 1.2716986 1.1999178 2.2209194 2.2369897 2.8476622 1.2556283.784232 2.9896167 1.207953 5.2019653 1.271163 2.2123485.0632099 4.1659648-.2506972 5.8608487-.9417213-.0310693-.3449764-.0230341-1.4045467.0241055-3.1787109.0471397-1.7741643-.0080351-2.75499-.1655244-2.9424772-3.5472571 1.0360005-5.697467.6904885-6.4506298-1.0365361-.7220934-1.6638147-.8635123-4.9909084-.4242566-9.981281v-.046604h6.7318605v-5.32088568h-6.7318605v-6.54383772h-4.0497228c-.2828378 1.28669763-.6122795 2.35376743-.9883252 3.20120941-.3760457.84744199-.98029 1.60060471-1.812733 2.25948817-.832443.65888347-1.87594303 1.01993018-3.1305 1.08314014z\" class=\"fill-color\" />\n</svg>\n`;\n","import icon from './index.js';\nimport { css, LitElement } from 'lit';\n\nclass IAIconTumblr extends LitElement {\n static get styles() {\n return css`\n :host {\n width: var(--iconWidth, 'auto');\n height: var(--iconHeight, 'auto');\n }\n\n .fill-color {\n fill: var(--iconFillColor);\n }\n\n .stroke-color {\n stroke: var(--iconStrokeColor);\n }\n `;\n }\n\n render() {\n return icon;\n }\n}\n\ncustomElements.define('ia-icon-tumblr', IAIconTumblr);\n\nexport default IAIconTumblr;\n","import '@internetarchive/icon-tumblr/icon-tumblr';\nimport { html } from 'lit';\nimport Provider from './provider.js';\n\nexport default class extends Provider {\n constructor(params) {\n super(params);\n this.name = 'Tumblr';\n this.icon = html`<ia-icon-tumblr></ia-icon-tumblr>`;\n this.class = 'tumblr';\n }\n\n get url() {\n return `https://www.tumblr.com/share/video?embed=%3Ciframe+width%3D%22640%22+height%3D%22480%22+frameborder%3D%220%22+allowfullscreen+src%3D%22https%3A%2F%2F${this.baseHost}%2Fembed%2F%22+webkitallowfullscreen%3D%22true%22+mozallowfullscreen%3D%22true%22%26gt%3B%26lt%3B%2Fiframe%3E&name=${this.encodedDescription}+%3A+${this.encodedCreator}${this.encodedPromoCopy}`;\n }\n}\n","import { html } from 'lit';\n\nexport default html`\n<svg viewBox=\"0 0 34 34\" xmlns=\"http://www.w3.org/2000/svg\" aria-labelledby=\"twitterTitleID twitterDescID\">\n <title id=\"twitterTitleID\">Twitter icon</title>\n <desc id=\"twitterDescID\">The Twitter logo, a cartoon bird</desc>\n <path d=\"m31.5297453 8.76273313c-.3135031.40766104-.7447036.83083673-1.2936015 1.26952707-.5488979.4386904-.9169698.7837578-1.1042157 1.0352022.1562166 2.319709-.1417719 4.5297454-.8939653 6.6301092-.7521935 2.1003638-1.8023754 3.9182538-3.1505457 5.45367-1.3481704 1.5354162-2.9627648 2.8284828-4.8437835 3.8791996-1.8810186 1.0507169-3.8321207 1.7483416-5.8533062 2.092874s-4.1215493.2894286-6.30109136-.1653114c-2.17954205-.45474-4.2092874-1.3401455-6.08923604-2.6562165 2.72737.4697196 5.67408517-.2514445 8.8401455-2.1634924-3.0719024-.7521935-4.88979241-2.2881447-5.45367-4.6078537 1.12882516.0631287 1.86550396.0631287 2.21003638 0-2.91568586-1.2850417-4.38904344-3.3693558-4.42007276-6.2529424.21934517.0310293.53284828.1487267.94050931.3530922s.78375775.3060133 1.12829017.3049433c-.81532206-.7211641-1.41076396-1.9045581-1.7863257-3.5501819-.37556173-1.64562376-.17173122-3.17355015.61149155-4.58377912 1.81789001 1.88101862 3.6908838 3.36989086 5.61898138 4.46661672 1.92809757 1.0967259 4.22426707 1.7547614 6.88850847 1.9741066-.2503745-1.1908838-.1722662-2.32719882.2343248-3.40894502.4065911-1.0817462 1.0416221-1.93612241 1.9050931-2.56312861.863471-.62700621 1.8114702-1.0817462 2.8439975-1.36421999 1.0325272-.28247378 2.0827091-.27444896 3.1505456.02407447s1.9767815.87042585 2.726835 1.71570726c1.3791997-.37663172 2.6802911-.87845068 3.9032742-1.50545688-.0310293.37663171-.1407019.74470361-.3290178 1.1042157-.1883158.35951209-.3530922.62593623-.4943291.79927242s-.3841216.4317355-.728654.77519795c-.3445324.34346244-.5638776.57832227-.6580355.70457949.2193452-.09415792.6895998-.23539482 1.410764-.42371067.7211641-.18831586 1.2069334-.39214638 1.4573079-.61149155 0 .44350524-.1567516.86668093-.4702547 1.27434196z\" class=\"fill-color\" />\n</svg>\n`;\n","import icon from './index.js';\nimport { css, LitElement } from 'lit';\n\nclass IAIconTwitter extends LitElement {\n static get styles() {\n return css`\n :host {\n width: var(--iconWidth, 'auto');\n height: var(--iconHeight, 'auto');\n }\n\n .fill-color {\n fill: var(--iconFillColor);\n }\n\n .stroke-color {\n stroke: var(--iconStrokeColor);\n }\n `;\n }\n\n render() {\n return icon;\n }\n}\n\ncustomElements.define('ia-icon-twitter', IAIconTwitter);\n\nexport default IAIconTwitter;\n","import '@internetarchive/icon-twitter/icon-twitter';\nimport { html } from 'lit';\nimport Provider from './provider.js';\n\nexport default class extends Provider {\n constructor(params) {\n super(params);\n this.name = 'Twitter';\n this.icon = html`<ia-icon-twitter></ia-icon-twitter>`;\n this.class = 'twitter';\n }\n\n get url() {\n return `https://twitter.com/intent/tweet?url=https://${this.baseHost}/details/${this.itemPath}&via=internetarchive&text=${this.encodedDescription}+%3A+${this.encodedCreator}${this.encodedPromoCopy}`;\n }\n}\n","import { classMap } from 'lit/directives/class-map.js';\nimport { html, LitElement } from 'lit';\nimport { nothing } from 'lit/html.js';\nimport '@internetarchive/icon-link/icon-link.js';\nimport sharingOptionsCSS from './styles/ia-sharing-options.js';\nimport EmailProvider from './providers/email.js';\nimport FacebookProvider from './providers/facebook.js';\nimport PinterestProvider from './providers/pinterest.js';\nimport TumblrProvider from './providers/tumblr.js';\nimport TwitterProvider from './providers/twitter.js';\n\nconst copyToClipboard = ({ currentTarget }) => {\n const textarea = currentTarget.querySelector('textarea');\n const note = currentTarget.querySelector('small');\n textarea.select();\n document.execCommand('copy');\n textarea.blur();\n note.classList.add('visible');\n clearTimeout(note.timeout);\n note.timeout = setTimeout(() => note.classList.remove('visible'), 4000);\n};\n\nexport class IASharingOptions extends LitElement {\n static get styles() {\n return sharingOptionsCSS;\n }\n\n static get properties() {\n return {\n baseHost: { type: String },\n creator: { type: String },\n description: { type: String },\n embedOptionsVisible: { type: Boolean },\n identifier: { type: String },\n sharingOptions: { type: Array },\n type: { type: String },\n renderHeader: { type: Boolean },\n fileSubPrefix: { type: String },\n };\n }\n\n constructor() {\n super();\n this.baseHost = '';\n this.sharingOptions = [];\n this.fileSubPrefix = '';\n }\n\n firstUpdated() {\n const {\n baseHost,\n creator,\n description,\n identifier,\n type,\n fileSubPrefix,\n } = this;\n const params = {\n baseHost,\n creator,\n description,\n identifier,\n type,\n fileSubPrefix,\n };\n\n this.sharingOptions = [\n new TwitterProvider(params),\n new FacebookProvider(params),\n new TumblrProvider(params),\n new PinterestProvider(params),\n new EmailProvider(params),\n ];\n }\n\n get sharingItems() {\n return this.sharingOptions.map(option => (\n html`<li>\n <a class=\"${option.class}\" href=\"${option.url}\" target=\"_blank\">\n ${option.icon}\n ${option.name}\n </a>\n </li>`\n ));\n }\n\n get embedOption() {\n return html`<li>\n <a href=\"#\" @click=${this.toggleEmbedOptions}>\n <ia-icon-link></ia-icon-link>\n Get an embeddable link\n </a>\n </li>`;\n }\n\n get iframeEmbed() {\n return html`&lt;iframe src=\"https://${this.baseHost}/embed/${this.identifier}\" width=\"560\" height=\"384\" frameborder=\"0\" webkitallowfullscreen=\"true\" mozallowfullscreen=\"true\" allowfullscreen&gt;&lt;/iframe&gt;`;\n }\n\n get bbcodeEmbed() {\n return `[archiveorg ${this.identifier} width=560 height=384 frameborder=0 webkitallowfullscreen=true mozallowfullscreen=true]`;\n }\n\n get helpURL() {\n return `https://${this.baseHost}/help/audio.php?identifier=${this.identifier}`;\n }\n\n toggleEmbedOptions(e) {\n e.preventDefault();\n this.embedOptionsVisible = !this.embedOptionsVisible;\n }\n\n get header() {\n const header = html`<header><h3>Share this ${this.type}</h3></header>`;\n return this.renderHeader ? header : nothing;\n }\n\n render() {\n return html`\n ${this.header}\n <ul>\n ${this.sharingItems}\n ${this.embedOption}\n <div class=${classMap({ visible: this.embedOptionsVisible, embed: true })}>\n <h4>Embed</h4>\n <div class=\"code\" @click=${copyToClipboard}>\n <textarea readonly=\"readonly\">${this.iframeEmbed}</textarea>\n <small>Copied to clipboard</small>\n </div>\n <h4>Embed for wordpress.com hosted blogs and archive.org item &lt;description&gt; tags</h4>\n <div class=\"code\" @click=${copyToClipboard}>\n <textarea readonly=\"readonly\">${this.bbcodeEmbed}</textarea>\n <small>Copied to clipboard</small>\n </div>\n <p>Want more? <a href=${this.helpURL}>Advanced embedding details, examples, and help</a>!</p>\n </div>\n </ul>\n `;\n }\n}\n\ncustomElements.define('ia-sharing-options', IASharingOptions);\n","import { html } from 'lit';\nimport '@internetarchive/icon-share/icon-share';\nimport '@internetarchive/ia-sharing-options';\n\nexport default class SharingProvider {\n constructor({\n item,\n baseHost,\n bookreader\n }) {\n const { identifier, creator, title } = item?.metadata;\n const creatorToUse = Array.isArray(creator) ? creator[0] : creator;\n const subPrefix = bookreader.options.subPrefix || '';\n const label = `Share this book`;\n this.icon = html`<ia-icon-share style=\"width: var(--iconWidth); height: var(--iconHeight);\"></ia-icon-share>`;\n this.label = label;\n this.id = 'share';\n this.component = html`<ia-sharing-options\n .identifier=${identifier}\n .type=${`book`}\n .creator=${creatorToUse}\n .description=${title}\n .baseHost=${baseHost}\n .fileSubPrefix=${subPrefix}\n ></ia-sharing-options>`;\n }\n}\n","import { html } from 'lit';\n\nexport default html`\n<svg name=\"sort-desc\" height=\"18\" viewBox=\"0 0 18 18\" width=\"18\" xmlns=\"http://www.w3.org/2000/svg\"><g fill=\"none\" fill-rule=\"evenodd\"><path d=\"m2.32514544 8.30769231.7756949-2.08468003h2.92824822l.75630252 2.08468003h1.01809955l-2.70523594-6.92307693h-1.01809955l-2.69553976 6.92307693zm3.41305753-2.86037492h-2.34647705l1.17323853-3.22883h.01939237z\" fill=\"#fff\" fill-rule=\"nonzero\"/><path d=\"m7.1689722 16.6153846v-.7756949h-4.4117647l4.29541047-5.3716871v-.77569491h-5.06140918v.77569491h3.97543633l-4.30510666 5.3716871v.7756949z\" fill=\"#fff\" fill-rule=\"nonzero\"/><path d=\"m10.3846154 11.0769231 2.7692308 5.5384615 2.7692307-5.5384615m-2.7692307 4.1538461v-13.15384612\" stroke=\"#fff\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.661538\"/></g></svg>\n`;\n","import { html } from 'lit';\n\nexport default html`\n<svg name=\"sort-asc\" height=\"18\" viewBox=\"0 0 18 18\" width=\"18\" xmlns=\"http://www.w3.org/2000/svg\"><g fill=\"none\" fill-rule=\"evenodd\"><path d=\"m2.32514544 8.30769231.7756949-2.08468003h2.92824822l.75630252 2.08468003h1.01809955l-2.70523594-6.92307693h-1.01809955l-2.69553976 6.92307693zm3.41305753-2.86037492h-2.34647705l1.17323853-3.22883h.01939237z\" fill=\"#fff\" fill-rule=\"nonzero\"/><path d=\"m7.1689722 16.6153846v-.7756949h-4.4117647l4.29541047-5.3716871v-.77569491h-5.06140918v.77569491h3.97543633l-4.30510666 5.3716871v.7756949z\" fill=\"#fff\" fill-rule=\"nonzero\"/><path d=\"m10.3846154 11.0769231 2.7692308 5.5384615 2.7692307-5.5384615m-2.7692307 4.1538461v-13.15384612\" stroke=\"#fff\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.661538\" transform=\"matrix(1 0 0 -1 0 18.692308)\"/></g></svg>\n`;\n","import { html } from 'lit';\n\nexport default html`\n<svg name=\"sort-neutral\" height=\"18\" viewBox=\"0 0 18 18\" width=\"18\" xmlns=\"http://www.w3.org/2000/svg\"><g fill=\"#fff\" fill-rule=\"evenodd\"><path d=\"m2.32514544 8.30769231.7756949-2.08468003h2.92824822l.75630252 2.08468003h1.01809955l-2.70523594-6.92307693h-1.01809955l-2.69553976 6.92307693zm3.41305753-2.86037492h-2.34647705l1.17323853-3.22883h.01939237z\" fill-rule=\"nonzero\"/><path d=\"m7.1689722 16.6153846v-.7756949h-4.4117647l4.29541047-5.3716871v-.77569491h-5.06140918v.77569491h3.97543633l-4.30510666 5.3716871v.7756949z\" fill-rule=\"nonzero\"/><circle cx=\"13\" cy=\"9\" r=\"2\"/></g></svg>\n`;\n","import { html } from 'lit';\n\nexport default html`\n <svg height=\"24\" viewBox=\"0 0 24 24\" width=\"24\" xmlns=\"http://www.w3.org/2000/svg\" aria-labelledby=\"volumesTitleID volumesDescID\">\n <title id=\"volumesTitleID\">Volumes icon</title>\n <desc id=\"volumesDescID\">Three books stacked on each other</desc>\n <g fill=\"#ffffff\">\n <path fill=\"#ffffff\" d=\"m9.83536396 0h10.07241114c.1725502.47117517.3378411.76385809.4958725.87804878.1295523.11419069.3199719.1998337.5712586.25692905.2512868.05709534.4704647.08564301.6575337.08564301h.2806036v15.24362526h-4.3355343v3.8106985h-4.44275v3.7250554h-12.01318261c-.27306495 0-.50313194-.085643-.69020098-.256929-.18706903-.1712861-.30936193-.3425721-.36687867-.5138581l-.06449694-.2785477v-14.2159091c0-.32815965.08627512-.5922949.25882537-.79240577.17255024-.20011086.34510049-.32150776.51765073-.36419068l.25882537-.0640244h3.36472977v-2.54767184c0-.31374722.08627513-.57067627.25882537-.77078714.17255025-.20011086.34510049-.32150776.51765074-.36419068l.25882536-.06402439h3.36472978v-2.56929047c0-.32815964.08627512-.5922949.25882537-.79240576.17255024-.20011087.34510049-.31430156.51765073-.34257207zm10.78355264 15.6294346v-13.53076498c-.2730649-.08536585-.4456152-.16380266-.5176507-.23531042-.1725502-.1424612-.2730649-.27078714-.3015441-.38497783v13.36031043h-9.87808272c0 .0144124-.02149898.0144124-.06449694 0-.04299795-.0144124-.08962561.006929-.13988296.0640244-.05025735.0570953-.07538603.1427383-.07538603.256929s.02149898.210643.06449694.289357c.04299795.078714.08599591.1322062.12899387.1604767l.06449693.0216187h10.71905571zm-10.2449613-2.4412417h7.98003v-11.60421286h-7.98003zm1.6827837-9.41990022h4.6153002c.1725502 0 .3199718.05349224.4422647.16047672s.1834393.23891353.1834393.39578714c0 .15687362-.0611464.28519956-.1834393.38497783s-.2697145.1496674-.4422647.1496674h-4.6153002c-.1725503 0-.3199719-.04988913-.4422647-.1496674-.1222929-.09977827-.1834394-.22810421-.1834394-.38497783 0-.15687361.0611465-.28880266.1834394-.39578714.1222928-.10698448.2697144-.16047672.4422647-.16047672zm-6.08197737 13.50997782h7.72120467v-.8131929h-3.79610541c-.27306495 0-.49950224-.085643-.67931188-.256929-.17980964-.1712861-.29847284-.3425721-.35598958-.5138581l-.06449694-.2785477v-10.02023282h-2.82530086zm6.77217827-11.36890243h3.2139578c.1295522 0 .240956.05709534.3342113.17128603.0932554.11419069.139883.24972284.139883.40659645 0 .15687362-.0466276.28880267-.139883.39578714-.0932553.10698448-.2046591.16047672-.3342113.16047672h-3.2139578c-.1295523 0-.2373264-.05349224-.3233223-.16047672-.0859959-.10698447-.1289938-.23891352-.1289938-.39578714 0-.15687361.0429979-.29240576.1289938-.40659645s.19377-.17128603.3233223-.17128603zm-11.15043132 15.11557653h7.69942646v-.7491685h-3.79610539c-.25854616 0-.48135376-.0892462-.66842279-.2677384-.18706904-.1784922-.30936193-.3605876-.36687868-.546286l-.06449694-.2569291v-10.04101994h-2.80352266zm14.62237682-4.5606985h-.8191949v2.1410754h-9.89986085s-.04299796.0285477-.12899387.085643c-.08599592.0570954-.12201369.1427384-.10805331.2569291 0 .1141907.01786928.210643.05360784.289357.03573856.0787139.07538603.125.1189424.138858l.06449694.0432373h10.71905575v-2.9542683zm-4.3991936 3.8106985h-.8191949v2.077051h-9.8563045c0 .0144124-.02149898.0144124-.06449694 0-.04299795-.0144125-.08962561.0105321-.13988296.0748337-.05025735.0643015-.07538603.1607538-.07538603.289357 0 .1141906.02149898.2070399.06449694.2785476.04299795.0715078.08599591.1141907.12899387.1280488l.06449693.0216186h10.69811519v-2.8686252z\" />\n </g>\n </svg>\n`;\n","import { css, html, LitElement, nothing } from 'lit';\nimport { repeat } from 'lit/directives/repeat.js';\n\nexport class Volumes extends LitElement {\n static get properties() {\n return {\n subPrefix: { type: String },\n hostUrl: { type: String },\n viewableFiles: { type: Array },\n sortOrderBy: { type: String },\n };\n }\n\n constructor() {\n super();\n this.hostUrl = '';\n this.sortOrderBy = '';\n this.subPrefix = '';\n this.viewableFiles = [];\n }\n\n firstUpdated() {\n const activeFile = this.shadowRoot.querySelector('.content.active');\n // allow for css animations to run before scrolling to active file\n setTimeout(() => {\n // scroll active file into view if needed\n // note: `scrollIntoViewIfNeeded` handles auto-scroll gracefully for Chrome, Safari\n // Firefox does not have this capability yet as it does not support `scrollIntoViewIfNeeded`\n if (activeFile?.scrollIntoViewIfNeeded) {\n activeFile?.scrollIntoViewIfNeeded(true);\n return;\n }\n\n // Todo: support `scrollIntoView` or `parentContainer.crollTop = x` for FF & \"IE 11\"\n // currently, the hard `position: absolutes` misaligns subpanel when `scrollIntoView` is applied :(\n }, 350);\n }\n\n volumeItemWithImageTitle(item) {\n const hrefUrl = this.sortOrderBy === 'default'\n ? `${this.hostUrl}${item.url_path}`\n : `${this.hostUrl}${item.url_path}?sort=${this.sortOrderBy}`;\n\n return html`\n <li class=\"content active\">\n <div class=\"separator\"></div>\n <a class=\"container\" href=\"${hrefUrl}\">\n <div class=\"image\">\n <img src=\"${item.image}\">\n </div>\n <div class=\"text\">\n <p class=\"item-title\">${item.title}</p>\n <small>by: ${item.author}</small>\n </div>\n </a>\n </li>\n `;\n }\n\n volumeItem(item) {\n const activeClass = this.subPrefix === item.file_subprefix ? ' active' : '';\n\n const hrefUrl = this.sortOrderBy === 'default'\n ? `${this.hostUrl}${item.url_path}`\n : `${this.hostUrl}${item.url_path}?sort=${this.sortOrderBy}`;\n\n return html`\n <li>\n <div class=\"separator\"></div>\n <div class=\"content${activeClass}\">\n <a href=\"https://${hrefUrl}\">\n <p class=\"item-title\">${item.title}</p>\n </a>\n </div>\n </li>\n `;\n }\n\n get volumesList() {\n const volumes = repeat(this.viewableFiles, volume => volume?.file_prefix, this.volumeItem.bind(this));\n return html`\n <ul>\n ${volumes}\n <div class=\"separator\"></div> \n </ul>\n `;\n }\n\n render() {\n return html`\n ${this.viewableFiles.length ? this.volumesList : nothing}\n `;\n }\n\n static get styles() {\n return css`\n :host {\n display: block;\n overflow-y: auto;\n box-sizing: border-box;\n color: var(--primaryTextColor);\n margin-top: 14px;\n margin-bottom: 2rem;\n --activeBorderWidth: 2px;\n }\n\n a {\n color: #ffffff;\n text-decoration: none\n }\n\n img {\n width: 35px;\n height: 45px;\n }\n\n ul {\n padding: 0;\n list-style: none;\n margin: var(--activeBorderWidth) 0.5rem 1rem 0;\n }\n\n ul > li:first-child .separator {\n display: none;\n }\n\n li {\n cursor: pointer;\n outline: none;\n position: relative;\n }\n\n li .content {\n padding: 2px 0 4px 2px;\n border: var(--activeBorderWidth) solid transparent;\n padding: .2rem 0 .4rem .2rem;\n }\n \n li .content.active {\n border: var(--activeBorderWidth) solid #538bc5;\n }\n\n small {\n font-style: italic;\n white-space: initial;\n }\n\n .container {\n display: flex;\n align-items: center;\n justify-content: center\n }\n\n .item-title {\n margin-block-start: 0em;\n margin-block-end: 0em;\n font-size: 14px;\n font-weight: bold;\n word-wrap: break-word;\n padding-left: 5px;\n }\n\n .separator {\n background-color: var(--secondaryBGColor);\n width: 98%;\n margin: 1px auto;\n height: 1px;\n }\n\n .text {\n padding-left: 10px;\n }\n\n .icon {\n display: inline-block;\n width: 14px;\n height: 14px;\n margin-left: .7rem;\n border: 1px solid var(--primaryTextColor);\n border-radius: 2px;\n background: var(--activeButtonBg) 50% 50% no-repeat;\n }\n\n `;\n }\n}\n\ncustomElements.define('viewable-files', Volumes);\n","import { html } from 'lit';\n\nimport sortDescIcon from '../assets/icon_sort_desc.js';\nimport sortAscIcon from '../assets/icon_sort_asc.js';\nimport sortNeutralIcon from '../assets/icon_sort_neutral.js';\nimport volumesIcon from '../assets/icon_volumes.js';\n\nimport './volumes.js';\n\nconst sortType = {\n title_asc: 'title_asc',\n title_desc: 'title_desc',\n default: 'default'\n};\nexport default class VolumesProvider {\n /**\n * @param {import('../../BookReader').default} bookreader\n */\n constructor({ baseHost, bookreader, onProviderChange }) {\n this.onProviderChange = onProviderChange;\n this.component = document.createElement(\"viewable-files\");\n\n const files = bookreader.options.multipleBooksList.by_subprefix;\n this.viewableFiles = Object.keys(files).map(item => files[item]);\n this.volumeCount = Object.keys(files).length;\n\n /** @type {import('../../BookReader').default} */\n this.bookreader = bookreader;\n\n this.component.subPrefix = bookreader.options.subPrefix || \"\";\n this.component.hostUrl = baseHost;\n this.component.viewableFiles = this.viewableFiles;\n\n this.id = \"volumes\";\n this.label = `Viewable files (${this.volumeCount})`;\n this.icon = html`${volumesIcon}`;\n\n this.sortOrderBy = sortType.default;\n\n // get sort state from query param\n if (this.bookreader.urlPlugin) {\n this.bookreader.urlPlugin.pullFromAddressBar();\n\n const urlSortValue = this.bookreader.urlPlugin.getUrlParam('sort');\n if (urlSortValue === sortType.title_asc || urlSortValue === sortType.title_desc) {\n this.sortOrderBy = urlSortValue;\n }\n }\n this.sortVolumes(this.sortOrderBy);\n }\n\n get sortButton() {\n const sortIcons = {\n default: html`\n <button class=\"sort-by neutral-icon\" aria-label=\"Sort volumes in initial order\" @click=${() => this.sortVolumes(\"title_asc\")}>${sortNeutralIcon}</button>\n `,\n title_asc: html`\n <button class=\"sort-by asc-icon\" aria-label=\"Sort volumes in ascending order\" @click=${() => this.sortVolumes(\"title_desc\")}>${sortAscIcon}</button>\n `,\n title_desc: html`\n <button class=\"sort-by desc-icon\" aria-label=\"Sort volumes in descending order\" @click=${() => this.sortVolumes(\"default\")}>${sortDescIcon}</button>\n `,\n };\n\n return sortIcons[this.sortOrderBy];\n }\n\n /**\n * @param {'default' | 'title_asc' | 'title_desc'} sortByType\n */\n sortVolumes(sortByType) {\n let sortedFiles = [];\n\n const files = this.viewableFiles;\n sortedFiles = files.sort((a, b) => {\n if (sortByType === sortType.title_asc) return a.title.localeCompare(b.title);\n else if (sortByType === sortType.title_desc) return b.title.localeCompare(a.title);\n else return a.orig_sort - b.orig_sort;\n });\n\n this.sortOrderBy = sortByType;\n this.component.sortOrderBy = sortByType;\n this.component.viewableFiles = [...sortedFiles];\n this.actionButton = this.sortButton;\n\n if (this.bookreader.urlPlugin) {\n this.bookreader.urlPlugin.pullFromAddressBar();\n if (this.sortOrderBy !== sortType.default) {\n this.bookreader.urlPlugin.setUrlParam('sort', sortByType);\n } else {\n this.bookreader.urlPlugin.removeUrlParam('sort');\n }\n }\n\n this.onProviderChange(this.bookreader);\n\n this.multipleFilesClicked(sortByType);\n }\n\n /**\n * @param {'default' | 'title_asc' | 'title_desc'} orderBy\n */\n multipleFilesClicked(orderBy) {\n if (!window.archive_analytics) {\n return;\n }\n window.archive_analytics?.send_event_no_sampling(\n 'BookReader',\n `VolumesSort|${orderBy}`,\n window.location.path,\n );\n }\n\n}\n","import { svg } from 'lit';\n\nexport default svg`\n <svg class=\"ia-logo\" width=\"27\" height=\"30\" viewBox=\"0 0 27 30\" xmlns=\"http://www.w3.org/2000/svg\" aria-labelledby=\"logoTitleID logoDescID\">\n <title id=\"logoTitleID\">Internet Archive logo</title>\n <desc id=\"logoDescID\">A line drawing of the Internet Archive headquarters building façade.</desc>\n <g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n <mask id=\"mask-2\" fill=\"white\">\n <path d=\"M26.6666667,28.6046512 L26.6666667,30 L0,30 L0.000283687943,28.6046512 L26.6666667,28.6046512 Z M25.6140351,26.5116279 L25.6140351,28.255814 L1.05263158,28.255814 L1.05263158,26.5116279 L25.6140351,26.5116279 Z M3.62469203,7.6744186 L3.91746909,7.82153285 L4.0639977,10.1739544 L4.21052632,13.9963932 L4.21052632,17.6725617 L4.0639977,22.255044 L4.03962296,25.3421929 L3.62469203,25.4651163 L2.16024641,25.4651163 L1.72094074,25.3421929 L1.55031755,22.255044 L1.40350877,17.6970339 L1.40350877,14.0211467 L1.55031755,10.1739544 L1.68423854,7.80887484 L1.98962322,7.6744186 L3.62469203,7.6744186 Z M24.6774869,7.6744186 L24.9706026,7.82153285 L25.1168803,10.1739544 L25.2631579,13.9963932 L25.2631579,17.6725617 L25.1168803,22.255044 L25.0927809,25.3421929 L24.6774869,25.4651163 L23.2130291,25.4651163 L22.7736357,25.3421929 L22.602418,22.255044 L22.4561404,17.6970339 L22.4561404,14.0211467 L22.602418,10.1739544 L22.7369262,7.80887484 L23.0420916,7.6744186 L24.6774869,7.6744186 Z M9.94042303,7.6744186 L10.2332293,7.82153285 L10.3797725,10.1739544 L10.5263158,13.9963932 L10.5263158,17.6725617 L10.3797725,22.255044 L10.3556756,25.3421929 L9.94042303,25.4651163 L8.47583122,25.4651163 L8.0362015,25.3421929 L7.86556129,22.255044 L7.71929825,17.6970339 L7.71929825,14.0211467 L7.86556129,10.1739544 L8.00005604,7.80887484 L8.30491081,7.6744186 L9.94042303,7.6744186 Z M18.0105985,7.6744186 L18.3034047,7.82153285 L18.449948,10.1739544 L18.5964912,13.9963932 L18.5964912,17.6725617 L18.449948,22.255044 L18.425851,25.3421929 L18.0105985,25.4651163 L16.5460067,25.4651163 L16.1066571,25.3421929 L15.9357367,22.255044 L15.7894737,17.6970339 L15.7894737,14.0211467 L15.9357367,10.1739544 L16.0702315,7.80887484 L16.3753664,7.6744186 L18.0105985,7.6744186 Z M25.6140351,4.53488372 L25.6140351,6.97674419 L1.05263158,6.97674419 L1.05263158,4.53488372 L25.6140351,4.53488372 Z M13.0806755,0 L25.9649123,2.93331338 L25.4484139,3.8372093 L0.771925248,3.8372093 L0,3.1041615 L13.0806755,0 Z\" id=\"path-1\"></path>\n </mask>\n <use fill=\"#FFFFFF\" xlink:href=\"#path-1\"></use>\n <g mask=\"url(#mask-2)\" fill=\"#FFFFFF\">\n <path d=\"M0,0 L26.6666667,0 L26.6666667,30 L0,30 L0,0 Z\" id=\"swatch\"></path>\n </g>\n </g>\n </svg>\n`;\n","// eslint-disable-next-line no-unused-vars\nimport { SharedResizeObserver } from '@internetarchive/shared-resize-observer';\n// eslint-disable-next-line no-unused-vars\nimport { ModalManager } from '@internetarchive/modal-manager';\nimport { css, html, LitElement, nothing } from 'lit';\nimport SearchProvider from './search/search-provider.js';\nimport DownloadProvider from './downloads/downloads-provider.js';\nimport VisualAdjustmentProvider from './visual-adjustments/visual-adjustments-provider.js';\nimport BookmarksProvider from './bookmarks/bookmarks-provider.js';\nimport SharingProvider from './sharing.js';\nimport VolumesProvider from './volumes/volumes-provider.js';\nimport iaLogo from './assets/ia-logo.js';\n\nconst events = {\n menuUpdated: 'menuUpdated',\n updateSideMenu: 'updateSideMenu',\n PostInit: 'PostInit',\n ViewportInFullScreen: 'ViewportInFullScreen',\n};\nexport class BookNavigator extends LitElement {\n static get properties() {\n return {\n itemMD: { type: Object },\n bookReaderLoaded: { type: Boolean },\n bookreader: { type: Object },\n bookIsRestricted: { type: Boolean },\n downloadableTypes: { type: Array },\n isAdmin: { type: Boolean },\n lendingInitialized: { type: Boolean },\n lendingStatus: { type: Object },\n menuProviders: { type: Object },\n menuShortcuts: { type: Array },\n signedIn: { type: Boolean },\n loaded: { type: Boolean },\n sharedObserver: { type: Object, attribute: false },\n modal: { type: Object, attribute: false },\n fullscreenBranding: { type: Object },\n };\n }\n\n constructor() {\n super();\n this.itemMD = undefined;\n this.loaded = false;\n this.bookReaderCannotLoad = false;\n this.bookReaderLoaded = false;\n this.bookreader = null;\n this.bookIsRestricted = false;\n this.downloadableTypes = [];\n this.isAdmin = false;\n this.lendingInitialized = false;\n this.lendingStatus = {};\n this.menuProviders = {};\n this.menuShortcuts = [];\n this.signedIn = false;\n /** @type {ModalManager} */\n this.modal = undefined;\n /** @type {SharedResizeObserver} */\n this.sharedObserver = undefined;\n this.fullscreenBranding = iaLogo;\n // Untracked properties\n this.sharedObserverHandler = undefined;\n this.brWidth = 0;\n this.brHeight = 0;\n this.shortcutOrder = [\n /**\n * sets exit FS button (`this.fullscreenBranding1)\n * when `br.options.enableFSLogoShortcut`\n */\n 'fullscreen',\n 'volumes',\n 'search',\n 'bookmarks'\n ];\n }\n\n disconnectedCallback() {\n this.sharedObserver.removeObserver({\n target: this.mainBRContainer,\n handler: this.sharedObserverHandler\n });\n }\n\n firstUpdated() {\n this.bindEventListeners();\n this.emitPostInit();\n this.loaded = true;\n }\n\n updated(changed) {\n if (!this.bookreader || !this.itemMD || !this.bookReaderLoaded) {\n return;\n }\n\n const reload = changed.has('loaded') && this.loaded;\n if (reload\n || changed.has('itemMD')\n || changed.has('bookreader')\n || changed.has('signedIn')\n || changed.has('isAdmin')\n || changed.has('modal')) {\n this.initializeBookSubmenus();\n }\n\n if (changed.has('sharedObserver') && this.bookreader) {\n this.loadSharedObserver();\n this.initializeBookSubmenus();\n }\n }\n\n /**\n * Global event emitter for when Book Navigator loads\n */\n emitPostInit() {\n // emit global event when book nav has loaded with current bookreader selector\n this.dispatchEvent(new CustomEvent(`BrBookNav:${events.PostInit}`, {\n detail: { brSelector: this.bookreader?.el },\n bubbles: true,\n composed: true,\n }));\n }\n\n /**\n * @typedef {{\n * baseHost: string,\n * modal: ModalManager,\n * sharedObserver: SharedResizeObserver,\n * bookreader: BookReader,\n * item: Item,\n * signedIn: boolean,\n * isAdmin: boolean,\n * onProviderChange: (BookReader, object) => void,\n * }} baseProviderConfig\n *\n * @return {baseProviderConfig}\n */\n get baseProviderConfig() {\n return {\n baseHost: this.baseHost,\n modal: this.modal,\n sharedObserver: this.sharedObserver,\n bookreader: this.bookreader,\n item: this.itemMD,\n signedIn: this.signedIn,\n isAdmin: this.isAdmin,\n onProviderChange: () => {}\n };\n }\n\n get isWideEnoughToOpenMenu() {\n return this.brWidth >= 640;\n }\n /**\n * Instantiates books submenus & their update callbacks\n *\n * NOTE: we are doing our best to scope bookreader's instance.\n * If your submenu provider uses a bookreader instance to read, manually\n * manipulate BookReader, please update the navigator's instance of it\n * to keep it in sync.\n */\n initializeBookSubmenus() {\n const providers = {\n downloads: new DownloadProvider(this.baseProviderConfig),\n share: new SharingProvider(this.baseProviderConfig),\n visualAdjustments: new VisualAdjustmentProvider({\n ...this.baseProviderConfig,\n /** Update menu contents */\n onProviderChange: () => {\n this.updateMenuContents();\n },\n }),\n };\n\n if (this.bookreader.options.enableSearch) {\n providers.search = new SearchProvider({\n ...this.baseProviderConfig,\n /**\n * Search specific menu updates\n * @param {BookReader} brInstance\n * @param {{ searchCanceled: boolean }} searchUpdates\n */\n onProviderChange: (brInstance = null, searchUpdates = {}) => {\n if (brInstance) {\n /* refresh br instance reference */\n this.bookreader = brInstance;\n }\n\n this.updateMenuContents();\n\n if (searchUpdates.openMenu === false) {\n return;\n }\n\n if (this.isWideEnoughToOpenMenu && !searchUpdates?.searchCanceled) {\n /* open side search menu */\n setTimeout(() => {\n this.updateSideMenu('search', 'open');\n }, 0);\n }\n },\n });\n }\n\n if (this.bookreader.options.enableBookmarks) {\n providers.bookmarks = new BookmarksProvider({\n ...this.baseProviderConfig,\n onProviderChange: (bookmarks) => {\n const method = Object.keys(bookmarks).length ? 'add' : 'remove';\n this[`${method}MenuShortcut`]('bookmarks');\n this.updateMenuContents();\n }\n });\n }\n\n // add shortcut for volumes if multipleBooksList exists\n if (this.bookreader.options.enableMultipleBooks) {\n providers.volumes = new VolumesProvider({\n ...this.baseProviderConfig,\n onProviderChange: (brInstance = null, volumesUpdates = {}) => {\n if (brInstance) {\n /* refresh br instance reference */\n this.bookreader = brInstance;\n }\n this.updateMenuContents();\n if (this.isWideEnoughToOpenMenu) {\n /* open side search menu */\n setTimeout(() => {\n this.updateSideMenu('volumes', 'open');\n });\n }\n }\n });\n }\n\n this.menuProviders = providers;\n this.addMenuShortcut('search');\n this.addMenuShortcut('volumes');\n this.updateMenuContents();\n }\n\n /** gets element that houses the bookreader in light dom */\n get mainBRContainer() {\n return document.querySelector(this.bookreader?.el);\n }\n\n /** Fullscreen Shortcut */\n addFullscreenShortcut() {\n const closeFS = {\n icon: this.fullscreenShortcut,\n id: 'fullscreen',\n };\n this.menuShortcuts.push(closeFS);\n this.sortMenuShortcuts();\n this.emitMenuShortcutsUpdated();\n }\n\n deleteFullscreenShortcut() {\n const updatedShortcuts = this.menuShortcuts.filter(({ id }) => {\n return id !== 'fullscreen';\n });\n this.menuShortcuts = updatedShortcuts;\n this.sortMenuShortcuts();\n this.emitMenuShortcutsUpdated();\n }\n\n closeFullscreen() {\n this.bookreader.exitFullScreen();\n }\n\n get fullscreenShortcut() {\n return html`\n <button\n @click=${() => this.closeFullscreen()}\n title=\"Exit fullscreen view\"\n >${this.fullscreenBranding}</button>\n `;\n }\n /** End Fullscreen Shortcut */\n\n /**\n * Open side menu\n * @param {string} menuId\n * @param {('open'|'close'|'toggle')} action\n */\n updateSideMenu(menuId = '', action = 'open') {\n if (!menuId) {\n return;\n }\n const event = new CustomEvent(\n events.updateSideMenu, {\n detail: { menuId, action },\n },\n );\n this.dispatchEvent(event);\n }\n\n /**\n * Sets order of menu and emits custom event when done\n */\n updateMenuContents() {\n const {\n search, downloads, visualAdjustments, share, bookmarks, volumes\n } = this.menuProviders;\n const availableMenus = [volumes, search, bookmarks, visualAdjustments, share].filter((menu) => !!menu);\n\n if (this.shouldShowDownloadsMenu()) {\n downloads?.update(this.downloadableTypes);\n availableMenus.splice(1, 0, downloads);\n }\n\n const event = new CustomEvent(\n events.menuUpdated, {\n detail: availableMenus,\n },\n );\n this.dispatchEvent(event);\n }\n\n /**\n * Confirms if we should show the downloads menu\n * @returns {bool}\n */\n shouldShowDownloadsMenu() {\n if (this.bookIsRestricted === false) { return true; }\n if (this.isAdmin) { return true; }\n const { user_loan_record = {} } = this.lendingStatus;\n const hasNoLoanRecord = Array.isArray(user_loan_record); /* (bc PHP assoc. arrays) */\n\n if (hasNoLoanRecord) { return false; }\n\n const hasValidLoan = user_loan_record.type && (user_loan_record.type !== 'SESSION_LOAN');\n return hasValidLoan;\n }\n\n /**\n * Adds a provider object to the menuShortcuts array property if it isn't\n * already added. menuShortcuts are then sorted by shortcutOrder and\n * a menuShortcutsUpdated event is emitted.\n *\n * @param {string} menuId - a string matching the id property of a provider\n */\n addMenuShortcut(menuId) {\n if (this.menuShortcuts.find((m) => m.id === menuId)) {\n // menu is already there\n return;\n }\n\n if (!this.menuProviders[menuId]) {\n // no provider for this menu\n return;\n }\n\n this.menuShortcuts.push(this.menuProviders[menuId]);\n\n this.sortMenuShortcuts();\n this.emitMenuShortcutsUpdated();\n }\n\n /**\n * Removes a provider object from the menuShortcuts array and emits a\n * menuShortcutsUpdated event.\n *\n * @param {string} menuId - a string matching the id property of a provider\n */\n removeMenuShortcut(menuId) {\n this.menuShortcuts = this.menuShortcuts.filter((m) => m.id !== menuId);\n this.emitMenuShortcutsUpdated();\n }\n\n /**\n * Sorts the menuShortcuts property by comparing each provider's id to\n * the id in each iteration over the shortcutOrder array.\n */\n sortMenuShortcuts() {\n this.menuShortcuts = this.shortcutOrder.reduce((shortcuts, id) => {\n const menu = this.menuShortcuts.find((m) => m.id === id);\n if (menu) { shortcuts.push(menu); }\n return shortcuts;\n }, []);\n }\n\n emitMenuShortcutsUpdated() {\n const event = new CustomEvent('menuShortcutsUpdated', {\n detail: this.menuShortcuts,\n });\n this.dispatchEvent(event);\n }\n\n emitLoadingStatusUpdate(loaded) {\n const event = new CustomEvent('loadingStateUpdated', {\n detail: { loaded },\n });\n this.dispatchEvent(event);\n }\n\n /**\n * Core bookreader event handler registry\n *\n * NOTE: we are trying to keep bookreader's instance in scope\n * Please update Book Navigator's instance reference of it to keep it current\n */\n bindEventListeners() {\n window.addEventListener('BookReader:PostInit', (e) => {\n this.bookreader = e.detail.props;\n this.bookReaderLoaded = true;\n this.bookReaderCannotLoad = false;\n this.emitLoadingStatusUpdate(true);\n this.loadSharedObserver();\n setTimeout(() => {\n this.bookreader.resize();\n }, 0);\n });\n window.addEventListener('BookReader:fullscreenToggled', (event) => {\n const { detail: { props: brInstance = null } } = event;\n if (brInstance) {\n this.bookreader = brInstance;\n }\n this.manageFullScreenBehavior();\n }, { passive: true });\n window.addEventListener('BookReader:ToggleSearchMenu', (event) => {\n this.dispatchEvent(new CustomEvent(events.updateSideMenu, {\n detail: { menuId: 'search', action: 'toggle' },\n }));\n });\n window.addEventListener('LendingFlow:PostInit', ({ detail }) => {\n const {\n downloadTypesAvailable, lendingStatus, isAdmin, previewType,\n } = detail;\n this.lendingInitialized = true;\n this.downloadableTypes = downloadTypesAvailable;\n this.lendingStatus = lendingStatus;\n this.isAdmin = isAdmin;\n this.bookReaderCannotLoad = previewType === 'singlePagePreview';\n this.emitLoadingStatusUpdate(true);\n });\n window.addEventListener('BRJSIA:PostInit', ({ detail }) => {\n const { isRestricted, downloadURLs } = detail;\n this.bookReaderLoaded = true;\n this.downloadableTypes = downloadURLs;\n this.bookIsRestricted = isRestricted;\n });\n }\n\n loadSharedObserver() {\n this.sharedObserverHandler = { handleResize: this.handleResize.bind(this) };\n this.sharedObserver?.addObserver({\n target: this.mainBRContainer,\n handler: this.sharedObserverHandler\n });\n }\n\n /**\n * Uses resize observer to fire BookReader's `resize` functionality\n * We do not want to trigger resize IF:\n * - book animation is happening\n * - book is in fullscreen (fullscreen is handled separately)\n *\n * @param { target: HTMLElement, contentRect: DOMRectReadOnly } entry\n */\n handleResize({ contentRect, target }) {\n const startBrWidth = this.brWidth;\n const startBrHeight = this.brHeight;\n const { animating } = this.bookreader;\n\n if (target === this.mainBRContainer) {\n this.brWidth = contentRect.width;\n this.brHeight = contentRect.height;\n }\n\n if (!startBrWidth && this.brWidth) {\n // loading up, let's update side menus\n this.initializeBookSubmenus();\n }\n\n const widthChange = startBrWidth !== this.brWidth;\n const heightChange = startBrHeight !== this.brHeight;\n\n if (!animating && (widthChange || heightChange)) {\n this.bookreader?.resize();\n }\n }\n\n /**\n * Manages Fullscreen behavior\n * This makes sure that controls are _always_ in view\n * We need this to accommodate LOAN BAR during fullscreen\n */\n manageFullScreenBehavior() {\n this.emitFullScreenState();\n\n if (!this.bookreader.options.enableFSLogoShortcut) {\n return;\n }\n\n const isFullScreen = this.bookreader.isFullscreen();\n if (isFullScreen) {\n this.addFullscreenShortcut();\n } else {\n this.deleteFullscreenShortcut();\n }\n }\n\n /**\n * Relays fullscreen toggle events\n */\n emitFullScreenState() {\n const isFullScreen = this.bookreader.isFullscreen();\n const event = new CustomEvent('ViewportInFullScreen', {\n detail: { isFullScreen },\n });\n this.dispatchEvent(event);\n }\n\n get itemImage() {\n const identifier = this.itemMD?.metadata.identifier;\n const url = `https://${this.baseHost}/services/img/${identifier}`;\n return html`<img class=\"cover-img\" src=${url} alt=\"cover image for ${identifier}\">`;\n }\n\n get placeholder() {\n return html`<div class=\"placeholder\">${this.itemImage}</div>`;\n }\n\n render() {\n return html`<div id=\"book-navigator__root\">\n ${this.bookReaderCannotLoad ? this.placeholder : nothing}\n ${!this.bookReaderCannotLoad ? html`<slot name=\"main\"></slot>` : nothing}\n </div>\n `;\n }\n\n static get styles() {\n return css`\n :host,\n #book-navigator__root,\n slot,\n slot > * {\n display: block;\n height: inherit;\n width: inherit;\n }\n .placeholder {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-direction: column;\n margin: 5%;\n }\n .cover-img {\n max-height: 300px;\n }\n `;\n }\n}\n\ncustomElements.define('book-navigator', BookNavigator);\n","/**\n * BookReaderTemplate to load BookNavigator components\n */\n\nimport { LitElement, html, css } from 'lit';\n\nimport '@internetarchive/ia-item-navigator';\nimport '../BookNavigator/book-navigator.js';\n// eslint-disable-next-line no-unused-vars\nimport { ModalManager } from '@internetarchive/modal-manager';\nimport '@internetarchive/modal-manager';\nimport { SharedResizeObserver } from '@internetarchive/shared-resize-observer';\n\nexport class IaBookReader extends LitElement {\n static get properties() {\n return {\n item: { type: Object },\n baseHost: { type: String },\n signedIn: { type: Boolean },\n fullscreen: { type: Boolean, reflect: true, attribute: true },\n sharedObserver: { type: Object, attribute: false },\n modal: { type: Object, attribute: false },\n loaded: { type: Boolean },\n menuShortcuts: { type: Array },\n menuContents: { type: Array },\n };\n }\n\n constructor() {\n super();\n this.item = undefined;\n this.bookreader = undefined;\n this.baseHost = 'https://archive.org';\n this.fullscreen = false;\n this.signedIn = false;\n /** @type {ModalManager} */\n this.modal = undefined;\n /** @type {SharedResizeObserver} */\n this.sharedObserver = undefined;\n this.loaded = false;\n this.menuShortcuts = [];\n this.menuContents = [];\n this.openMenuName = '';\n }\n\n updated() {\n if (!this.modal) {\n this.setModalManager();\n }\n\n if (!this.sharedObserver) {\n this.sharedObserver = new SharedResizeObserver();\n }\n }\n\n get itemNav() {\n return this.shadowRoot.querySelector('ia-item-navigator');\n }\n\n /** Creates modal DOM & attaches to `<body>` */\n setModalManager() {\n let modalManager = document.querySelector('modal-manager');\n if (!modalManager) {\n modalManager = document.createElement(\n 'modal-manager'\n );\n document.body.appendChild(modalManager);\n }\n\n this.modal = modalManager;\n }\n\n manageFullscreen(e) {\n const { detail } = e;\n const fullscreen = !!detail.isFullScreen;\n this.fullscreen = fullscreen;\n this.dispatchEvent(new CustomEvent('fullscreenStateUpdated', { detail: { fullscreen }}));\n\n }\n\n loadingStateUpdated(e) {\n const { loaded } = e.detail;\n this.loaded = loaded || null;\n this.dispatchEvent(new CustomEvent('loadingStateUpdated', { detail: { loaded }}));\n }\n\n setMenuShortcuts(e) {\n this.menuShortcuts = [...e.detail];\n }\n\n setMenuContents(e) {\n const updatedContents = [...e.detail];\n this.menuContents = updatedContents;\n }\n\n manageSideMenuEvents(e) {\n const { menuId, action } = e.detail;\n if (!menuId) {\n return;\n }\n\n this.openMenuName = menuId;\n\n if (action === 'open') {\n this.itemNav?.openShortcut(menuId);\n } else if (action === 'toggle') {\n this.itemNav?.toggleMenu();\n }\n }\n\n render() {\n return html`\n <div class=\"main-component\">\n <ia-item-navigator\n ?viewportInFullscreen=${this.fullscreen}\n .basehost=${this.baseHost}\n .item=${this.item}\n .modal=${this.modal}\n .loaded=${this.loaded}\n .sharedObserver=${this.sharedObserver}\n ?signedIn=${this.signedIn}\n .menuShortcuts=${this.menuShortcuts}\n .menuContents=${this.menuContents}\n .openMenu=${this.openMenuName}\n >\n <div slot=\"header\">\n <slot name=\"header\"></slot>\n </div>\n <div slot=\"main\">\n <book-navigator\n .modal=${this.modal}\n .baseHost=${this.baseHost}\n .itemMD=${this.item}\n ?signedIn=${this.signedIn}\n ?sideMenuOpen=${this.menuOpened}\n .sharedObserver=${this.sharedObserver}\n @ViewportInFullScreen=${this.manageFullscreen}\n @loadingStateUpdated=${this.loadingStateUpdated}\n @updateSideMenu=${this.manageSideMenuEvents}\n @menuUpdated=${this.setMenuContents}\n @menuShortcutsUpdated=${this.setMenuShortcuts}\n >\n <div slot=\"main\">\n <slot name=\"main\"></slot>\n </div>\n </book-navigator>\n </div>\n </ia-item-navigator>\n </div>\n `;\n }\n\n static get styles() {\n return css`\n :host {\n display: block;\n --primaryBGColor: var(--black, #000);\n --secondaryBGColor: #222;\n --tertiaryBGColor: #333;\n --primaryTextColor: var(--white, #fff);\n --primaryCTAFill: #194880;\n --primaryCTABorder: #c5d1df;\n --secondaryCTAFill: #333;\n --secondaryCTABorder: #999;\n --primaryErrorCTAFill: #e51c26;\n --primaryErrorCTABorder: #f8c6c8;\n background-color: var(--primaryBGColor);\n position: relative;\n }\n\n :host([fullscreen]),\n ia-item-navigator[viewportinfullscreen] {\n position: fixed;\n inset: 0;\n height: 100%;\n min-height: unset;\n }\n\n .main-component {\n height: 100%;\n width: 100%;\n min-height: inherit;\n }\n\n div[slot=\"header\"],\n div[slot=\"main\"] {\n display: flex;\n width: 100%;\n }\n\n slot {\n display: block;\n flex: 1;\n }\n\n ia-item-navigator {\n min-height: var(--br-height, inherit);\n height: var(--br-height, inherit);\n display: block;\n width: 100%;\n color: var(--primaryTextColor);\n --menuButtonLabelDisplay: block;\n --menuWidth: 320px;\n --menuSliderBg: var(--secondaryBGColor);\n --activeButtonBg: var(--tertiaryBGColor);\n --subpanelRightBorderColor: var(--secondaryCTABorder);\n --animationTiming: 100ms;\n --iconFillColor: var(--primaryTextColor);\n --iconStrokeColor: var(--primaryTextColor);\n --menuSliderHeaderIconHeight: 2rem;\n --menuSliderHeaderIconWidth: 2rem;\n --iconWidth: 2.4rem;\n --iconHeight: 2.4rem;\n --shareLinkColor: var(--primaryTextColor);\n --shareIconBorder: var(--primaryTextColor);\n --shareIconBg: var(--secondaryBGColor);\n --activityIndicatorLoadingDotColor: var(--primaryTextColor);\n --activityIndicatorLoadingRingColor: var(--primaryTextColor);\n }\n `;\n }\n}\n\nwindow.customElements.define(\"ia-bookreader\", IaBookReader);\n","var isObject = require('../internals/is-object');\n\nvar floor = Math.floor;\n\n// `Number.isInteger` method implementation\n// https://tc39.es/ecma262/#sec-number.isinteger\nmodule.exports = function isInteger(it) {\n return !isObject(it) && isFinite(it) && floor(it) === it;\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar $reduceRight = require('../internals/array-reduce').right;\nvar arrayMethodIsStrict = require('../internals/array-method-is-strict');\nvar CHROME_VERSION = require('../internals/engine-v8-version');\nvar IS_NODE = require('../internals/engine-is-node');\n\nvar STRICT_METHOD = arrayMethodIsStrict('reduceRight');\n// Chrome 80-82 has a critical bug\n// https://bugs.chromium.org/p/chromium/issues/detail?id=1049982\nvar CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83;\n\n// `Array.prototype.reduceRight` method\n// https://tc39.es/ecma262/#sec-array.prototype.reduceright\n$({ target: 'Array', proto: true, forced: !STRICT_METHOD || CHROME_BUG }, {\n reduceRight: function reduceRight(callbackfn /* , initialValue */) {\n return $reduceRight(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n","var $ = require('../internals/export');\nvar isInteger = require('../internals/is-integer');\n\n// `Number.isInteger` method\n// https://tc39.es/ecma262/#sec-number.isinteger\n$({ target: 'Number', stat: true }, {\n isInteger: isInteger\n});\n","'use strict';\nvar fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');\nvar anObject = require('../internals/an-object');\nvar toLength = require('../internals/to-length');\nvar toString = require('../internals/to-string');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\nvar advanceStringIndex = require('../internals/advance-string-index');\nvar regExpExec = require('../internals/regexp-exec-abstract');\n\n// @@match logic\nfixRegExpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNative) {\n return [\n // `String.prototype.match` method\n // https://tc39.es/ecma262/#sec-string.prototype.match\n function match(regexp) {\n var O = requireObjectCoercible(this);\n var matcher = regexp == undefined ? undefined : regexp[MATCH];\n return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](toString(O));\n },\n // `RegExp.prototype[@@match]` method\n // https://tc39.es/ecma262/#sec-regexp.prototype-@@match\n function (string) {\n var rx = anObject(this);\n var S = toString(string);\n var res = maybeCallNative(nativeMatch, rx, S);\n\n if (res.done) return res.value;\n\n if (!rx.global) return regExpExec(rx, S);\n\n var fullUnicode = rx.unicode;\n rx.lastIndex = 0;\n var A = [];\n var n = 0;\n var result;\n while ((result = regExpExec(rx, S)) !== null) {\n var matchStr = toString(result[0]);\n A[n] = matchStr;\n if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);\n n++;\n }\n return n === 0 ? null : A;\n }\n ];\n});\n","(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n\ttypeof define === 'function' && define.amd ? define(['exports'], factory) :\n\t(global = global || self, factory(global.throttleDebounce = {}));\n}(this, (function (exports) { 'use strict';\n\n\t/* eslint-disable no-undefined,no-param-reassign,no-shadow */\n\n\t/**\n\t * Throttle execution of a function. Especially useful for rate limiting\n\t * execution of handlers on events like resize and scroll.\n\t *\n\t * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.\n\t * @param {boolean} [noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds while the\n\t * throttled-function is being called. If noTrailing is false or unspecified, callback will be executed one final time\n\t * after the last throttled-function call. (After the throttled-function has not been called for `delay` milliseconds,\n\t * the internal counter is reset).\n\t * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,\n\t * to `callback` when the throttled-function is executed.\n\t * @param {boolean} [debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is false (at end),\n\t * schedule `callback` to execute after `delay` ms.\n\t *\n\t * @returns {Function} A new, throttled, function.\n\t */\n\tfunction throttle (delay, noTrailing, callback, debounceMode) {\n\t /*\n\t * After wrapper has stopped being called, this timeout ensures that\n\t * `callback` is executed at the proper times in `throttle` and `end`\n\t * debounce modes.\n\t */\n\t var timeoutID;\n\t var cancelled = false; // Keep track of the last time `callback` was executed.\n\n\t var lastExec = 0; // Function to clear existing timeout\n\n\t function clearExistingTimeout() {\n\t if (timeoutID) {\n\t clearTimeout(timeoutID);\n\t }\n\t } // Function to cancel next exec\n\n\n\t function cancel() {\n\t clearExistingTimeout();\n\t cancelled = true;\n\t } // `noTrailing` defaults to falsy.\n\n\n\t if (typeof noTrailing !== 'boolean') {\n\t debounceMode = callback;\n\t callback = noTrailing;\n\t noTrailing = undefined;\n\t }\n\t /*\n\t * The `wrapper` function encapsulates all of the throttling / debouncing\n\t * functionality and when executed will limit the rate at which `callback`\n\t * is executed.\n\t */\n\n\n\t function wrapper() {\n\t for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {\n\t arguments_[_key] = arguments[_key];\n\t }\n\n\t var self = this;\n\t var elapsed = Date.now() - lastExec;\n\n\t if (cancelled) {\n\t return;\n\t } // Execute `callback` and update the `lastExec` timestamp.\n\n\n\t function exec() {\n\t lastExec = Date.now();\n\t callback.apply(self, arguments_);\n\t }\n\t /*\n\t * If `debounceMode` is true (at begin) this is used to clear the flag\n\t * to allow future `callback` executions.\n\t */\n\n\n\t function clear() {\n\t timeoutID = undefined;\n\t }\n\n\t if (debounceMode && !timeoutID) {\n\t /*\n\t * Since `wrapper` is being called for the first time and\n\t * `debounceMode` is true (at begin), execute `callback`.\n\t */\n\t exec();\n\t }\n\n\t clearExistingTimeout();\n\n\t if (debounceMode === undefined && elapsed > delay) {\n\t /*\n\t * In throttle mode, if `delay` time has been exceeded, execute\n\t * `callback`.\n\t */\n\t exec();\n\t } else if (noTrailing !== true) {\n\t /*\n\t * In trailing throttle mode, since `delay` time has not been\n\t * exceeded, schedule `callback` to execute `delay` ms after most\n\t * recent execution.\n\t *\n\t * If `debounceMode` is true (at begin), schedule `clear` to execute\n\t * after `delay` ms.\n\t *\n\t * If `debounceMode` is false (at end), schedule `callback` to\n\t * execute after `delay` ms.\n\t */\n\t timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);\n\t }\n\t }\n\n\t wrapper.cancel = cancel; // Return the wrapper function.\n\n\t return wrapper;\n\t}\n\n\t/* eslint-disable no-undefined */\n\t/**\n\t * Debounce execution of a function. Debouncing, unlike throttling,\n\t * guarantees that a function is only executed a single time, either at the\n\t * very beginning of a series of calls, or at the very end.\n\t *\n\t * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.\n\t * @param {boolean} [atBegin] - Optional, defaults to false. If atBegin is false or unspecified, callback will only be executed `delay` milliseconds\n\t * after the last debounced-function call. If atBegin is true, callback will be executed only at the first debounced-function call.\n\t * (After the throttled-function has not been called for `delay` milliseconds, the internal counter is reset).\n\t * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,\n\t * to `callback` when the debounced-function is executed.\n\t *\n\t * @returns {Function} A new, debounced function.\n\t */\n\n\tfunction debounce (delay, atBegin, callback) {\n\t return callback === undefined ? throttle(delay, atBegin, false) : throttle(delay, callback, atBegin !== false);\n\t}\n\n\texports.debounce = debounce;\n\texports.throttle = throttle;\n\n\tObject.defineProperty(exports, '__esModule', { value: true });\n\n})));\n//# sourceMappingURL=index.umd.js.map\n"],"names":["__decorate","decorators","target","key","desc","d","c","arguments","length","r","Object","getOwnPropertyDescriptor","Reflect","decorate","i","defineProperty","SearchServiceErrorType","SortDirection","BooleanParser","parseValue","rawValue","Boolean","shared","NumberParser","value","parseFloat","Number","isNaN","ByteParser","DateParser","this","parseJSDate","parseBracketDate","yearMatch","match","parsedValue","replace","parsed","Date","parse","date","indexOf","getTime","getTimezoneOffset","DurationParser","componentArray","split","seconds","parseNumberFormat","parseColonSeparatedFormat","undefined","hasNaNComponent","map","element","index","componentValue","multiplier","Math","floor","reduce","a","b","MediaTypeParser","StringParser","String","constructor","parser","values","processRawValue","Array","isArray","forEach","parseAndPersistValue","push","BooleanField","super","DateField","DurationField","NumberField","StringField","ByteField","MediaTypeField","Metadata","json","rawMetadata","identifier","addeddate","publicdate","indexdate","audio_codec","audio_sample_rate","collection","collections_raw","collection_size","contributor","coverage","creator","description","downloads","duration","files_count","item_count","item_size","language","lineage","mediatype","month","noindex","notes","num_favorites","num_reviews","runtime","scanner","source","start_localtime","start_time","stop_time","subject","taper","title","track","transferer","type","uploader","utc_offset","venue","week","year","File","name","btih","md5","format","mtime","crc32","sha1","original","size","height","width","external_identifier","album","Review","reviewbody","reviewtitle","reviewer","reviewdate","createdate","stars","MetadataResponse","_a","_b","rawResponse","created","d1","d2","dir","files","file","item_last_updated","metadata","server","uniq","workable_servers","speech_vs_music_asr","reviews","entry","SearchResponseDetails","numFound","start","docs","doc","aggregations","SearchResponse","responseHeader","response","SearchServiceError","Error","message","details","SearchService","searchBackend","params","performSearch","error","success","fetchMetadata","itemNotFound","default","baseUrl","queryAsString","asUrlSearchParams","toString","url","fetchUrl","fetch","err","getErrorResult","networkError","forensics","searchEngineError","decodingError","errorType","menuButtonWidth","sliderWidth","transitionTiming","IAIconCollapseSidebar","render","customElements","define","MenuButton","icon","href","label","menuDetails","id","selected","followable","onClick","e","preventDefault","dispatchMenuTypeSelectedEvent","dispatchEvent","CustomEvent","bubbles","composed","detail","iconClass","buttonClass","menuItem","linkButton","clickButton","sliderEvents","closeDrawer","IAMenuSlider","menus","open","manuallyHandleClose","selectedMenu","selectedMenuAction","animateMenuOpen","updated","actionButton","selectedMenuDetails","setSelectedMenu","closeMenu","drawerClosed","find","menu","component","headerClass","actionBlock","closeButton","sliderDetailsClass","menuItems","selectedMenuClass","renderMenuHeader","selectedMenuComponent","window","IAIconEllipses","IAItemNavLoader","bookIconSvg","loader","IANoTheaterAvailable","emitLoaded","loaded","changed","has","downloadUrl","prototype","ItemNavigator","viewAvailable","baseHost","signedIn","menuContents","menuShortcuts","viewportInFullscreen","menuOpened","openMenuState","disconnectedCallback","removeResizeObserver","oldObserver","get","removeObserver","resizeObserverConfig","setResizeObserver","handleResize","contentRect","sharedObserver","addObserver","headerSlot","handler","requestUpdate","frame","loaderTitle","slotChange","slottedContent","assignedNodes","slot","displayReaderClass","headerHeight","offsetHeight","menuClass","shouldRenderMenu","renderSideMenu","renderViewport","loadingArea","item","loadingStateUpdated","noTheaterView","slotVisibility","manageViewportFullscreen","fullscreenStatus","isFullScreen","event","toggleMenu","setOpenMenu","openMenu","setMenuContents","updatedContents","setMenuShortcuts","manageSideMenuEvents","menuId","action","openShortcut","drawerState","shortcuts","menuToggleButton","selectedMenuId","hasMenuOrShortcuts","subnavWidth","transitionEffect","menuMargin","theaterBg","converter","JSON","atob","arg","reflect","attribute","ResizeObserverBoxOptions","resizeObservers","msg","trigger","freeze","obj","ResizeObserverSize","inlineSize","blockSize","DOMRectReadOnly","x","y","top","left","bottom","right","toJSON","fromRect","rectangle","isSVG","SVGElement","isHidden","getBBox","offsetWidth","getClientRects","isElement","Element","scope","ownerDocument","defaultView","global","cache","WeakMap","scrollRegexp","verticalRegexp","IE","test","navigator","userAgent","parseDimension","pixel","switchSizes","zeroBoxes","devicePixelContentBoxSize","borderBoxSize","contentBoxSize","calculateBoxSizes","forceRecalculation","set","cs","getComputedStyle","svg","ownerSVGElement","removePadding","boxSizing","writingMode","canScrollVertically","overflowY","canScrollHorizontally","overflowX","paddingTop","paddingRight","paddingBottom","paddingLeft","borderTop","borderTopWidth","borderRight","borderRightWidth","borderBottom","borderBottomWidth","horizontalPadding","verticalPadding","horizontalBorderArea","borderLeftWidth","verticalBorderArea","horizontalScrollbarThickness","clientHeight","verticalScrollbarThickness","clientWidth","widthReduction","heightReduction","contentWidth","contentHeight","borderBoxWidth","borderBoxHeight","boxes","round","devicePixelRatio","calculateBoxSize","observedBox","DEVICE_PIXEL_CONTENT_BOX","BORDER_BOX","ResizeObserverEntry","calculateDepthForNode","node","Infinity","depth","parent","parentNode","broadcastActiveObservations","shallowestDepth","callbacks","ro","activeTargets","entries","ot","targetDepth","lastReportedSize","callback","call","observer","splice","_i","callbacks_1","gatherActiveObservationsAtDepth","skippedTargets","observationTargets","isActive","watching","observerConfig","attributes","characterData","childList","subtree","events","time","timeout","now","scheduled","scheduler","Scheduler","_this","stopped","listener","schedule","run","cb","until","elementsHaveResized","some","ErrorEvent","document","createEvent","initEvent","process","toggle_1","el_1","createTextNode","MutationObserver","observe","textContent","queueMicroTask","requestAnimationFrame","stop","body","addEventListener","disconnect","removeEventListener","updateCount","n","ResizeObservation","CONTENT_BOX","tagName","isReplacedElement","display","ResizeObserverDetail","resizeObserver","observerMap","getObservationIndex","ResizeObserverController","connect","options","firstObservation","box","unobserve","lastObservation","slice","ResizeObserver","TypeError","SharedResizeObserver","handlers","resizeHandlers","Map","Set","add","delete","ModalConfig","_c","_d","_e","subtitle","headline","headerColor","showProcessingIndicator","processingImageMode","showCloseButton","closeOnBackdropClick","isCEPolyfill","polyfillWrapFlushCallback","removeNodes","container","end","nextSibling","removeChild","marker","random","nodeMarker","markerRegex","RegExp","boundAttributeSuffix","Template","result","parts","nodesToRemove","stack","walker","createTreeWalker","content","lastPartIndex","partIndex","strings","nextNode","nodeType","hasAttributes","count","endsWith","stringForPart","lastAttributeNameRegex","exec","attributeLookupName","toLowerCase","attributeValue","getAttribute","removeAttribute","statics","currentNode","data","lastIndex","insert","s","createMarker","insertBefore","previousSibling","pop","str","suffix","isTemplatePartActive","part","createComment","walkerNodeFilter","removeNodesFromTemplate","template","nextActiveIndexInTemplateParts","nodeIndex","removeCount","nodesToRemoveInTemplate","currentRemovingNode","countNodes","startIndex","directives","isDirective","o","noChange","nothing","TemplateInstance","processor","__parts","setValue","commit","fragment","cloneNode","importNode","nodeName","handleTextExpression","insertAfterNode","handleAttributeExpressions","adoptNode","upgrade","policy","trustedTypes","createPolicy","createHTML","commentMarker","TemplateResult","l","html","isCommentBinding","commentOpen","lastIndexOf","attributeMatch","substr","createElement","getHTML","innerHTML","isPrimitive","isIterable","Symbol","iterator","AttributeCommitter","dirty","_createPart","AttributePart","v","text","t","setAttribute","_getValue","committer","directive","NodePart","__pendingValue","startNode","appendChild","endNode","ref","__insert","__commitText","__commitTemplateResult","Node","__commitNode","__commitIterable","clear","valueAsString","templateFactory","update","instance","_clone","itemPart","itemParts","appendIntoPart","insertAfterPart","BooleanAttributePart","PropertyCommitter","single","PropertyPart","eventOptionsSupported","EventPart","eventName","eventContext","__boundHandleEvent","handleEvent","newListener","oldListener","shouldRemoveListener","capture","once","passive","shouldAddListener","__options","getOptions","templateCache","templateCaches","stringsArray","keyString","join","getTemplateElement","prefix","getTemplateCacheKey","scopeName","compatibleShadyCSSVersion","ShadyCSS","prepareTemplateDom","console","warn","shadyTemplateFactory","cacheKey","TEMPLATE_TYPES","shadyRenderSet","JSCompiler_renameProperty","prop","_obj","defaultConverter","toAttribute","stringify","fromAttribute","notEqual","old","defaultPropertyDeclaration","hasChanged","UpdatingElement","initialize","finalize","_classProperties","p","attr","_attributeNameForProperty","_attributeToPropertyMap","hasOwnProperty","superProperties","getPrototypeOf","k","_ensureClassProperties","noAccessor","descriptor","getPropertyDescriptor","oldValue","requestUpdateInternal","configurable","enumerable","superCtor","props","properties","getOwnPropertyNames","getOwnPropertySymbols","createProperty","_updateState","_updatePromise","Promise","res","_enableUpdatingResolver","_changedProperties","_saveInstanceProperties","_v","_instanceProperties","enableUpdating","_attributeToProperty","ctor","attrValue","_propertyValueToAttribute","propName","getPropertyOptions","_propertyValueFromAttribute","shouldRequestUpdate","_valueHasChanged","_reflectingProperties","_hasRequestedUpdate","_enqueueUpdate","updateComplete","performUpdate","_applyInstanceProperties","shouldUpdate","changedProperties","_markUpdated","firstUpdated","_getUpdateComplete","getUpdateComplete","_propertyToAttribute","HTMLElement","customElement","classOrDescriptor","clazz","legacyCustomElement","kind","elements","finisher","standardCustomElement","property","protoOrDescriptor","proto","legacyProperty","placement","initializer","standardProperty","ElementProto","msMatchesSelector","webkitMatchesSelector","supportsAdoptingStyleSheets","ShadowRoot","nativeShadow","Document","CSSStyleSheet","constructionToken","CSSResult","cssText","safeToken","_styleSheet","replaceSync","textFromCSSResult","css","acc","idx","renderNotImplemented","LitElement","styles","userStyles","getStyles","addStyles","reduceRight","unshift","_styles","cssRules","rule","_getUniqueStyles","renderRoot","createRenderRoot","adoptStyles","attachShadow","shadowRootOptions","adoptedStyleSheets","styleSheet","_needsShimAdoptedStyleSheets","ScopingShim","prepareAdoptedCssText","localName","hasUpdated","styleElement","templateResult","style","hasRendered","needsScoping","host","firstScopeRender","renderContainer","createDocumentFragment","firstChild","appendInto","renderedDOM","templateElement","querySelectorAll","condensedStyle","templates","from","removeStylesFromLitTemplates","refNode","insertCount","walkerIndex","insertNodeIntoTemplate","prepareTemplateStyles","querySelector","removes","mode","IAActivityIndicatorMode","processing","complete","checkmarkColorCss","completedRingColorCss","loadingRingColorCss","loadingDotColorCss","ModalTemplate","config","closeButtonTemplate","handleCloseButton","Event","modalLogoSize","processingImageSize","modalCornerRadius","modalBorder","modalBottomMarginCss","modalTopMarginCss","modalHeaderBottomPaddingCss","modalBottomPadding","scrollOffset","titleFontSize","subtitleFontSize","headlineFontSize","messageFontSize","titleLineHeight","subtitleLineHeight","headlineLineHeight","messageLineHeight","ModalManagerMode","ModalManagerHostBridge","modalManager","windowResizeThrottler","throttle","updateModalContainerHeight","bind","handleModeChange","Open","startResizeListener","stopDocumentScroll","Closed","stopResizeListener","resumeDocumentScroll","setProperty","innerHeight","classList","remove","ModalManager","hostBridge","backdropClicked","closeButtonPressed","customModalContent","getMode","closeModal","callUserClosedModalCallback","userClosedModalCallback","showModal","thisArg","generator","modalTemplate","focus","P","resolve","reject","fulfilled","step","next","rejected","done","then","apply","emitModeChangeEvent","modalBackdropColor","modalBackdropZindex","modalWidth","modalMaxWidth","modalZindex","selector","legacyQuery","standardQuery","UnsafeHTMLDirective","partInfo","PartType","directiveName","_templateResult","_value","raw","_$litType$","resultType","Directive","unsafeHTML","BookSearchResult","matchRegex","hit","par","resultDetails","pageNumber","isInteger","page","coverImage","cover","resultSelected","highlightedHit","IABookSearchResults","results","query","queryInProgress","renderHeader","renderSearchAllFields","displayResultImages","errorMessage","bindBookReaderListeners","renderSearchAllFiles","searchResultText","searchResultBg","searchResultBorder","activeButtonBg","mainCSS","checkmarkIcon","closeIcon","buttonCSS","focusOnInputIfNecessary","setResults","shadowRoot","currentTarget","input","dispatchSearchCanceled","header","resultsCount","controls","cancelSearch","resultsClass","selectResult","searchMultipleControls","setQuery","showSearchCTA","headerSection","searchForm","loadingIndicator","setErrorMessage","resultsSet","searchCTA","searchState","SearchProvider","onProviderChange","bookreader","onBookSearchInitiated","onSearchStarted","onSearchRequestError","onSearchResultsClicked","onSearchResultsChange","onSearchResultsCleared","searchCanceledInMenu","bindEventListeners","getMenuDetails","getComponent","advanceToPage","updateMenu","unit","onSearchCanceled","searchCanceled","term","search","errorMessages","noResults","notIndexed","messageToShow","searchResults","q","matches","cancelSearchRequest","searchView","clearSearchFieldAndResults","searchUpdates","leaf","leafNumToIndex","_searchPluginGoToResult","IABookDownloads","expiration","isBookProtected","mainCss","buttonStyles","option","note","formatsCount","loanExpiryMessage","renderDownloadOptions","accessProtectedBook","menuBase","pdf","epub","publicMenuBase","DownloadsProvider","isProtected","computeAvailableTypes","downloadTypes","ending","availableTypes","menuData","found","incoming","link","formattedType","downloadOption","menuButtonText","menuInfo","assign","IAIconVisualAdjustment","ChildPart","_$LH","insertPart","containerPart","refPart","_$startNode","_$endNode","newConnectionState","oldParent","_$parent","parentChanged","_$reparentDisconnectables","_$notifyConnectionChanged","_$isConnected","setChildPartValue","directiveParent","_$setValue","RESET_VALUE","removePart","generateMap","list","repeat","_getValuesAndKeys","items","keyFnOrTemplate","keyFn","keys","oldParts","_$committedValue","getCommittedValue","newValues","newKeys","_itemKeys","newKeyToIndexMap","oldKeyToIndexMap","oldKeys","newParts","oldHead","oldTail","newHead","newTail","oldIndex","oldPart","newPart","setCommittedValue","namespacedEvent","optionChange","zoomIn","zoomOut","IABookVisualAdjustments","activeCount","showZoomControls","activeOptions","emitOptionChangedEvent","active","changedOptionId","prepareEventDetails","optionName","updatedOptions","checkedOption","min","max","setRangeValue","formID","changeActiveStateFor","rangeSlider","activeAdjustments","emitZoomOut","emitZoomIn","adjustmentCheckbox","zoomControls","visualAdjustmentOptions","VisualAdjustmentsProvider","bookContainer","refs","$brContainer","onAdjustmentChange","optionUpdateComplete","updateOptionsCount","onZoomIn","onZoomOut","zoom","adjustments","brightness","contrast","grayscale","invert","filters","newValue","DeleteModalActions","cancelAction","Function","deleteAction","pageID","BookmarkButton","state","side","position","handleClick","BookmarksLogin","api","endpoint","headers","credentials","method","getAll","post","bookmark","sendBookmarkData","put","color","IABookmarks","bookmarks","editedBookmark","modal","loginOptions","loginClicked","loginUrl","displayMode","bookmarkColors","className","defaultColor","deleteModalConfig","activeBookmarkID","updateDisplay","emitBookmarksChanged","bookId","fetchUserBookmarks","setBREventListeners","fetchBookmarks","initializeBookmarks","setTimeout","renderBookmarkButtons","markActiveBookmark","leafNum","nomalizedParams","getBookmarkColor","formatPage","getPageNum","thumbnail","getPageURI","resText","parsedResponse","bkmrks","formattedLeafNum","parseInt","formattedBookmark","formatBookmark","getBookmark","confirmDeletion","createBookmark","$","not","pageEl","existingButton","pageBookmark","bookmarkState","_models","book","getPage","isViewable","bookmarkButton","stopPropagation","pageSide","constMode2up","bookmarkButtonClicked","atSetup","constModeThumb","currentIndex","pagesInView","displayedIndices","pagesHaveActiveBookmark","includes","requestedPageHasBookmark","closeEdit","m","existingBookmark","bookmarkEdited","emitBookmarkButtonClicked","disableAddBookmarkButton","jumpToPage","displayDeletionModal","deleteBookmark","currBookmarks","pageToCheck","shouldEnableAddBookmarkButton","addBookmark","bookmarkSelected","saveBookmark","bookmarksList","allowAddingBookmark","addBookmarkButton","bookmarkHelperMessage","IABookmarkEdit","showBookmark","bookmarkEditCSS","bookmarkColorsCSS","colorId","bookmarkId","emitColorChangedEvent","changeColorTo","bookmarkTemplate","emitSaveEvent","updateNote","bookmarkColor","emitDeleteEvent","IAIconEditPencil","IABookmarksList","defaultBookmarkColor","emitEditEvent","emitSaveBookmark","emitDeleteBookmark","colorVal","labelInfo","editMode","bookmarkColorInfo","activeClass","emitSelectedEvent","editBookmark","editBookmarkComponent","emitBookmarkColorChanged","sort","bookmarksCount","sortedBookmarks","sortBookmarks","bookmarkItem","bookmarkslist","BookmarksProvider","referrerStr","encodeURIComponent","location","bookmarksLoginClicked","bindEvents","setup","bookmarksChanged","bookmarksLength","showSidePanel","archive_analytics","send_event_no_sampling","path","IAIconShare","classMap","classInfo","filter","_previousClasses","_staticClasses","IAIconLink","IAIconEmail","promoCopy","encodeString","encodedFileSubPrefix","fileSubPrefix","class","itemPath","IAIconFacebook","IAIconPinterest","encodedDescription","encodedCreator","encodedPromoCopy","IAIconTumblr","IAIconTwitter","copyToClipboard","textarea","select","execCommand","blur","clearTimeout","IASharingOptions","embedOptionsVisible","sharingOptions","toggleEmbedOptions","sharingItems","embedOption","visible","embed","iframeEmbed","bbcodeEmbed","helpURL","SharingProvider","creatorToUse","subPrefix","Volumes","hostUrl","sortOrderBy","viewableFiles","activeFile","scrollIntoViewIfNeeded","hrefUrl","url_path","image","author","file_subprefix","volumes","volume","file_prefix","volumeItem","volumesList","sortType","VolumesProvider","multipleBooksList","by_subprefix","volumeCount","volumesIcon","urlPlugin","pullFromAddressBar","urlSortValue","getUrlParam","sortVolumes","sortNeutralIcon","title_asc","sortAscIcon","title_desc","sortDescIcon","sortByType","sortedFiles","localeCompare","orig_sort","sortButton","setUrlParam","removeUrlParam","multipleFilesClicked","orderBy","BookNavigator","itemMD","bookReaderCannotLoad","bookReaderLoaded","bookIsRestricted","downloadableTypes","isAdmin","lendingInitialized","lendingStatus","menuProviders","fullscreenBranding","iaLogo","sharedObserverHandler","brWidth","brHeight","shortcutOrder","mainBRContainer","emitPostInit","initializeBookSubmenus","loadSharedObserver","brSelector","el","providers","DownloadProvider","baseProviderConfig","share","visualAdjustments","VisualAdjustmentProvider","updateMenuContents","enableSearch","brInstance","isWideEnoughToOpenMenu","updateSideMenu","enableBookmarks","enableMultipleBooks","addMenuShortcut","closeFS","fullscreenShortcut","sortMenuShortcuts","emitMenuShortcutsUpdated","updatedShortcuts","exitFullScreen","closeFullscreen","availableMenus","shouldShowDownloadsMenu","user_loan_record","emitLoadingStatusUpdate","resize","manageFullScreenBehavior","downloadTypesAvailable","previewType","isRestricted","downloadURLs","startBrWidth","startBrHeight","animating","widthChange","heightChange","emitFullScreenState","enableFSLogoShortcut","isFullscreen","addFullscreenShortcut","deleteFullscreenShortcut","itemImage","placeholder","IaBookReader","fullscreen","openMenuName","setModalManager","itemNav","manageFullscreen","isObject","module","exports","it","isFinite","$reduceRight","arrayMethodIsStrict","CHROME_VERSION","IS_NODE","forced","callbackfn","stat","fixRegExpWellKnownSymbolLogic","anObject","toLength","requireObjectCoercible","advanceStringIndex","regExpExec","MATCH","nativeMatch","maybeCallNative","regexp","O","matcher","string","rx","S","fullUnicode","unicode","A","matchStr","delay","noTrailing","debounceMode","timeoutID","cancelled","lastExec","clearExistingTimeout","wrapper","_len","arguments_","_key","self","elapsed","cancel","debounce","atBegin","factory"],"sourceRoot":""}
1
+ {"version":3,"file":"ia-bookreader-bundle.js","mappings":";kQAoDO,SAASA,EAAWC,EAAYC,EAAQC,EAAKC,GAChD,IAA2HC,EAAvHC,EAAIC,UAAUC,OAAQC,EAAIH,EAAI,EAAIJ,EAAkB,OAATE,EAAgBA,EAAOM,OAAOC,yBAAyBT,EAAQC,GAAOC,EACrH,GAAuB,iBAAZQ,SAAoD,mBAArBA,QAAQC,SAAyBJ,EAAIG,QAAQC,SAASZ,EAAYC,EAAQC,EAAKC,QACpH,IAAK,IAAIU,EAAIb,EAAWO,OAAS,EAAGM,GAAK,EAAGA,KAAST,EAAIJ,EAAWa,MAAIL,GAAKH,EAAI,EAAID,EAAEI,GAAKH,EAAI,EAAID,EAAEH,EAAQC,EAAKM,GAAKJ,EAAEH,EAAQC,KAASM,GAChJ,OAAOH,EAAI,GAAKG,GAAKC,OAAOK,eAAeb,EAAQC,EAAKM,GAAIA,MCtDrDO,ECiCAC,YCnCJ,MAAMC,EAETC,WAAWC,GACP,OAAwB,iBAAbA,GACO,UAAbA,GAAqC,MAAbA,IAGtBC,QAAQD,IAKvBF,EAAcI,OAAS,IAAIJ,ECZpB,MAAMK,EAETJ,WAAWC,GACP,GAAwB,iBAAbA,EACP,OAAOA,EACX,GAAwB,kBAAbA,EACP,OACJ,MAAMI,EAAQC,WAAWL,GACzB,OAAIM,OAAOC,MAAMH,QAAjB,EAGOA,GAKfD,EAAaD,OAAS,IAAIC,ECPnB,MAAMK,EAETT,WAAWC,GAEP,OADeG,EAAaD,OACdH,WAAWC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AaiK,GAuBjB,SAASI,IACP,IAAK,IAAIC,EAAOv9C,UAAUC,OAAQu9C,EAAa,IAAI15C,MAAMy5C,GAAOE,EAAO,EAAGA,EAAOF,EAAME,IACrFD,EAAWC,GAAQz9C,UAAUy9C,GAG/B,IAAIC,EAAOn8C,KACPo8C,EAAU57C,KAAK6a,MAAQwgC,EAO3B,SAASn6B,IACPm6B,EAAWr7C,KAAK6a,MAChBnB,EAASoe,MAAM6jB,EAAMF,GAQvB,SAAS10B,IACPo0B,OAAYv6C,EAhBVw6C,IAmBAF,IAAiBC,GAKnBj6B,IAGFo6B,SAEqB16C,IAAjBs6C,GAA8BU,EAAUZ,EAK1C95B,KACwB,IAAf+5B,IAYTE,EAAYxS,WAAWuS,EAAen0B,EAAQ7F,OAAuBtgB,IAAjBs6C,EAA6BF,EAAQY,EAAUZ,KAMvG,MAzE0B,kBAAfC,IACTC,EAAexhC,EACfA,EAAWuhC,EACXA,OAAar6C,GAoEf26C,EAAQM,OA7ER,WACEP,IACAF,GAAY,GA6EPG,EAuBTpC,EAAQ2C,SAJR,SAAmBd,EAAOe,EAASriC,GACjC,YAAoB9Y,IAAb8Y,EAAyB8b,EAASwlB,EAAOe,GAAS,GAASvmB,EAASwlB,EAAOthC,GAAsB,IAAZqiC,IAI9F5C,EAAQ3jB,SAAWA,EAEnBp3B,OAAOK,eAAe06C,EAAS,aAAc,CAAEj6C,OAAO,IAlJS88C,CAAQ7C","sources":["webpack://@internetarchive/bookreader/./node_modules/tslib/tslib.es6.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/search-service/dist/src/search-service-error.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/search-service/dist/src/search-params.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/field-parsers/dist/src/field-types/boolean.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/field-parsers/dist/src/field-types/number.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/field-parsers/dist/src/field-types/byte.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/field-parsers/dist/src/field-types/date.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/field-parsers/dist/src/field-types/duration.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/field-parsers/dist/src/field-types/mediatype.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/field-parsers/dist/src/field-types/page-progression.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/field-parsers/dist/src/field-types/string.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/search-service/dist/src/models/metadata-fields/metadata-field.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/search-service/dist/src/models/metadata-fields/field-types/boolean.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/search-service/dist/src/models/metadata-fields/field-types/date.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/search-service/dist/src/models/metadata-fields/field-types/duration.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/search-service/dist/src/models/metadata-fields/field-types/number.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/search-service/dist/src/models/metadata-fields/field-types/string.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/search-service/dist/src/models/metadata-fields/field-types/byte.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/search-service/dist/src/models/metadata-fields/field-types/mediatype.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/search-service/dist/src/models/metadata.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/search-service/dist/src/models/file.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/search-service/dist/src/models/review.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/search-service/dist/src/responses/metadata/metadata-response.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/search-service/dist/src/responses/search/search-response-details.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/search-service/dist/src/responses/search/search-response.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/search-service/dist/src/search-service.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/search-service/dist/src/search-backend/default-search-backend.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/ia-menu-slider/src/styles/menu-slider.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-collapse-sidebar/index.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-collapse-sidebar/icon-collapse-sidebar.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/ia-menu-slider/src/styles/menu-button.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/ia-menu-slider/src/menu-button.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/ia-menu-slider/src/ia-menu-slider.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-ellipses/index.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-ellipses/icon-ellipses.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/ia-item-navigator/dist/src/loader.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/ia-item-navigator/dist/src/no-theater-available.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/ia-item-navigator/dist/src/item-navigator.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/ResizeObserverBoxOptions.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/utils/resizeObservers.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/algorithms/deliverResizeLoopError.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/utils/freeze.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/utils/queueMicroTask.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/ResizeObserverSize.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/DOMRectReadOnly.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/utils/element.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/utils/global.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/algorithms/calculateBoxSize.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/ResizeObserverEntry.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/algorithms/calculateDepthForNode.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/algorithms/broadcastActiveObservations.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/algorithms/gatherActiveObservationsAtDepth.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/utils/scheduler.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/utils/queueResizeObserver.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/utils/process.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/algorithms/hasActiveObservations.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/algorithms/hasSkippedObservations.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/ResizeObservation.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/ResizeObserverDetail.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/ResizeObserverController.js","webpack://@internetarchive/bookreader/./node_modules/@juggle/resize-observer/lib/ResizeObserver.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/shared-resize-observer/dist/src/shared-resize-observer.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/modal-manager/dist/src/modal-config.js","webpack://@internetarchive/bookreader/../src/lib/dom.ts","webpack://@internetarchive/bookreader/../src/lib/template.ts","webpack://@internetarchive/bookreader/../src/lib/modify-template.ts","webpack://@internetarchive/bookreader/../src/lib/directive.ts","webpack://@internetarchive/bookreader/../src/lib/part.ts","webpack://@internetarchive/bookreader/../src/lib/template-instance.ts","webpack://@internetarchive/bookreader/../src/lib/template-result.ts","webpack://@internetarchive/bookreader/../src/lib/parts.ts","webpack://@internetarchive/bookreader/../src/lib/template-factory.ts","webpack://@internetarchive/bookreader/../src/lib/render.ts","webpack://@internetarchive/bookreader/../src/lib/default-template-processor.ts","webpack://@internetarchive/bookreader/src/lit-html.ts","webpack://@internetarchive/bookreader/../src/lib/shady-render.ts","webpack://@internetarchive/bookreader/../src/lib/updating-element.ts","webpack://@internetarchive/bookreader/../src/lib/decorators.ts","webpack://@internetarchive/bookreader/../src/lib/css-tag.ts","webpack://@internetarchive/bookreader/src/lit-element.ts","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/ia-activity-indicator/src/ia-activity-indicator.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/ia-activity-indicator/ia-activity-indicator.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/modal-manager/node_modules/@internetarchive/icon-close/index.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/modal-manager/node_modules/@internetarchive/icon-ia-logo/index.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/modal-manager/dist/src/modal-template.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/modal-manager/dist/src/modal-manager-mode.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/modal-manager/dist/src/modal-manager-host-bridge.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/modal-manager/dist/src/modal-manager.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-search/index.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-search/icon-search.js","webpack://@internetarchive/bookreader/../src/directives/unsafe-html.ts","webpack://@internetarchive/bookreader/./src/BookNavigator/search/a-search-result.js","webpack://@internetarchive/bookreader/./src/BookNavigator/assets/icon_checkmark.js","webpack://@internetarchive/bookreader/./src/BookNavigator/assets/icon_close.js","webpack://@internetarchive/bookreader/./src/BookNavigator/assets/button-base.js","webpack://@internetarchive/bookreader/./src/BookNavigator/search/search-results.js","webpack://@internetarchive/bookreader/./src/BookNavigator/search/search-provider.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-dl/index.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-dl/icon-dl.js","webpack://@internetarchive/bookreader/./src/BookNavigator/downloads/downloads.js","webpack://@internetarchive/bookreader/./src/BookNavigator/downloads/downloads-provider.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-visual-adjustment/index.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-visual-adjustment/icon-visual-adjustment.js","webpack://@internetarchive/bookreader/src/directive-helpers.ts","webpack://@internetarchive/bookreader/../src/directives/repeat.ts","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-magnify-minus/index.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-magnify-minus/icon-magnify-minus.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-magnify-plus/index.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-magnify-plus/icon-magnify-plus.js","webpack://@internetarchive/bookreader/./src/BookNavigator/visual-adjustments/visual-adjustments.js","webpack://@internetarchive/bookreader/./src/BookNavigator/visual-adjustments/visual-adjustments-provider.js","webpack://@internetarchive/bookreader/./src/BookNavigator/delete-modal-actions.js","webpack://@internetarchive/bookreader/./src/BookNavigator/bookmarks/bookmark-button.js","webpack://@internetarchive/bookreader/./src/BookNavigator/bookmarks/bookmarks-loginCTA.js","webpack://@internetarchive/bookreader/./src/BookNavigator/bookmarks/ia-bookmarks.js","webpack://@internetarchive/bookreader/./src/BookNavigator/assets/bookmark-colors.js","webpack://@internetarchive/bookreader/./src/BookNavigator/bookmarks/bookmark-edit.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-edit-pencil/index.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-edit-pencil/icon-edit-pencil.js","webpack://@internetarchive/bookreader/./src/BookNavigator/bookmarks/bookmarks-list.js","webpack://@internetarchive/bookreader/./src/BookNavigator/bookmarks/bookmarks-provider.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-bookmark/src/icon-bookmark.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-share/index.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-share/icon-share.js","webpack://@internetarchive/bookreader/../src/directives/class-map.ts","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-link/index.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-link/icon-link.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/ia-sharing-options/src/styles/ia-sharing-options.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-email/index.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-email/icon-email.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/ia-sharing-options/src/providers/provider.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/ia-sharing-options/src/providers/email.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-facebook/index.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-facebook/icon-facebook.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/ia-sharing-options/src/providers/facebook.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-pinterest/index.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-pinterest/icon-pinterest.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/ia-sharing-options/src/providers/pinterest.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-tumblr/index.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-tumblr/icon-tumblr.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/ia-sharing-options/src/providers/tumblr.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-twitter/index.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-twitter/icon-twitter.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/ia-sharing-options/src/providers/twitter.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/ia-sharing-options/src/ia-sharing-options.js","webpack://@internetarchive/bookreader/./src/BookNavigator/sharing.js","webpack://@internetarchive/bookreader/./src/BookNavigator/assets/icon_sort_desc.js","webpack://@internetarchive/bookreader/./src/BookNavigator/assets/icon_sort_asc.js","webpack://@internetarchive/bookreader/./src/BookNavigator/assets/icon_sort_neutral.js","webpack://@internetarchive/bookreader/./src/BookNavigator/assets/icon_volumes.js","webpack://@internetarchive/bookreader/./src/BookNavigator/volumes/volumes.js","webpack://@internetarchive/bookreader/./src/BookNavigator/volumes/volumes-provider.js","webpack://@internetarchive/bookreader/./src/BookNavigator/assets/ia-logo.js","webpack://@internetarchive/bookreader/./src/BookNavigator/book-navigator.js","webpack://@internetarchive/bookreader/./src/ia-bookreader/ia-bookreader.js","webpack://@internetarchive/bookreader/./node_modules/core-js/internals/is-integer.js","webpack://@internetarchive/bookreader/./node_modules/core-js/modules/es.array.reduce-right.js","webpack://@internetarchive/bookreader/./node_modules/core-js/modules/es.number.is-integer.js","webpack://@internetarchive/bookreader/./node_modules/core-js/modules/es.string.match.js","webpack://@internetarchive/bookreader/./node_modules/throttle-debounce/index.umd.js"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nexport var SearchServiceErrorType;\n(function (SearchServiceErrorType) {\n SearchServiceErrorType[\"networkError\"] = \"SearchService.NetworkError\";\n SearchServiceErrorType[\"itemNotFound\"] = \"SearchService.ItemNotFound\";\n SearchServiceErrorType[\"decodingError\"] = \"SearchService.DecodingError\";\n SearchServiceErrorType[\"searchEngineError\"] = \"SearchService.SearchEngineError\";\n})(SearchServiceErrorType || (SearchServiceErrorType = {}));\nexport class SearchServiceError extends Error {\n constructor(type, message, details) {\n super(message);\n this.name = type;\n this.type = type;\n this.details = details;\n }\n}\n//# sourceMappingURL=search-service-error.js.map","export class AggregateSearchParams {\n constructor(searchParams) {\n this.searchParams = searchParams;\n }\n /**\n * Generates a query parameter from the given aggregate search params\n *\n * Example:\n *\n * [\n * {\n * \"terms\": {\n * \"field\": \"collection\",\n * \"size\":10\n * }\n * },\n * {\n * \"terms\": {\n * \"field\": \"subjectSorter\",\n * \"size\": 10\n * }\n * }\n * ]\n *\n * @returns {Record<string, AggregateSearchParam>[]}\n * @memberof AggregateSearchParams\n */\n get asSearchParams() {\n return this.searchParams.map(param => {\n return {\n terms: param,\n };\n });\n }\n}\nexport var SortDirection;\n(function (SortDirection) {\n SortDirection[\"Asc\"] = \"asc\";\n SortDirection[\"Desc\"] = \"desc\";\n})(SortDirection || (SortDirection = {}));\nexport class SortParam {\n constructor(field, direction) {\n this.field = field;\n this.direction = direction;\n }\n get asString() {\n return `${this.field} ${this.direction}`;\n }\n}\n/**\n * SearchParams provides an encapsulation to all of the search parameters\n * available for searching.\n *\n * It also provides an `asUrlSearchParams` method for converting the\n * parameters to an IA-style query string. ie. it converts the `fields` array\n * to `fl=identifier,collection` and `sort` to `sort=date+desc,downloads+asc`\n */\nexport class SearchParams {\n constructor(options) {\n this.query = options.query;\n this.sort = options.sort;\n this.rows = options.rows;\n this.page = options.page;\n this.fields = options.fields;\n this.aggregations = options.aggregations;\n }\n /**\n * Return a URLSearchParams representation of the parameters for use in network requests.\n *\n * @readonly\n * @type {URLSearchParams}\n * @memberof SearchParams\n */\n get asUrlSearchParams() {\n const params = new URLSearchParams();\n params.append('q', this.query);\n params.append('output', 'json');\n if (this.rows) {\n params.append('rows', String(this.rows));\n }\n if (this.page) {\n params.append('page', String(this.page));\n }\n if (this.fields) {\n params.append('fl', this.fields.join(','));\n }\n if (this.sort) {\n const sortStrings = this.sort.map(sort => sort.asString);\n params.append('sort', sortStrings.join(','));\n }\n if (this.aggregations) {\n const searchParams = this.aggregations.asSearchParams;\n const stringified = JSON.stringify(searchParams);\n params.append('user_aggs', stringified);\n }\n return params;\n }\n}\n//# sourceMappingURL=search-params.js.map","export class BooleanParser {\n /** @inheritdoc */\n parseValue(rawValue) {\n if (typeof rawValue === 'string' &&\n (rawValue === 'false' || rawValue === '0')) {\n return false;\n }\n return Boolean(rawValue);\n }\n}\n// use a shared static instance for performance instead of\n// instantiating a new instance for every use\nBooleanParser.shared = new BooleanParser();\n//# sourceMappingURL=boolean.js.map","export class NumberParser {\n /** @inheritdoc */\n parseValue(rawValue) {\n if (typeof rawValue === 'number')\n return rawValue;\n if (typeof rawValue === 'boolean')\n return undefined;\n const value = parseFloat(rawValue);\n if (Number.isNaN(value)) {\n return undefined;\n }\n return value;\n }\n}\n// use a shared static instance for performance instead of\n// instantiating a new instance for every use\nNumberParser.shared = new NumberParser();\n//# sourceMappingURL=number.js.map","import { NumberParser } from './number';\n/**\n * The ByteParser is a unit-specific NumberParser\n * that returns a value in bytes\n *\n * @export\n * @class ByteParser\n * @implements {FieldParserInterface<Byte>}\n */\nexport class ByteParser {\n /** @inheritdoc */\n parseValue(rawValue) {\n const parser = NumberParser.shared;\n return parser.parseValue(rawValue);\n }\n}\n// use a shared static instance for performance instead of\n// instantiating a new instance for every use\nByteParser.shared = new ByteParser();\n//# sourceMappingURL=byte.js.map","export class DateParser {\n /** @inheritdoc */\n parseValue(rawValue) {\n // try different date parsing\n return this.parseJSDate(rawValue) || this.parseBracketDate(rawValue);\n }\n // handles \"[yyyy]\" format\n parseBracketDate(rawValue) {\n if (typeof rawValue !== 'string')\n return undefined;\n const yearMatch = rawValue.match(/\\[([0-9]{4})\\]/);\n if (!yearMatch || yearMatch.length < 2) {\n return undefined;\n }\n return this.parseJSDate(yearMatch[1]);\n }\n parseJSDate(rawValue) {\n if (typeof rawValue !== 'string')\n return undefined;\n let parsedValue = rawValue;\n // fix for Safari not supporting `yyyy-mm-dd HH:MM:SS` format, insert a `T` into the space\n if (parsedValue.match(/^[0-9]{4}-[0-9]{2}-[0-9]{2}\\s{1}[0-9]{2}:[0-9]{2}:[0-9]{2}$/)) {\n parsedValue = parsedValue.replace(' ', 'T');\n }\n const parsed = Date.parse(parsedValue);\n if (Number.isNaN(parsed)) {\n return undefined;\n }\n let date = new Date(parsedValue);\n // the `Date(string)` constructor parses some strings as GMT and some in the local timezone\n // this attempts to detect cases that get parsed as GMT and adjusts accordingly\n const dateWithTimeZone = parsedValue.indexOf('Z') > -1 || // ISO8601 with GMT timezone\n parsedValue.indexOf('+') > -1 || // ISO8601 with positive timezone offset\n parsedValue.match(/^[0-9]{4}$/) || // just the year, ie `2020`\n parsedValue.match(/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/) || // YYYY-MM-DD format\n parsedValue.match(/^.*?-[0-9]{2}:[0-9]{2}$/) || // `YYYY-MM-DDTHH:mm:ss-00:00` format\n parsedValue.match(/^.*?-[0-9]{4}$/); // `YYYY-MM-DDTHH:mm:ss-0000` format\n if (dateWithTimeZone) {\n date = new Date(date.getTime() + date.getTimezoneOffset() * 1000 * 60);\n }\n return date;\n }\n}\n// use a shared static instance for performance instead of\n// instantiating a new instance for every use\nDateParser.shared = new DateParser();\n//# sourceMappingURL=date.js.map","/**\n * Parses duration format to a `Duration` (number of seconds with decimal)\n *\n * Can parse hh:mm:ss.ms, hh:mm:ss, mm:ss, mm:ss.ms, and s.ms formats\n */\nexport class DurationParser {\n /** @inheritdoc */\n parseValue(rawValue) {\n if (typeof rawValue === 'number')\n return rawValue;\n if (typeof rawValue === 'boolean')\n return undefined;\n const componentArray = rawValue.split(':');\n let seconds;\n // if there are no colons in the string, we can assume it's in sss.ms format so just parse it\n if (componentArray.length === 1) {\n seconds = this.parseNumberFormat(componentArray[0]);\n }\n else {\n seconds = this.parseColonSeparatedFormat(componentArray);\n }\n return seconds;\n }\n /**\n * Parse sss.ms format\n *\n * @param rawValue\n * @returns\n */\n parseNumberFormat(rawValue) {\n let seconds = parseFloat(rawValue);\n if (Number.isNaN(seconds))\n seconds = undefined;\n return seconds;\n }\n /**\n * Parse hh:mm:ss.ms format\n *\n * @param componentArray\n * @returns\n */\n parseColonSeparatedFormat(componentArray) {\n // if any of the hh:mm:ss components are NaN, just return undefined\n let hasNaNComponent = false;\n const parsedValue = componentArray\n .map((element, index) => {\n const componentValue = parseFloat(element);\n if (Number.isNaN(componentValue)) {\n hasNaNComponent = true;\n return 0;\n }\n const exponent = componentArray.length - 1 - index;\n const multiplier = 60 ** exponent;\n return componentValue * Math.floor(multiplier);\n })\n .reduce((a, b) => a + b, 0);\n return hasNaNComponent ? undefined : parsedValue;\n }\n}\n// use a shared static instance for performance instead of\n// instantiating a new instance for every use\nDurationParser.shared = new DurationParser();\n//# sourceMappingURL=duration.js.map","export class MediaTypeParser {\n /** @inheritdoc */\n parseValue(rawValue) {\n if (typeof rawValue !== 'string')\n return undefined;\n return rawValue;\n }\n}\n// use a shared static instance for performance instead of\n// instantiating a new instance for every use\nMediaTypeParser.shared = new MediaTypeParser();\n//# sourceMappingURL=mediatype.js.map","export class PageProgressionParser {\n /** @inheritdoc */\n parseValue(rawValue) {\n if (typeof rawValue !== 'string')\n return undefined;\n return rawValue;\n }\n}\n// use a shared static instance for performance instead of\n// instantiating a new instance for every use\nPageProgressionParser.shared = new PageProgressionParser();\n//# sourceMappingURL=page-progression.js.map","export class StringParser {\n /** @inheritdoc */\n parseValue(rawValue) {\n return String(rawValue);\n }\n}\n// use a shared static instance for performance instead of\n// instantiating a new instance for every use\nStringParser.shared = new StringParser();\n//# sourceMappingURL=string.js.map","/**\n * The MetadataField is responsible for three things:\n * 1. Take in some raw data (strings, arrays, numbers, etc)\n * 2. Normalize the input to an array of the input,\n * ie. [string, string], [number, number], [Date, Date], etc\n * 3. Cast the values to their expected `Type`\n *\n * This class gets instiated with a `Type` and a parser of that type. For instance, the\n * `DateField` is a subclass of `MetadataField` with a `Type` of `Date` and a `DateParser`.\n *\n * When using a `DateField`, you can pass it a string date and it will cast it to a javascript Date,\n * ie:\n *\n * ```\n * const dateField = new DateField('2020-02-13')\n * dateField.value = Date(2020-02-13) // native javascript Date object\n * dateField.values = [Date(2020-02-13)] // the normalized array of values\n * dateField.rawValue = '2020-02-13' // the raw string that was passed in\n * ```\n *\n * @class MetadataField\n * @template Type The type of metadata this is (string, number, Date, etc)\n * @template FieldParserInterfaceType The parser for that type (StringParser, NumberParser, etc)\n */\nexport class MetadataField {\n constructor(parser, rawValue) {\n /**\n * The array of all values for the field.\n *\n * Many fields only contain a single value and\n * can be accessed via the `.value` getter\n *\n * @type {Type[]}\n * @memberof MetadataField\n */\n this.values = [];\n this.parser = parser;\n this.rawValue = rawValue;\n this.processRawValue();\n }\n /**\n * The first value if there are multiple or the only value if there is one\n *\n * @readonly\n * @type {(Type | undefined)}\n * @memberof MetadataField\n */\n get value() {\n return this.values.length > 0 ? this.values[0] : undefined;\n }\n processRawValue() {\n if (this.rawValue === undefined) {\n return;\n }\n if (Array.isArray(this.rawValue)) {\n this.rawValue.forEach(value => {\n this.parseAndPersistValue(value);\n });\n }\n else {\n this.parseAndPersistValue(this.rawValue);\n }\n }\n parseAndPersistValue(value) {\n const parsedValue = this.parser.parseValue(value);\n if (parsedValue !== undefined) {\n this.values.push(parsedValue);\n }\n }\n}\n//# sourceMappingURL=metadata-field.js.map","import { BooleanParser } from '@internetarchive/field-parsers';\nimport { MetadataField } from '../metadata-field';\nexport class BooleanField extends MetadataField {\n constructor(rawValue) {\n super(BooleanParser.shared, rawValue);\n }\n}\n//# sourceMappingURL=boolean.js.map","import { DateParser } from '@internetarchive/field-parsers';\nimport { MetadataField } from '../metadata-field';\nexport class DateField extends MetadataField {\n constructor(rawValue) {\n super(DateParser.shared, rawValue);\n }\n}\n//# sourceMappingURL=date.js.map","import { DurationParser } from '@internetarchive/field-parsers';\nimport { MetadataField } from '../metadata-field';\n/**\n * The DurationField parses different duration formats\n * and returns a `Duration`, which is a number in seconds\n * with decimals.\n *\n * @export\n * @class DurationField\n * @extends {MetadataField<Duration, DurationParser>}\n */\nexport class DurationField extends MetadataField {\n constructor(rawValue) {\n super(DurationParser.shared, rawValue);\n }\n}\n//# sourceMappingURL=duration.js.map","import { NumberParser } from '@internetarchive/field-parsers';\nimport { MetadataField } from '../metadata-field';\nexport class NumberField extends MetadataField {\n constructor(rawValue) {\n super(NumberParser.shared, rawValue);\n }\n}\n//# sourceMappingURL=number.js.map","import { StringParser } from '@internetarchive/field-parsers';\nimport { MetadataField } from '../metadata-field';\nexport class StringField extends MetadataField {\n constructor(rawValue) {\n super(StringParser.shared, rawValue);\n }\n}\n//# sourceMappingURL=string.js.map","import { ByteParser } from '@internetarchive/field-parsers';\nimport { MetadataField } from '../metadata-field';\n/**\n * ByteField is a unit-specific number field that\n * returns a value in bytes\n *\n * @export\n * @class ByteField\n * @extends {MetadataField<Byte, ByteParser>}\n */\nexport class ByteField extends MetadataField {\n constructor(rawValue) {\n super(ByteParser.shared, rawValue);\n }\n}\n//# sourceMappingURL=byte.js.map","import { MediaTypeParser } from '@internetarchive/field-parsers';\nimport { MetadataField } from '../metadata-field';\nexport class MediaTypeField extends MetadataField {\n constructor(rawValue) {\n super(MediaTypeParser.shared, rawValue);\n }\n}\n//# sourceMappingURL=mediatype.js.map","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { BooleanField } from './metadata-fields/field-types/boolean';\nimport { DateField } from './metadata-fields/field-types/date';\nimport { DurationField } from './metadata-fields/field-types/duration';\nimport { NumberField } from './metadata-fields/field-types/number';\nimport { StringField } from './metadata-fields/field-types/string';\nimport { ByteField } from './metadata-fields/field-types/byte';\nimport { MediaTypeField } from './metadata-fields/field-types/mediatype';\n/**\n * Metadata is an expansive model that describes an Item.\n *\n * The fields in here get casted to their respective field types. See `metadata-fields/field-type`.\n *\n * Add additional fields as needed.\n *\n * @export\n * @class Metadata\n */\nexport class Metadata {\n constructor(json) {\n this.rawMetadata = json;\n this.identifier = json.identifier;\n this.addeddate = json.addeddate ? new DateField(json.addeddate) : undefined;\n this.publicdate = json.publicdate\n ? new DateField(json.publicdate)\n : undefined;\n this.indexdate = json.indexdate ? new DateField(json.indexdate) : undefined;\n this.audio_codec = json.audio_codec\n ? new StringField(json.audio_codec)\n : undefined;\n this.audio_sample_rate = json.audio_sample_rate\n ? new NumberField(json.audio_sample_rate)\n : undefined;\n this.collection = json.collection\n ? new StringField(json.collection)\n : undefined;\n this.collections_raw = json.collections_raw\n ? new StringField(json.collections_raw)\n : undefined;\n this.collection_size = json.collection_size\n ? new ByteField(json.collection_size)\n : undefined;\n this.contributor = json.contributor\n ? new StringField(json.contributor)\n : undefined;\n this.coverage = json.coverage ? new StringField(json.coverage) : undefined;\n this.creator = json.creator ? new StringField(json.creator) : undefined;\n this.date = json.date ? new DateField(json.date) : undefined;\n this.description = json.description\n ? new StringField(json.description)\n : undefined;\n this.downloads = json.downloads\n ? new NumberField(json.downloads)\n : undefined;\n this.duration = json.duration\n ? new DurationField(json.duration)\n : undefined;\n this.files_count = json.files_count\n ? new NumberField(json.files_count)\n : undefined;\n this.item_count = json.item_count\n ? new NumberField(json.item_count)\n : undefined;\n this.item_size = json.item_size ? new ByteField(json.item_size) : undefined;\n this.language = json.language ? new StringField(json.language) : undefined;\n this.length = json.length ? new DurationField(json.length) : undefined;\n this.lineage = json.lineage ? new StringField(json.lineage) : undefined;\n this.mediatype = json.mediatype\n ? new MediaTypeField(json.mediatype)\n : undefined;\n this.month = json.month ? new NumberField(json.month) : undefined;\n this.noindex = json.noindex ? new BooleanField(json.noindex) : undefined;\n this.notes = json.notes ? new StringField(json.notes) : undefined;\n this.num_favorites = json.num_favorites\n ? new NumberField(json.num_favorites)\n : undefined;\n this.num_reviews = json.num_reviews\n ? new NumberField(json.num_reviews)\n : undefined;\n this.runtime = json.runtime ? new DurationField(json.runtime) : undefined;\n this.scanner = json.scanner ? new StringField(json.scanner) : undefined;\n this.source = json.source ? new StringField(json.source) : undefined;\n this.start_localtime = json.start_localtime\n ? new DateField(json.start_localtime)\n : undefined;\n this.start_time = json.start_time\n ? new DateField(json.start_time)\n : undefined;\n this.stop_time = json.stop_time ? new DateField(json.stop_time) : undefined;\n this.subject = json.subject ? new StringField(json.subject) : undefined;\n this.taper = json.taper ? new StringField(json.taper) : undefined;\n this.title = json.title ? new StringField(json.title) : undefined;\n this.track = json.track ? new NumberField(json.track) : undefined;\n this.transferer = json.transferer\n ? new StringField(json.transferer)\n : undefined;\n this.type = json.type ? new StringField(json.type) : undefined;\n this.uploader = json.uploader ? new StringField(json.uploader) : undefined;\n this.utc_offset = json.utc_offset\n ? new NumberField(json.utc_offset)\n : undefined;\n this.venue = json.venue ? new StringField(json.venue) : undefined;\n this.week = json.week ? new NumberField(json.week) : undefined;\n this.year = json.year ? new DateField(json.year) : undefined;\n }\n}\n//# sourceMappingURL=metadata.js.map","import { ByteParser, DurationParser, NumberParser, } from '@internetarchive/field-parsers';\n/**\n * This represents an Internet Archive File\n *\n * @export\n * @class File\n */\nexport class File {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n constructor(json) {\n this.name = json.name;\n this.source = json.source;\n this.btih = json.btih;\n this.md5 = json.md5;\n this.format = json.format;\n this.mtime = json.mtime;\n this.crc32 = json.crc32;\n this.sha1 = json.sha1;\n this.original = json.original;\n this.title = json.title;\n this.length = json.length\n ? DurationParser.shared.parseValue(json.length)\n : undefined;\n this.size = json.size ? ByteParser.shared.parseValue(json.size) : undefined;\n this.height = json.height\n ? NumberParser.shared.parseValue(json.height)\n : undefined;\n this.width = json.width\n ? NumberParser.shared.parseValue(json.width)\n : undefined;\n this.track = json.track\n ? NumberParser.shared.parseValue(json.track)\n : undefined;\n this.external_identifier = json['external-identifier'];\n this.creator = json.creator;\n this.album = json.album;\n }\n}\n//# sourceMappingURL=file.js.map","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { DateParser } from '@internetarchive/field-parsers';\nexport class Review {\n constructor(json) {\n this.reviewbody = json.reviewbody;\n this.reviewtitle = json.reviewtitle;\n this.reviewer = json.reviewer;\n this.reviewdate = DateParser.shared.parseValue(json.reviewdate);\n this.createdate = DateParser.shared.parseValue(json.createdate);\n this.stars = json.stars ? parseFloat(json.stars) : undefined;\n }\n}\n//# sourceMappingURL=review.js.map","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { File } from '../../models/file';\nimport { Metadata } from '../../models/metadata';\nimport { Review } from '../../models/review';\n/**\n * The main top-level reponse when fetching Metadata\n *\n * @export\n * @class MetadataResponse\n */\nexport class MetadataResponse {\n constructor(json) {\n var _a, _b;\n this.rawResponse = json;\n this.created = json.created;\n this.d1 = json.d1;\n this.d2 = json.d2;\n this.dir = json.dir;\n this.files = (_a = json.files) === null || _a === void 0 ? void 0 : _a.map((file) => new File(file));\n this.files_count = json.files_count;\n this.item_last_updated = json.item_last_updated;\n this.item_size = json.item_size;\n this.metadata = new Metadata(json.metadata);\n this.server = json.server;\n this.uniq = json.uniq;\n this.workable_servers = json.workable_servers;\n this.speech_vs_music_asr = json.speech_vs_music_asr;\n this.reviews = (_b = json.reviews) === null || _b === void 0 ? void 0 : _b.map((entry) => new Review(entry));\n }\n}\n//# sourceMappingURL=metadata-response.js.map","import { Metadata } from '../../models/metadata';\n/**\n * This is the search response details inside the SearchResponse object that contains\n * the search results, under the `docs` key.\n *\n * @export\n * @class Response\n */\nexport class SearchResponseDetails {\n constructor(json) {\n this.numFound = json.numFound;\n this.start = json.start;\n this.docs = json.docs.map((doc) => new Metadata(doc));\n this.aggregations = json.aggregations;\n }\n}\n//# sourceMappingURL=search-response-details.js.map","import { SearchResponseDetails } from './search-response-details';\n/**\n * The top-level response model when retrieving a response from the advanced search endpoint.\n *\n * @export\n * @class SearchResponse\n */\nexport class SearchResponse {\n constructor(json) {\n this.rawResponse = json;\n this.responseHeader = json.responseHeader;\n this.response = new SearchResponseDetails(json.response);\n }\n}\n//# sourceMappingURL=search-response.js.map","import { SearchResponse } from './responses/search/search-response';\nimport { MetadataResponse } from './responses/metadata/metadata-response';\nimport { DefaultSearchBackend } from './search-backend/default-search-backend';\nimport { SearchServiceError, SearchServiceErrorType, } from './search-service-error';\n/**\n * The Search Service is responsible for taking the raw response provided by\n * the Search Backend and modeling it as a `SearchResponse` or `MetadataResponse`\n * object, depending on the type of response.\n */\nexport class SearchService {\n constructor(searchBackend) {\n this.searchBackend = searchBackend;\n }\n /** @inheritdoc */\n async search(params) {\n const rawResponse = await this.searchBackend.performSearch(params);\n if (rawResponse.error) {\n return rawResponse;\n }\n const modeledResponse = new SearchResponse(rawResponse.success);\n return { success: modeledResponse };\n }\n /** @inheritdoc */\n async fetchMetadata(identifier) {\n var _a;\n const rawResponse = await this.searchBackend.fetchMetadata(identifier);\n if (rawResponse.error) {\n return rawResponse;\n }\n if (((_a = rawResponse.success) === null || _a === void 0 ? void 0 : _a.metadata) === undefined) {\n return {\n error: new SearchServiceError(SearchServiceErrorType.itemNotFound),\n };\n }\n const modeledResponse = new MetadataResponse(rawResponse.success);\n return { success: modeledResponse };\n }\n}\nSearchService.default = new SearchService(new DefaultSearchBackend());\n//# sourceMappingURL=search-service.js.map","import { SearchServiceError, SearchServiceErrorType, } from '../search-service-error';\n/**\n * The DefaultSearchBackend performs a `window.fetch` request to archive.org\n */\nexport class DefaultSearchBackend {\n constructor(baseUrl = 'archive.org') {\n this.baseUrl = baseUrl;\n }\n async performSearch(params) {\n const urlSearchParam = params.asUrlSearchParams;\n const queryAsString = urlSearchParam.toString();\n const url = `https://${this.baseUrl}/advancedsearch.php?${queryAsString}`;\n return this.fetchUrl(url);\n }\n async fetchMetadata(identifier) {\n const url = `https://${this.baseUrl}/metadata/${identifier}`;\n return this.fetchUrl(url);\n }\n async fetchUrl(url) {\n let response;\n // first try the fetch and return a networkError if it fails\n try {\n response = await fetch(url);\n }\n catch (err) {\n const message = err instanceof Error ? err.message : err;\n return this.getErrorResult(SearchServiceErrorType.networkError, message);\n }\n // then try json decoding and return a decodingError if it fails\n try {\n const json = await response.json();\n // the advanced search endpoint doesn't return an HTTP Error 400\n // and instead returns an HTTP 200 with an `error` key in the payload\n const error = json['error'];\n if (error) {\n const forensics = json['forensics'];\n return this.getErrorResult(SearchServiceErrorType.searchEngineError, error, forensics);\n }\n else {\n // success\n return { success: json };\n }\n }\n catch (err) {\n const message = err instanceof Error ? err.message : err;\n return this.getErrorResult(SearchServiceErrorType.decodingError, message);\n }\n }\n getErrorResult(errorType, message, details) {\n const error = new SearchServiceError(errorType, message, details);\n const result = { error };\n return result;\n }\n}\n//# sourceMappingURL=default-search-backend.js.map","import { css } from 'lit';\n\nconst menuButtonWidth = css`42px`;\nconst sliderWidth = css`var(--menuWidth, 320px)`;\nconst transitionTiming = css`var(--animationTiming, 200ms)`;\n\nexport default css`\n\n .main {\n overflow: hidden;\n width: 100%;\n height: 100%;\n }\n\n .animate {\n transition: transform ${transitionTiming} ease-out;\n }\n\n .menu {\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n width: ${sliderWidth};\n padding: .5rem .5rem 0 0;\n box-sizing: border-box;\n font-size: 1.4rem;\n color: var(--primaryTextColor);\n background: var(--menuSliderBg);\n transform: translateX(calc(${sliderWidth} * -1));\n }\n\n .menu > button.close {\n right: 0.7rem;\n }\n\n button {\n outline: none;\n cursor: pointer;\n }\n\n header {\n margin: 0 0 .5rem 0;\n }\n\n header * {\n margin: 0;\n display: inline-block;\n }\n header button {\n outline: none;\n cursor: pointer;\n }\n\n header.with-secondary-action .details {\n width: 80%;\n }\n\n header .details {\n font-weight: bold;\n width: 88%;\n }\n\n header .custom-action > *,\n button.close {\n padding: 0;\n background-color: transparent;\n border: 0;\n --iconWidth: var(--menuSliderHeaderIconWidth);\n --iconHeight: var(--menuSliderHeaderIconHeight);\n }\n\n header .custom-action,\n button.close {\n position: absolute;\n }\n button.close {\n right: .5rem;\n }\n\n button.close * {\n float: right;\n }\n\n .content {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: ${menuButtonWidth};\n z-index: 1;\n transform: translateX(calc(${sliderWidth} * -1));\n transition: transform ${transitionTiming} ease-out;\n background: var(--activeButtonBg);\n border-right: .2rem solid;\n border-color: var(--subpanelRightBorderColor);\n padding: .5rem 0 0 .5rem;\n }\n\n .open {\n transform: translateX(0);\n }\n\n .menu-list {\n padding: 0;\n margin: 0;\n list-style: none;\n background: var(--menuSliderBg);\n }\n .menu-list li {\n margin-bottom: .2rem;\n }\n\n .content section {\n height: 100%;\n position: relative;\n width: 100%;\n }\n\n .content .selected-menu {\n overflow: auto;\n height: inherit;\n position: relative;\n }\n\n .content .selected-menu > * {\n display: block;\n padding-bottom: 3rem;\n position: relative;\n }\n`;\n","import { html } from 'lit';\n\nexport default html`\n<svg\n viewBox=\"0 0 18 18\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-labelledby=\"collapseSidebarTitleID collapseSidebarDescID\"\n>\n <title id=\"collapseSidebarTitleID\">Collapse sidebar</title>\n <desc id=\"collapseSidebarDescID\">A circle with a left pointing chevron</desc>\n <path d=\"m9 0c4.9705627 0 9 4.02943725 9 9 0 4.9705627-4.0294373 9-9 9-4.97056275 0-9-4.0294373-9-9 0-4.97056275 4.02943725-9 9-9zm1.6976167 5.28352881c-.365258-.3556459-.9328083-.37581056-1.32099801-.06558269l-.09308988.0844372-3 3.08108108-.08194436.09533317c-.27484337.36339327-.26799482.87009349.01656959 1.22592581l.084491.09308363 3 2.91891889.09533796.0818904c.3633964.2746544.8699472.2677153 1.2256839-.0167901l.093059-.0844712.0818904-.095338c.2746544-.3633964.2677153-.8699472-.0167901-1.2256839l-.0844712-.093059-2.283355-2.2222741 2.3024712-2.36338332.0819252-.09530804c.2997677-.39632298.2644782-.96313393-.1007797-1.31877983z\" fill-rule=\"evenodd\" class=\"fill-color\" />\n</svg>\n`;\n","import icon from './index.js';\nimport { css, LitElement } from 'lit';\n\nclass IAIconCollapseSidebar extends LitElement {\n static get styles() {\n return css`\n :host {\n width: var(--iconWidth, 'auto');\n height: var(--iconHeight, 'auto');\n }\n\n .fill-color {\n fill: var(--iconFillColor);\n }\n\n .stroke-color {\n stroke: var(--iconStrokeColor);\n }\n `;\n }\n\n render() {\n return icon;\n }\n}\n\ncustomElements.define('ia-icon-collapse-sidebar', IAIconCollapseSidebar);\n\nexport default IAIconCollapseSidebar;\n","import { css } from 'lit';\n\nexport default css`\n a {\n display: inline-block;\n text-decoration: none;\n }\n\n .menu-item {\n display: inline-flex;\n width: 100%;\n padding: 0;\n font-size: 1.6rem;\n text-align: left;\n background: transparent;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n border: none;\n cursor: pointer;\n }\n\n button.menu-item {\n -webkit-appearance: none;\n appearance: none;\n border-radius: 0;\n }\n\n .menu-item:focus {\n outline: none;\n }\n\n .label {\n display: var(--menuButtonLabelDisplay, none);\n padding: 0;\n font-weight: 400;\n color: var(--primaryTextColor);\n text-align: left;\n vertical-align: middle;\n margin-left: 1rem;\n }\n\n .menu-details {\n color: var(--primaryTextColor);\n display: inline-block;\n margin-left: .5rem;\n font-style: italic;\n font-size: 1.5rem;\n }\n\n .menu-item > .icon {\n position: relative;\n display: inline-flex;\n z-index: 2;\n min-width: 4.2rem;\n max-width: 4.2rem;\n height: 4.2rem;\n vertical-align: middle;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n }\n\n .menu-item.selected .icon {\n background-color: var(--activeButtonBg);\n border-radius: 1rem 0 0 1rem;\n }\n\n .icon .fill-color {\n fill: #999;\n }\n\n .icon.active .fill-color {\n fill: #fff;\n }\n`;\n","import { html, LitElement } from 'lit';\nimport menuButtonCSS from './styles/menu-button.js';\n\nclass MenuButton extends LitElement {\n static get styles() {\n return menuButtonCSS;\n }\n\n static get properties() {\n return {\n icon: { type: String },\n href: { type: String },\n label: { type: String },\n menuDetails: { type: String },\n id: { type: String },\n selected: { type: Boolean },\n followable: { type: Boolean },\n };\n }\n\n constructor() {\n super();\n this.icon = '';\n this.href = '';\n this.label = '';\n this.menuDetails = '';\n this.id = '';\n this.selected = false;\n this.followable = false;\n }\n\n onClick(e) {\n e.preventDefault();\n this.dispatchMenuTypeSelectedEvent();\n }\n\n dispatchMenuTypeSelectedEvent() {\n this.dispatchEvent(new CustomEvent('menuTypeSelected', {\n bubbles: true,\n composed: true,\n detail: {\n id: this.id,\n },\n }));\n }\n\n get buttonClass() {\n return this.selected ? 'selected' : '';\n }\n\n get iconClass() {\n return this.selected ? 'active' : '';\n }\n\n get menuItem() {\n return html`\n <span class=\"icon ${this.iconClass}\">\n ${this.icon}\n </span>\n <span class=\"label\">${this.label}</span>\n <span class=\"menu-details\">${this.menuDetails}</span>\n `;\n }\n\n get linkButton() {\n return html`\n <a\n href=\"${this.href}\"\n class=\"menu-item ${this.buttonClass}\"\n @click=${this.followable ? undefined : this.onClick}\n >${this.menuItem}</a>\n `;\n }\n\n get clickButton() {\n return html`\n <button\n class=\"menu-item ${this.buttonClass}\"\n @click=${this.onClick}\n >\n ${this.menuItem}\n </button>\n `;\n }\n\n render() {\n return this.href ? this.linkButton : this.clickButton;\n }\n}\n\ncustomElements.define('menu-button', MenuButton);\n","import { nothing } from 'lit/html.js';\nimport { LitElement, html } from 'lit';\nimport menuSliderCSS from './styles/menu-slider.js';\nimport '@internetarchive/icon-collapse-sidebar/icon-collapse-sidebar.js';\nimport './menu-button.js';\n\nconst sliderEvents = {\n closeDrawer: 'menuSliderClosed',\n};\nexport class IAMenuSlider extends LitElement {\n static get styles() {\n return menuSliderCSS;\n }\n\n static get properties() {\n return {\n menus: { type: Array },\n open: { type: Boolean },\n manuallyHandleClose: { type: Boolean },\n selectedMenu: { type: String },\n selectedMenuAction: { type: Object },\n animateMenuOpen: { type: Boolean },\n };\n }\n\n constructor() {\n super();\n\n this.menus = [];\n this.open = false;\n this.selectedMenu = '';\n this.selectedMenuAction = nothing;\n this.animateMenuOpen = false;\n this.manuallyHandleClose = false;\n }\n\n updated() {\n const { actionButton } = this.selectedMenuDetails || {};\n const actionButtonHasChanged = actionButton !== this.selectedMenuAction;\n if (actionButtonHasChanged) {\n this.selectedMenuAction = actionButton || nothing;\n }\n }\n\n /**\n * Event handler, captures state of selected menu\n * @param { CustomEvent } event\n */\n setSelectedMenu({ detail }) {\n const { id } = detail;\n this.selectedMenu = this.selectedMenu === id ? '' : id;\n const { actionButton } = this.selectedMenuDetails || {};\n this.selectedMenuAction = actionButton || nothing;\n }\n\n /**\n * closes menu drawer\n */\n closeMenu() {\n if (!this.manuallyHandleClose) {\n this.open = false;\n }\n const { closeDrawer } = sliderEvents;\n const drawerClosed = new CustomEvent(closeDrawer, {\n detail: this.selectedMenuDetails,\n });\n this.dispatchEvent(drawerClosed);\n }\n\n get selectedMenuDetails() {\n const selectedMenu = this.menus.find(menu => menu.id === this.selectedMenu);\n return selectedMenu;\n }\n\n get selectedMenuComponent() {\n const menuItem = this.selectedMenuDetails;\n return menuItem && menuItem.component ? menuItem.component : html``;\n }\n\n /* render */\n\n get sliderDetailsClass() {\n const animate = this.animateMenuOpen ? 'animate' : '';\n const state = this.open ? 'open' : '';\n return `${animate} ${state}`;\n }\n\n get selectedMenuClass() {\n return this.selectedMenu ? 'open' : '';\n }\n\n get menuItems() {\n return this.menus.map(menu => (\n html`\n <li>\n <menu-button\n @menuTypeSelected=${this.setSelectedMenu}\n .icon=${menu.icon}\n .label=${menu.label}\n .menuDetails=${menu.menuDetails}\n .id=${menu.id}\n .selected=${menu.id === this.selectedMenu}\n .followable=${menu.followable}\n .href=${menu.href}\n ></menu-button>\n </li>\n `\n ));\n }\n\n get renderMenuHeader() {\n const { label = '', menuDetails = '' } = this.selectedMenuDetails || {};\n const headerClass = this.selectedMenuAction ? 'with-secondary-action' : '';\n const actionBlock = this.selectedMenuAction\n ? html`<span class=\"custom-action\">${this.selectedMenuAction}</span>`\n : nothing;\n return html`\n <header class=\"${headerClass}\">\n <div class=\"details\">\n <h3>${label}</h3>\n <span class=\"extra-details\">${menuDetails}</span>\n </div>\n ${actionBlock}\n ${this.closeButton}\n </header>\n `;\n }\n\n get closeButton() {\n return html`\n <button class=\"close\" aria-label=\"Close this menu\" @click=${this.closeMenu}>\n <ia-icon-collapse-sidebar></ia-icon-collapse-sidebar>\n </button>\n `;\n }\n\n /** @inheritdoc */\n render() {\n return html`\n <div class=\"main\">\n <div class=\"menu ${this.sliderDetailsClass}\">\n ${this.closeButton}\n <ul class=\"menu-list\">\n ${this.menuItems}\n </ul>\n <div class=\"content ${this.selectedMenuClass}\" @menuTypeSelected=${this.setSelectedMenu}>\n ${this.renderMenuHeader}\n <section>\n <div class=\"selected-menu\">\n ${this.selectedMenuComponent}\n </div>\n </section>\n </div>\n </div>\n </div>\n `;\n }\n}\n\nwindow.customElements.define('ia-menu-slider', IAMenuSlider);\n","import { html } from 'lit';\n\nexport default html`\n<svg\n viewBox=\"0 0 40 40\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-labelledby=\"ellipsesTitleID ellipsesDescID\"\n>\n <title id=\"ellipsesTitleID\">Ellipses icon</title>\n <desc id=\"ellipsesDescID\">An illustration of text ellipses.</desc>\n <path class=\"fill-color\" d=\"m10.5 17.5c1.3807119 0 2.5 1.1192881 2.5 2.5s-1.1192881 2.5-2.5 2.5c-1.38071187 0-2.5-1.1192881-2.5-2.5s1.11928813-2.5 2.5-2.5zm9.5 0c1.3807119 0 2.5 1.1192881 2.5 2.5s-1.1192881 2.5-2.5 2.5-2.5-1.1192881-2.5-2.5 1.1192881-2.5 2.5-2.5zm9.5 0c1.3807119 0 2.5 1.1192881 2.5 2.5s-1.1192881 2.5-2.5 2.5-2.5-1.1192881-2.5-2.5 1.1192881-2.5 2.5-2.5z\" fill-rule=\"evenodd\"/>\n</svg>\n`;\n","import icon from './index.js';\nimport { css, LitElement } from 'lit';\n\nclass IAIconEllipses extends LitElement {\n static get styles() {\n return css`\n :host {\n width: var(--iconWidth, 'auto');\n height: var(--iconHeight, 'auto');\n }\n\n .fill-color {\n fill: var(--iconFillColor);\n }\n\n .stroke-color {\n stroke: var(--iconStrokeColor);\n }\n `;\n }\n\n render() {\n return icon;\n }\n}\n\ncustomElements.define('ia-icon-ellipses', IAIconEllipses);\n\nexport default IAIconEllipses;\n","import { __decorate } from \"tslib\";\n/* eslint-disable class-methods-use-this */\nimport { css, html, LitElement, svg, nothing } from 'lit';\nimport { customElement } from 'lit/decorators.js';\nlet IAItemNavLoader = class IAItemNavLoader extends LitElement {\n static get properties() {\n return {\n title: { type: String },\n };\n }\n get bookIconSvg() {\n return svg `\n <g class=\"bookIcon\" transform=\"matrix(1 0 0 -1 28 67.362264)\">\n <path d=\"m44.71698 31.6981124v-29.99320678s-18.0956599.30735848-18.6322637-.7171698c-.0633962-.12226414-1.890566-.59207545-2.9745282-.59207545-1.3228302 0-3.5122641 0-4.1286791.74547168-.9707547 1.17452827-18.82811278.71660375-18.82811278.71660375v30.040754l1.83849052.7867924.29094339-28.48188608s15.94981097.15339622 17.09094297-1.10716978c.8145283-.90056602 4.997547-.91641507 5.3450942-.3526415.9611321 1.55716977 14.7101883 1.31716978 17.6077354 1.45981128l.3266038 28.22830118z\"/>\n <path d=\"m40.1129424 33.5957539h-12.8337733c-1.8690565 0-3.1098112-.7545283-3.9299999-1.6279245v-26.70452764l1.2362264-.00792453c.4584906.72962262 3.0922641 1.39415091 3.0922641 1.39415091h10.1298111s1.0381131.01754717 1.5141509.47377357c.5643396.54056602.7913207 1.36981129.7913207 1.36981129z\"/>\n <path d=\"m17.3354713 33.5957539h-12.8337733v-25.37660316s0-.75283017.49358489-1.14113205c.52867924-.41433961 1.3415094-.42849055 1.3415094-.42849055h10.59905631s2.2075471-.52698112 3.0928301-1.39415091l1.2.00792453v26.74245214c-.8201886.8581132-2.0530188 1.59-3.8932074 1.59\"/>\n </g>\n `;\n }\n get icon() {\n return this.bookIconSvg;\n }\n get loader() {\n return svg `\n <svg\n height=\"100\"\n viewBox=\"0 0 100 100\"\n width=\"100\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-labelledby=\"item-loading\"\n >\n <title id=\"item-loading\">Currently loading viewer.</title>\n <desc>Please wait while we load theater.</desc>\n <g fill=\"#333\" fill-rule=\"evenodd\" class=\"book-icon\">\n ${this.icon}\n <path\n class=\"ring\"\n d=\"m17.8618849 11.6970233c18.5864635-15.59603144 45.6875867-15.59603102 64.2740497.000001 1.9271446 1.6170806 2.1785128 4.4902567.5614466 6.4174186-1.6170661 1.9271618-4.4902166 2.1785323-6.4173612.5614517-15.1996922-12.75416882-37.3625282-12.75416916-52.5622206-.000001-15.19969387 12.7541707-19.04823077 34.5805019-9.1273354 51.7641499 9.9208955 17.183646 30.7471499 24.7638499 49.3923323 17.9774983 18.6451823-6.7863521 29.7266014-25.9801026 26.2811129-45.5206248-.436848-2.4775114 1.2174186-4.8400696 3.6949079-5.2769215 2.4774893-.4368518 4.8400264 1.2174296 5.2768744 3.694941 4.2132065 23.8945096-9.3373563 47.3649806-32.137028 55.6634567-22.799672 8.2984758-48.2663986-.9707372-60.39785211-21.9832155-12.1314534-21.012481-7.42539173-47.7021198 11.16107351-63.2981544z\"\n fill-rule=\"nonzero\"\n />\n </g>\n </svg>\n `;\n }\n render() {\n const title = this.title ? html `<h2>${this.title}</h2>` : nothing;\n return html `\n <div class=\"place-holder\">\n ${title} ${this.loader}\n <h3>Loading viewer</h3>\n </div>\n `;\n }\n static get styles() {\n return css `\n .place-holder {\n width: 30%;\n margin: auto;\n text-align: center;\n color: var(--primaryTextColor);\n }\n\n .place-holder {\n position: relative;\n }\n\n .place-holder svg {\n display: block;\n width: 60%;\n max-width: 100px;\n height: auto;\n margin: auto;\n }\n\n svg * {\n fill: var(--primaryTextColor);\n }\n\n svg .ring {\n animation: rotate 1.3s infinite linear;\n transform-origin: 50px 50px;\n transform-box: fill-box;\n display: block; // transform won't work on inline style\n }\n\n @keyframes rotate {\n 0% {\n -moz-transform: rotate(-360deg);\n -webkit-transform: rotate(-360deg);\n transform: rotate(-360deg);\n }\n }\n `;\n }\n};\nIAItemNavLoader = __decorate([\n customElement('ia-itemnav-loader')\n], IAItemNavLoader);\nexport { IAItemNavLoader };\n//# sourceMappingURL=loader.js.map","import { __decorate } from \"tslib\";\nimport { LitElement, html, css, } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nlet IANoTheaterAvailable = class IANoTheaterAvailable extends LitElement {\n constructor() {\n super(...arguments);\n this.identifier = '';\n }\n emitLoaded() {\n this.dispatchEvent(new CustomEvent('loadingStateUpdated', {\n detail: { loaded: true },\n }));\n }\n updated(changed) {\n if (changed.has('identifier')) {\n this.emitLoaded();\n }\n }\n get downloadUrl() {\n return `/download/${this.identifier}`;\n }\n render() {\n return html `\n <section>\n <h2>THERE IS NO PREVIEW AVAILABLE FOR THIS ITEM</h2>\n <p>\n This item does not appear to have any files that can be experienced on\n Archive.org. <br />\n Please download files in this item to interact with them on your\n computer.\n </p>\n <a href=${this.downloadUrl}>Show all files</a>\n </section>\n `;\n }\n static get styles() {\n return css `\n :host {\n color: var(--primaryTextColor, #fff);\n text-align: center;\n }\n section {\n width: 100%;\n margin: 5%;\n padding: 0 5%;\n }\n p {\n font-size: 1.4rem;\n }\n a {\n color: var(--primaryTextColor, #fff);\n background-color: rgb(25, 72, 128);\n min-height: 35px;\n outline: none;\n cursor: pointer;\n line-height: normal;\n border-radius: 0.4rem;\n text-align: center;\n vertical-align: middle;\n font-size: 1.4rem;\n font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;\n display: inline-block;\n padding: 0.85rem 1.2rem;\n border: 1px solid rgb(197, 209, 223);\n white-space: nowrap;\n appearance: auto;\n box-sizing: border-box;\n user-select: none;\n text-decoration: none;\n }\n `;\n }\n};\n__decorate([\n property({ type: String })\n], IANoTheaterAvailable.prototype, \"identifier\", void 0);\nIANoTheaterAvailable = __decorate([\n customElement('ia-no-theater-available')\n], IANoTheaterAvailable);\nexport { IANoTheaterAvailable };\n//# sourceMappingURL=no-theater-available.js.map","import { __decorate } from \"tslib\";\nimport { css, html, LitElement, nothing, } from 'lit';\nimport { customElement, property, state, query } from 'lit/decorators.js';\nimport { MetadataResponse } from '@internetarchive/search-service';\nimport '@internetarchive/ia-menu-slider';\nimport '@internetarchive/icon-ellipses/icon-ellipses';\nimport './loader';\nimport './no-theater-available';\nlet ItemNavigator = class ItemNavigator extends LitElement {\n constructor() {\n super(...arguments);\n this.viewAvailable = true;\n this.baseHost = 'archive.org';\n this.signedIn = false;\n this.menuContents = [];\n this.menuShortcuts = [];\n this.viewportInFullscreen = null;\n this.menuOpened = false;\n this.loaded = null;\n this.openMenuState = 'shift';\n }\n disconnectedCallback() {\n this.removeResizeObserver();\n }\n updated(changed) {\n if (changed.has('sharedObserver')) {\n const oldObserver = changed.get('sharedObserver');\n oldObserver === null || oldObserver === void 0 ? void 0 : oldObserver.removeObserver(this.resizeObserverConfig);\n this.setResizeObserver();\n }\n }\n /** Shared observer */\n handleResize(entry) {\n const { width } = entry.contentRect;\n if (width <= 600) {\n this.openMenuState = 'overlay';\n return;\n }\n this.openMenuState = 'shift';\n }\n setResizeObserver() {\n var _a, _b;\n (_a = this.sharedObserver) === null || _a === void 0 ? void 0 : _a.addObserver(this.resizeObserverConfig);\n (_b = this.sharedObserver) === null || _b === void 0 ? void 0 : _b.addObserver({\n target: this.headerSlot,\n handler: {\n handleResize: ({ contentRect }) => {\n if (contentRect.height) {\n this.requestUpdate();\n }\n },\n },\n });\n }\n removeResizeObserver() {\n var _a;\n (_a = this.sharedObserver) === null || _a === void 0 ? void 0 : _a.removeObserver(this.resizeObserverConfig);\n }\n get resizeObserverConfig() {\n return {\n handler: this,\n target: this.frame,\n };\n }\n /** End shared observer */\n get loaderTitle() {\n return this.viewportInFullscreen ? 'Internet Archive' : '';\n }\n get loadingArea() {\n return html `\n <div class=\"loading-area\">\n <div class=\"loading-view\">\n <ia-itemnav-loader .title=${this.loaderTitle}></ia-itemnav-loader>\n </div>\n </div>\n `;\n }\n slotChange(e, type) {\n var _a;\n const slottedContent = (_a = e.target.assignedNodes()) === null || _a === void 0 ? void 0 : _a[0];\n this.dispatchEvent(new CustomEvent('slotChange', {\n detail: { slot: slottedContent, type },\n }));\n this.requestUpdate();\n }\n render() {\n var _a, _b;\n const displayReaderClass = this.loaded ? '' : 'hidden';\n const headerHeight = ((_b = (_a = this.headerSlot) === null || _a === void 0 ? void 0 : _a.assignedNodes()[0]) === null || _b === void 0 ? void 0 : _b.offsetHeight) || 0;\n return html `\n <div id=\"frame\" class=${this.menuClass}>\n <slot\n name=\"header\"\n style=${`height: ${headerHeight}px`}\n @slotchange=${(e) => this.slotChange(e, 'header')}\n ></slot>\n <div class=\"menu-and-reader\">\n ${this.shouldRenderMenu ? this.renderSideMenu : nothing}\n <div id=\"reader\" class=${displayReaderClass}>\n ${this.renderViewport}\n </div>\n ${!this.loaded ? this.loadingArea : nothing}\n </div>\n </div>\n `;\n }\n get noTheaterView() {\n var _a, _b;\n return html `<ia-no-theater-available\n .identifier=${(_b = (_a = this.item) === null || _a === void 0 ? void 0 : _a.metadata) === null || _b === void 0 ? void 0 : _b.identifier}\n @loadingStateUpdated=${this.loadingStateUpdated}\n ></ia-no-theater-available>`;\n }\n get renderViewport() {\n if (!this.viewAvailable) {\n return this.noTheaterView;\n }\n const slotVisibility = !this.loaded ? 'opacity: 0;' : 'opacity: 1;';\n return html `\n <div slot=\"main\" style=${slotVisibility}>\n <slot\n name=\"main\"\n @slotchange=${(e) => this.slotChange(e, 'main')}\n ></slot>\n </div>\n `;\n }\n loadingStateUpdated(e) {\n const { loaded } = e.detail;\n this.loaded = loaded || null;\n }\n /** Fullscreen Management */\n manageViewportFullscreen(e) {\n const fullscreenStatus = !!e.detail.isFullScreen;\n this.viewportInFullscreen = !fullscreenStatus ? null : fullscreenStatus;\n const event = new CustomEvent('fullscreenToggled', {\n detail: e.detail,\n });\n this.dispatchEvent(event);\n }\n /** End Fullscreen Management */\n /** Side menu */\n get shouldRenderMenu() {\n var _a;\n return !!((_a = this.menuContents) === null || _a === void 0 ? void 0 : _a.length);\n }\n toggleMenu() {\n this.menuOpened = !this.menuOpened;\n }\n closeMenu() {\n this.menuOpened = false;\n }\n setOpenMenu(e) {\n const { id } = e.detail;\n this.openMenu = id !== this.openMenu ? id : undefined;\n }\n setMenuContents(e) {\n const updatedContents = [...e.detail];\n this.menuContents = updatedContents;\n }\n setMenuShortcuts(e) {\n this.menuShortcuts = [...e.detail];\n }\n /** Toggles Side Menu & Sets viewable subpanel */\n manageSideMenuEvents(e) {\n const { menuId, action } = e.detail;\n if (!menuId) {\n return;\n }\n if (action === 'open') {\n this.openShortcut(menuId);\n }\n else if (action === 'toggle') {\n this.openMenu = menuId;\n this.toggleMenu();\n }\n }\n get menuToggleButton() {\n return html `\n <button\n class=\"toggle-menu\"\n @click=${this.toggleMenu}\n title=\"Toggle theater side panels\"\n >\n <div>\n <ia-icon-ellipses\n style=\"width: var(--iconWidth); height: var(--iconHeight);\"\n ></ia-icon-ellipses>\n </div>\n </button>\n `;\n }\n get selectedMenuId() {\n return this.openMenu || '';\n }\n get renderSideMenu() {\n const drawerState = this.menuOpened ? '' : 'hidden';\n return html `\n <nav>\n <div class=\"minimized\">${this.shortcuts} ${this.menuToggleButton}</div>\n <div id=\"menu\" class=${drawerState}>\n <ia-menu-slider\n .menus=${this.menuContents}\n .selectedMenu=${this.selectedMenuId}\n @menuTypeSelected=${this.setOpenMenu}\n @menuSliderClosed=${this.closeMenu}\n manuallyHandleClose\n open\n ></ia-menu-slider>\n </div>\n </nav>\n `;\n }\n /** End Side menu */\n /** Menu Shortcuts */\n openShortcut(selectedMenuId = '') {\n this.openMenu = selectedMenuId;\n this.menuOpened = true;\n }\n get shortcuts() {\n const shortcuts = this.menuShortcuts.map(({ icon, id }) => {\n if (id === 'fullscreen') {\n return html `${icon}`;\n }\n return html `\n <button class=\"shortcut ${id}\" @click=\"${() => this.openShortcut(id)}\">\n ${icon}\n </button>\n `;\n });\n return html `<div class=\"shortcuts\">${shortcuts}</div>`;\n }\n /** End Menu Shortcuts */\n /** Misc Render */\n get menuClass() {\n var _a, _b;\n const hasMenuOrShortcuts = ((_a = this.menuContents) === null || _a === void 0 ? void 0 : _a.length) || ((_b = this.menuShortcuts) === null || _b === void 0 ? void 0 : _b.length);\n const drawerState = this.menuOpened && hasMenuOrShortcuts ? 'open' : '';\n const fullscreenState = this.viewportInFullscreen ? 'fullscreen' : '';\n return `${drawerState} ${fullscreenState} ${this.openMenuState}`;\n }\n static get styles() {\n const subnavWidth = css `var(--menuWidth, 320px)`;\n const transitionTiming = css `var(--animationTiming, 200ms)`;\n const transitionEffect = css `transform ${transitionTiming} ease-out`;\n const menuMargin = css `var(--theaterMenuMargin, 42px)`;\n const theaterBg = css `var(--theaterBgColor, #000)`;\n return css `\n :host,\n #frame,\n .menu-and-reader {\n position: relative;\n overflow: hidden;\n display: block;\n }\n\n :host,\n #frame,\n .loading-area,\n .loading-view {\n min-height: inherit;\n height: inherit;\n }\n\n slot {\n display: block;\n width: 100%;\n }\n\n slot * {\n display: block;\n height: inherit;\n }\n\n #frame {\n background-color: ${theaterBg};\n color-scheme: dark;\n display: flex;\n flex-direction: column;\n }\n\n #frame.fullscreen {\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 9;\n }\n\n .loading-view {\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .loading-area {\n width: 100%;\n }\n\n ia-itemnav-loader {\n display: block;\n width: 100%;\n }\n\n .hidden {\n display: none !important;\n }\n\n button {\n cursor: pointer;\n padding: 0;\n border: 0;\n }\n\n button:focus,\n button:active {\n outline: none;\n }\n\n .menu-and-reader {\n position: relative;\n display: flex;\n flex: 1;\n }\n\n nav button {\n background: none;\n }\n\n nav .minimized {\n background: rgba(0, 0, 0, 0.7);\n padding-top: 6px;\n position: absolute;\n width: ${menuMargin};\n z-index: 2;\n left: 0;\n border-bottom-right-radius: 5%;\n }\n\n nav .minimized button {\n width: var(--iconWidth);\n height: var(--iconHeight);\n margin-bottom: 0.2rem;\n margin: auto;\n display: inline-flex;\n vertical-align: middle;\n -webkit-box-align: center;\n align-items: center;\n -webkit-box-pack: center;\n justify-content: center;\n width: ${menuMargin};\n height: ${menuMargin};\n }\n\n nav .minimized button.toggle-menu > * {\n border: 2px solid var(--iconStrokeColor);\n border-radius: var(--iconWidth);\n width: var(--iconWidth);\n height: var(--iconHeight);\n margin: auto;\n }\n\n ia-icon-ellipses {\n width: var(--iconWidth);\n height: var(--iconHeight);\n }\n\n #menu {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n z-index: 3;\n overflow: hidden;\n transform: translateX(-${subnavWidth});\n width: ${subnavWidth};\n transform: translateX(calc(${subnavWidth} * -1));\n transition: ${transitionEffect};\n }\n\n #reader {\n position: relative;\n z-index: 1;\n transform: translateX(0);\n width: 100%;\n display: flex;\n }\n\n #reader > * {\n width: 100%;\n display: flex;\n flex: 1;\n }\n\n .open.overlay #reader {\n transition: none;\n }\n\n .open #menu {\n width: ${subnavWidth};\n transform: translateX(0);\n transition: ${transitionEffect};\n }\n\n .open.shift #reader {\n width: calc(100% - ${subnavWidth});\n margin-left: ${subnavWidth};\n transition: ${transitionEffect};\n }\n `;\n }\n};\n__decorate([\n property({\n type: Object,\n converter: (value) => {\n if (value && typeof value === 'string') {\n return new MetadataResponse(JSON.parse(atob(value)));\n }\n return value;\n },\n })\n], ItemNavigator.prototype, \"item\", void 0);\n__decorate([\n property({ type: Boolean })\n], ItemNavigator.prototype, \"viewAvailable\", void 0);\n__decorate([\n property({ type: String })\n], ItemNavigator.prototype, \"baseHost\", void 0);\n__decorate([\n property({\n converter: (arg) => {\n if (typeof arg === 'boolean') {\n return arg;\n }\n return arg === 'true';\n },\n })\n], ItemNavigator.prototype, \"signedIn\", void 0);\n__decorate([\n property({ type: Array })\n], ItemNavigator.prototype, \"menuContents\", void 0);\n__decorate([\n property({ type: Array })\n], ItemNavigator.prototype, \"menuShortcuts\", void 0);\n__decorate([\n property({ type: Boolean, reflect: true, attribute: true })\n], ItemNavigator.prototype, \"viewportInFullscreen\", void 0);\n__decorate([\n property({ type: Boolean })\n], ItemNavigator.prototype, \"menuOpened\", void 0);\n__decorate([\n property({ type: String })\n], ItemNavigator.prototype, \"openMenu\", void 0);\n__decorate([\n property({ attribute: false })\n], ItemNavigator.prototype, \"modal\", void 0);\n__decorate([\n property({ attribute: false })\n], ItemNavigator.prototype, \"sharedObserver\", void 0);\n__decorate([\n property({ type: Boolean, reflect: true, attribute: true })\n], ItemNavigator.prototype, \"loaded\", void 0);\n__decorate([\n state()\n], ItemNavigator.prototype, \"openMenuState\", void 0);\n__decorate([\n query('#frame')\n], ItemNavigator.prototype, \"frame\", void 0);\n__decorate([\n query('slot[name=\"header\"]')\n], ItemNavigator.prototype, \"headerSlot\", void 0);\n__decorate([\n query('slot[name=\"main\"]')\n], ItemNavigator.prototype, \"mainSlot\", void 0);\nItemNavigator = __decorate([\n customElement('ia-item-navigator')\n], ItemNavigator);\nexport { ItemNavigator };\n//# sourceMappingURL=item-navigator.js.map","var ResizeObserverBoxOptions;\n(function (ResizeObserverBoxOptions) {\n ResizeObserverBoxOptions[\"BORDER_BOX\"] = \"border-box\";\n ResizeObserverBoxOptions[\"CONTENT_BOX\"] = \"content-box\";\n ResizeObserverBoxOptions[\"DEVICE_PIXEL_CONTENT_BOX\"] = \"device-pixel-content-box\";\n})(ResizeObserverBoxOptions || (ResizeObserverBoxOptions = {}));\nexport { ResizeObserverBoxOptions };\n","var resizeObservers = [];\nexport { resizeObservers };\n","var msg = 'ResizeObserver loop completed with undelivered notifications.';\nvar deliverResizeLoopError = function () {\n var event;\n if (typeof ErrorEvent === 'function') {\n event = new ErrorEvent('error', {\n message: msg\n });\n }\n else {\n event = document.createEvent('Event');\n event.initEvent('error', false, false);\n event.message = msg;\n }\n window.dispatchEvent(event);\n};\nexport { deliverResizeLoopError };\n","export var freeze = function (obj) { return Object.freeze(obj); };\n","var trigger;\nvar callbacks = [];\nvar notify = function () { return callbacks.splice(0).forEach(function (cb) { return cb(); }); };\nvar queueMicroTask = function (callback) {\n if (!trigger) {\n var toggle_1 = 0;\n var el_1 = document.createTextNode('');\n var config = { characterData: true };\n new MutationObserver(function () { return notify(); }).observe(el_1, config);\n trigger = function () { el_1.textContent = \"\" + (toggle_1 ? toggle_1-- : toggle_1++); };\n }\n callbacks.push(callback);\n trigger();\n};\nexport { queueMicroTask };\n","import { freeze } from './utils/freeze';\nvar ResizeObserverSize = (function () {\n function ResizeObserverSize(inlineSize, blockSize) {\n this.inlineSize = inlineSize;\n this.blockSize = blockSize;\n freeze(this);\n }\n return ResizeObserverSize;\n}());\nexport { ResizeObserverSize };\n","import { freeze } from './utils/freeze';\nvar DOMRectReadOnly = (function () {\n function DOMRectReadOnly(x, y, width, height) {\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n this.top = this.y;\n this.left = this.x;\n this.bottom = this.top + this.height;\n this.right = this.left + this.width;\n return freeze(this);\n }\n DOMRectReadOnly.prototype.toJSON = function () {\n var _a = this, x = _a.x, y = _a.y, top = _a.top, right = _a.right, bottom = _a.bottom, left = _a.left, width = _a.width, height = _a.height;\n return { x: x, y: y, top: top, right: right, bottom: bottom, left: left, width: width, height: height };\n };\n DOMRectReadOnly.fromRect = function (rectangle) {\n return new DOMRectReadOnly(rectangle.x, rectangle.y, rectangle.width, rectangle.height);\n };\n return DOMRectReadOnly;\n}());\nexport { DOMRectReadOnly };\n","var isSVG = function (target) { return target instanceof SVGElement && 'getBBox' in target; };\nvar isHidden = function (target) {\n if (isSVG(target)) {\n var _a = target.getBBox(), width = _a.width, height = _a.height;\n return !width && !height;\n }\n var _b = target, offsetWidth = _b.offsetWidth, offsetHeight = _b.offsetHeight;\n return !(offsetWidth || offsetHeight || target.getClientRects().length);\n};\nvar isElement = function (obj) {\n var _a, _b;\n if (obj instanceof Element) {\n return true;\n }\n var scope = (_b = (_a = obj) === null || _a === void 0 ? void 0 : _a.ownerDocument) === null || _b === void 0 ? void 0 : _b.defaultView;\n return !!(scope && obj instanceof scope.Element);\n};\nvar isReplacedElement = function (target) {\n switch (target.tagName) {\n case 'INPUT':\n if (target.type !== 'image') {\n break;\n }\n case 'VIDEO':\n case 'AUDIO':\n case 'EMBED':\n case 'OBJECT':\n case 'CANVAS':\n case 'IFRAME':\n case 'IMG':\n return true;\n }\n return false;\n};\nexport { isSVG, isHidden, isElement, isReplacedElement };\n","export var global = typeof window !== 'undefined' ? window : {};\n","import { ResizeObserverBoxOptions } from '../ResizeObserverBoxOptions';\nimport { ResizeObserverSize } from '../ResizeObserverSize';\nimport { DOMRectReadOnly } from '../DOMRectReadOnly';\nimport { isSVG, isHidden } from '../utils/element';\nimport { freeze } from '../utils/freeze';\nimport { global } from '../utils/global';\nvar cache = new WeakMap();\nvar scrollRegexp = /auto|scroll/;\nvar verticalRegexp = /^tb|vertical/;\nvar IE = (/msie|trident/i).test(global.navigator && global.navigator.userAgent);\nvar parseDimension = function (pixel) { return parseFloat(pixel || '0'); };\nvar size = function (inlineSize, blockSize, switchSizes) {\n if (inlineSize === void 0) { inlineSize = 0; }\n if (blockSize === void 0) { blockSize = 0; }\n if (switchSizes === void 0) { switchSizes = false; }\n return new ResizeObserverSize((switchSizes ? blockSize : inlineSize) || 0, (switchSizes ? inlineSize : blockSize) || 0);\n};\nvar zeroBoxes = freeze({\n devicePixelContentBoxSize: size(),\n borderBoxSize: size(),\n contentBoxSize: size(),\n contentRect: new DOMRectReadOnly(0, 0, 0, 0)\n});\nvar calculateBoxSizes = function (target, forceRecalculation) {\n if (forceRecalculation === void 0) { forceRecalculation = false; }\n if (cache.has(target) && !forceRecalculation) {\n return cache.get(target);\n }\n if (isHidden(target)) {\n cache.set(target, zeroBoxes);\n return zeroBoxes;\n }\n var cs = getComputedStyle(target);\n var svg = isSVG(target) && target.ownerSVGElement && target.getBBox();\n var removePadding = !IE && cs.boxSizing === 'border-box';\n var switchSizes = verticalRegexp.test(cs.writingMode || '');\n var canScrollVertically = !svg && scrollRegexp.test(cs.overflowY || '');\n var canScrollHorizontally = !svg && scrollRegexp.test(cs.overflowX || '');\n var paddingTop = svg ? 0 : parseDimension(cs.paddingTop);\n var paddingRight = svg ? 0 : parseDimension(cs.paddingRight);\n var paddingBottom = svg ? 0 : parseDimension(cs.paddingBottom);\n var paddingLeft = svg ? 0 : parseDimension(cs.paddingLeft);\n var borderTop = svg ? 0 : parseDimension(cs.borderTopWidth);\n var borderRight = svg ? 0 : parseDimension(cs.borderRightWidth);\n var borderBottom = svg ? 0 : parseDimension(cs.borderBottomWidth);\n var borderLeft = svg ? 0 : parseDimension(cs.borderLeftWidth);\n var horizontalPadding = paddingLeft + paddingRight;\n var verticalPadding = paddingTop + paddingBottom;\n var horizontalBorderArea = borderLeft + borderRight;\n var verticalBorderArea = borderTop + borderBottom;\n var horizontalScrollbarThickness = !canScrollHorizontally ? 0 : target.offsetHeight - verticalBorderArea - target.clientHeight;\n var verticalScrollbarThickness = !canScrollVertically ? 0 : target.offsetWidth - horizontalBorderArea - target.clientWidth;\n var widthReduction = removePadding ? horizontalPadding + horizontalBorderArea : 0;\n var heightReduction = removePadding ? verticalPadding + verticalBorderArea : 0;\n var contentWidth = svg ? svg.width : parseDimension(cs.width) - widthReduction - verticalScrollbarThickness;\n var contentHeight = svg ? svg.height : parseDimension(cs.height) - heightReduction - horizontalScrollbarThickness;\n var borderBoxWidth = contentWidth + horizontalPadding + verticalScrollbarThickness + horizontalBorderArea;\n var borderBoxHeight = contentHeight + verticalPadding + horizontalScrollbarThickness + verticalBorderArea;\n var boxes = freeze({\n devicePixelContentBoxSize: size(Math.round(contentWidth * devicePixelRatio), Math.round(contentHeight * devicePixelRatio), switchSizes),\n borderBoxSize: size(borderBoxWidth, borderBoxHeight, switchSizes),\n contentBoxSize: size(contentWidth, contentHeight, switchSizes),\n contentRect: new DOMRectReadOnly(paddingLeft, paddingTop, contentWidth, contentHeight)\n });\n cache.set(target, boxes);\n return boxes;\n};\nvar calculateBoxSize = function (target, observedBox, forceRecalculation) {\n var _a = calculateBoxSizes(target, forceRecalculation), borderBoxSize = _a.borderBoxSize, contentBoxSize = _a.contentBoxSize, devicePixelContentBoxSize = _a.devicePixelContentBoxSize;\n switch (observedBox) {\n case ResizeObserverBoxOptions.DEVICE_PIXEL_CONTENT_BOX:\n return devicePixelContentBoxSize;\n case ResizeObserverBoxOptions.BORDER_BOX:\n return borderBoxSize;\n default:\n return contentBoxSize;\n }\n};\nexport { calculateBoxSize, calculateBoxSizes };\n","import { calculateBoxSizes } from './algorithms/calculateBoxSize';\nimport { freeze } from './utils/freeze';\nvar ResizeObserverEntry = (function () {\n function ResizeObserverEntry(target) {\n var boxes = calculateBoxSizes(target);\n this.target = target;\n this.contentRect = boxes.contentRect;\n this.borderBoxSize = freeze([boxes.borderBoxSize]);\n this.contentBoxSize = freeze([boxes.contentBoxSize]);\n this.devicePixelContentBoxSize = freeze([boxes.devicePixelContentBoxSize]);\n }\n return ResizeObserverEntry;\n}());\nexport { ResizeObserverEntry };\n","import { isHidden } from '../utils/element';\nvar calculateDepthForNode = function (node) {\n if (isHidden(node)) {\n return Infinity;\n }\n var depth = 0;\n var parent = node.parentNode;\n while (parent) {\n depth += 1;\n parent = parent.parentNode;\n }\n return depth;\n};\nexport { calculateDepthForNode };\n","import { resizeObservers } from '../utils/resizeObservers';\nimport { ResizeObserverEntry } from '../ResizeObserverEntry';\nimport { calculateDepthForNode } from './calculateDepthForNode';\nimport { calculateBoxSize } from './calculateBoxSize';\nvar broadcastActiveObservations = function () {\n var shallowestDepth = Infinity;\n var callbacks = [];\n resizeObservers.forEach(function processObserver(ro) {\n if (ro.activeTargets.length === 0) {\n return;\n }\n var entries = [];\n ro.activeTargets.forEach(function processTarget(ot) {\n var entry = new ResizeObserverEntry(ot.target);\n var targetDepth = calculateDepthForNode(ot.target);\n entries.push(entry);\n ot.lastReportedSize = calculateBoxSize(ot.target, ot.observedBox);\n if (targetDepth < shallowestDepth) {\n shallowestDepth = targetDepth;\n }\n });\n callbacks.push(function resizeObserverCallback() {\n ro.callback.call(ro.observer, entries, ro.observer);\n });\n ro.activeTargets.splice(0, ro.activeTargets.length);\n });\n for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) {\n var callback = callbacks_1[_i];\n callback();\n }\n return shallowestDepth;\n};\nexport { broadcastActiveObservations };\n","import { resizeObservers } from '../utils/resizeObservers';\nimport { calculateDepthForNode } from './calculateDepthForNode';\nvar gatherActiveObservationsAtDepth = function (depth) {\n resizeObservers.forEach(function processObserver(ro) {\n ro.activeTargets.splice(0, ro.activeTargets.length);\n ro.skippedTargets.splice(0, ro.skippedTargets.length);\n ro.observationTargets.forEach(function processTarget(ot) {\n if (ot.isActive()) {\n if (calculateDepthForNode(ot.target) > depth) {\n ro.activeTargets.push(ot);\n }\n else {\n ro.skippedTargets.push(ot);\n }\n }\n });\n });\n};\nexport { gatherActiveObservationsAtDepth };\n","import { process } from './process';\nimport { global } from './global';\nimport { queueResizeObserver } from './queueResizeObserver';\nvar watching = 0;\nvar isWatching = function () { return !!watching; };\nvar CATCH_PERIOD = 250;\nvar observerConfig = { attributes: true, characterData: true, childList: true, subtree: true };\nvar events = [\n 'resize',\n 'load',\n 'transitionend',\n 'animationend',\n 'animationstart',\n 'animationiteration',\n 'keyup',\n 'keydown',\n 'mouseup',\n 'mousedown',\n 'mouseover',\n 'mouseout',\n 'blur',\n 'focus'\n];\nvar time = function (timeout) {\n if (timeout === void 0) { timeout = 0; }\n return Date.now() + timeout;\n};\nvar scheduled = false;\nvar Scheduler = (function () {\n function Scheduler() {\n var _this = this;\n this.stopped = true;\n this.listener = function () { return _this.schedule(); };\n }\n Scheduler.prototype.run = function (timeout) {\n var _this = this;\n if (timeout === void 0) { timeout = CATCH_PERIOD; }\n if (scheduled) {\n return;\n }\n scheduled = true;\n var until = time(timeout);\n queueResizeObserver(function () {\n var elementsHaveResized = false;\n try {\n elementsHaveResized = process();\n }\n finally {\n scheduled = false;\n timeout = until - time();\n if (!isWatching()) {\n return;\n }\n if (elementsHaveResized) {\n _this.run(1000);\n }\n else if (timeout > 0) {\n _this.run(timeout);\n }\n else {\n _this.start();\n }\n }\n });\n };\n Scheduler.prototype.schedule = function () {\n this.stop();\n this.run();\n };\n Scheduler.prototype.observe = function () {\n var _this = this;\n var cb = function () { return _this.observer && _this.observer.observe(document.body, observerConfig); };\n document.body ? cb() : global.addEventListener('DOMContentLoaded', cb);\n };\n Scheduler.prototype.start = function () {\n var _this = this;\n if (this.stopped) {\n this.stopped = false;\n this.observer = new MutationObserver(this.listener);\n this.observe();\n events.forEach(function (name) { return global.addEventListener(name, _this.listener, true); });\n }\n };\n Scheduler.prototype.stop = function () {\n var _this = this;\n if (!this.stopped) {\n this.observer && this.observer.disconnect();\n events.forEach(function (name) { return global.removeEventListener(name, _this.listener, true); });\n this.stopped = true;\n }\n };\n return Scheduler;\n}());\nvar scheduler = new Scheduler();\nvar updateCount = function (n) {\n !watching && n > 0 && scheduler.start();\n watching += n;\n !watching && scheduler.stop();\n};\nexport { scheduler, updateCount };\n","import { queueMicroTask } from './queueMicroTask';\nvar queueResizeObserver = function (cb) {\n queueMicroTask(function ResizeObserver() {\n requestAnimationFrame(cb);\n });\n};\nexport { queueResizeObserver };\n","import { hasActiveObservations } from '../algorithms/hasActiveObservations';\nimport { hasSkippedObservations } from '../algorithms/hasSkippedObservations';\nimport { deliverResizeLoopError } from '../algorithms/deliverResizeLoopError';\nimport { broadcastActiveObservations } from '../algorithms/broadcastActiveObservations';\nimport { gatherActiveObservationsAtDepth } from '../algorithms/gatherActiveObservationsAtDepth';\nvar process = function () {\n var depth = 0;\n gatherActiveObservationsAtDepth(depth);\n while (hasActiveObservations()) {\n depth = broadcastActiveObservations();\n gatherActiveObservationsAtDepth(depth);\n }\n if (hasSkippedObservations()) {\n deliverResizeLoopError();\n }\n return depth > 0;\n};\nexport { process };\n","import { resizeObservers } from '../utils/resizeObservers';\nvar hasActiveObservations = function () {\n return resizeObservers.some(function (ro) { return ro.activeTargets.length > 0; });\n};\nexport { hasActiveObservations };\n","import { resizeObservers } from '../utils/resizeObservers';\nvar hasSkippedObservations = function () {\n return resizeObservers.some(function (ro) { return ro.skippedTargets.length > 0; });\n};\nexport { hasSkippedObservations };\n","import { ResizeObserverBoxOptions } from './ResizeObserverBoxOptions';\nimport { calculateBoxSize } from './algorithms/calculateBoxSize';\nimport { isSVG, isReplacedElement } from './utils/element';\nvar skipNotifyOnElement = function (target) {\n return !isSVG(target)\n && !isReplacedElement(target)\n && getComputedStyle(target).display === 'inline';\n};\nvar ResizeObservation = (function () {\n function ResizeObservation(target, observedBox) {\n this.target = target;\n this.observedBox = observedBox || ResizeObserverBoxOptions.CONTENT_BOX;\n this.lastReportedSize = {\n inlineSize: 0,\n blockSize: 0\n };\n }\n ResizeObservation.prototype.isActive = function () {\n var size = calculateBoxSize(this.target, this.observedBox, true);\n if (skipNotifyOnElement(this.target)) {\n this.lastReportedSize = size;\n }\n if (this.lastReportedSize.inlineSize !== size.inlineSize\n || this.lastReportedSize.blockSize !== size.blockSize) {\n return true;\n }\n return false;\n };\n return ResizeObservation;\n}());\nexport { ResizeObservation };\n","var ResizeObserverDetail = (function () {\n function ResizeObserverDetail(resizeObserver, callback) {\n this.activeTargets = [];\n this.skippedTargets = [];\n this.observationTargets = [];\n this.observer = resizeObserver;\n this.callback = callback;\n }\n return ResizeObserverDetail;\n}());\nexport { ResizeObserverDetail };\n","import { scheduler, updateCount } from './utils/scheduler';\nimport { ResizeObservation } from './ResizeObservation';\nimport { ResizeObserverDetail } from './ResizeObserverDetail';\nimport { resizeObservers } from './utils/resizeObservers';\nvar observerMap = new WeakMap();\nvar getObservationIndex = function (observationTargets, target) {\n for (var i = 0; i < observationTargets.length; i += 1) {\n if (observationTargets[i].target === target) {\n return i;\n }\n }\n return -1;\n};\nvar ResizeObserverController = (function () {\n function ResizeObserverController() {\n }\n ResizeObserverController.connect = function (resizeObserver, callback) {\n var detail = new ResizeObserverDetail(resizeObserver, callback);\n observerMap.set(resizeObserver, detail);\n };\n ResizeObserverController.observe = function (resizeObserver, target, options) {\n var detail = observerMap.get(resizeObserver);\n var firstObservation = detail.observationTargets.length === 0;\n if (getObservationIndex(detail.observationTargets, target) < 0) {\n firstObservation && resizeObservers.push(detail);\n detail.observationTargets.push(new ResizeObservation(target, options && options.box));\n updateCount(1);\n scheduler.schedule();\n }\n };\n ResizeObserverController.unobserve = function (resizeObserver, target) {\n var detail = observerMap.get(resizeObserver);\n var index = getObservationIndex(detail.observationTargets, target);\n var lastObservation = detail.observationTargets.length === 1;\n if (index >= 0) {\n lastObservation && resizeObservers.splice(resizeObservers.indexOf(detail), 1);\n detail.observationTargets.splice(index, 1);\n updateCount(-1);\n }\n };\n ResizeObserverController.disconnect = function (resizeObserver) {\n var _this = this;\n var detail = observerMap.get(resizeObserver);\n detail.observationTargets.slice().forEach(function (ot) { return _this.unobserve(resizeObserver, ot.target); });\n detail.activeTargets.splice(0, detail.activeTargets.length);\n };\n return ResizeObserverController;\n}());\nexport { ResizeObserverController };\n","import { ResizeObserverController } from './ResizeObserverController';\nimport { isElement } from './utils/element';\nvar ResizeObserver = (function () {\n function ResizeObserver(callback) {\n if (arguments.length === 0) {\n throw new TypeError(\"Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.\");\n }\n if (typeof callback !== 'function') {\n throw new TypeError(\"Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.\");\n }\n ResizeObserverController.connect(this, callback);\n }\n ResizeObserver.prototype.observe = function (target, options) {\n if (arguments.length === 0) {\n throw new TypeError(\"Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.\");\n }\n if (!isElement(target)) {\n throw new TypeError(\"Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element\");\n }\n ResizeObserverController.observe(this, target, options);\n };\n ResizeObserver.prototype.unobserve = function (target) {\n if (arguments.length === 0) {\n throw new TypeError(\"Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.\");\n }\n if (!isElement(target)) {\n throw new TypeError(\"Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element\");\n }\n ResizeObserverController.unobserve(this, target);\n };\n ResizeObserver.prototype.disconnect = function () {\n ResizeObserverController.disconnect(this);\n };\n ResizeObserver.toString = function () {\n return 'function ResizeObserver () { [polyfill code] }';\n };\n return ResizeObserver;\n}());\nexport { ResizeObserver };\n","import { ResizeObserver as Polyfill } from '@juggle/resize-observer';\nconst ResizeObserver = window.ResizeObserver || Polyfill;\n/** @inheritdoc */\nexport class SharedResizeObserver {\n constructor() {\n /**\n * This is the ResizeObserver that dispatches\n * callbacks to all of the handlers.\n *\n * @private\n * @memberof SharedResizeObserver\n */\n this.resizeObserver = new ResizeObserver(entries => {\n // This requestAnimationFrame is to throttle the refresh rate,\n // otherwise you get a bunch of\n // `ResizeObserver loop completed with undelivered notifications` errors\n // The errors are not harmful, but they happen a lot, see:\n // https://stackoverflow.com/a/58701523\n // https://github.com/souporserious/react-measure/issues/104\n // https://github.com/WICG/resize-observer/issues/38\n window.requestAnimationFrame(() => {\n for (const entry of entries) {\n const handlers = this.resizeHandlers.get(entry.target);\n handlers === null || handlers === void 0 ? void 0 : handlers.forEach(handler => {\n handler.handleResize(entry);\n });\n }\n });\n });\n /**\n * A map of all of the observed elements and their resize handlers\n *\n * @private\n * @type {Map<\n * Element,\n * Set<SharedResizeObserverResizeHandlerInterface>\n * >}\n * @memberof SharedResizeObserver\n */\n this.resizeHandlers = new Map();\n }\n /** @inheritdoc */\n addObserver(options) {\n var _a;\n const handlers = (_a = this.resizeHandlers.get(options.target)) !== null && _a !== void 0 ? _a : new Set();\n handlers.add(options.handler);\n this.resizeHandlers.set(options.target, handlers);\n this.resizeObserver.observe(options.target, options.options);\n }\n /** @inheritdoc */\n removeObserver(options) {\n const handlers = this.resizeHandlers.get(options.target);\n if (!handlers)\n return;\n this.resizeObserver.unobserve(options.target);\n handlers.delete(options.handler);\n if (handlers.size === 0) {\n this.resizeHandlers.delete(options.target);\n }\n }\n}\n//# sourceMappingURL=shared-resize-observer.js.map","/**\n * Configuration to show a modal\n *\n * @export\n * @class ModalConfig\n */\nexport class ModalConfig {\n constructor(options) {\n var _a, _b, _c, _d, _e;\n this.title = options === null || options === void 0 ? void 0 : options.title;\n this.subtitle = options === null || options === void 0 ? void 0 : options.subtitle;\n this.headline = options === null || options === void 0 ? void 0 : options.headline;\n this.message = options === null || options === void 0 ? void 0 : options.message;\n this.headerColor = (_a = options === null || options === void 0 ? void 0 : options.headerColor) !== null && _a !== void 0 ? _a : '#55A183';\n this.showProcessingIndicator = (_b = options === null || options === void 0 ? void 0 : options.showProcessingIndicator) !== null && _b !== void 0 ? _b : false;\n this.processingImageMode = (_c = options === null || options === void 0 ? void 0 : options.processingImageMode) !== null && _c !== void 0 ? _c : 'complete';\n this.showCloseButton = (_d = options === null || options === void 0 ? void 0 : options.showCloseButton) !== null && _d !== void 0 ? _d : true;\n this.closeOnBackdropClick = (_e = options === null || options === void 0 ? void 0 : options.closeOnBackdropClick) !== null && _e !== void 0 ? _e : true;\n }\n}\n//# sourceMappingURL=modal-config.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\ninterface MaybePolyfilledCe extends CustomElementRegistry {\n readonly polyfillWrapFlushCallback?: object;\n}\n\n/**\n * True if the custom elements polyfill is in use.\n */\nexport const isCEPolyfill = typeof window !== 'undefined' &&\n window.customElements != null &&\n (window.customElements as MaybePolyfilledCe).polyfillWrapFlushCallback !==\n undefined;\n\n/**\n * Reparents nodes, starting from `start` (inclusive) to `end` (exclusive),\n * into another container (could be the same container), before `before`. If\n * `before` is null, it appends the nodes to the container.\n */\nexport const reparentNodes =\n (container: Node,\n start: Node|null,\n end: Node|null = null,\n before: Node|null = null): void => {\n while (start !== end) {\n const n = start!.nextSibling;\n container.insertBefore(start!, before);\n start = n;\n }\n };\n\n/**\n * Removes nodes, starting from `start` (inclusive) to `end` (exclusive), from\n * `container`.\n */\nexport const removeNodes =\n (container: Node, start: Node|null, end: Node|null = null): void => {\n while (start !== end) {\n const n = start!.nextSibling;\n container.removeChild(start!);\n start = n;\n }\n };\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {TemplateResult} from './template-result.js';\n\n/**\n * An expression marker with embedded unique key to avoid collision with\n * possible text in templates.\n */\nexport const marker = `{{lit-${String(Math.random()).slice(2)}}}`;\n\n/**\n * An expression marker used text-positions, multi-binding attributes, and\n * attributes with markup-like text values.\n */\nexport const nodeMarker = `<!--${marker}-->`;\n\nexport const markerRegex = new RegExp(`${marker}|${nodeMarker}`);\n\n/**\n * Suffix appended to all bound attribute names.\n */\nexport const boundAttributeSuffix = '$lit$';\n\n/**\n * An updatable Template that tracks the location of dynamic parts.\n */\nexport class Template {\n readonly parts: TemplatePart[] = [];\n readonly element: HTMLTemplateElement;\n\n constructor(result: TemplateResult, element: HTMLTemplateElement) {\n this.element = element;\n\n const nodesToRemove: Node[] = [];\n const stack: Node[] = [];\n // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null\n const walker = document.createTreeWalker(\n element.content,\n 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */,\n null,\n false);\n // Keeps track of the last index associated with a part. We try to delete\n // unnecessary nodes, but we never want to associate two different parts\n // to the same index. They must have a constant node between.\n let lastPartIndex = 0;\n let index = -1;\n let partIndex = 0;\n const {strings, values: {length}} = result;\n while (partIndex < length) {\n const node = walker.nextNode() as Element | Comment | Text | null;\n if (node === null) {\n // We've exhausted the content inside a nested template element.\n // Because we still have parts (the outer for-loop), we know:\n // - There is a template in the stack\n // - The walker will find a nextNode outside the template\n walker.currentNode = stack.pop()!;\n continue;\n }\n index++;\n\n if (node.nodeType === 1 /* Node.ELEMENT_NODE */) {\n if ((node as Element).hasAttributes()) {\n const attributes = (node as Element).attributes;\n const {length} = attributes;\n // Per\n // https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap,\n // attributes are not guaranteed to be returned in document order.\n // In particular, Edge/IE can return them out of order, so we cannot\n // assume a correspondence between part index and attribute index.\n let count = 0;\n for (let i = 0; i < length; i++) {\n if (endsWith(attributes[i].name, boundAttributeSuffix)) {\n count++;\n }\n }\n while (count-- > 0) {\n // Get the template literal section leading up to the first\n // expression in this attribute\n const stringForPart = strings[partIndex];\n // Find the attribute name\n const name = lastAttributeNameRegex.exec(stringForPart)![2];\n // Find the corresponding attribute\n // All bound attributes have had a suffix added in\n // TemplateResult#getHTML to opt out of special attribute\n // handling. To look up the attribute value we also need to add\n // the suffix.\n const attributeLookupName =\n name.toLowerCase() + boundAttributeSuffix;\n const attributeValue =\n (node as Element).getAttribute(attributeLookupName)!;\n (node as Element).removeAttribute(attributeLookupName);\n const statics = attributeValue.split(markerRegex);\n this.parts.push({type: 'attribute', index, name, strings: statics});\n partIndex += statics.length - 1;\n }\n }\n if ((node as Element).tagName === 'TEMPLATE') {\n stack.push(node);\n walker.currentNode = (node as HTMLTemplateElement).content;\n }\n } else if (node.nodeType === 3 /* Node.TEXT_NODE */) {\n const data = (node as Text).data;\n if (data.indexOf(marker) >= 0) {\n const parent = node.parentNode!;\n const strings = data.split(markerRegex);\n const lastIndex = strings.length - 1;\n // Generate a new text node for each literal section\n // These nodes are also used as the markers for node parts\n for (let i = 0; i < lastIndex; i++) {\n let insert: Node;\n let s = strings[i];\n if (s === '') {\n insert = createMarker();\n } else {\n const match = lastAttributeNameRegex.exec(s);\n if (match !== null && endsWith(match[2], boundAttributeSuffix)) {\n s = s.slice(0, match.index) + match[1] +\n match[2].slice(0, -boundAttributeSuffix.length) + match[3];\n }\n insert = document.createTextNode(s);\n }\n parent.insertBefore(insert, node);\n this.parts.push({type: 'node', index: ++index});\n }\n // If there's no text, we must insert a comment to mark our place.\n // Else, we can trust it will stick around after cloning.\n if (strings[lastIndex] === '') {\n parent.insertBefore(createMarker(), node);\n nodesToRemove.push(node);\n } else {\n (node as Text).data = strings[lastIndex];\n }\n // We have a part for each match found\n partIndex += lastIndex;\n }\n } else if (node.nodeType === 8 /* Node.COMMENT_NODE */) {\n if ((node as Comment).data === marker) {\n const parent = node.parentNode!;\n // Add a new marker node to be the startNode of the Part if any of\n // the following are true:\n // * We don't have a previousSibling\n // * The previousSibling is already the start of a previous part\n if (node.previousSibling === null || index === lastPartIndex) {\n index++;\n parent.insertBefore(createMarker(), node);\n }\n lastPartIndex = index;\n this.parts.push({type: 'node', index});\n // If we don't have a nextSibling, keep this node so we have an end.\n // Else, we can remove it to save future costs.\n if (node.nextSibling === null) {\n (node as Comment).data = '';\n } else {\n nodesToRemove.push(node);\n index--;\n }\n partIndex++;\n } else {\n let i = -1;\n while ((i = (node as Comment).data.indexOf(marker, i + 1)) !== -1) {\n // Comment node has a binding marker inside, make an inactive part\n // The binding won't work, but subsequent bindings will\n // TODO (justinfagnani): consider whether it's even worth it to\n // make bindings in comments work\n this.parts.push({type: 'node', index: -1});\n partIndex++;\n }\n }\n }\n }\n\n // Remove text binding nodes after the walk to not disturb the TreeWalker\n for (const n of nodesToRemove) {\n n.parentNode!.removeChild(n);\n }\n }\n}\n\nconst endsWith = (str: string, suffix: string): boolean => {\n const index = str.length - suffix.length;\n return index >= 0 && str.slice(index) === suffix;\n};\n\n/**\n * A placeholder for a dynamic expression in an HTML template.\n *\n * There are two built-in part types: AttributePart and NodePart. NodeParts\n * always represent a single dynamic expression, while AttributeParts may\n * represent as many expressions are contained in the attribute.\n *\n * A Template's parts are mutable, so parts can be replaced or modified\n * (possibly to implement different template semantics). The contract is that\n * parts can only be replaced, not removed, added or reordered, and parts must\n * always consume the correct number of values in their `update()` method.\n *\n * TODO(justinfagnani): That requirement is a little fragile. A\n * TemplateInstance could instead be more careful about which values it gives\n * to Part.update().\n */\nexport type TemplatePart = {\n readonly type: 'node'; index: number;\n}|{\n readonly type: 'attribute';\n index: number;\n readonly name: string;\n readonly strings: ReadonlyArray<string>;\n};\n\nexport const isTemplatePartActive = (part: TemplatePart) => part.index !== -1;\n\n// Allows `document.createComment('')` to be renamed for a\n// small manual size-savings.\nexport const createMarker = () => document.createComment('');\n\n/**\n * This regex extracts the attribute name preceding an attribute-position\n * expression. It does this by matching the syntax allowed for attributes\n * against the string literal directly preceding the expression, assuming that\n * the expression is in an attribute-value position.\n *\n * See attributes in the HTML spec:\n * https://www.w3.org/TR/html5/syntax.html#elements-attributes\n *\n * \" \\x09\\x0a\\x0c\\x0d\" are HTML space characters:\n * https://www.w3.org/TR/html5/infrastructure.html#space-characters\n *\n * \"\\0-\\x1F\\x7F-\\x9F\" are Unicode control characters, which includes every\n * space character except \" \".\n *\n * So an attribute is:\n * * The name: any character except a control character, space character, ('),\n * (\"), \">\", \"=\", or \"/\"\n * * Followed by zero or more space characters\n * * Followed by \"=\"\n * * Followed by zero or more space characters\n * * Followed by:\n * * Any character except space, ('), (\"), \"<\", \">\", \"=\", (`), or\n * * (\") then any non-(\"), or\n * * (') then any non-(')\n */\nexport const lastAttributeNameRegex =\n // eslint-disable-next-line no-control-regex\n /([ \\x09\\x0a\\x0c\\x0d])([^\\0-\\x1F\\x7F-\\x9F \"'>=/]+)([ \\x09\\x0a\\x0c\\x0d]*=[ \\x09\\x0a\\x0c\\x0d]*(?:[^ \\x09\\x0a\\x0c\\x0d\"'`<>=]*|\"[^\"]*|'[^']*))$/;\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {isTemplatePartActive, Template, TemplatePart} from './template.js';\n\nconst walkerNodeFilter = 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */;\n\n/**\n * Removes the list of nodes from a Template safely. In addition to removing\n * nodes from the Template, the Template part indices are updated to match\n * the mutated Template DOM.\n *\n * As the template is walked the removal state is tracked and\n * part indices are adjusted as needed.\n *\n * div\n * div#1 (remove) <-- start removing (removing node is div#1)\n * div\n * div#2 (remove) <-- continue removing (removing node is still div#1)\n * div\n * div <-- stop removing since previous sibling is the removing node (div#1,\n * removed 4 nodes)\n */\nexport function removeNodesFromTemplate(\n template: Template, nodesToRemove: Set<Node>) {\n const {element: {content}, parts} = template;\n const walker =\n document.createTreeWalker(content, walkerNodeFilter, null, false);\n let partIndex = nextActiveIndexInTemplateParts(parts);\n let part = parts[partIndex];\n let nodeIndex = -1;\n let removeCount = 0;\n const nodesToRemoveInTemplate = [];\n let currentRemovingNode: Node|null = null;\n while (walker.nextNode()) {\n nodeIndex++;\n const node = walker.currentNode as Element;\n // End removal if stepped past the removing node\n if (node.previousSibling === currentRemovingNode) {\n currentRemovingNode = null;\n }\n // A node to remove was found in the template\n if (nodesToRemove.has(node)) {\n nodesToRemoveInTemplate.push(node);\n // Track node we're removing\n if (currentRemovingNode === null) {\n currentRemovingNode = node;\n }\n }\n // When removing, increment count by which to adjust subsequent part indices\n if (currentRemovingNode !== null) {\n removeCount++;\n }\n while (part !== undefined && part.index === nodeIndex) {\n // If part is in a removed node deactivate it by setting index to -1 or\n // adjust the index as needed.\n part.index = currentRemovingNode !== null ? -1 : part.index - removeCount;\n // go to the next active part.\n partIndex = nextActiveIndexInTemplateParts(parts, partIndex);\n part = parts[partIndex];\n }\n }\n nodesToRemoveInTemplate.forEach((n) => n.parentNode!.removeChild(n));\n}\n\nconst countNodes = (node: Node) => {\n let count = (node.nodeType === 11 /* Node.DOCUMENT_FRAGMENT_NODE */) ? 0 : 1;\n const walker = document.createTreeWalker(node, walkerNodeFilter, null, false);\n while (walker.nextNode()) {\n count++;\n }\n return count;\n};\n\nconst nextActiveIndexInTemplateParts =\n (parts: TemplatePart[], startIndex = -1) => {\n for (let i = startIndex + 1; i < parts.length; i++) {\n const part = parts[i];\n if (isTemplatePartActive(part)) {\n return i;\n }\n }\n return -1;\n };\n\n/**\n * Inserts the given node into the Template, optionally before the given\n * refNode. In addition to inserting the node into the Template, the Template\n * part indices are updated to match the mutated Template DOM.\n */\nexport function insertNodeIntoTemplate(\n template: Template, node: Node, refNode: Node|null = null) {\n const {element: {content}, parts} = template;\n // If there's no refNode, then put node at end of template.\n // No part indices need to be shifted in this case.\n if (refNode === null || refNode === undefined) {\n content.appendChild(node);\n return;\n }\n const walker =\n document.createTreeWalker(content, walkerNodeFilter, null, false);\n let partIndex = nextActiveIndexInTemplateParts(parts);\n let insertCount = 0;\n let walkerIndex = -1;\n while (walker.nextNode()) {\n walkerIndex++;\n const walkerNode = walker.currentNode as Element;\n if (walkerNode === refNode) {\n insertCount = countNodes(node);\n refNode.parentNode!.insertBefore(node, refNode);\n }\n while (partIndex !== -1 && parts[partIndex].index === walkerIndex) {\n // If we've inserted the node, simply adjust all subsequent parts\n if (insertCount > 0) {\n while (partIndex !== -1) {\n parts[partIndex].index += insertCount;\n partIndex = nextActiveIndexInTemplateParts(parts, partIndex);\n }\n return;\n }\n partIndex = nextActiveIndexInTemplateParts(parts, partIndex);\n }\n }\n}\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {Part} from './part.js';\n\nconst directives = new WeakMap<object, true>();\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type DirectiveFactory = (...args: any[]) => object;\n\nexport type DirectiveFn = (part: Part) => void;\n\n/**\n * Brands a function as a directive factory function so that lit-html will call\n * the function during template rendering, rather than passing as a value.\n *\n * A _directive_ is a function that takes a Part as an argument. It has the\n * signature: `(part: Part) => void`.\n *\n * A directive _factory_ is a function that takes arguments for data and\n * configuration and returns a directive. Users of directive usually refer to\n * the directive factory as the directive. For example, \"The repeat directive\".\n *\n * Usually a template author will invoke a directive factory in their template\n * with relevant arguments, which will then return a directive function.\n *\n * Here's an example of using the `repeat()` directive factory that takes an\n * array and a function to render an item:\n *\n * ```js\n * html`<ul><${repeat(items, (item) => html`<li>${item}</li>`)}</ul>`\n * ```\n *\n * When `repeat` is invoked, it returns a directive function that closes over\n * `items` and the template function. When the outer template is rendered, the\n * return directive function is called with the Part for the expression.\n * `repeat` then performs it's custom logic to render multiple items.\n *\n * @param f The directive factory function. Must be a function that returns a\n * function of the signature `(part: Part) => void`. The returned function will\n * be called with the part object.\n *\n * @example\n *\n * import {directive, html} from 'lit-html';\n *\n * const immutable = directive((v) => (part) => {\n * if (part.value !== v) {\n * part.setValue(v)\n * }\n * });\n */\nexport const directive = <F extends DirectiveFactory>(f: F): F =>\n ((...args: unknown[]) => {\n const d = f(...args);\n directives.set(d, true);\n return d;\n }) as F;\n\nexport const isDirective = (o: unknown): o is DirectiveFn => {\n return typeof o === 'function' && directives.has(o);\n};\n","/**\n * @license\n * Copyright (c) 2018 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * The Part interface represents a dynamic part of a template instance rendered\n * by lit-html.\n */\nexport interface Part {\n readonly value: unknown;\n\n /**\n * Sets the current part value, but does not write it to the DOM.\n * @param value The value that will be committed.\n */\n setValue(value: unknown): void;\n\n /**\n * Commits the current part value, causing it to actually be written to the\n * DOM.\n *\n * Directives are run at the start of `commit`, so that if they call\n * `part.setValue(...)` synchronously that value will be used in the current\n * commit, and there's no need to call `part.commit()` within the directive.\n * If directives set a part value asynchronously, then they must call\n * `part.commit()` manually.\n */\n commit(): void;\n}\n\n/**\n * A sentinel value that signals that a value was handled by a directive and\n * should not be written to the DOM.\n */\nexport const noChange = {};\n\n/**\n * A sentinel value that signals a NodePart to fully clear its content.\n */\nexport const nothing = {};\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {isCEPolyfill} from './dom.js';\nimport {Part} from './part.js';\nimport {RenderOptions} from './render-options.js';\nimport {TemplateProcessor} from './template-processor.js';\nimport {isTemplatePartActive, Template, TemplatePart} from './template.js';\n\n/**\n * An instance of a `Template` that can be attached to the DOM and updated\n * with new values.\n */\nexport class TemplateInstance {\n private readonly __parts: Array<Part|undefined> = [];\n readonly processor: TemplateProcessor;\n readonly options: RenderOptions;\n readonly template: Template;\n\n constructor(\n template: Template, processor: TemplateProcessor,\n options: RenderOptions) {\n this.template = template;\n this.processor = processor;\n this.options = options;\n }\n\n update(values: readonly unknown[]) {\n let i = 0;\n for (const part of this.__parts) {\n if (part !== undefined) {\n part.setValue(values[i]);\n }\n i++;\n }\n for (const part of this.__parts) {\n if (part !== undefined) {\n part.commit();\n }\n }\n }\n\n _clone(): DocumentFragment {\n // There are a number of steps in the lifecycle of a template instance's\n // DOM fragment:\n // 1. Clone - create the instance fragment\n // 2. Adopt - adopt into the main document\n // 3. Process - find part markers and create parts\n // 4. Upgrade - upgrade custom elements\n // 5. Update - set node, attribute, property, etc., values\n // 6. Connect - connect to the document. Optional and outside of this\n // method.\n //\n // We have a few constraints on the ordering of these steps:\n // * We need to upgrade before updating, so that property values will pass\n // through any property setters.\n // * We would like to process before upgrading so that we're sure that the\n // cloned fragment is inert and not disturbed by self-modifying DOM.\n // * We want custom elements to upgrade even in disconnected fragments.\n //\n // Given these constraints, with full custom elements support we would\n // prefer the order: Clone, Process, Adopt, Upgrade, Update, Connect\n //\n // But Safari does not implement CustomElementRegistry#upgrade, so we\n // can not implement that order and still have upgrade-before-update and\n // upgrade disconnected fragments. So we instead sacrifice the\n // process-before-upgrade constraint, since in Custom Elements v1 elements\n // must not modify their light DOM in the constructor. We still have issues\n // when co-existing with CEv0 elements like Polymer 1, and with polyfills\n // that don't strictly adhere to the no-modification rule because shadow\n // DOM, which may be created in the constructor, is emulated by being placed\n // in the light DOM.\n //\n // The resulting order is on native is: Clone, Adopt, Upgrade, Process,\n // Update, Connect. document.importNode() performs Clone, Adopt, and Upgrade\n // in one step.\n //\n // The Custom Elements v1 polyfill supports upgrade(), so the order when\n // polyfilled is the more ideal: Clone, Process, Adopt, Upgrade, Update,\n // Connect.\n\n const fragment = isCEPolyfill ?\n this.template.element.content.cloneNode(true) as DocumentFragment :\n document.importNode(this.template.element.content, true);\n\n const stack: Node[] = [];\n const parts = this.template.parts;\n // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null\n const walker = document.createTreeWalker(\n fragment,\n 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */,\n null,\n false);\n let partIndex = 0;\n let nodeIndex = 0;\n let part: TemplatePart;\n let node = walker.nextNode();\n // Loop through all the nodes and parts of a template\n while (partIndex < parts.length) {\n part = parts[partIndex];\n if (!isTemplatePartActive(part)) {\n this.__parts.push(undefined);\n partIndex++;\n continue;\n }\n\n // Progress the tree walker until we find our next part's node.\n // Note that multiple parts may share the same node (attribute parts\n // on a single element), so this loop may not run at all.\n while (nodeIndex < part.index) {\n nodeIndex++;\n if (node!.nodeName === 'TEMPLATE') {\n stack.push(node!);\n walker.currentNode = (node as HTMLTemplateElement).content;\n }\n if ((node = walker.nextNode()) === null) {\n // We've exhausted the content inside a nested template element.\n // Because we still have parts (the outer for-loop), we know:\n // - There is a template in the stack\n // - The walker will find a nextNode outside the template\n walker.currentNode = stack.pop()!;\n node = walker.nextNode();\n }\n }\n\n // We've arrived at our part's node.\n if (part.type === 'node') {\n const part = this.processor.handleTextExpression(this.options);\n part.insertAfterNode(node!.previousSibling!);\n this.__parts.push(part);\n } else {\n this.__parts.push(...this.processor.handleAttributeExpressions(\n node as Element, part.name, part.strings, this.options));\n }\n partIndex++;\n }\n\n if (isCEPolyfill) {\n document.adoptNode(fragment);\n customElements.upgrade(fragment);\n }\n return fragment;\n }\n}\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * @module lit-html\n */\n\nimport {reparentNodes} from './dom.js';\nimport {TemplateProcessor} from './template-processor.js';\nimport {boundAttributeSuffix, lastAttributeNameRegex, marker, nodeMarker} from './template.js';\n\ndeclare const trustedTypes: typeof window.trustedTypes;\n/**\n * Our TrustedTypePolicy for HTML which is declared using the html template\n * tag function.\n *\n * That HTML is a developer-authored constant, and is parsed with innerHTML\n * before any untrusted expressions have been mixed in. Therefor it is\n * considered safe by construction.\n */\nconst policy = window.trustedTypes &&\n trustedTypes!.createPolicy('lit-html', {createHTML: (s) => s});\n\nconst commentMarker = ` ${marker} `;\n\n/**\n * The return type of `html`, which holds a Template and the values from\n * interpolated expressions.\n */\nexport class TemplateResult {\n readonly strings: TemplateStringsArray;\n readonly values: readonly unknown[];\n readonly type: string;\n readonly processor: TemplateProcessor;\n\n constructor(\n strings: TemplateStringsArray, values: readonly unknown[], type: string,\n processor: TemplateProcessor) {\n this.strings = strings;\n this.values = values;\n this.type = type;\n this.processor = processor;\n }\n\n /**\n * Returns a string of HTML used to create a `<template>` element.\n */\n getHTML(): string {\n const l = this.strings.length - 1;\n let html = '';\n let isCommentBinding = false;\n\n for (let i = 0; i < l; i++) {\n const s = this.strings[i];\n // For each binding we want to determine the kind of marker to insert\n // into the template source before it's parsed by the browser's HTML\n // parser. The marker type is based on whether the expression is in an\n // attribute, text, or comment position.\n // * For node-position bindings we insert a comment with the marker\n // sentinel as its text content, like <!--{{lit-guid}}-->.\n // * For attribute bindings we insert just the marker sentinel for the\n // first binding, so that we support unquoted attribute bindings.\n // Subsequent bindings can use a comment marker because multi-binding\n // attributes must be quoted.\n // * For comment bindings we insert just the marker sentinel so we don't\n // close the comment.\n //\n // The following code scans the template source, but is *not* an HTML\n // parser. We don't need to track the tree structure of the HTML, only\n // whether a binding is inside a comment, and if not, if it appears to be\n // the first binding in an attribute.\n const commentOpen = s.lastIndexOf('<!--');\n // We're in comment position if we have a comment open with no following\n // comment close. Because <-- can appear in an attribute value there can\n // be false positives.\n isCommentBinding = (commentOpen > -1 || isCommentBinding) &&\n s.indexOf('-->', commentOpen + 1) === -1;\n // Check to see if we have an attribute-like sequence preceding the\n // expression. This can match \"name=value\" like structures in text,\n // comments, and attribute values, so there can be false-positives.\n const attributeMatch = lastAttributeNameRegex.exec(s);\n if (attributeMatch === null) {\n // We're only in this branch if we don't have a attribute-like\n // preceding sequence. For comments, this guards against unusual\n // attribute values like <div foo=\"<!--${'bar'}\">. Cases like\n // <!-- foo=${'bar'}--> are handled correctly in the attribute branch\n // below.\n html += s + (isCommentBinding ? commentMarker : nodeMarker);\n } else {\n // For attributes we use just a marker sentinel, and also append a\n // $lit$ suffix to the name to opt-out of attribute-specific parsing\n // that IE and Edge do for style and certain SVG attributes.\n html += s.substr(0, attributeMatch.index) + attributeMatch[1] +\n attributeMatch[2] + boundAttributeSuffix + attributeMatch[3] +\n marker;\n }\n }\n html += this.strings[l];\n return html;\n }\n\n getTemplateElement(): HTMLTemplateElement {\n const template = document.createElement('template');\n let value = this.getHTML();\n if (policy !== undefined) {\n // this is secure because `this.strings` is a TemplateStringsArray.\n // TODO: validate this when\n // https://github.com/tc39/proposal-array-is-template-object is\n // implemented.\n value = policy.createHTML(value) as unknown as string;\n }\n template.innerHTML = value;\n return template;\n }\n}\n\n/**\n * A TemplateResult for SVG fragments.\n *\n * This class wraps HTML in an `<svg>` tag in order to parse its contents in the\n * SVG namespace, then modifies the template to remove the `<svg>` tag so that\n * clones only container the original fragment.\n */\nexport class SVGTemplateResult extends TemplateResult {\n getHTML(): string {\n return `<svg>${super.getHTML()}</svg>`;\n }\n\n getTemplateElement(): HTMLTemplateElement {\n const template = super.getTemplateElement();\n const content = template.content;\n const svgElement = content.firstChild!;\n content.removeChild(svgElement);\n reparentNodes(content, svgElement.firstChild);\n return template;\n }\n}\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {isDirective} from './directive.js';\nimport {removeNodes} from './dom.js';\nimport {noChange, nothing, Part} from './part.js';\nimport {RenderOptions} from './render-options.js';\nimport {TemplateInstance} from './template-instance.js';\nimport {TemplateResult} from './template-result.js';\nimport {createMarker} from './template.js';\n\n// https://tc39.github.io/ecma262/#sec-typeof-operator\nexport type Primitive = null|undefined|boolean|number|string|symbol|bigint;\nexport const isPrimitive = (value: unknown): value is Primitive => {\n return (\n value === null ||\n !(typeof value === 'object' || typeof value === 'function'));\n};\nexport const isIterable = (value: unknown): value is Iterable<unknown> => {\n return Array.isArray(value) ||\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n !!(value && (value as any)[Symbol.iterator]);\n};\n\n/**\n * Writes attribute values to the DOM for a group of AttributeParts bound to a\n * single attribute. The value is only set once even if there are multiple parts\n * for an attribute.\n */\nexport class AttributeCommitter {\n readonly element: Element;\n readonly name: string;\n readonly strings: ReadonlyArray<string>;\n readonly parts: ReadonlyArray<AttributePart>;\n dirty = true;\n\n constructor(element: Element, name: string, strings: ReadonlyArray<string>) {\n this.element = element;\n this.name = name;\n this.strings = strings;\n this.parts = [];\n for (let i = 0; i < strings.length - 1; i++) {\n (this.parts as AttributePart[])[i] = this._createPart();\n }\n }\n\n /**\n * Creates a single part. Override this to create a differnt type of part.\n */\n protected _createPart(): AttributePart {\n return new AttributePart(this);\n }\n\n protected _getValue(): unknown {\n const strings = this.strings;\n const l = strings.length - 1;\n const parts = this.parts;\n\n // If we're assigning an attribute via syntax like:\n // attr=\"${foo}\" or attr=${foo}\n // but not\n // attr=\"${foo} ${bar}\" or attr=\"${foo} baz\"\n // then we don't want to coerce the attribute value into one long\n // string. Instead we want to just return the value itself directly,\n // so that sanitizeDOMValue can get the actual value rather than\n // String(value)\n // The exception is if v is an array, in which case we do want to smash\n // it together into a string without calling String() on the array.\n //\n // This also allows trusted values (when using TrustedTypes) being\n // assigned to DOM sinks without being stringified in the process.\n if (l === 1 && strings[0] === '' && strings[1] === '') {\n const v = parts[0].value;\n if (typeof v === 'symbol') {\n return String(v);\n }\n if (typeof v === 'string' || !isIterable(v)) {\n return v;\n }\n }\n let text = '';\n\n for (let i = 0; i < l; i++) {\n text += strings[i];\n const part = parts[i];\n if (part !== undefined) {\n const v = part.value;\n if (isPrimitive(v) || !isIterable(v)) {\n text += typeof v === 'string' ? v : String(v);\n } else {\n for (const t of v) {\n text += typeof t === 'string' ? t : String(t);\n }\n }\n }\n }\n\n text += strings[l];\n return text;\n }\n\n commit(): void {\n if (this.dirty) {\n this.dirty = false;\n this.element.setAttribute(this.name, this._getValue() as string);\n }\n }\n}\n\n/**\n * A Part that controls all or part of an attribute value.\n */\nexport class AttributePart implements Part {\n readonly committer: AttributeCommitter;\n value: unknown = undefined;\n\n constructor(committer: AttributeCommitter) {\n this.committer = committer;\n }\n\n setValue(value: unknown): void {\n if (value !== noChange && (!isPrimitive(value) || value !== this.value)) {\n this.value = value;\n // If the value is a not a directive, dirty the committer so that it'll\n // call setAttribute. If the value is a directive, it'll dirty the\n // committer if it calls setValue().\n if (!isDirective(value)) {\n this.committer.dirty = true;\n }\n }\n }\n\n commit() {\n while (isDirective(this.value)) {\n const directive = this.value;\n this.value = noChange;\n directive(this);\n }\n if (this.value === noChange) {\n return;\n }\n this.committer.commit();\n }\n}\n\n/**\n * A Part that controls a location within a Node tree. Like a Range, NodePart\n * has start and end locations and can set and update the Nodes between those\n * locations.\n *\n * NodeParts support several value types: primitives, Nodes, TemplateResults,\n * as well as arrays and iterables of those types.\n */\nexport class NodePart implements Part {\n readonly options: RenderOptions;\n startNode!: Node;\n endNode!: Node;\n value: unknown = undefined;\n private __pendingValue: unknown = undefined;\n\n constructor(options: RenderOptions) {\n this.options = options;\n }\n\n /**\n * Appends this part into a container.\n *\n * This part must be empty, as its contents are not automatically moved.\n */\n appendInto(container: Node) {\n this.startNode = container.appendChild(createMarker());\n this.endNode = container.appendChild(createMarker());\n }\n\n /**\n * Inserts this part after the `ref` node (between `ref` and `ref`'s next\n * sibling). Both `ref` and its next sibling must be static, unchanging nodes\n * such as those that appear in a literal section of a template.\n *\n * This part must be empty, as its contents are not automatically moved.\n */\n insertAfterNode(ref: Node) {\n this.startNode = ref;\n this.endNode = ref.nextSibling!;\n }\n\n /**\n * Appends this part into a parent part.\n *\n * This part must be empty, as its contents are not automatically moved.\n */\n appendIntoPart(part: NodePart) {\n part.__insert(this.startNode = createMarker());\n part.__insert(this.endNode = createMarker());\n }\n\n /**\n * Inserts this part after the `ref` part.\n *\n * This part must be empty, as its contents are not automatically moved.\n */\n insertAfterPart(ref: NodePart) {\n ref.__insert(this.startNode = createMarker());\n this.endNode = ref.endNode;\n ref.endNode = this.startNode;\n }\n\n setValue(value: unknown): void {\n this.__pendingValue = value;\n }\n\n commit() {\n if (this.startNode.parentNode === null) {\n return;\n }\n while (isDirective(this.__pendingValue)) {\n const directive = this.__pendingValue;\n this.__pendingValue = noChange;\n directive(this);\n }\n const value = this.__pendingValue;\n if (value === noChange) {\n return;\n }\n if (isPrimitive(value)) {\n if (value !== this.value) {\n this.__commitText(value);\n }\n } else if (value instanceof TemplateResult) {\n this.__commitTemplateResult(value);\n } else if (value instanceof Node) {\n this.__commitNode(value);\n } else if (isIterable(value)) {\n this.__commitIterable(value);\n } else if (value === nothing) {\n this.value = nothing;\n this.clear();\n } else {\n // Fallback, will render the string representation\n this.__commitText(value);\n }\n }\n\n private __insert(node: Node) {\n this.endNode.parentNode!.insertBefore(node, this.endNode);\n }\n\n private __commitNode(value: Node): void {\n if (this.value === value) {\n return;\n }\n this.clear();\n this.__insert(value);\n this.value = value;\n }\n\n private __commitText(value: unknown): void {\n const node = this.startNode.nextSibling!;\n value = value == null ? '' : value;\n // If `value` isn't already a string, we explicitly convert it here in case\n // it can't be implicitly converted - i.e. it's a symbol.\n const valueAsString: string =\n typeof value === 'string' ? value : String(value);\n if (node === this.endNode.previousSibling &&\n node.nodeType === 3 /* Node.TEXT_NODE */) {\n // If we only have a single text node between the markers, we can just\n // set its value, rather than replacing it.\n // TODO(justinfagnani): Can we just check if this.value is primitive?\n (node as Text).data = valueAsString;\n } else {\n this.__commitNode(document.createTextNode(valueAsString));\n }\n this.value = value;\n }\n\n private __commitTemplateResult(value: TemplateResult): void {\n const template = this.options.templateFactory(value);\n if (this.value instanceof TemplateInstance &&\n this.value.template === template) {\n this.value.update(value.values);\n } else {\n // Make sure we propagate the template processor from the TemplateResult\n // so that we use its syntax extension, etc. The template factory comes\n // from the render function options so that it can control template\n // caching and preprocessing.\n const instance =\n new TemplateInstance(template, value.processor, this.options);\n const fragment = instance._clone();\n instance.update(value.values);\n this.__commitNode(fragment);\n this.value = instance;\n }\n }\n\n private __commitIterable(value: Iterable<unknown>): void {\n // For an Iterable, we create a new InstancePart per item, then set its\n // value to the item. This is a little bit of overhead for every item in\n // an Iterable, but it lets us recurse easily and efficiently update Arrays\n // of TemplateResults that will be commonly returned from expressions like:\n // array.map((i) => html`${i}`), by reusing existing TemplateInstances.\n\n // If _value is an array, then the previous render was of an\n // iterable and _value will contain the NodeParts from the previous\n // render. If _value is not an array, clear this part and make a new\n // array for NodeParts.\n if (!Array.isArray(this.value)) {\n this.value = [];\n this.clear();\n }\n\n // Lets us keep track of how many items we stamped so we can clear leftover\n // items from a previous render\n const itemParts = this.value as NodePart[];\n let partIndex = 0;\n let itemPart: NodePart|undefined;\n\n for (const item of value) {\n // Try to reuse an existing part\n itemPart = itemParts[partIndex];\n\n // If no existing part, create a new one\n if (itemPart === undefined) {\n itemPart = new NodePart(this.options);\n itemParts.push(itemPart);\n if (partIndex === 0) {\n itemPart.appendIntoPart(this);\n } else {\n itemPart.insertAfterPart(itemParts[partIndex - 1]);\n }\n }\n itemPart.setValue(item);\n itemPart.commit();\n partIndex++;\n }\n\n if (partIndex < itemParts.length) {\n // Truncate the parts array so _value reflects the current state\n itemParts.length = partIndex;\n this.clear(itemPart && itemPart.endNode);\n }\n }\n\n clear(startNode: Node = this.startNode) {\n removeNodes(\n this.startNode.parentNode!, startNode.nextSibling!, this.endNode);\n }\n}\n\n/**\n * Implements a boolean attribute, roughly as defined in the HTML\n * specification.\n *\n * If the value is truthy, then the attribute is present with a value of\n * ''. If the value is falsey, the attribute is removed.\n */\nexport class BooleanAttributePart implements Part {\n readonly element: Element;\n readonly name: string;\n readonly strings: readonly string[];\n value: unknown = undefined;\n private __pendingValue: unknown = undefined;\n\n constructor(element: Element, name: string, strings: readonly string[]) {\n if (strings.length !== 2 || strings[0] !== '' || strings[1] !== '') {\n throw new Error(\n 'Boolean attributes can only contain a single expression');\n }\n this.element = element;\n this.name = name;\n this.strings = strings;\n }\n\n setValue(value: unknown): void {\n this.__pendingValue = value;\n }\n\n commit() {\n while (isDirective(this.__pendingValue)) {\n const directive = this.__pendingValue;\n this.__pendingValue = noChange;\n directive(this);\n }\n if (this.__pendingValue === noChange) {\n return;\n }\n const value = !!this.__pendingValue;\n if (this.value !== value) {\n if (value) {\n this.element.setAttribute(this.name, '');\n } else {\n this.element.removeAttribute(this.name);\n }\n this.value = value;\n }\n this.__pendingValue = noChange;\n }\n}\n\n/**\n * Sets attribute values for PropertyParts, so that the value is only set once\n * even if there are multiple parts for a property.\n *\n * If an expression controls the whole property value, then the value is simply\n * assigned to the property under control. If there are string literals or\n * multiple expressions, then the strings are expressions are interpolated into\n * a string first.\n */\nexport class PropertyCommitter extends AttributeCommitter {\n readonly single: boolean;\n\n constructor(element: Element, name: string, strings: ReadonlyArray<string>) {\n super(element, name, strings);\n this.single =\n (strings.length === 2 && strings[0] === '' && strings[1] === '');\n }\n\n protected _createPart(): PropertyPart {\n return new PropertyPart(this);\n }\n\n protected _getValue() {\n if (this.single) {\n return this.parts[0].value;\n }\n return super._getValue();\n }\n\n commit(): void {\n if (this.dirty) {\n this.dirty = false;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (this.element as any)[this.name] = this._getValue();\n }\n }\n}\n\nexport class PropertyPart extends AttributePart {}\n\n// Detect event listener options support. If the `capture` property is read\n// from the options object, then options are supported. If not, then the third\n// argument to add/removeEventListener is interpreted as the boolean capture\n// value so we should only pass the `capture` property.\nlet eventOptionsSupported = false;\n\n// Wrap into an IIFE because MS Edge <= v41 does not support having try/catch\n// blocks right into the body of a module\n(() => {\n try {\n const options = {\n get capture() {\n eventOptionsSupported = true;\n return false;\n }\n };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n window.addEventListener('test', options as any, options);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n window.removeEventListener('test', options as any, options);\n } catch (_e) {\n // event options not supported\n }\n})();\n\ntype EventHandlerWithOptions =\n EventListenerOrEventListenerObject&Partial<AddEventListenerOptions>;\nexport class EventPart implements Part {\n readonly element: Element;\n readonly eventName: string;\n readonly eventContext?: EventTarget;\n value: undefined|EventHandlerWithOptions = undefined;\n private __options?: AddEventListenerOptions;\n private __pendingValue: undefined|EventHandlerWithOptions = undefined;\n private readonly __boundHandleEvent: (event: Event) => void;\n\n constructor(element: Element, eventName: string, eventContext?: EventTarget) {\n this.element = element;\n this.eventName = eventName;\n this.eventContext = eventContext;\n this.__boundHandleEvent = (e) => this.handleEvent(e);\n }\n\n setValue(value: undefined|EventHandlerWithOptions): void {\n this.__pendingValue = value;\n }\n\n commit() {\n while (isDirective(this.__pendingValue)) {\n const directive = this.__pendingValue;\n this.__pendingValue = noChange as EventHandlerWithOptions;\n directive(this);\n }\n if (this.__pendingValue === noChange) {\n return;\n }\n\n const newListener = this.__pendingValue;\n const oldListener = this.value;\n const shouldRemoveListener = newListener == null ||\n oldListener != null &&\n (newListener.capture !== oldListener.capture ||\n newListener.once !== oldListener.once ||\n newListener.passive !== oldListener.passive);\n const shouldAddListener =\n newListener != null && (oldListener == null || shouldRemoveListener);\n\n if (shouldRemoveListener) {\n this.element.removeEventListener(\n this.eventName, this.__boundHandleEvent, this.__options);\n }\n if (shouldAddListener) {\n this.__options = getOptions(newListener);\n this.element.addEventListener(\n this.eventName, this.__boundHandleEvent, this.__options);\n }\n this.value = newListener;\n this.__pendingValue = noChange as EventHandlerWithOptions;\n }\n\n handleEvent(event: Event) {\n if (typeof this.value === 'function') {\n this.value.call(this.eventContext || this.element, event);\n } else {\n (this.value as EventListenerObject).handleEvent(event);\n }\n }\n}\n\n// We copy options because of the inconsistent behavior of browsers when reading\n// the third argument of add/removeEventListener. IE11 doesn't support options\n// at all. Chrome 41 only reads `capture` if the argument is an object.\nconst getOptions = (o: AddEventListenerOptions|undefined) => o &&\n (eventOptionsSupported ?\n {capture: o.capture, passive: o.passive, once: o.once} :\n o.capture as AddEventListenerOptions);\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {TemplateResult} from './template-result.js';\nimport {marker, Template} from './template.js';\n\n/**\n * A function type that creates a Template from a TemplateResult.\n *\n * This is a hook into the template-creation process for rendering that\n * requires some modification of templates before they're used, like ShadyCSS,\n * which must add classes to elements and remove styles.\n *\n * Templates should be cached as aggressively as possible, so that many\n * TemplateResults produced from the same expression only do the work of\n * creating the Template the first time.\n *\n * Templates are usually cached by TemplateResult.strings and\n * TemplateResult.type, but may be cached by other keys if this function\n * modifies the template.\n *\n * Note that currently TemplateFactories must not add, remove, or reorder\n * expressions, because there is no way to describe such a modification\n * to render() so that values are interpolated to the correct place in the\n * template instances.\n */\nexport type TemplateFactory = (result: TemplateResult) => Template;\n\n/**\n * The default TemplateFactory which caches Templates keyed on\n * result.type and result.strings.\n */\nexport function templateFactory(result: TemplateResult) {\n let templateCache = templateCaches.get(result.type);\n if (templateCache === undefined) {\n templateCache = {\n stringsArray: new WeakMap<TemplateStringsArray, Template>(),\n keyString: new Map<string, Template>()\n };\n templateCaches.set(result.type, templateCache);\n }\n\n let template = templateCache.stringsArray.get(result.strings);\n if (template !== undefined) {\n return template;\n }\n\n // If the TemplateStringsArray is new, generate a key from the strings\n // This key is shared between all templates with identical content\n const key = result.strings.join(marker);\n\n // Check if we already have a Template for this key\n template = templateCache.keyString.get(key);\n if (template === undefined) {\n // If we have not seen this key before, create a new Template\n template = new Template(result, result.getTemplateElement());\n // Cache the Template for this key\n templateCache.keyString.set(key, template);\n }\n\n // Cache all future queries for this TemplateStringsArray\n templateCache.stringsArray.set(result.strings, template);\n return template;\n}\n\n/**\n * The first argument to JS template tags retain identity across multiple\n * calls to a tag for the same literal, so we can cache work done per literal\n * in a Map.\n *\n * Safari currently has a bug which occasionally breaks this behavior, so we\n * need to cache the Template at two levels. We first cache the\n * TemplateStringsArray, and if that fails, we cache a key constructed by\n * joining the strings array.\n */\nexport interface TemplateCache {\n readonly stringsArray: WeakMap<TemplateStringsArray, Template>;\n readonly keyString: Map<string, Template>;\n}\n\nexport const templateCaches = new Map<string, TemplateCache>();\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {removeNodes} from './dom.js';\nimport {NodePart} from './parts.js';\nimport {RenderOptions} from './render-options.js';\nimport {templateFactory} from './template-factory.js';\n\nexport const parts = new WeakMap<Node, NodePart>();\n\n/**\n * Renders a template result or other value to a container.\n *\n * To update a container with new values, reevaluate the template literal and\n * call `render` with the new result.\n *\n * @param result Any value renderable by NodePart - typically a TemplateResult\n * created by evaluating a template tag like `html` or `svg`.\n * @param container A DOM parent to render to. The entire contents are either\n * replaced, or efficiently updated if the same result type was previous\n * rendered there.\n * @param options RenderOptions for the entire render tree rendered to this\n * container. Render options must *not* change between renders to the same\n * container, as those changes will not effect previously rendered DOM.\n */\nexport const render =\n (result: unknown,\n container: Element|DocumentFragment,\n options?: Partial<RenderOptions>) => {\n let part = parts.get(container);\n if (part === undefined) {\n removeNodes(container, container.firstChild);\n parts.set(container, part = new NodePart({\n templateFactory,\n ...options,\n }));\n part.appendInto(container);\n }\n part.setValue(result);\n part.commit();\n };\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {Part} from './part.js';\nimport {AttributeCommitter, BooleanAttributePart, EventPart, NodePart, PropertyCommitter} from './parts.js';\nimport {RenderOptions} from './render-options.js';\nimport {TemplateProcessor} from './template-processor.js';\n\n/**\n * Creates Parts when a template is instantiated.\n */\nexport class DefaultTemplateProcessor implements TemplateProcessor {\n /**\n * Create parts for an attribute-position binding, given the event, attribute\n * name, and string literals.\n *\n * @param element The element containing the binding\n * @param name The attribute name\n * @param strings The string literals. There are always at least two strings,\n * event for fully-controlled bindings with a single expression.\n */\n handleAttributeExpressions(\n element: Element, name: string, strings: string[],\n options: RenderOptions): ReadonlyArray<Part> {\n const prefix = name[0];\n if (prefix === '.') {\n const committer = new PropertyCommitter(element, name.slice(1), strings);\n return committer.parts;\n }\n if (prefix === '@') {\n return [new EventPart(element, name.slice(1), options.eventContext)];\n }\n if (prefix === '?') {\n return [new BooleanAttributePart(element, name.slice(1), strings)];\n }\n const committer = new AttributeCommitter(element, name, strings);\n return committer.parts;\n }\n /**\n * Create parts for a text-position binding.\n * @param templateFactory\n */\n handleTextExpression(options: RenderOptions) {\n return new NodePart(options);\n }\n}\n\nexport const defaultTemplateProcessor = new DefaultTemplateProcessor();\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n *\n * Main lit-html module.\n *\n * Main exports:\n *\n * - [[html]]\n * - [[svg]]\n * - [[render]]\n *\n * @packageDocumentation\n */\n\n/**\n * Do not remove this comment; it keeps typedoc from misplacing the module\n * docs.\n */\nimport {defaultTemplateProcessor} from './lib/default-template-processor.js';\nimport {SVGTemplateResult, TemplateResult} from './lib/template-result.js';\n\nexport {DefaultTemplateProcessor, defaultTemplateProcessor} from './lib/default-template-processor.js';\nexport {directive, DirectiveFn, isDirective} from './lib/directive.js';\n// TODO(justinfagnani): remove line when we get NodePart moving methods\nexport {removeNodes, reparentNodes} from './lib/dom.js';\nexport {noChange, nothing, Part} from './lib/part.js';\nexport {AttributeCommitter, AttributePart, BooleanAttributePart, EventPart, isIterable, isPrimitive, NodePart, PropertyCommitter, PropertyPart} from './lib/parts.js';\nexport {RenderOptions} from './lib/render-options.js';\nexport {parts, render} from './lib/render.js';\nexport {templateCaches, templateFactory} from './lib/template-factory.js';\nexport {TemplateInstance} from './lib/template-instance.js';\nexport {TemplateProcessor} from './lib/template-processor.js';\nexport {SVGTemplateResult, TemplateResult} from './lib/template-result.js';\nexport {createMarker, isTemplatePartActive, Template} from './lib/template.js';\n\ndeclare global {\n interface Window {\n litHtmlVersions: string[];\n }\n}\n\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for lit-html usage.\n// TODO(justinfagnani): inject version number at build time\nif (typeof window !== 'undefined') {\n (window['litHtmlVersions'] || (window['litHtmlVersions'] = [])).push('1.3.0');\n}\n\n/**\n * Interprets a template literal as an HTML template that can efficiently\n * render to and update a container.\n */\nexport const html = (strings: TemplateStringsArray, ...values: unknown[]) =>\n new TemplateResult(strings, values, 'html', defaultTemplateProcessor);\n\n/**\n * Interprets a template literal as an SVG template that can efficiently\n * render to and update a container.\n */\nexport const svg = (strings: TemplateStringsArray, ...values: unknown[]) =>\n new SVGTemplateResult(strings, values, 'svg', defaultTemplateProcessor);\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * Module to add shady DOM/shady CSS polyfill support to lit-html template\n * rendering. See the [[render]] method for details.\n *\n * @packageDocumentation\n */\n\n/**\n * Do not remove this comment; it keeps typedoc from misplacing the module\n * docs.\n */\nimport {removeNodes} from './dom.js';\nimport {insertNodeIntoTemplate, removeNodesFromTemplate} from './modify-template.js';\nimport {RenderOptions} from './render-options.js';\nimport {parts, render as litRender} from './render.js';\nimport {templateCaches} from './template-factory.js';\nimport {TemplateInstance} from './template-instance.js';\nimport {TemplateResult} from './template-result.js';\nimport {marker, Template} from './template.js';\n\nexport {html, svg, TemplateResult} from '../lit-html.js';\n\n// Get a key to lookup in `templateCaches`.\nconst getTemplateCacheKey = (type: string, scopeName: string) =>\n `${type}--${scopeName}`;\n\nlet compatibleShadyCSSVersion = true;\n\nif (typeof window.ShadyCSS === 'undefined') {\n compatibleShadyCSSVersion = false;\n} else if (typeof window.ShadyCSS.prepareTemplateDom === 'undefined') {\n console.warn(\n `Incompatible ShadyCSS version detected. ` +\n `Please update to at least @webcomponents/webcomponentsjs@2.0.2 and ` +\n `@webcomponents/shadycss@1.3.1.`);\n compatibleShadyCSSVersion = false;\n}\n\n/**\n * Template factory which scopes template DOM using ShadyCSS.\n * @param scopeName {string}\n */\nexport const shadyTemplateFactory = (scopeName: string) =>\n (result: TemplateResult) => {\n const cacheKey = getTemplateCacheKey(result.type, scopeName);\n let templateCache = templateCaches.get(cacheKey);\n if (templateCache === undefined) {\n templateCache = {\n stringsArray: new WeakMap<TemplateStringsArray, Template>(),\n keyString: new Map<string, Template>()\n };\n templateCaches.set(cacheKey, templateCache);\n }\n\n let template = templateCache.stringsArray.get(result.strings);\n if (template !== undefined) {\n return template;\n }\n\n const key = result.strings.join(marker);\n template = templateCache.keyString.get(key);\n if (template === undefined) {\n const element = result.getTemplateElement();\n if (compatibleShadyCSSVersion) {\n window.ShadyCSS!.prepareTemplateDom(element, scopeName);\n }\n template = new Template(result, element);\n templateCache.keyString.set(key, template);\n }\n templateCache.stringsArray.set(result.strings, template);\n return template;\n };\n\nconst TEMPLATE_TYPES = ['html', 'svg'];\n\n/**\n * Removes all style elements from Templates for the given scopeName.\n */\nconst removeStylesFromLitTemplates = (scopeName: string) => {\n TEMPLATE_TYPES.forEach((type) => {\n const templates = templateCaches.get(getTemplateCacheKey(type, scopeName));\n if (templates !== undefined) {\n templates.keyString.forEach((template) => {\n const {element: {content}} = template;\n // IE 11 doesn't support the iterable param Set constructor\n const styles = new Set<Element>();\n Array.from(content.querySelectorAll('style')).forEach((s: Element) => {\n styles.add(s);\n });\n removeNodesFromTemplate(template, styles);\n });\n }\n });\n};\n\nconst shadyRenderSet = new Set<string>();\n\n/**\n * For the given scope name, ensures that ShadyCSS style scoping is performed.\n * This is done just once per scope name so the fragment and template cannot\n * be modified.\n * (1) extracts styles from the rendered fragment and hands them to ShadyCSS\n * to be scoped and appended to the document\n * (2) removes style elements from all lit-html Templates for this scope name.\n *\n * Note, <style> elements can only be placed into templates for the\n * initial rendering of the scope. If <style> elements are included in templates\n * dynamically rendered to the scope (after the first scope render), they will\n * not be scoped and the <style> will be left in the template and rendered\n * output.\n */\nconst prepareTemplateStyles =\n (scopeName: string, renderedDOM: DocumentFragment, template?: Template) => {\n shadyRenderSet.add(scopeName);\n // If `renderedDOM` is stamped from a Template, then we need to edit that\n // Template's underlying template element. Otherwise, we create one here\n // to give to ShadyCSS, which still requires one while scoping.\n const templateElement =\n !!template ? template.element : document.createElement('template');\n // Move styles out of rendered DOM and store.\n const styles = renderedDOM.querySelectorAll('style');\n const {length} = styles;\n // If there are no styles, skip unnecessary work\n if (length === 0) {\n // Ensure prepareTemplateStyles is called to support adding\n // styles via `prepareAdoptedCssText` since that requires that\n // `prepareTemplateStyles` is called.\n //\n // ShadyCSS will only update styles containing @apply in the template\n // given to `prepareTemplateStyles`. If no lit Template was given,\n // ShadyCSS will not be able to update uses of @apply in any relevant\n // template. However, this is not a problem because we only create the\n // template for the purpose of supporting `prepareAdoptedCssText`,\n // which doesn't support @apply at all.\n window.ShadyCSS!.prepareTemplateStyles(templateElement, scopeName);\n return;\n }\n const condensedStyle = document.createElement('style');\n // Collect styles into a single style. This helps us make sure ShadyCSS\n // manipulations will not prevent us from being able to fix up template\n // part indices.\n // NOTE: collecting styles is inefficient for browsers but ShadyCSS\n // currently does this anyway. When it does not, this should be changed.\n for (let i = 0; i < length; i++) {\n const style = styles[i];\n style.parentNode!.removeChild(style);\n condensedStyle.textContent! += style.textContent;\n }\n // Remove styles from nested templates in this scope.\n removeStylesFromLitTemplates(scopeName);\n // And then put the condensed style into the \"root\" template passed in as\n // `template`.\n const content = templateElement.content;\n if (!!template) {\n insertNodeIntoTemplate(template, condensedStyle, content.firstChild);\n } else {\n content.insertBefore(condensedStyle, content.firstChild);\n }\n // Note, it's important that ShadyCSS gets the template that `lit-html`\n // will actually render so that it can update the style inside when\n // needed (e.g. @apply native Shadow DOM case).\n window.ShadyCSS!.prepareTemplateStyles(templateElement, scopeName);\n const style = content.querySelector('style');\n if (window.ShadyCSS!.nativeShadow && style !== null) {\n // When in native Shadow DOM, ensure the style created by ShadyCSS is\n // included in initially rendered output (`renderedDOM`).\n renderedDOM.insertBefore(style.cloneNode(true), renderedDOM.firstChild);\n } else if (!!template) {\n // When no style is left in the template, parts will be broken as a\n // result. To fix this, we put back the style node ShadyCSS removed\n // and then tell lit to remove that node from the template.\n // There can be no style in the template in 2 cases (1) when Shady DOM\n // is in use, ShadyCSS removes all styles, (2) when native Shadow DOM\n // is in use ShadyCSS removes the style if it contains no content.\n // NOTE, ShadyCSS creates its own style so we can safely add/remove\n // `condensedStyle` here.\n content.insertBefore(condensedStyle, content.firstChild);\n const removes = new Set<Node>();\n removes.add(condensedStyle);\n removeNodesFromTemplate(template, removes);\n }\n };\n\nexport interface ShadyRenderOptions extends Partial<RenderOptions> {\n scopeName: string;\n}\n\n/**\n * Extension to the standard `render` method which supports rendering\n * to ShadowRoots when the ShadyDOM (https://github.com/webcomponents/shadydom)\n * and ShadyCSS (https://github.com/webcomponents/shadycss) polyfills are used\n * or when the webcomponentsjs\n * (https://github.com/webcomponents/webcomponentsjs) polyfill is used.\n *\n * Adds a `scopeName` option which is used to scope element DOM and stylesheets\n * when native ShadowDOM is unavailable. The `scopeName` will be added to\n * the class attribute of all rendered DOM. In addition, any style elements will\n * be automatically re-written with this `scopeName` selector and moved out\n * of the rendered DOM and into the document `<head>`.\n *\n * It is common to use this render method in conjunction with a custom element\n * which renders a shadowRoot. When this is done, typically the element's\n * `localName` should be used as the `scopeName`.\n *\n * In addition to DOM scoping, ShadyCSS also supports a basic shim for css\n * custom properties (needed only on older browsers like IE11) and a shim for\n * a deprecated feature called `@apply` that supports applying a set of css\n * custom properties to a given location.\n *\n * Usage considerations:\n *\n * * Part values in `<style>` elements are only applied the first time a given\n * `scopeName` renders. Subsequent changes to parts in style elements will have\n * no effect. Because of this, parts in style elements should only be used for\n * values that will never change, for example parts that set scope-wide theme\n * values or parts which render shared style elements.\n *\n * * Note, due to a limitation of the ShadyDOM polyfill, rendering in a\n * custom element's `constructor` is not supported. Instead rendering should\n * either done asynchronously, for example at microtask timing (for example\n * `Promise.resolve()`), or be deferred until the first time the element's\n * `connectedCallback` runs.\n *\n * Usage considerations when using shimmed custom properties or `@apply`:\n *\n * * Whenever any dynamic changes are made which affect\n * css custom properties, `ShadyCSS.styleElement(element)` must be called\n * to update the element. There are two cases when this is needed:\n * (1) the element is connected to a new parent, (2) a class is added to the\n * element that causes it to match different custom properties.\n * To address the first case when rendering a custom element, `styleElement`\n * should be called in the element's `connectedCallback`.\n *\n * * Shimmed custom properties may only be defined either for an entire\n * shadowRoot (for example, in a `:host` rule) or via a rule that directly\n * matches an element with a shadowRoot. In other words, instead of flowing from\n * parent to child as do native css custom properties, shimmed custom properties\n * flow only from shadowRoots to nested shadowRoots.\n *\n * * When using `@apply` mixing css shorthand property names with\n * non-shorthand names (for example `border` and `border-width`) is not\n * supported.\n */\nexport const render =\n (result: unknown,\n container: Element|DocumentFragment|ShadowRoot,\n options: ShadyRenderOptions) => {\n if (!options || typeof options !== 'object' || !options.scopeName) {\n throw new Error('The `scopeName` option is required.');\n }\n const scopeName = options.scopeName;\n const hasRendered = parts.has(container);\n const needsScoping = compatibleShadyCSSVersion &&\n container.nodeType === 11 /* Node.DOCUMENT_FRAGMENT_NODE */ &&\n !!(container as ShadowRoot).host;\n // Handle first render to a scope specially...\n const firstScopeRender = needsScoping && !shadyRenderSet.has(scopeName);\n // On first scope render, render into a fragment; this cannot be a single\n // fragment that is reused since nested renders can occur synchronously.\n const renderContainer =\n firstScopeRender ? document.createDocumentFragment() : container;\n litRender(\n result,\n renderContainer,\n {templateFactory: shadyTemplateFactory(scopeName), ...options} as\n RenderOptions);\n // When performing first scope render,\n // (1) We've rendered into a fragment so that there's a chance to\n // `prepareTemplateStyles` before sub-elements hit the DOM\n // (which might cause them to render based on a common pattern of\n // rendering in a custom element's `connectedCallback`);\n // (2) Scope the template with ShadyCSS one time only for this scope.\n // (3) Render the fragment into the container and make sure the\n // container knows its `part` is the one we just rendered. This ensures\n // DOM will be re-used on subsequent renders.\n if (firstScopeRender) {\n const part = parts.get(renderContainer)!;\n parts.delete(renderContainer);\n // ShadyCSS might have style sheets (e.g. from `prepareAdoptedCssText`)\n // that should apply to `renderContainer` even if the rendered value is\n // not a TemplateInstance. However, it will only insert scoped styles\n // into the document if `prepareTemplateStyles` has already been called\n // for the given scope name.\n const template = part.value instanceof TemplateInstance ?\n part.value.template :\n undefined;\n prepareTemplateStyles(\n scopeName, renderContainer as DocumentFragment, template);\n removeNodes(container, container.firstChild);\n container.appendChild(renderContainer);\n parts.set(container, part);\n }\n // After elements have hit the DOM, update styling if this is the\n // initial render to this container.\n // This is needed whenever dynamic changes are made so it would be\n // safest to do every render; however, this would regress performance\n // so we leave it up to the user to call `ShadyCSS.styleElement`\n // for dynamic changes.\n if (!hasRendered && needsScoping) {\n window.ShadyCSS!.styleElement((container as ShadowRoot).host);\n }\n };\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * Use this module if you want to create your own base class extending\n * [[UpdatingElement]].\n * @packageDocumentation\n */\n\n/*\n * When using Closure Compiler, JSCompiler_renameProperty(property, object) is\n * replaced at compile time by the munged name for object[property]. We cannot\n * alias this function, so we have to use a small shim that has the same\n * behavior when not compiling.\n */\nwindow.JSCompiler_renameProperty =\n <P extends PropertyKey>(prop: P, _obj: unknown): P => prop;\n\ndeclare global {\n var JSCompiler_renameProperty: <P extends PropertyKey>(\n prop: P, _obj: unknown) => P;\n\n interface Window {\n JSCompiler_renameProperty: typeof JSCompiler_renameProperty;\n }\n}\n\n/**\n * Converts property values to and from attribute values.\n */\nexport interface ComplexAttributeConverter<Type = unknown, TypeHint = unknown> {\n /**\n * Function called to convert an attribute value to a property\n * value.\n */\n fromAttribute?(value: string|null, type?: TypeHint): Type;\n\n /**\n * Function called to convert a property value to an attribute\n * value.\n *\n * It returns unknown instead of string, to be compatible with\n * https://github.com/WICG/trusted-types (and similar efforts).\n */\n toAttribute?(value: Type, type?: TypeHint): unknown;\n}\n\ntype AttributeConverter<Type = unknown, TypeHint = unknown> =\n ComplexAttributeConverter<Type>|\n ((value: string|null, type?: TypeHint) => Type);\n\n/**\n * Defines options for a property accessor.\n */\nexport interface PropertyDeclaration<Type = unknown, TypeHint = unknown> {\n /**\n * Indicates how and whether the property becomes an observed attribute.\n * If the value is `false`, the property is not added to `observedAttributes`.\n * If true or absent, the lowercased property name is observed (e.g. `fooBar`\n * becomes `foobar`). If a string, the string value is observed (e.g\n * `attribute: 'foo-bar'`).\n */\n readonly attribute?: boolean|string;\n\n /**\n * Indicates the type of the property. This is used only as a hint for the\n * `converter` to determine how to convert the attribute\n * to/from a property.\n */\n readonly type?: TypeHint;\n\n /**\n * Indicates how to convert the attribute to/from a property. If this value\n * is a function, it is used to convert the attribute value a the property\n * value. If it's an object, it can have keys for `fromAttribute` and\n * `toAttribute`. If no `toAttribute` function is provided and\n * `reflect` is set to `true`, the property value is set directly to the\n * attribute. A default `converter` is used if none is provided; it supports\n * `Boolean`, `String`, `Number`, `Object`, and `Array`. Note,\n * when a property changes and the converter is used to update the attribute,\n * the property is never updated again as a result of the attribute changing,\n * and vice versa.\n */\n readonly converter?: AttributeConverter<Type, TypeHint>;\n\n /**\n * Indicates if the property should reflect to an attribute.\n * If `true`, when the property is set, the attribute is set using the\n * attribute name determined according to the rules for the `attribute`\n * property option and the value of the property converted using the rules\n * from the `converter` property option.\n */\n readonly reflect?: boolean;\n\n /**\n * A function that indicates if a property should be considered changed when\n * it is set. The function should take the `newValue` and `oldValue` and\n * return `true` if an update should be requested.\n */\n hasChanged?(value: Type, oldValue: Type): boolean;\n\n /**\n * Indicates whether an accessor will be created for this property. By\n * default, an accessor will be generated for this property that requests an\n * update when set. If this flag is `true`, no accessor will be created, and\n * it will be the user's responsibility to call\n * `this.requestUpdate(propertyName, oldValue)` to request an update when\n * the property changes.\n */\n readonly noAccessor?: boolean;\n}\n\n/**\n * Map of properties to PropertyDeclaration options. For each property an\n * accessor is made, and the property is processed according to the\n * PropertyDeclaration options.\n */\nexport interface PropertyDeclarations {\n readonly [key: string]: PropertyDeclaration;\n}\n\ntype PropertyDeclarationMap = Map<PropertyKey, PropertyDeclaration>;\n\ntype AttributeMap = Map<string, PropertyKey>;\n\n/**\n * Map of changed properties with old values. Takes an optional generic\n * interface corresponding to the declared element properties.\n */\n// tslint:disable-next-line:no-any\nexport type PropertyValues<T = any> =\n keyof T extends PropertyKey ? Map<keyof T, unknown>: never;\n\nexport const defaultConverter: ComplexAttributeConverter = {\n\n toAttribute(value: unknown, type?: unknown): unknown {\n switch (type) {\n case Boolean:\n return value ? '' : null;\n case Object:\n case Array:\n // if the value is `null` or `undefined` pass this through\n // to allow removing/no change behavior.\n return value == null ? value : JSON.stringify(value);\n }\n return value;\n },\n\n fromAttribute(value: string|null, type?: unknown) {\n switch (type) {\n case Boolean:\n return value !== null;\n case Number:\n return value === null ? null : Number(value);\n case Object:\n case Array:\n // Type assert to adhere to Bazel's \"must type assert JSON parse\" rule.\n return JSON.parse(value!) as unknown;\n }\n return value;\n }\n\n};\n\nexport interface HasChanged {\n (value: unknown, old: unknown): boolean;\n}\n\n/**\n * Change function that returns true if `value` is different from `oldValue`.\n * This method is used as the default for a property's `hasChanged` function.\n */\nexport const notEqual: HasChanged = (value: unknown, old: unknown): boolean => {\n // This ensures (old==NaN, value==NaN) always returns false\n return old !== value && (old === old || value === value);\n};\n\nconst defaultPropertyDeclaration: PropertyDeclaration = {\n attribute: true,\n type: String,\n converter: defaultConverter,\n reflect: false,\n hasChanged: notEqual\n};\n\nconst STATE_HAS_UPDATED = 1;\nconst STATE_UPDATE_REQUESTED = 1 << 2;\nconst STATE_IS_REFLECTING_TO_ATTRIBUTE = 1 << 3;\nconst STATE_IS_REFLECTING_TO_PROPERTY = 1 << 4;\ntype UpdateState = typeof STATE_HAS_UPDATED|typeof STATE_UPDATE_REQUESTED|\n typeof STATE_IS_REFLECTING_TO_ATTRIBUTE|\n typeof STATE_IS_REFLECTING_TO_PROPERTY;\n\n/**\n * The Closure JS Compiler doesn't currently have good support for static\n * property semantics where \"this\" is dynamic (e.g.\n * https://github.com/google/closure-compiler/issues/3177 and others) so we use\n * this hack to bypass any rewriting by the compiler.\n */\nconst finalized = 'finalized';\n\n/**\n * Base element class which manages element properties and attributes. When\n * properties change, the `update` method is asynchronously called. This method\n * should be supplied by subclassers to render updates as desired.\n * @noInheritDoc\n */\nexport abstract class UpdatingElement extends HTMLElement {\n /*\n * Due to closure compiler ES6 compilation bugs, @nocollapse is required on\n * all static methods and properties with initializers. Reference:\n * - https://github.com/google/closure-compiler/issues/1776\n */\n\n /**\n * Maps attribute names to properties; for example `foobar` attribute to\n * `fooBar` property. Created lazily on user subclasses when finalizing the\n * class.\n */\n private static _attributeToPropertyMap: AttributeMap;\n\n /**\n * Marks class as having finished creating properties.\n */\n protected static[finalized] = true;\n\n /**\n * Memoized list of all class properties, including any superclass properties.\n * Created lazily on user subclasses when finalizing the class.\n */\n private static _classProperties?: PropertyDeclarationMap;\n\n /**\n * User-supplied object that maps property names to `PropertyDeclaration`\n * objects containing options for configuring the property.\n */\n static properties: PropertyDeclarations;\n\n /**\n * Returns a list of attributes corresponding to the registered properties.\n * @nocollapse\n */\n static get observedAttributes() {\n // note: piggy backing on this to ensure we're finalized.\n this.finalize();\n const attributes: string[] = [];\n // Use forEach so this works even if for/of loops are compiled to for loops\n // expecting arrays\n this._classProperties!.forEach((v, p) => {\n const attr = this._attributeNameForProperty(p, v);\n if (attr !== undefined) {\n this._attributeToPropertyMap.set(attr, p);\n attributes.push(attr);\n }\n });\n return attributes;\n }\n\n /**\n * Ensures the private `_classProperties` property metadata is created.\n * In addition to `finalize` this is also called in `createProperty` to\n * ensure the `@property` decorator can add property metadata.\n */\n /** @nocollapse */\n private static _ensureClassProperties() {\n // ensure private storage for property declarations.\n if (!this.hasOwnProperty(\n JSCompiler_renameProperty('_classProperties', this))) {\n this._classProperties = new Map();\n // NOTE: Workaround IE11 not supporting Map constructor argument.\n const superProperties: PropertyDeclarationMap =\n Object.getPrototypeOf(this)._classProperties;\n if (superProperties !== undefined) {\n superProperties.forEach(\n (v: PropertyDeclaration, k: PropertyKey) =>\n this._classProperties!.set(k, v));\n }\n }\n }\n\n /**\n * Creates a property accessor on the element prototype if one does not exist\n * and stores a PropertyDeclaration for the property with the given options.\n * The property setter calls the property's `hasChanged` property option\n * or uses a strict identity check to determine whether or not to request\n * an update.\n *\n * This method may be overridden to customize properties; however,\n * when doing so, it's important to call `super.createProperty` to ensure\n * the property is setup correctly. This method calls\n * `getPropertyDescriptor` internally to get a descriptor to install.\n * To customize what properties do when they are get or set, override\n * `getPropertyDescriptor`. To customize the options for a property,\n * implement `createProperty` like this:\n *\n * static createProperty(name, options) {\n * options = Object.assign(options, {myOption: true});\n * super.createProperty(name, options);\n * }\n *\n * @nocollapse\n */\n static createProperty(\n name: PropertyKey,\n options: PropertyDeclaration = defaultPropertyDeclaration) {\n // Note, since this can be called by the `@property` decorator which\n // is called before `finalize`, we ensure storage exists for property\n // metadata.\n this._ensureClassProperties();\n this._classProperties!.set(name, options);\n // Do not generate an accessor if the prototype already has one, since\n // it would be lost otherwise and that would never be the user's intention;\n // Instead, we expect users to call `requestUpdate` themselves from\n // user-defined accessors. Note that if the super has an accessor we will\n // still overwrite it\n if (options.noAccessor || this.prototype.hasOwnProperty(name)) {\n return;\n }\n const key = typeof name === 'symbol' ? Symbol() : `__${name}`;\n const descriptor = this.getPropertyDescriptor(name, key, options);\n if (descriptor !== undefined) {\n Object.defineProperty(this.prototype, name, descriptor);\n }\n }\n\n /**\n * Returns a property descriptor to be defined on the given named property.\n * If no descriptor is returned, the property will not become an accessor.\n * For example,\n *\n * class MyElement extends LitElement {\n * static getPropertyDescriptor(name, key, options) {\n * const defaultDescriptor =\n * super.getPropertyDescriptor(name, key, options);\n * const setter = defaultDescriptor.set;\n * return {\n * get: defaultDescriptor.get,\n * set(value) {\n * setter.call(this, value);\n * // custom action.\n * },\n * configurable: true,\n * enumerable: true\n * }\n * }\n * }\n *\n * @nocollapse\n */\n protected static getPropertyDescriptor(\n name: PropertyKey, key: string|symbol, options: PropertyDeclaration) {\n return {\n // tslint:disable-next-line:no-any no symbol in index\n get(): any {\n return (this as {[key: string]: unknown})[key as string];\n },\n set(this: UpdatingElement, value: unknown) {\n const oldValue =\n (this as {} as {[key: string]: unknown})[name as string];\n (this as {} as {[key: string]: unknown})[key as string] = value;\n (this as unknown as UpdatingElement)\n .requestUpdateInternal(name, oldValue, options);\n },\n configurable: true,\n enumerable: true\n };\n }\n\n /**\n * Returns the property options associated with the given property.\n * These options are defined with a PropertyDeclaration via the `properties`\n * object or the `@property` decorator and are registered in\n * `createProperty(...)`.\n *\n * Note, this method should be considered \"final\" and not overridden. To\n * customize the options for a given property, override `createProperty`.\n *\n * @nocollapse\n * @final\n */\n protected static getPropertyOptions(name: PropertyKey) {\n return this._classProperties && this._classProperties.get(name) ||\n defaultPropertyDeclaration;\n }\n\n /**\n * Creates property accessors for registered properties and ensures\n * any superclasses are also finalized.\n * @nocollapse\n */\n protected static finalize() {\n // finalize any superclasses\n const superCtor = Object.getPrototypeOf(this);\n if (!superCtor.hasOwnProperty(finalized)) {\n superCtor.finalize();\n }\n this[finalized] = true;\n this._ensureClassProperties();\n // initialize Map populated in observedAttributes\n this._attributeToPropertyMap = new Map();\n // make any properties\n // Note, only process \"own\" properties since this element will inherit\n // any properties defined on the superClass, and finalization ensures\n // the entire prototype chain is finalized.\n if (this.hasOwnProperty(JSCompiler_renameProperty('properties', this))) {\n const props = this.properties;\n // support symbols in properties (IE11 does not support this)\n const propKeys = [\n ...Object.getOwnPropertyNames(props),\n ...(typeof Object.getOwnPropertySymbols === 'function') ?\n Object.getOwnPropertySymbols(props) :\n []\n ];\n // This for/of is ok because propKeys is an array\n for (const p of propKeys) {\n // note, use of `any` is due to TypeSript lack of support for symbol in\n // index types\n // tslint:disable-next-line:no-any no symbol in index\n this.createProperty(p, (props as any)[p]);\n }\n }\n }\n\n /**\n * Returns the property name for the given attribute `name`.\n * @nocollapse\n */\n private static _attributeNameForProperty(\n name: PropertyKey, options: PropertyDeclaration) {\n const attribute = options.attribute;\n return attribute === false ?\n undefined :\n (typeof attribute === 'string' ?\n attribute :\n (typeof name === 'string' ? name.toLowerCase() : undefined));\n }\n\n /**\n * Returns true if a property should request an update.\n * Called when a property value is set and uses the `hasChanged`\n * option for the property if present or a strict identity check.\n * @nocollapse\n */\n private static _valueHasChanged(\n value: unknown, old: unknown, hasChanged: HasChanged = notEqual) {\n return hasChanged(value, old);\n }\n\n /**\n * Returns the property value for the given attribute value.\n * Called via the `attributeChangedCallback` and uses the property's\n * `converter` or `converter.fromAttribute` property option.\n * @nocollapse\n */\n private static _propertyValueFromAttribute(\n value: string|null, options: PropertyDeclaration) {\n const type = options.type;\n const converter = options.converter || defaultConverter;\n const fromAttribute =\n (typeof converter === 'function' ? converter : converter.fromAttribute);\n return fromAttribute ? fromAttribute(value, type) : value;\n }\n\n /**\n * Returns the attribute value for the given property value. If this\n * returns undefined, the property will *not* be reflected to an attribute.\n * If this returns null, the attribute will be removed, otherwise the\n * attribute will be set to the value.\n * This uses the property's `reflect` and `type.toAttribute` property options.\n * @nocollapse\n */\n private static _propertyValueToAttribute(\n value: unknown, options: PropertyDeclaration) {\n if (options.reflect === undefined) {\n return;\n }\n const type = options.type;\n const converter = options.converter;\n const toAttribute =\n converter && (converter as ComplexAttributeConverter).toAttribute ||\n defaultConverter.toAttribute;\n return toAttribute!(value, type);\n }\n\n private _updateState!: UpdateState;\n private _instanceProperties?: PropertyValues;\n // Initialize to an unresolved Promise so we can make sure the element has\n // connected before first update.\n private _updatePromise!: Promise<unknown>;\n private _enableUpdatingResolver: ((r?: unknown) => void)|undefined;\n\n /**\n * Map with keys for any properties that have changed since the last\n * update cycle with previous values.\n */\n private _changedProperties!: PropertyValues;\n\n /**\n * Map with keys of properties that should be reflected when updated.\n */\n private _reflectingProperties?: Map<PropertyKey, PropertyDeclaration>;\n\n constructor() {\n super();\n this.initialize();\n }\n\n /**\n * Performs element initialization. By default captures any pre-set values for\n * registered properties.\n */\n protected initialize() {\n this._updateState = 0;\n this._updatePromise =\n new Promise((res) => this._enableUpdatingResolver = res);\n this._changedProperties = new Map();\n this._saveInstanceProperties();\n // ensures first update will be caught by an early access of\n // `updateComplete`\n this.requestUpdateInternal();\n }\n\n /**\n * Fixes any properties set on the instance before upgrade time.\n * Otherwise these would shadow the accessor and break these properties.\n * The properties are stored in a Map which is played back after the\n * constructor runs. Note, on very old versions of Safari (<=9) or Chrome\n * (<=41), properties created for native platform properties like (`id` or\n * `name`) may not have default values set in the element constructor. On\n * these browsers native properties appear on instances and therefore their\n * default value will overwrite any element default (e.g. if the element sets\n * this.id = 'id' in the constructor, the 'id' will become '' since this is\n * the native platform default).\n */\n private _saveInstanceProperties() {\n // Use forEach so this works even if for/of loops are compiled to for loops\n // expecting arrays\n (this.constructor as typeof UpdatingElement)\n ._classProperties!.forEach((_v, p) => {\n if (this.hasOwnProperty(p)) {\n const value = this[p as keyof this];\n delete this[p as keyof this];\n if (!this._instanceProperties) {\n this._instanceProperties = new Map();\n }\n this._instanceProperties.set(p, value);\n }\n });\n }\n\n /**\n * Applies previously saved instance properties.\n */\n private _applyInstanceProperties() {\n // Use forEach so this works even if for/of loops are compiled to for loops\n // expecting arrays\n // tslint:disable-next-line:no-any\n this._instanceProperties!.forEach((v, p) => (this as any)[p] = v);\n this._instanceProperties = undefined;\n }\n\n connectedCallback() {\n // Ensure first connection completes an update. Updates cannot complete\n // before connection.\n this.enableUpdating();\n }\n\n protected enableUpdating() {\n if (this._enableUpdatingResolver !== undefined) {\n this._enableUpdatingResolver();\n this._enableUpdatingResolver = undefined;\n }\n }\n\n /**\n * Allows for `super.disconnectedCallback()` in extensions while\n * reserving the possibility of making non-breaking feature additions\n * when disconnecting at some point in the future.\n */\n disconnectedCallback() {\n }\n\n /**\n * Synchronizes property values when attributes change.\n */\n attributeChangedCallback(name: string, old: string|null, value: string|null) {\n if (old !== value) {\n this._attributeToProperty(name, value);\n }\n }\n\n private _propertyToAttribute(\n name: PropertyKey, value: unknown,\n options: PropertyDeclaration = defaultPropertyDeclaration) {\n const ctor = (this.constructor as typeof UpdatingElement);\n const attr = ctor._attributeNameForProperty(name, options);\n if (attr !== undefined) {\n const attrValue = ctor._propertyValueToAttribute(value, options);\n // an undefined value does not change the attribute.\n if (attrValue === undefined) {\n return;\n }\n // Track if the property is being reflected to avoid\n // setting the property again via `attributeChangedCallback`. Note:\n // 1. this takes advantage of the fact that the callback is synchronous.\n // 2. will behave incorrectly if multiple attributes are in the reaction\n // stack at time of calling. However, since we process attributes\n // in `update` this should not be possible (or an extreme corner case\n // that we'd like to discover).\n // mark state reflecting\n this._updateState = this._updateState | STATE_IS_REFLECTING_TO_ATTRIBUTE;\n if (attrValue == null) {\n this.removeAttribute(attr);\n } else {\n this.setAttribute(attr, attrValue as string);\n }\n // mark state not reflecting\n this._updateState = this._updateState & ~STATE_IS_REFLECTING_TO_ATTRIBUTE;\n }\n }\n\n private _attributeToProperty(name: string, value: string|null) {\n // Use tracking info to avoid deserializing attribute value if it was\n // just set from a property setter.\n if (this._updateState & STATE_IS_REFLECTING_TO_ATTRIBUTE) {\n return;\n }\n const ctor = (this.constructor as typeof UpdatingElement);\n // Note, hint this as an `AttributeMap` so closure clearly understands\n // the type; it has issues with tracking types through statics\n // tslint:disable-next-line:no-unnecessary-type-assertion\n const propName = (ctor._attributeToPropertyMap as AttributeMap).get(name);\n if (propName !== undefined) {\n const options = ctor.getPropertyOptions(propName);\n // mark state reflecting\n this._updateState = this._updateState | STATE_IS_REFLECTING_TO_PROPERTY;\n this[propName as keyof this] =\n // tslint:disable-next-line:no-any\n ctor._propertyValueFromAttribute(value, options) as any;\n // mark state not reflecting\n this._updateState = this._updateState & ~STATE_IS_REFLECTING_TO_PROPERTY;\n }\n }\n\n /**\n * This protected version of `requestUpdate` does not access or return the\n * `updateComplete` promise. This promise can be overridden and is therefore\n * not free to access.\n */\n protected requestUpdateInternal(\n name?: PropertyKey, oldValue?: unknown, options?: PropertyDeclaration) {\n let shouldRequestUpdate = true;\n // If we have a property key, perform property update steps.\n if (name !== undefined) {\n const ctor = this.constructor as typeof UpdatingElement;\n options = options || ctor.getPropertyOptions(name);\n if (ctor._valueHasChanged(\n this[name as keyof this], oldValue, options.hasChanged)) {\n if (!this._changedProperties.has(name)) {\n this._changedProperties.set(name, oldValue);\n }\n // Add to reflecting properties set.\n // Note, it's important that every change has a chance to add the\n // property to `_reflectingProperties`. This ensures setting\n // attribute + property reflects correctly.\n if (options.reflect === true &&\n !(this._updateState & STATE_IS_REFLECTING_TO_PROPERTY)) {\n if (this._reflectingProperties === undefined) {\n this._reflectingProperties = new Map();\n }\n this._reflectingProperties.set(name, options);\n }\n } else {\n // Abort the request if the property should not be considered changed.\n shouldRequestUpdate = false;\n }\n }\n if (!this._hasRequestedUpdate && shouldRequestUpdate) {\n this._updatePromise = this._enqueueUpdate();\n }\n }\n\n /**\n * Requests an update which is processed asynchronously. This should\n * be called when an element should update based on some state not triggered\n * by setting a property. In this case, pass no arguments. It should also be\n * called when manually implementing a property setter. In this case, pass the\n * property `name` and `oldValue` to ensure that any configured property\n * options are honored. Returns the `updateComplete` Promise which is resolved\n * when the update completes.\n *\n * @param name {PropertyKey} (optional) name of requesting property\n * @param oldValue {any} (optional) old value of requesting property\n * @returns {Promise} A Promise that is resolved when the update completes.\n */\n requestUpdate(name?: PropertyKey, oldValue?: unknown) {\n this.requestUpdateInternal(name, oldValue);\n return this.updateComplete;\n }\n\n /**\n * Sets up the element to asynchronously update.\n */\n private async _enqueueUpdate() {\n this._updateState = this._updateState | STATE_UPDATE_REQUESTED;\n try {\n // Ensure any previous update has resolved before updating.\n // This `await` also ensures that property changes are batched.\n await this._updatePromise;\n } catch (e) {\n // Ignore any previous errors. We only care that the previous cycle is\n // done. Any error should have been handled in the previous update.\n }\n const result = this.performUpdate();\n // If `performUpdate` returns a Promise, we await it. This is done to\n // enable coordinating updates with a scheduler. Note, the result is\n // checked to avoid delaying an additional microtask unless we need to.\n if (result != null) {\n await result;\n }\n return !this._hasRequestedUpdate;\n }\n\n private get _hasRequestedUpdate() {\n return (this._updateState & STATE_UPDATE_REQUESTED);\n }\n\n protected get hasUpdated() {\n return (this._updateState & STATE_HAS_UPDATED);\n }\n\n /**\n * Performs an element update. Note, if an exception is thrown during the\n * update, `firstUpdated` and `updated` will not be called.\n *\n * You can override this method to change the timing of updates. If this\n * method is overridden, `super.performUpdate()` must be called.\n *\n * For instance, to schedule updates to occur just before the next frame:\n *\n * ```\n * protected async performUpdate(): Promise<unknown> {\n * await new Promise((resolve) => requestAnimationFrame(() => resolve()));\n * super.performUpdate();\n * }\n * ```\n */\n protected performUpdate(): void|Promise<unknown> {\n // Abort any update if one is not pending when this is called.\n // This can happen if `performUpdate` is called early to \"flush\"\n // the update.\n if (!this._hasRequestedUpdate) {\n return;\n }\n // Mixin instance properties once, if they exist.\n if (this._instanceProperties) {\n this._applyInstanceProperties();\n }\n let shouldUpdate = false;\n const changedProperties = this._changedProperties;\n try {\n shouldUpdate = this.shouldUpdate(changedProperties);\n if (shouldUpdate) {\n this.update(changedProperties);\n } else {\n this._markUpdated();\n }\n } catch (e) {\n // Prevent `firstUpdated` and `updated` from running when there's an\n // update exception.\n shouldUpdate = false;\n // Ensure element can accept additional updates after an exception.\n this._markUpdated();\n throw e;\n }\n if (shouldUpdate) {\n if (!(this._updateState & STATE_HAS_UPDATED)) {\n this._updateState = this._updateState | STATE_HAS_UPDATED;\n this.firstUpdated(changedProperties);\n }\n this.updated(changedProperties);\n }\n }\n\n private _markUpdated() {\n this._changedProperties = new Map();\n this._updateState = this._updateState & ~STATE_UPDATE_REQUESTED;\n }\n\n /**\n * Returns a Promise that resolves when the element has completed updating.\n * The Promise value is a boolean that is `true` if the element completed the\n * update without triggering another update. The Promise result is `false` if\n * a property was set inside `updated()`. If the Promise is rejected, an\n * exception was thrown during the update.\n *\n * To await additional asynchronous work, override the `_getUpdateComplete`\n * method. For example, it is sometimes useful to await a rendered element\n * before fulfilling this Promise. To do this, first await\n * `super._getUpdateComplete()`, then any subsequent state.\n *\n * @returns {Promise} The Promise returns a boolean that indicates if the\n * update resolved without triggering another update.\n */\n get updateComplete() {\n return this._getUpdateComplete();\n }\n\n /**\n * Override point for the `updateComplete` promise.\n *\n * It is not safe to override the `updateComplete` getter directly due to a\n * limitation in TypeScript which means it is not possible to call a\n * superclass getter (e.g. `super.updateComplete.then(...)`) when the target\n * language is ES5 (https://github.com/microsoft/TypeScript/issues/338).\n * This method should be overridden instead. For example:\n *\n * class MyElement extends LitElement {\n * async _getUpdateComplete() {\n * await super._getUpdateComplete();\n * await this._myChild.updateComplete;\n * }\n * }\n * @deprecated Override `getUpdateComplete()` instead for forward\n * compatibility with `lit-element` 3.0 / `@lit/reactive-element`.\n */\n protected _getUpdateComplete() {\n return this.getUpdateComplete();\n }\n\n /**\n * Override point for the `updateComplete` promise.\n *\n * It is not safe to override the `updateComplete` getter directly due to a\n * limitation in TypeScript which means it is not possible to call a\n * superclass getter (e.g. `super.updateComplete.then(...)`) when the target\n * language is ES5 (https://github.com/microsoft/TypeScript/issues/338).\n * This method should be overridden instead. For example:\n *\n * class MyElement extends LitElement {\n * async getUpdateComplete() {\n * await super.getUpdateComplete();\n * await this._myChild.updateComplete;\n * }\n * }\n */\n protected getUpdateComplete() {\n return this._updatePromise;\n }\n\n /**\n * Controls whether or not `update` should be called when the element requests\n * an update. By default, this method always returns `true`, but this can be\n * customized to control when to update.\n *\n * @param _changedProperties Map of changed properties with old values\n */\n protected shouldUpdate(_changedProperties: PropertyValues): boolean {\n return true;\n }\n\n /**\n * Updates the element. This method reflects property values to attributes.\n * It can be overridden to render and keep updated element DOM.\n * Setting properties inside this method will *not* trigger\n * another update.\n *\n * @param _changedProperties Map of changed properties with old values\n */\n protected update(_changedProperties: PropertyValues) {\n if (this._reflectingProperties !== undefined &&\n this._reflectingProperties.size > 0) {\n // Use forEach so this works even if for/of loops are compiled to for\n // loops expecting arrays\n this._reflectingProperties.forEach(\n (v, k) => this._propertyToAttribute(k, this[k as keyof this], v));\n this._reflectingProperties = undefined;\n }\n this._markUpdated();\n }\n\n /**\n * Invoked whenever the element is updated. Implement to perform\n * post-updating tasks via DOM APIs, for example, focusing an element.\n *\n * Setting properties inside this method will trigger the element to update\n * again after this update cycle completes.\n *\n * @param _changedProperties Map of changed properties with old values\n */\n protected updated(_changedProperties: PropertyValues) {\n }\n\n /**\n * Invoked when the element is first updated. Implement to perform one time\n * work on the element after update.\n *\n * Setting properties inside this method will trigger the element to update\n * again after this update cycle completes.\n *\n * @param _changedProperties Map of changed properties with old values\n */\n protected firstUpdated(_changedProperties: PropertyValues) {\n }\n}\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure Compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\n\nimport {LitElement} from '../lit-element.js';\n\nimport {PropertyDeclaration, UpdatingElement} from './updating-element.js';\n\nexport type Constructor<T> = {\n // tslint:disable-next-line:no-any\n new (...args: any[]): T\n};\n\n// From the TC39 Decorators proposal\ninterface ClassDescriptor {\n kind: 'class';\n elements: ClassElement[];\n finisher?: <T>(clazz: Constructor<T>) => undefined | Constructor<T>;\n}\n\n// From the TC39 Decorators proposal\ninterface ClassElement {\n kind: 'field'|'method';\n key: PropertyKey;\n placement: 'static'|'prototype'|'own';\n initializer?: Function;\n extras?: ClassElement[];\n finisher?: <T>(clazz: Constructor<T>) => undefined | Constructor<T>;\n descriptor?: PropertyDescriptor;\n}\n\nconst legacyCustomElement =\n (tagName: string, clazz: Constructor<HTMLElement>) => {\n window.customElements.define(tagName, clazz);\n // Cast as any because TS doesn't recognize the return type as being a\n // subtype of the decorated class when clazz is typed as\n // `Constructor<HTMLElement>` for some reason.\n // `Constructor<HTMLElement>` is helpful to make sure the decorator is\n // applied to elements however.\n // tslint:disable-next-line:no-any\n return clazz as any;\n };\n\nconst standardCustomElement =\n (tagName: string, descriptor: ClassDescriptor) => {\n const {kind, elements} = descriptor;\n return {\n kind,\n elements,\n // This callback is called once the class is otherwise fully defined\n finisher(clazz: Constructor<HTMLElement>) {\n window.customElements.define(tagName, clazz);\n }\n };\n };\n\n/**\n * Class decorator factory that defines the decorated class as a custom element.\n *\n * ```\n * @customElement('my-element')\n * class MyElement {\n * render() {\n * return html``;\n * }\n * }\n * ```\n * @category Decorator\n * @param tagName The name of the custom element to define.\n */\nexport const customElement = (tagName: string) =>\n (classOrDescriptor: Constructor<HTMLElement>|ClassDescriptor) =>\n (typeof classOrDescriptor === 'function') ?\n legacyCustomElement(tagName, classOrDescriptor) :\n standardCustomElement(tagName, classOrDescriptor);\n\nconst standardProperty =\n (options: PropertyDeclaration, element: ClassElement) => {\n // When decorating an accessor, pass it through and add property metadata.\n // Note, the `hasOwnProperty` check in `createProperty` ensures we don't\n // stomp over the user's accessor.\n if (element.kind === 'method' && element.descriptor &&\n !('value' in element.descriptor)) {\n return {\n ...element,\n finisher(clazz: typeof UpdatingElement) {\n clazz.createProperty(element.key, options);\n }\n };\n } else {\n // createProperty() takes care of defining the property, but we still\n // must return some kind of descriptor, so return a descriptor for an\n // unused prototype field. The finisher calls createProperty().\n return {\n kind: 'field',\n key: Symbol(),\n placement: 'own',\n descriptor: {},\n // When @babel/plugin-proposal-decorators implements initializers,\n // do this instead of the initializer below. See:\n // https://github.com/babel/babel/issues/9260 extras: [\n // {\n // kind: 'initializer',\n // placement: 'own',\n // initializer: descriptor.initializer,\n // }\n // ],\n initializer(this: {[key: string]: unknown}) {\n if (typeof element.initializer === 'function') {\n this[element.key as string] = element.initializer.call(this);\n }\n },\n finisher(clazz: typeof UpdatingElement) {\n clazz.createProperty(element.key, options);\n }\n };\n }\n };\n\nconst legacyProperty =\n (options: PropertyDeclaration, proto: Object, name: PropertyKey) => {\n (proto.constructor as typeof UpdatingElement)\n .createProperty(name, options);\n };\n\n/**\n * A property decorator which creates a LitElement property which reflects a\n * corresponding attribute value. A [[`PropertyDeclaration`]] may optionally be\n * supplied to configure property features.\n *\n * This decorator should only be used for public fields. Private or protected\n * fields should use the [[`internalProperty`]] decorator.\n *\n * @example\n * ```ts\n * class MyElement {\n * @property({ type: Boolean })\n * clicked = false;\n * }\n * ```\n * @category Decorator\n * @ExportDecoratedItems\n */\nexport function property(options?: PropertyDeclaration) {\n // tslint:disable-next-line:no-any decorator\n return (protoOrDescriptor: Object|ClassElement, name?: PropertyKey): any =>\n (name !== undefined) ?\n legacyProperty(options!, protoOrDescriptor as Object, name) :\n standardProperty(options!, protoOrDescriptor as ClassElement);\n}\n\nexport interface InternalPropertyDeclaration<Type = unknown> {\n /**\n * A function that indicates if a property should be considered changed when\n * it is set. The function should take the `newValue` and `oldValue` and\n * return `true` if an update should be requested.\n */\n hasChanged?(value: Type, oldValue: Type): boolean;\n}\n\n/**\n * Declares a private or protected property that still triggers updates to the\n * element when it changes.\n *\n * Properties declared this way must not be used from HTML or HTML templating\n * systems, they're solely for properties internal to the element. These\n * properties may be renamed by optimization tools like the Closure Compiler.\n * @category Decorator\n * @deprecated `internalProperty` has been renamed to `state` in lit-element\n * 3.0. Please update to `state` now to be compatible with 3.0.\n */\nexport function internalProperty(options?: InternalPropertyDeclaration) {\n return property({attribute: false, hasChanged: options?.hasChanged});\n}\n\n/**\n * Declares a private or protected property that still triggers updates to the\n * element when it changes.\n *\n * Properties declared this way must not be used from HTML or HTML templating\n * systems, they're solely for properties internal to the element. These\n * properties may be renamed by optimization tools like the Closure Compiler.\n * @category Decorator\n */\nexport const state = (options?: InternalPropertyDeclaration) =>\n internalProperty(options);\n\n/**\n * A property decorator that converts a class property into a getter that\n * executes a querySelector on the element's renderRoot.\n *\n * @param selector A DOMString containing one or more selectors to match.\n * @param cache An optional boolean which when true performs the DOM query only\n * once and caches the result.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector\n *\n * @example\n *\n * ```ts\n * class MyElement {\n * @query('#first')\n * first;\n *\n * render() {\n * return html`\n * <div id=\"first\"></div>\n * <div id=\"second\"></div>\n * `;\n * }\n * }\n * ```\n * @category Decorator\n */\nexport function query(selector: string, cache?: boolean) {\n return (protoOrDescriptor: Object|ClassElement,\n // tslint:disable-next-line:no-any decorator\n name?: PropertyKey): any => {\n const descriptor = {\n get(this: LitElement) {\n return this.renderRoot.querySelector(selector);\n },\n enumerable: true,\n configurable: true,\n };\n if (cache) {\n const prop =\n name !== undefined ? name : (protoOrDescriptor as ClassElement).key;\n const key = typeof prop === 'symbol' ? Symbol() : `__${prop}`;\n descriptor.get = function(this: LitElement) {\n if ((this as unknown as\n {[key: string]: Element | null})[key as string] === undefined) {\n ((this as unknown as {[key: string]: Element | null})[key as string] =\n this.renderRoot.querySelector(selector));\n }\n return (\n this as unknown as {[key: string]: Element | null})[key as string];\n };\n }\n return (name !== undefined) ?\n legacyQuery(descriptor, protoOrDescriptor as Object, name) :\n standardQuery(descriptor, protoOrDescriptor as ClassElement);\n };\n}\n\n// Note, in the future, we may extend this decorator to support the use case\n// where the queried element may need to do work to become ready to interact\n// with (e.g. load some implementation code). If so, we might elect to\n// add a second argument defining a function that can be run to make the\n// queried element loaded/updated/ready.\n/**\n * A property decorator that converts a class property into a getter that\n * returns a promise that resolves to the result of a querySelector on the\n * element's renderRoot done after the element's `updateComplete` promise\n * resolves. When the queried property may change with element state, this\n * decorator can be used instead of requiring users to await the\n * `updateComplete` before accessing the property.\n *\n * @param selector A DOMString containing one or more selectors to match.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector\n *\n * @example\n * ```ts\n * class MyElement {\n * @queryAsync('#first')\n * first;\n *\n * render() {\n * return html`\n * <div id=\"first\"></div>\n * <div id=\"second\"></div>\n * `;\n * }\n * }\n *\n * // external usage\n * async doSomethingWithFirst() {\n * (await aMyElement.first).doSomething();\n * }\n * ```\n * @category Decorator\n */\nexport function queryAsync(selector: string) {\n return (protoOrDescriptor: Object|ClassElement,\n // tslint:disable-next-line:no-any decorator\n name?: PropertyKey): any => {\n const descriptor = {\n async get(this: LitElement) {\n await this.updateComplete;\n return this.renderRoot.querySelector(selector);\n },\n enumerable: true,\n configurable: true,\n };\n return (name !== undefined) ?\n legacyQuery(descriptor, protoOrDescriptor as Object, name) :\n standardQuery(descriptor, protoOrDescriptor as ClassElement);\n };\n}\n\n/**\n * A property decorator that converts a class property into a getter\n * that executes a querySelectorAll on the element's renderRoot.\n *\n * @param selector A DOMString containing one or more selectors to match.\n *\n * See:\n * https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll\n *\n * @example\n * ```ts\n * class MyElement {\n * @queryAll('div')\n * divs;\n *\n * render() {\n * return html`\n * <div id=\"first\"></div>\n * <div id=\"second\"></div>\n * `;\n * }\n * }\n * ```\n * @category Decorator\n */\nexport function queryAll(selector: string) {\n return (protoOrDescriptor: Object|ClassElement,\n // tslint:disable-next-line:no-any decorator\n name?: PropertyKey): any => {\n const descriptor = {\n get(this: LitElement) {\n return this.renderRoot.querySelectorAll(selector);\n },\n enumerable: true,\n configurable: true,\n };\n return (name !== undefined) ?\n legacyQuery(descriptor, protoOrDescriptor as Object, name) :\n standardQuery(descriptor, protoOrDescriptor as ClassElement);\n };\n}\n\nconst legacyQuery =\n (descriptor: PropertyDescriptor, proto: Object, name: PropertyKey) => {\n Object.defineProperty(proto, name, descriptor);\n };\n\nconst standardQuery = (descriptor: PropertyDescriptor, element: ClassElement) =>\n ({\n kind: 'method',\n placement: 'prototype',\n key: element.key,\n descriptor,\n });\n\nconst standardEventOptions =\n (options: AddEventListenerOptions, element: ClassElement) => {\n return {\n ...element,\n finisher(clazz: typeof UpdatingElement) {\n Object.assign(\n clazz.prototype[element.key as keyof UpdatingElement], options);\n }\n };\n };\n\nconst legacyEventOptions =\n // tslint:disable-next-line:no-any legacy decorator\n (options: AddEventListenerOptions, proto: any, name: PropertyKey) => {\n Object.assign(proto[name], options);\n };\n\n/**\n * Adds event listener options to a method used as an event listener in a\n * lit-html template.\n *\n * @param options An object that specifies event listener options as accepted by\n * `EventTarget#addEventListener` and `EventTarget#removeEventListener`.\n *\n * Current browsers support the `capture`, `passive`, and `once` options. See:\n * https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Parameters\n *\n * @example\n * ```ts\n * class MyElement {\n * clicked = false;\n *\n * render() {\n * return html`\n * <div @click=${this._onClick}`>\n * <button></button>\n * </div>\n * `;\n * }\n *\n * @eventOptions({capture: true})\n * _onClick(e) {\n * this.clicked = true;\n * }\n * }\n * ```\n * @category Decorator\n */\nexport function eventOptions(options: AddEventListenerOptions) {\n // Return value typed as any to prevent TypeScript from complaining that\n // standard decorator function signature does not match TypeScript decorator\n // signature\n // TODO(kschaaf): unclear why it was only failing on this decorator and not\n // the others\n return ((protoOrDescriptor: Object|ClassElement, name?: string) =>\n (name !== undefined) ?\n legacyEventOptions(options, protoOrDescriptor as Object, name) :\n standardEventOptions(\n options, protoOrDescriptor as ClassElement)) as\n // tslint:disable-next-line:no-any decorator\n any;\n}\n\n// x-browser support for matches\n// tslint:disable-next-line:no-any\nconst ElementProto = Element.prototype as any;\nconst legacyMatches =\n ElementProto.msMatchesSelector || ElementProto.webkitMatchesSelector;\n\n/**\n * A property decorator that converts a class property into a getter that\n * returns the `assignedNodes` of the given named `slot`. Note, the type of\n * this property should be annotated as `NodeListOf<HTMLElement>`.\n *\n * @param slotName A string name of the slot.\n * @param flatten A boolean which when true flattens the assigned nodes,\n * meaning any assigned nodes that are slot elements are replaced with their\n * assigned nodes.\n * @param selector A string which filters the results to elements that match\n * the given css selector.\n *\n * * @example\n * ```ts\n * class MyElement {\n * @queryAssignedNodes('list', true, '.item')\n * listItems;\n *\n * render() {\n * return html`\n * <slot name=\"list\"></slot>\n * `;\n * }\n * }\n * ```\n * @category Decorator\n */\nexport function queryAssignedNodes(\n slotName = '', flatten = false, selector = '') {\n return (protoOrDescriptor: Object|ClassElement,\n // tslint:disable-next-line:no-any decorator\n name?: PropertyKey): any => {\n const descriptor = {\n get(this: LitElement) {\n const slotSelector =\n `slot${slotName ? `[name=${slotName}]` : ':not([name])'}`;\n const slot = this.renderRoot.querySelector(slotSelector);\n let nodes = slot && (slot as HTMLSlotElement).assignedNodes({flatten});\n if (nodes && selector) {\n nodes = nodes.filter(\n (node) => node.nodeType === Node.ELEMENT_NODE &&\n // tslint:disable-next-line:no-any testing existence on older browsers\n ((node as any).matches ?\n (node as Element).matches(selector) :\n legacyMatches.call(node as Element, selector)));\n }\n return nodes;\n },\n enumerable: true,\n configurable: true,\n };\n return (name !== undefined) ?\n legacyQuery(descriptor, protoOrDescriptor as Object, name) :\n standardQuery(descriptor, protoOrDescriptor as ClassElement);\n };\n}\n","/**\n@license\nCopyright (c) 2019 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at\nhttp://polymer.github.io/LICENSE.txt The complete set of authors may be found at\nhttp://polymer.github.io/AUTHORS.txt The complete set of contributors may be\nfound at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as\npart of the polymer project is also subject to an additional IP rights grant\nfound at http://polymer.github.io/PATENTS.txt\n*/\n\n/**\n * Whether the current browser supports `adoptedStyleSheets`.\n */\nexport const supportsAdoptingStyleSheets = (window.ShadowRoot) &&\n (window.ShadyCSS === undefined || window.ShadyCSS.nativeShadow) &&\n ('adoptedStyleSheets' in Document.prototype) &&\n ('replace' in CSSStyleSheet.prototype);\n\nconst constructionToken = Symbol();\n\nexport class CSSResult {\n _styleSheet?: CSSStyleSheet|null;\n\n readonly cssText: string;\n\n constructor(cssText: string, safeToken: symbol) {\n if (safeToken !== constructionToken) {\n throw new Error(\n 'CSSResult is not constructable. Use `unsafeCSS` or `css` instead.');\n }\n\n this.cssText = cssText;\n }\n\n // Note, this is a getter so that it's lazy. In practice, this means\n // stylesheets are not created until the first element instance is made.\n get styleSheet(): CSSStyleSheet|null {\n if (this._styleSheet === undefined) {\n // Note, if `supportsAdoptingStyleSheets` is true then we assume\n // CSSStyleSheet is constructable.\n if (supportsAdoptingStyleSheets) {\n this._styleSheet = new CSSStyleSheet();\n this._styleSheet.replaceSync(this.cssText);\n } else {\n this._styleSheet = null;\n }\n }\n return this._styleSheet;\n }\n\n toString(): string {\n return this.cssText;\n }\n}\n\n/**\n * Wrap a value for interpolation in a [[`css`]] tagged template literal.\n *\n * This is unsafe because untrusted CSS text can be used to phone home\n * or exfiltrate data to an attacker controlled site. Take care to only use\n * this with trusted input.\n */\nexport const unsafeCSS = (value: unknown) => {\n return new CSSResult(String(value), constructionToken);\n};\n\nconst textFromCSSResult = (value: CSSResult|number) => {\n if (value instanceof CSSResult) {\n return value.cssText;\n } else if (typeof value === 'number') {\n return value;\n } else {\n throw new Error(\n `Value passed to 'css' function must be a 'css' function result: ${\n value}. Use 'unsafeCSS' to pass non-literal values, but\n take care to ensure page security.`);\n }\n};\n\n/**\n * Template tag which which can be used with LitElement's [[LitElement.styles |\n * `styles`]] property to set element styles. For security reasons, only literal\n * string values may be used. To incorporate non-literal values [[`unsafeCSS`]]\n * may be used inside a template string part.\n */\nexport const css =\n (strings: TemplateStringsArray, ...values: (CSSResult|number)[]) => {\n const cssText = values.reduce(\n (acc, v, idx) => acc + textFromCSSResult(v) + strings[idx + 1],\n strings[0]);\n return new CSSResult(cssText, constructionToken);\n };\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * The main LitElement module, which defines the [[`LitElement`]] base class and\n * related APIs.\n *\n * LitElement components can define a template and a set of observed\n * properties. Changing an observed property triggers a re-render of the\n * element.\n *\n * Import [[`LitElement`]] and [[`html`]] from this module to create a\n * component:\n *\n * ```js\n * import {LitElement, html} from 'lit-element';\n *\n * class MyElement extends LitElement {\n *\n * // Declare observed properties\n * static get properties() {\n * return {\n * adjective: {}\n * }\n * }\n *\n * constructor() {\n * this.adjective = 'awesome';\n * }\n *\n * // Define the element's template\n * render() {\n * return html`<p>your ${adjective} template here</p>`;\n * }\n * }\n *\n * customElements.define('my-element', MyElement);\n * ```\n *\n * `LitElement` extends [[`UpdatingElement`]] and adds lit-html templating.\n * The `UpdatingElement` class is provided for users that want to build\n * their own custom element base classes that don't use lit-html.\n *\n * @packageDocumentation\n */\nimport {render, ShadyRenderOptions} from 'lit-html/lib/shady-render.js';\n\nimport {PropertyValues, UpdatingElement} from './lib/updating-element.js';\n\nexport * from './lib/updating-element.js';\nexport {UpdatingElement as ReactiveElement} from './lib/updating-element.js';\nexport * from './lib/decorators.js';\nexport {html, svg, TemplateResult, SVGTemplateResult} from 'lit-html/lit-html.js';\nimport {supportsAdoptingStyleSheets, CSSResult, unsafeCSS} from './lib/css-tag.js';\nexport * from './lib/css-tag.js';\n\ndeclare global {\n interface Window {\n litElementVersions: string[];\n }\n}\n\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for LitElement usage.\n// TODO(justinfagnani): inject version number at build time\n(window['litElementVersions'] || (window['litElementVersions'] = []))\n .push('2.5.1');\n\nexport type CSSResultOrNative = CSSResult|CSSStyleSheet;\n\nexport interface CSSResultArray extends\n Array<CSSResultOrNative|CSSResultArray> {}\n\nexport type CSSResultGroup = CSSResultOrNative|CSSResultArray;\n\n/**\n * Sentinal value used to avoid calling lit-html's render function when\n * subclasses do not implement `render`\n */\nconst renderNotImplemented = {};\n\n/**\n * Base element class that manages element properties and attributes, and\n * renders a lit-html template.\n *\n * To define a component, subclass `LitElement` and implement a\n * `render` method to provide the component's template. Define properties\n * using the [[`properties`]] property or the [[`property`]] decorator.\n */\nexport class LitElement extends UpdatingElement {\n /**\n * Ensure this class is marked as `finalized` as an optimization ensuring\n * it will not needlessly try to `finalize`.\n *\n * Note this property name is a string to prevent breaking Closure JS Compiler\n * optimizations. See updating-element.ts for more information.\n */\n protected static['finalized'] = true;\n\n /**\n * Reference to the underlying library method used to render the element's\n * DOM. By default, points to the `render` method from lit-html's shady-render\n * module.\n *\n * **Most users will never need to touch this property.**\n *\n * This property should not be confused with the `render` instance method,\n * which should be overridden to define a template for the element.\n *\n * Advanced users creating a new base class based on LitElement can override\n * this property to point to a custom render method with a signature that\n * matches [shady-render's `render`\n * method](https://lit-html.polymer-project.org/api/modules/shady_render.html#render).\n *\n * @nocollapse\n */\n static render:\n (result: unknown, container: Element|DocumentFragment,\n options: ShadyRenderOptions) => void = render;\n\n /**\n * Array of styles to apply to the element. The styles should be defined\n * using the [[`css`]] tag function or via constructible stylesheets.\n */\n static styles?: CSSResultGroup;\n\n /** @nocollapse */\n static shadowRootOptions: ShadowRootInit = {mode: 'open'};\n\n private static _styles: Array<CSSResultOrNative|CSSResult>|undefined;\n\n /**\n * Return the array of styles to apply to the element.\n * Override this method to integrate into a style management system.\n *\n * @nocollapse\n */\n static getStyles(): CSSResultGroup|undefined {\n return this.styles;\n }\n\n /** @nocollapse */\n private static _getUniqueStyles() {\n // Only gather styles once per class\n if (this.hasOwnProperty(JSCompiler_renameProperty('_styles', this))) {\n return;\n }\n // Take care not to call `this.getStyles()` multiple times since this\n // generates new CSSResults each time.\n // TODO(sorvell): Since we do not cache CSSResults by input, any\n // shared styles will generate new stylesheet objects, which is wasteful.\n // This should be addressed when a browser ships constructable\n // stylesheets.\n const userStyles = this.getStyles();\n\n if (Array.isArray(userStyles)) {\n // De-duplicate styles preserving the _last_ instance in the set.\n // This is a performance optimization to avoid duplicated styles that can\n // occur especially when composing via subclassing.\n // The last item is kept to try to preserve the cascade order with the\n // assumption that it's most important that last added styles override\n // previous styles.\n const addStyles = (styles: CSSResultArray, set: Set<CSSResultOrNative>):\n Set<CSSResultOrNative> => styles.reduceRight(\n (set: Set<CSSResultOrNative>, s) =>\n // Note: On IE set.add() does not return the set\n Array.isArray(s) ? addStyles(s, set) : (set.add(s), set),\n set);\n // Array.from does not work on Set in IE, otherwise return\n // Array.from(addStyles(userStyles, new Set<CSSResult>())).reverse()\n const set = addStyles(userStyles, new Set<CSSResultOrNative>());\n const styles: CSSResultOrNative[] = [];\n set.forEach((v) => styles.unshift(v));\n this._styles = styles;\n } else {\n this._styles = userStyles === undefined ? [] : [userStyles];\n }\n\n // Ensure that there are no invalid CSSStyleSheet instances here. They are\n // invalid in two conditions.\n // (1) the sheet is non-constructible (`sheet` of a HTMLStyleElement), but\n // this is impossible to check except via .replaceSync or use\n // (2) the ShadyCSS polyfill is enabled (:. supportsAdoptingStyleSheets is\n // false)\n this._styles = this._styles.map((s) => {\n if (s instanceof CSSStyleSheet && !supportsAdoptingStyleSheets) {\n // Flatten the cssText from the passed constructible stylesheet (or\n // undetectable non-constructible stylesheet). The user might have\n // expected to update their stylesheets over time, but the alternative\n // is a crash.\n const cssText = Array.prototype.slice.call(s.cssRules)\n .reduce((css, rule) => css + rule.cssText, '');\n return unsafeCSS(cssText);\n }\n return s;\n });\n }\n\n private _needsShimAdoptedStyleSheets?: boolean;\n\n /**\n * Node or ShadowRoot into which element DOM should be rendered. Defaults\n * to an open shadowRoot.\n */\n readonly renderRoot!: Element|DocumentFragment;\n\n /**\n * Performs element initialization. By default this calls\n * [[`createRenderRoot`]] to create the element [[`renderRoot`]] node and\n * captures any pre-set values for registered properties.\n */\n protected initialize() {\n super.initialize();\n (this.constructor as typeof LitElement)._getUniqueStyles();\n (this as {\n renderRoot: Element|DocumentFragment;\n }).renderRoot = this.createRenderRoot();\n // Note, if renderRoot is not a shadowRoot, styles would/could apply to the\n // element's getRootNode(). While this could be done, we're choosing not to\n // support this now since it would require different logic around de-duping.\n if (window.ShadowRoot && this.renderRoot instanceof window.ShadowRoot) {\n this.adoptStyles();\n }\n }\n\n /**\n * Returns the node into which the element should render and by default\n * creates and returns an open shadowRoot. Implement to customize where the\n * element's DOM is rendered. For example, to render into the element's\n * childNodes, return `this`.\n * @returns {Element|DocumentFragment} Returns a node into which to render.\n */\n protected createRenderRoot(): Element|ShadowRoot {\n return this.attachShadow(\n (this.constructor as typeof LitElement).shadowRootOptions);\n }\n\n /**\n * Applies styling to the element shadowRoot using the [[`styles`]]\n * property. Styling will apply using `shadowRoot.adoptedStyleSheets` where\n * available and will fallback otherwise. When Shadow DOM is polyfilled,\n * ShadyCSS scopes styles and adds them to the document. When Shadow DOM\n * is available but `adoptedStyleSheets` is not, styles are appended to the\n * end of the `shadowRoot` to [mimic spec\n * behavior](https://wicg.github.io/construct-stylesheets/#using-constructed-stylesheets).\n */\n protected adoptStyles() {\n const styles = (this.constructor as typeof LitElement)._styles!;\n if (styles.length === 0) {\n return;\n }\n // There are three separate cases here based on Shadow DOM support.\n // (1) shadowRoot polyfilled: use ShadyCSS\n // (2) shadowRoot.adoptedStyleSheets available: use it\n // (3) shadowRoot.adoptedStyleSheets polyfilled: append styles after\n // rendering\n if (window.ShadyCSS !== undefined && !window.ShadyCSS.nativeShadow) {\n window.ShadyCSS.ScopingShim!.prepareAdoptedCssText(\n styles.map((s) => (s as CSSResult).cssText), this.localName);\n } else if (supportsAdoptingStyleSheets) {\n (this.renderRoot as ShadowRoot).adoptedStyleSheets =\n styles.map((s) => s instanceof CSSStyleSheet ? s : s.styleSheet!);\n } else {\n // This must be done after rendering so the actual style insertion is done\n // in `update`.\n this._needsShimAdoptedStyleSheets = true;\n }\n }\n\n connectedCallback() {\n super.connectedCallback();\n // Note, first update/render handles styleElement so we only call this if\n // connected after first update.\n if (this.hasUpdated && window.ShadyCSS !== undefined) {\n window.ShadyCSS.styleElement(this);\n }\n }\n\n /**\n * Updates the element. This method reflects property values to attributes\n * and calls `render` to render DOM via lit-html. Setting properties inside\n * this method will *not* trigger another update.\n * @param _changedProperties Map of changed properties with old values\n */\n protected update(changedProperties: PropertyValues) {\n // Setting properties in `render` should not trigger an update. Since\n // updates are allowed after super.update, it's important to call `render`\n // before that.\n const templateResult = this.render();\n super.update(changedProperties);\n // If render is not implemented by the component, don't call lit-html render\n if (templateResult !== renderNotImplemented) {\n (this.constructor as typeof LitElement)\n .render(\n templateResult,\n this.renderRoot,\n {scopeName: this.localName, eventContext: this});\n }\n // When native Shadow DOM is used but adoptedStyles are not supported,\n // insert styling after rendering to ensure adoptedStyles have highest\n // priority.\n if (this._needsShimAdoptedStyleSheets) {\n this._needsShimAdoptedStyleSheets = false;\n (this.constructor as typeof LitElement)._styles!.forEach((s) => {\n const style = document.createElement('style');\n style.textContent = (s as CSSResult).cssText;\n this.renderRoot.appendChild(style);\n });\n }\n }\n\n /**\n * Invoked on each update to perform rendering tasks. This method may return\n * any value renderable by lit-html's `NodePart` - typically a\n * `TemplateResult`. Setting properties inside this method will *not* trigger\n * the element to update.\n */\n protected render(): unknown {\n return renderNotImplemented;\n }\n}\n","import { LitElement, html, css } from 'lit-element';\n\nconst IAActivityIndicatorMode = Object.freeze({\n processing: 'processing',\n complete: 'complete',\n});\n\nclass IAActivityIndicator extends LitElement {\n static get properties() {\n return {\n mode: { type: String },\n };\n }\n\n constructor() {\n super();\n this.mode = IAActivityIndicatorMode.processing;\n }\n\n render() {\n return html`\n <div class=\"${this.mode}\">\n <svg\n viewBox=\"0 0 120 120\"\n preserveAspectRatio=\"none\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n aria-labelledby=\"indicatorTitle indicatorDescription\"\n >\n <title id=\"indicatorTitle\">Activity Indicator</title>\n <desc id=\"indicatorDescription\">\n A rotating activity indicator with three dots in the middle.\n </desc>\n <g\n id=\"icons/check-ring---squared\"\n stroke=\"none\"\n stroke-width=\"1\"\n fill=\"none\"\n fill-rule=\"evenodd\"\n >\n <path\n id=\"completed-ring\"\n class=\"loaded-indicator\"\n d=\"M60,10 C70.5816709,10 80.3955961,13.2871104 88.4763646,18.8959201 L78.3502633,29.0214223 C72.9767592,25.8315427 66.7022695,24 60,24 C40.117749,24 24,40.117749 24,60 C24,79.882251 40.117749,96 60,96 C79.882251,96 96,79.882251 96,60 L95.995,59.46 L108.327675,47.128668 C109.350926,50.9806166 109.925886,55.015198 109.993301,59.1731586 L110,60 C110,87.6142375 87.6142375,110 60,110 C32.3857625,110 10,87.6142375 10,60 C10,32.3857625 32.3857625,10 60,10 Z\"\n ></path>\n <polygon\n id=\"check\"\n class=\"loaded-indicator\"\n transform=\"translate(75.000000, 41.500000) rotate(44.000000) translate(-75.000000, -41.500000) \"\n points=\"96 85 54 85 54 65 76 64.999 76 -2 96 -2\"\n ></polygon>\n <path\n id=\"activity-ring\"\n class=\"activity-indicator\"\n d=\"M60,10 C69.8019971,10 78.9452178,12.8205573 86.6623125,17.6943223 L76.4086287,27.9484118 C71.4880919,25.4243078 65.9103784,24 60,24 C40.117749,24 24,40.117749 24,60 C24,79.882251 40.117749,96 60,96 C79.882251,96 96,79.882251 96,60 C96,53.3014663 94.1704984,47.0302355 90.9839104,41.6587228 L101.110332,31.5326452 C106.715332,39.6116982 110,49.4222615 110,60 C110,87.6142375 87.6142375,110 60,110 C32.3857625,110 10,87.6142375 10,60 C10,32.3857625 32.3857625,10 60,10 Z\"\n ></path>\n <g\n id=\"activity-dots\"\n class=\"activity-indicator\"\n transform=\"translate(40.000000, 55.000000)\"\n >\n <circle id=\"left-dot\" cx=\"5\" cy=\"5\" r=\"5\"></circle>\n <circle id=\"middle-dot\" cx=\"20\" cy=\"5\" r=\"5\"></circle>\n <circle id=\"right-dot\" cx=\"35\" cy=\"5\" r=\"5\"></circle>\n </g>\n </g>\n </svg>\n </div>\n `;\n }\n\n static get styles() {\n const checkmarkColorCss = css`var(--activityIndicatorCheckmarkColor, #31A481)`;\n const completedRingColorCss = css`var(--activityIndicatorCompletedRingColor, #31A481)`;\n const loadingRingColorCss = css`var(--activityIndicatorLoadingRingColor, #333333)`;\n const loadingDotColorCss = css`var(--activityIndicatorLoadingDotColor, #333333)`;\n\n return css`\n #completed-ring {\n fill: ${completedRingColorCss};\n }\n\n #check {\n fill: ${checkmarkColorCss};\n }\n\n #activity-ring {\n fill: ${loadingRingColorCss};\n }\n\n #activity-dots {\n fill: ${loadingDotColorCss};\n }\n\n .activity-indicator {\n opacity: 0;\n transition: opacity 0.25s ease-out;\n }\n\n .processing .activity-indicator {\n opacity: 1;\n }\n\n .loaded-indicator {\n opacity: 1;\n transition: opacity 0.25s ease-out;\n }\n\n .processing .loaded-indicator {\n opacity: 0;\n }\n\n .image {\n border: 1px solid red;\n display: inline-block;\n }\n\n .processing #activity-ring {\n animation: rotate 1.3s infinite linear;\n transform-origin: 50px 50px;\n transform-box: fill-box;\n }\n\n .processing #left-dot {\n opacity: 0;\n animation: dot 1.3s infinite;\n animation-delay: 0.2s;\n }\n\n .processing #middle-dot {\n opacity: 0;\n animation: dot 1.3s infinite;\n animation-delay: 0.4s;\n }\n\n .processing #right-dot {\n opacity: 0;\n animation: dot 1.3s infinite;\n animation-delay: 0.6s;\n }\n\n @keyframes rotate {\n 0% {\n transform: rotate(-360deg);\n }\n }\n\n @keyframes dot {\n 0% {\n opacity: 0;\n }\n 25% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n `;\n }\n}\n\nexport { IAActivityIndicator, IAActivityIndicatorMode };\n","import { IAActivityIndicator } from './src/ia-activity-indicator.js';\n\nwindow.customElements.define('ia-activity-indicator', IAActivityIndicator);\n","import { html } from 'lit-html';\n\nexport default html`\n <svg\n viewBox=\"0 0 40 40\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-labelledby=\"closeTitleID closeDescID\"\n >\n <title id=\"closeTitleID\">Close icon</title>\n <desc id=\"closeDescID\">A line drawing of an X</desc>\n <path d=\"m29.1923882 10.8076118c.5857864.5857865.5857864 1.535534 0 2.1213204l-7.0711162 7.0703398 7.0711162 7.0717958c.5857864.5857864.5857864 1.5355339 0 2.1213204-.5857865.5857864-1.535534.5857864-2.1213204 0l-7.0717958-7.0711162-7.0703398 7.0711162c-.5857864.5857864-1.5355339.5857864-2.1213204 0-.5857864-.5857865-.5857864-1.535534 0-2.1213204l7.0706602-7.0717958-7.0706602-7.0703398c-.5857864-.5857864-.5857864-1.5355339 0-2.1213204.5857865-.5857864 1.535534-.5857864 2.1213204 0l7.0703398 7.0706602 7.0717958-7.0706602c.5857864-.5857864 1.5355339-.5857864 2.1213204 0z\" class=\"fill-color\" fill-rule=\"evenodd\"/>\n </svg>\n`;\n","import { html } from 'lit-html';\n\nexport default html`\n <svg\n class=\"ia-logo\"\n viewBox=\"0 0 27 30\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-labelledby=\"logoTitleID logoDescID\"\n >\n <title id=\"logoTitleID\">Internet Archive logo</title>\n <desc id=\"logoDescID\">A line drawing of the Internet Archive headquarters building façade.</desc>\n <g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n <mask id=\"mask-2\" class=\"fill-color\">\n <path d=\"M26.6666667,28.6046512 L26.6666667,30 L0,30 L0.000283687943,28.6046512 L26.6666667,28.6046512 Z M25.6140351,26.5116279 L25.6140351,28.255814 L1.05263158,28.255814 L1.05263158,26.5116279 L25.6140351,26.5116279 Z M3.62469203,7.6744186 L3.91746909,7.82153285 L4.0639977,10.1739544 L4.21052632,13.9963932 L4.21052632,17.6725617 L4.0639977,22.255044 L4.03962296,25.3421929 L3.62469203,25.4651163 L2.16024641,25.4651163 L1.72094074,25.3421929 L1.55031755,22.255044 L1.40350877,17.6970339 L1.40350877,14.0211467 L1.55031755,10.1739544 L1.68423854,7.80887484 L1.98962322,7.6744186 L3.62469203,7.6744186 Z M24.6774869,7.6744186 L24.9706026,7.82153285 L25.1168803,10.1739544 L25.2631579,13.9963932 L25.2631579,17.6725617 L25.1168803,22.255044 L25.0927809,25.3421929 L24.6774869,25.4651163 L23.2130291,25.4651163 L22.7736357,25.3421929 L22.602418,22.255044 L22.4561404,17.6970339 L22.4561404,14.0211467 L22.602418,10.1739544 L22.7369262,7.80887484 L23.0420916,7.6744186 L24.6774869,7.6744186 Z M9.94042303,7.6744186 L10.2332293,7.82153285 L10.3797725,10.1739544 L10.5263158,13.9963932 L10.5263158,17.6725617 L10.3797725,22.255044 L10.3556756,25.3421929 L9.94042303,25.4651163 L8.47583122,25.4651163 L8.0362015,25.3421929 L7.86556129,22.255044 L7.71929825,17.6970339 L7.71929825,14.0211467 L7.86556129,10.1739544 L8.00005604,7.80887484 L8.30491081,7.6744186 L9.94042303,7.6744186 Z M18.0105985,7.6744186 L18.3034047,7.82153285 L18.449948,10.1739544 L18.5964912,13.9963932 L18.5964912,17.6725617 L18.449948,22.255044 L18.425851,25.3421929 L18.0105985,25.4651163 L16.5460067,25.4651163 L16.1066571,25.3421929 L15.9357367,22.255044 L15.7894737,17.6970339 L15.7894737,14.0211467 L15.9357367,10.1739544 L16.0702315,7.80887484 L16.3753664,7.6744186 L18.0105985,7.6744186 Z M25.6140351,4.53488372 L25.6140351,6.97674419 L1.05263158,6.97674419 L1.05263158,4.53488372 L25.6140351,4.53488372 Z M13.0806755,0 L25.9649123,2.93331338 L25.4484139,3.8372093 L0.771925248,3.8372093 L0,3.1041615 L13.0806755,0 Z\" id=\"path-1\"></path>\n </mask>\n <use class=\"fill-color\" xlink:href=\"#path-1\"></use>\n <g mask=\"url(#mask-2)\" class=\"fill-color\">\n <path d=\"M0,0 L26.6666667,0 L26.6666667,30 L0,30 L0,0 Z\" id=\"swatch\"></path>\n </g>\n </g>\n </svg>\n`;\n","import { __decorate } from \"tslib\";\nimport { LitElement, html, css, customElement, property, } from 'lit-element';\nimport '@internetarchive/ia-activity-indicator/ia-activity-indicator';\nimport closeIcon from '@internetarchive/icon-close';\nimport iaLogo from '@internetarchive/icon-ia-logo';\nimport { ModalConfig } from './modal-config';\nlet ModalTemplate = class ModalTemplate extends LitElement {\n constructor() {\n super(...arguments);\n /**\n * The ModalConfig that displayed the template\n *\n * @type {ModalConfig}\n * @memberof ModalTemplate\n */\n this.config = new ModalConfig();\n }\n /** @inheritdoc */\n render() {\n return html `\n <div class=\"modal-wrapper\">\n <div class=\"modal-container\">\n <header style=\"background-color: ${this.config.headerColor}\">\n ${this.config.showCloseButton ? this.closeButtonTemplate : ''}\n <div class=\"logo-icon\">\n ${iaLogo}\n </div>\n ${this.config.title\n ? html `<h1 class=\"title\">${this.config.title}</h1>`\n : ''}\n ${this.config.subtitle\n ? html `<h2 class=\"subtitle\">${this.config.subtitle}</h2>`\n : ''}\n </header>\n <section class=\"modal-body\">\n <div class=\"content\">\n <div\n class=\"processing-logo ${this.config.showProcessingIndicator\n ? ''\n : 'hidden'}\"\n >\n <ia-activity-indicator\n .mode=${this.config.processingImageMode}\n ></ia-activity-indicator>\n </div>\n\n ${this.config.headline\n ? html ` <h1 class=\"headline\">${this.config.headline}</h1> `\n : ''}\n ${this.config.message\n ? html ` <p class=\"message\">${this.config.message}</p> `\n : ''}\n\n <div class=\"slot-container\">\n <slot> </slot>\n </div>\n </div>\n </section>\n </div>\n </div>\n `;\n }\n /**\n * Dispatch the `closeButtonPressed` event to the consumer\n *\n * @private\n * @memberof ModalTemplate\n */\n handleCloseButton() {\n const event = new Event('closeButtonPressed');\n this.dispatchEvent(event);\n }\n /**\n * The close button template\n *\n * @readonly\n * @private\n * @type {TemplateResult}\n * @memberof ModalTemplate\n */\n get closeButtonTemplate() {\n return html `\n <button\n type=\"button\"\n class=\"close-button\"\n tabindex=\"0\"\n @click=${this.handleCloseButton}\n >\n ${closeIcon}\n </button>\n `;\n }\n /** @inheritdoc */\n static get styles() {\n const modalLogoSize = css `var(--modalLogoSize, 6.5rem)`;\n const processingImageSize = css `var(--processingImageSize, 7.5rem)`;\n const modalCornerRadius = css `var(--modalCornerRadius, 1rem)`;\n const modalBorder = css `var(--modalBorder, 2px solid black)`;\n // if the content of the modal is too big to fit on screen, this sets the bottom margin\n // it's not exact, but a close estimation\n const modalBottomMarginCss = css `var(--modalBottomMargin, 2.5rem)`;\n const modalTopMarginCss = css `var(--modalTopMargin, 5rem)`;\n const modalHeaderBottomPaddingCss = css `var(--modalHeaderBottomPadding, 0.5em)`;\n const modalBottomPadding = css `var(--modalBottomPadding, 2rem)`;\n const scrollOffset = css `var(--modalScrollOffset, 5px)`;\n const titleFontSize = css `var(--modalTitleFontSize, 1.8rem)`;\n const subtitleFontSize = css `var(--modalSubtitleFontSize, 1.4rem)`;\n const headlineFontSize = css `var(--modalHeadlineFontSize, 1.6rem)`;\n const messageFontSize = css `var(--modalMessageFontSize, 1.4rem)`;\n const titleLineHeight = css `var(--modalTitleLineHeight, normal)`;\n const subtitleLineHeight = css `var(--modalSubtitleLineHeight, normal)`;\n const headlineLineHeight = css `var(--modalHeadlineLineHeight, normal)`;\n const messageLineHeight = css `var(--modalMessageLineHeight, normal)`;\n return css `\n .processing-logo {\n margin: auto;\n width: ${processingImageSize};\n height: ${processingImageSize};\n }\n\n .processing-logo.hidden {\n height: 1rem;\n }\n\n .processing-logo.hidden ia-activity-indicator {\n display: none;\n }\n\n .modal-wrapper {\n outline: none;\n }\n\n .modal-container {\n border-radius: ${modalCornerRadius};\n width: 100%;\n margin-top: ${modalTopMarginCss};\n }\n\n header {\n position: relative;\n background-color: #36a483;\n color: white;\n border-radius: calc(${modalCornerRadius}) calc(${modalCornerRadius}) 0 0;\n border: ${modalBorder};\n border-bottom: 0;\n text-align: center;\n padding-bottom: ${modalHeaderBottomPaddingCss};\n }\n\n .title {\n margin: 0;\n padding: 0;\n font-size: ${titleFontSize};\n font-weight: bold;\n line-height: ${titleLineHeight};\n }\n\n .subtitle {\n margin: 0;\n padding: 0;\n font-weight: normal;\n padding-top: 0;\n font-size: ${subtitleFontSize};\n line-height: ${subtitleLineHeight};\n }\n\n .modal-body {\n background-color: #f5f5f7;\n border-radius: 0 0 calc(${modalCornerRadius}) calc(${modalCornerRadius});\n border: ${modalBorder};\n border-top: 0;\n padding: 0 1rem calc(${modalBottomPadding} - ${scrollOffset}) 1rem;\n color: #333;\n margin-bottom: 2.5rem;\n min-height: 5rem;\n }\n\n .content {\n overflow-y: auto;\n max-height: calc(100vh - (16.5rem + ${modalBottomMarginCss}));\n min-height: 5rem;\n padding: 0 0 calc(${scrollOffset}) 0;\n }\n\n .headline {\n font-size: ${headlineFontSize};\n font-weight: bold;\n text-align: center;\n line-height: ${headlineLineHeight};\n margin: 0;\n padding: 0;\n }\n\n .message {\n margin: 1rem 0 0 0;\n text-align: center;\n font-size: ${messageFontSize};\n line-height: ${messageLineHeight};\n }\n\n .logo-icon {\n border-radius: 100%;\n border: 3px solid #fff;\n box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18),\n 0 2px 2px 0 rgba(0, 0, 0, 0.08);\n width: ${modalLogoSize};\n height: ${modalLogoSize};\n margin: -2.9rem auto 0.5rem auto;\n background-color: black;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n\n .logo-icon svg {\n width: calc(${modalLogoSize} * 0.65);\n height: calc(${modalLogoSize} * 0.65);\n }\n\n .logo-icon svg .fill-color {\n fill: white;\n }\n\n .logo-icon svg .stroke-color {\n stroke: red;\n }\n\n .close-button {\n position: absolute;\n right: 1.2rem;\n top: 1.2rem;\n width: 2rem;\n height: 2rem;\n border-radius: 100%;\n border: 0;\n padding: 0;\n cursor: pointer;\n background-color: white;\n box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18),\n 0 4px 4px 0 rgba(0, 0, 0, 0.08);\n }\n `;\n }\n};\n__decorate([\n property({ type: Object })\n], ModalTemplate.prototype, \"config\", void 0);\nModalTemplate = __decorate([\n customElement('modal-template')\n], ModalTemplate);\nexport { ModalTemplate };\n//# sourceMappingURL=modal-template.js.map","/**\n * Various modes the modal can be in\n *\n * @export\n * @enum {number}\n */\nexport var ModalManagerMode;\n(function (ModalManagerMode) {\n ModalManagerMode[\"Open\"] = \"open\";\n ModalManagerMode[\"Closed\"] = \"closed\";\n})(ModalManagerMode || (ModalManagerMode = {}));\n//# sourceMappingURL=modal-manager-mode.js.map","import { throttle } from 'throttle-debounce';\nimport { ModalManagerMode } from './modal-manager-mode';\n/**\n * The `ModalManagerHostBridge` is a bridge between the `ModalManager` and the\n * host that sets up environment-specific changes when the modal opens and closes.\n *\n * For instance, when the modal opens, this adds a class to the `<body>` tag for styling\n * and adds a `resize` listener to fix a Safari shadow root issue.\n *\n * Consumers can create their own `ModalManagerHostBridgeInterface` classes and pass\n * them into the `ModalManager` if this one does not work for their environment.\n *\n * @export\n * @class ModalManagerHostBridge\n * @implements {ModalManagerHostBridgeInterface}\n */\nexport class ModalManagerHostBridge {\n constructor(modalManager) {\n this.windowResizeThrottler = throttle(100, false, this.updateModalContainerHeight).bind(this);\n this.modalManager = modalManager;\n }\n /**\n * Handle the mode change\n *\n * @private\n * @memberof ModalManager\n */\n handleModeChange(mode) {\n switch (mode) {\n case ModalManagerMode.Open:\n this.startResizeListener();\n this.stopDocumentScroll();\n break;\n case ModalManagerMode.Closed:\n this.stopResizeListener();\n this.resumeDocumentScroll();\n break;\n }\n }\n // This is a workaround for Safari. Safari does not update shadowRoot elements calculated\n // based on the viewport size (ie. `calc(100vh - 10px)`). It does an initial calculation correctly,\n // but resizing the window does not cause the calculation to update. Firefox and Chrome both handle\n // this correctly.\n // It doesn't matter what css variable you set, it is just forcing Safari to do an update.\n // Also note that the value has to change on each update for Safari to do the update,\n // ie. you can't just set a static value.\n updateModalContainerHeight() {\n this.modalManager.style.setProperty('--containerHeight', `${window.innerHeight}px`);\n }\n stopDocumentScroll() {\n document.body.classList.add('modal-manager-open');\n }\n resumeDocumentScroll() {\n document.body.classList.remove('modal-manager-open');\n }\n startResizeListener() {\n window.addEventListener('resize', this.windowResizeThrottler);\n }\n stopResizeListener() {\n window.removeEventListener('resize', this.windowResizeThrottler);\n }\n}\n//# sourceMappingURL=modal-manager-host-bridge.js.map","import { __awaiter, __decorate } from \"tslib\";\nimport { LitElement, html, css, customElement, property, query, } from 'lit-element';\nimport './modal-template';\nimport { ModalManagerHostBridge } from './modal-manager-host-bridge';\nimport { ModalManagerMode } from './modal-manager-mode';\nlet ModalManager = class ModalManager extends LitElement {\n constructor() {\n super(...arguments);\n /**\n * The current mode of the ModalManager\n *\n * Current options are `modal` or `closed`\n *\n * @type {ModalManagerMode}\n * @memberof ModalManager\n */\n this.mode = ModalManagerMode.Closed;\n /**\n * Thie hostBridge handles environmental-specific interactions such as adding classes\n * to the body tag or event listeners needed to support the modal manager in the host environment.\n *\n * There is a default `ModalManagerHostBridge`, but consumers can override it with a custom\n * `ModalManagerHostBridgeInterface`\n *\n * @type {ModalManagerHostBridgeInterface}\n * @memberof ModalManager\n */\n this.hostBridge = new ModalManagerHostBridge(this);\n /**\n * Whether the modal should close if the user taps on the backdrop\n *\n * @private\n * @memberof ModalManager\n */\n this.closeOnBackdropClick = true;\n }\n /** @inheritdoc */\n render() {\n return html `\n <div class=\"container\">\n <div class=\"backdrop\" @click=${this.backdropClicked}></div>\n <modal-template\n @closeButtonPressed=${this.closeButtonPressed}\n tabindex=\"0\"\n >\n ${this.customModalContent}\n </modal-template>\n </div>\n `;\n }\n /** @inheritdoc */\n getMode() {\n return this.mode;\n }\n /** @inheritdoc */\n closeModal() {\n this.mode = ModalManagerMode.Closed;\n }\n /**\n * Call the userClosedModalCallback and reset it if it exists\n *\n * @private\n * @memberof ModalManager\n */\n callUserClosedModalCallback() {\n // we assign the callback to a temp var and undefine it before calling it\n // otherwise, we run into the potential for an infinite loop if the\n // callback triggers another `showModal()`, which would execute `userClosedModalCallback`\n const callback = this.userClosedModalCallback;\n this.userClosedModalCallback = undefined;\n if (callback)\n callback();\n }\n /** @inheritdoc */\n showModal(options) {\n return __awaiter(this, void 0, void 0, function* () {\n this.closeOnBackdropClick = options.config.closeOnBackdropClick;\n this.userClosedModalCallback = options.userClosedModalCallback;\n this.modalTemplate.config = options.config;\n this.customModalContent = options.customModalContent;\n this.mode = ModalManagerMode.Open;\n yield this.modalTemplate.updateComplete;\n this.modalTemplate.focus();\n });\n }\n /** @inheritdoc */\n updated(changed) {\n /* istanbul ignore else */\n if (changed.has('mode')) {\n this.handleModeChange();\n }\n }\n /**\n * Called when the backdrop is clicked\n *\n * @private\n * @memberof ModalManager\n */\n backdropClicked() {\n if (this.closeOnBackdropClick) {\n this.closeModal();\n this.callUserClosedModalCallback();\n }\n }\n /**\n * Handle the mode change\n *\n * @private\n * @memberof ModalManager\n */\n handleModeChange() {\n this.hostBridge.handleModeChange(this.mode);\n this.emitModeChangeEvent();\n }\n /**\n * Emit a modeChange event\n *\n * @private\n * @memberof ModalManager\n */\n emitModeChangeEvent() {\n const event = new CustomEvent('modeChanged', {\n detail: { mode: this.mode },\n });\n this.dispatchEvent(event);\n }\n /**\n * Called when the modal close button is pressed. Closes the modal.\n *\n * @private\n * @memberof ModalManager\n */\n closeButtonPressed() {\n this.closeModal();\n this.callUserClosedModalCallback();\n }\n /** @inheritdoc */\n static get styles() {\n const modalBackdropColor = css `var(--modalBackdropColor, rgba(10, 10, 10, 0.9))`;\n const modalBackdropZindex = css `var(--modalBackdropZindex, 1000)`;\n const modalWidth = css `var(--modalWidth, 32rem)`;\n const modalMaxWidth = css `var(--modalMaxWidth, 95%)`;\n const modalZindex = css `var(--modalZindex, 2000)`;\n return css `\n .container {\n width: 100%;\n height: 100%;\n }\n\n .backdrop {\n position: fixed;\n top: 0;\n left: 0;\n background-color: ${modalBackdropColor};\n width: 100%;\n height: 100%;\n z-index: ${modalBackdropZindex};\n }\n\n modal-template {\n outline: 0;\n position: fixed;\n top: 0;\n left: 50%;\n transform: translate(-50%, 0);\n z-index: ${modalZindex};\n width: ${modalWidth};\n max-width: ${modalMaxWidth};\n }\n `;\n }\n};\n__decorate([\n property({ type: String, reflect: true })\n], ModalManager.prototype, \"mode\", void 0);\n__decorate([\n property({ type: Object })\n], ModalManager.prototype, \"customModalContent\", void 0);\n__decorate([\n property({ type: Object })\n], ModalManager.prototype, \"hostBridge\", void 0);\n__decorate([\n query('modal-template')\n], ModalManager.prototype, \"modalTemplate\", void 0);\nModalManager = __decorate([\n customElement('modal-manager')\n], ModalManager);\nexport { ModalManager };\n//# sourceMappingURL=modal-manager.js.map","import { html } from 'lit-html';\n\nexport default html`\n<svg\n viewBox=\"0 0 18 18\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-labelledby=\"searchTitleID searchDescID\"\n>\n <title id=\"searchTitleID\">Search icon</title>\n <desc id=\"searchDescID\">Search for something.</desc>\n <path\n class=\"fill-color\"\n fill=\"none\"\n d=\"m7 0c3.854149 0 7 3.1458514 7 7 0 1.5717634-.529107 3.020558-1.410156 4.191406.0416324.03077.0808125.0647264.117187.101563l4.335938 4.335937c.3904239.3905071.3904239 1.0235559 0 1.414063-.3905071.3904239-1.0235559.3904239-1.414063 0l-4.335937-4.335938c-.0362414-.0370712-.0695452-.0769047-.09961-.11914-1.171224.882043-2.6206167 1.412109-4.193359 1.412109-3.8541486 0-7-3.145851-7-7 0-3.8541486 3.1458514-7 7-7zm0 2c-2.7732684 0-5 2.2267316-5 5s2.2267316 5 5 5 5-2.2267316 5-5-2.2267316-5-5-5z\" />\n</svg>\n`;\n","import icon from './index.js';\nimport { css, LitElement } from 'lit-element';\n\nclass IAIconSearch extends LitElement {\n static get styles() {\n return css`\n :host {\n width: var(--iconWidth, 'auto');\n height: var(--iconHeight, 'auto');\n }\n\n .fill-color {\n fill: var(--iconFillColor);\n }\n\n .stroke-color {\n stroke: var(--iconStrokeColor);\n }\n `;\n }\n\n render() {\n return icon;\n }\n}\n\ncustomElements.define('ia-icon-search', IAIconSearch);\n\nexport default IAIconSearch;","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {nothing, TemplateResult, noChange} from '../lit-html.js';\nimport {directive, Directive, PartInfo, PartType} from '../directive.js';\n\nconst HTML_RESULT = 1;\n\nexport class UnsafeHTMLDirective extends Directive {\n static directiveName = 'unsafeHTML';\n static resultType = HTML_RESULT;\n\n private _value: unknown = nothing;\n private _templateResult?: TemplateResult;\n\n constructor(partInfo: PartInfo) {\n super(partInfo);\n if (partInfo.type !== PartType.CHILD) {\n throw new Error(\n `${\n (this.constructor as typeof UnsafeHTMLDirective).directiveName\n }() can only be used in child bindings`\n );\n }\n }\n\n render(value: string | typeof nothing | typeof noChange | undefined | null) {\n if (value === nothing || value == null) {\n this._templateResult = undefined;\n return (this._value = value);\n }\n if (value === noChange) {\n return value;\n }\n if (typeof value != 'string') {\n throw new Error(\n `${\n (this.constructor as typeof UnsafeHTMLDirective).directiveName\n }() called with a non-string value`\n );\n }\n if (value === this._value) {\n return this._templateResult;\n }\n this._value = value;\n const strings = [value] as unknown as TemplateStringsArray;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (strings as any).raw = strings;\n // WARNING: impersonating a TemplateResult like this is extremely\n // dangerous. Third-party directives should not do this.\n return (this._templateResult = {\n // Cast to a known set of integers that satisfy ResultType so that we\n // don't have to export ResultType and possibly encourage this pattern.\n // This property needs to remain unminified.\n ['_$litType$']: (this.constructor as typeof UnsafeHTMLDirective)\n .resultType as 1 | 2,\n strings,\n values: [],\n });\n }\n}\n\n/**\n * Renders the result as HTML, rather than text.\n *\n * The values `undefined`, `null`, and `nothing`, will all result in no content\n * (empty string) being rendered.\n *\n * Note, this is unsafe to use with any user-provided input that hasn't been\n * sanitized or escaped, as it may lead to cross-site-scripting\n * vulnerabilities.\n */\nexport const unsafeHTML = directive(UnsafeHTMLDirective);\n","import { html, LitElement, nothing } from 'lit';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\n\nexport class BookSearchResult extends LitElement {\n static get properties() {\n return {\n match: { type: Object },\n };\n }\n\n constructor() {\n super();\n\n this.matchRegex = new RegExp('{{{(.+?)}}}', 'g');\n }\n\n createRenderRoot() {\n return this;\n }\n\n highlightedHit(hit) {\n return html`\n <p>${unsafeHTML(hit.replace(this.matchRegex, '<mark>$1</mark>'))}</p>\n `;\n }\n\n resultSelected() {\n this.dispatchEvent(new CustomEvent('resultSelected', {\n bubbles: true,\n composed: true,\n detail: {\n match: this.match,\n },\n }));\n }\n\n render() {\n const { match } = this;\n const { par = [] } = match;\n const [resultDetails = {}] = par;\n const pageNumber = Number.isInteger(resultDetails.page)\n ? html`<p class=\"page-num\">Page -${resultDetails.page}-</p>` : nothing;\n const coverImage = html`<img src=\"${match.cover}\" />`;\n return html`\n <li @click=${this.resultSelected}>\n ${match.cover ? coverImage : nothing}\n <h4>${match.title || nothing}</h4>\n ${pageNumber}\n ${this.highlightedHit(match.text)}\n </li>\n `;\n }\n}\ncustomElements.define('book-search-result', BookSearchResult);\n","import { css } from 'lit';\n\n// Original SVG object for reference\n// <svg height=\"10\" viewBox=\"0 0 13 10\" width=\"13\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"m4.33333333 10-4.33333333-4.16666667 1.73333333-1.66666666 2.6 2.5 6.93333337-6.66666667 1.7333333 1.66666667z\" fill=\"#fff\" fill-rule=\"evenodd\"/></svg>\n\nexport default css`data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjEwIiB2aWV3Qm94PSIwIDAgMTMgMTAiIHdpZHRoPSIxMyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJtNC4zMzMzMzMzMyAxMC00LjMzMzMzMzMzLTQuMTY2NjY2NjcgMS43MzMzMzMzMy0xLjY2NjY2NjY2IDIuNiAyLjUgNi45MzMzMzMzNy02LjY2NjY2NjY3IDEuNzMzMzMzMyAxLjY2NjY2NjY3eiIgZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIi8+PC9zdmc+`;\n","import { css } from 'lit';\n\nexport default css`data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgNDAgNDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgYXJpYS1sYWJlbGxlZGJ5PSJjbG9zZVRpdGxlSUQgY2xvc2VEZXNjSUQiPjxwYXRoIGQ9Ik0yOS4xOTIgMTAuODA4YTEuNSAxLjUgMCAwMTAgMi4xMkwyMi4xMjIgMjBsNy4wNyA3LjA3MmExLjUgMS41IDAgMDEtMi4xMiAyLjEyMWwtNy4wNzMtNy4wNy03LjA3IDcuMDdhMS41IDEuNSAwIDAxLTIuMTIxLTIuMTJsNy4wNy03LjA3My03LjA3LTcuMDdhMS41IDEuNSAwIDAxMi4xMi0yLjEyMUwyMCAxNy44NzhsNy4wNzItNy4wN2ExLjUgMS41IDAgMDEyLjEyMSAweiIgY2xhc3M9ImZpbGwtY29sb3IiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==`;\n","import { css } from 'lit';\n\nexport default css`\n .ia-button {\n min-height: 3rem;\n border: none;\n outline: none;\n cursor: pointer;\n color: var(--primaryTextColor);\n line-height: normal;\n border-radius: .4rem;\n text-align: center;\n vertical-align: middle;\n font-size: 1.4rem;\n display: inline-block;\n padding: .6rem 1.2rem;\n border: 1px solid transparent;\n\n white-space: nowrap;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n -o-user-select: none;\n user-select: none;\n }\n\n .ia-button.link,\n .ia-button.external {\n min-height: unset;\n text-decoration: none;\n }\n\n .ia-button:disabled,\n .ia-button.disabled {\n cursor: not-allowed;\n opacity: 0.5;\n }\n\n .ia-button.transparent {\n background-color: transparent;\n }\n \n .ia-button.slim {\n padding: 0;\n }\n\n .ia-button.primary {\n background-color: var(--primaryCTAFill);\n border-color: var(--primaryCTABorder);\n }\n\n .ia-button.cancel {\n background-color: var(--primaryErrorCTAFill);\n border-color: var(--primaryErrorCTABorder);\n }\n\n .ia-button.external {\n background: var(--secondaryCTAFill);\n border-color: var(--secondaryCTABorder);\n }\n`;\n","/* eslint-disable class-methods-use-this */\nimport { css, html, LitElement, nothing } from 'lit';\nimport '@internetarchive/ia-activity-indicator/ia-activity-indicator';\nimport './a-search-result.js';\nimport checkmarkIcon from '../assets/icon_checkmark.js';\nimport closeIcon from '../assets/icon_close.js';\nimport buttonCSS from '../assets/button-base.js';\n\n\nexport class IABookSearchResults extends LitElement {\n static get properties() {\n return {\n results: { type: Array },\n query: { type: String },\n queryInProgress: { type: Boolean },\n renderHeader: { type: Boolean },\n renderSearchAllFiles: { type: Boolean },\n displayResultImages: { type: Boolean },\n errorMessage: { type: String },\n };\n }\n\n constructor() {\n super();\n\n this.results = [];\n this.query = '';\n this.queryInProgress = false;\n this.renderHeader = false;\n this.renderSearchAllFields = false;\n this.displayResultImages = false;\n this.errorMessage = '';\n\n this.bindBookReaderListeners();\n }\n\n /** @inheritdoc */\n updated() {\n this.focusOnInputIfNecessary();\n }\n\n bindBookReaderListeners() {\n document.addEventListener('BookReader:SearchCallback', this.setResults.bind(this));\n }\n\n /**\n * Provide immediate input focus if there aren't any results displayed\n */\n focusOnInputIfNecessary() {\n if (this.results.length) {\n return;\n }\n const searchInput = this.shadowRoot.querySelector('input[type=\\'search\\']');\n searchInput.focus();\n }\n\n setResults({ detail }) {\n this.results = detail.results;\n }\n\n setQuery(e) {\n this.query = e.currentTarget.value;\n }\n\n performSearch(e) {\n e.preventDefault();\n const input = e.currentTarget.querySelector('input[type=\"search\"]');\n if (!input || !input.value) {\n return;\n }\n this.dispatchEvent(new CustomEvent('bookSearchInitiated', {\n bubbles: true,\n composed: true,\n detail: {\n query: this.query,\n },\n }));\n }\n\n selectResult() {\n this.dispatchEvent(new CustomEvent('closeMenu', {\n bubbles: true,\n composed: true,\n }));\n }\n\n cancelSearch() {\n this.queryInProgress = false;\n this.dispatchSearchCanceled();\n }\n\n dispatchSearchCanceled() {\n this.dispatchEvent(new Event('bookSearchCanceled'));\n }\n\n get resultsCount() {\n const count = this.results.length;\n return count ? html`<p>(${count} result${count > 1 ? 's' : ''})</p>` : nothing;\n }\n\n get headerSection() {\n const header = html`<header>\n <h3>Search inside</h3>\n ${this.resultsCount}\n </header>`;\n return this.renderHeader ? header : nothing;\n }\n\n get searchMultipleControls() {\n const controls = html`\n <input name=\"all_files\" id=\"all_files\" type=\"checkbox\" />\n <label class=\"checkbox\" for=\"all_files\">Search all files</label>\n `;\n return this.renderSearchAllFiles ? controls : nothing;\n }\n\n get loadingIndicator() {\n return html`\n <div class=\"loading\">\n <ia-activity-indicator mode=\"processing\"></ia-activity-indicator>\n <p>Searching</p>\n <button class=\"ia-button external cancel-search\" @click=${this.cancelSearch}>Cancel</button>\n </div>\n `;\n }\n\n get resultsSet() {\n const resultsClass = this.displayResultImages ? 'show-image' : '';\n return html`\n <ul class=\"results ${resultsClass}\">\n ${this.results.map(match => html`\n <book-search-result\n .match=${match}\n @resultSelected=${this.selectResult}\n ></book-search-result>\n `)}\n </ul>\n `;\n }\n\n get searchForm() {\n return html`\n <form action=\"\" method=\"get\" @submit=${this.performSearch}>\n <fieldset>\n ${this.searchMultipleControls}\n <input\n type=\"search\"\n name=\"query\"\n alt=\"Search inside this book.\"\n @keyup=${this.setQuery}\n .value=${this.query}\n />\n </fieldset>\n </form>\n `;\n }\n\n get setErrorMessage() {\n return html`\n <p class=\"error-message\">${this.errorMessage}</p>\n `;\n }\n\n get searchCTA() {\n return html`<p class=\"search-cta\"><em>Please enter text to search for</em></p>`;\n }\n\n render() {\n const showSearchCTA = (!this.queryInProgress && !this.errorMessage)\n && (!this.queryInProgress && !this.results.length);\n return html`\n ${this.headerSection}\n ${this.searchForm}\n <div class=\"results-container\">\n ${this.queryInProgress ? this.loadingIndicator : nothing}\n ${this.errorMessage ? this.setErrorMessage : nothing}\n ${this.results.length ? this.resultsSet : nothing}\n ${showSearchCTA ? this.searchCTA : nothing}\n </div>\n `;\n }\n\n static get styles() {\n const searchResultText = css`var(--searchResultText, #adaedc)`;\n const searchResultBg = css`var(--searchResultBg, #272958)`;\n const searchResultBorder = css`var(--searchResultBorder, #adaedc)`;\n const activeButtonBg = css`(--tertiaryBGColor, #333)`;\n\n const mainCSS = css`\n :host {\n display: block;\n height: 100%;\n padding: 1.5rem 1rem 2rem 0;\n overflow-y: auto;\n font-size: 1.4rem;\n box-sizing: border-box;\n }\n\n mark {\n padding: 0 .2rem;\n color: ${searchResultText};\n background: ${searchResultBg};\n border: 1px solid ${searchResultBorder};\n border-radius: 2px;\n }\n\n h3 {\n padding: 0;\n margin: 0 1rem 0 0;\n font-size: 2rem;\n }\n\n header {\n display: flex;\n align-items: center;\n padding: 0 2rem 0 0;\n }\n header p {\n padding: 0;\n margin: 0;\n font-size: 1.2rem;\n font-weight: bold;\n font-style: italic;\n }\n\n fieldset {\n padding: 0 0 1rem 0;\n border: none;\n }\n\n [type=\"checkbox\"] {\n display: none;\n }\n\n label {\n display: block;\n text-align: center;\n }\n\n label.checkbox {\n padding-bottom: .5rem;\n font-size: 1.6rem;\n line-height: 150%;\n vertical-align: middle;\n }\n\n label.checkbox:after {\n display: inline-block;\n width: 14px;\n height: 14px;\n margin-left: .7rem;\n content: \"\";\n border-radius: 2px;\n }\n :checked + label.checkbox:after {\n background-image: url('${checkmarkIcon}');\n }\n\n label.checkbox[for=\"all_files\"]:after {\n background: ${activeButtonBg} 50% 50% no-repeat;\n border: 1px solid var(--primaryTextColor);\n }\n\n [type=\"search\"] {\n color: var(--primaryTextColor);\n border: 1px solid var(--primaryTextColor);\n -webkit-appearance: textfield;\n width: 100%;\n height: 3rem;\n padding: 0 1.5rem;\n box-sizing: border-box;\n font: normal 1.6rem \"Helvetica qNeue\", Helvetica, Arial, sans-serif;\n border-radius: 1.5rem;\n background: transparent;\n }\n [type=\"search\"]:focus {\n outline: none;\n }\n [type=\"search\"]::-webkit-search-cancel-button {\n width: 18px;\n height: 18px;\n -webkit-appearance: none;\n appearance: none;\n -webkit-mask: url('${closeIcon}') 0 0 no-repeat;\n mask: url('${closeIcon}') 0 0 no-repeat;\n -webkit-mask-size: 100%;\n mask-size: 100%;\n background: #fff;\n }\n\n p.page-num {\n font-weight: bold;\n padding-bottom: 0;\n }\n\n p.search-cta {\n text-align: center;\n }\n\n .results-container {\n padding-bottom: 2rem;\n }\n\n ul {\n padding: 0 0 2rem 0;\n margin: 0;\n list-style: none;\n }\n\n ul.show-image li {\n display: grid;\n }\n\n li {\n cursor: pointer;\n grid-template-columns: 30px 1fr;\n grid-gap: 0 .5rem;\n }\n\n li img {\n display: block;\n width: 100%;\n }\n\n li h4 {\n grid-column: 2 / 3;\n padding: 0 0 2rem 0;\n margin: 0;\n font-weight: normal;\n }\n\n li p {\n grid-column: 2 / 3;\n padding: 0 0 1.5rem 0;\n margin: 0;\n font-size: 1.2rem;\n }\n\n .loading {\n text-align: center;\n }\n\n .loading p {\n padding: 0 0 1rem 0;\n margin: 0;\n font-size: 1.2rem;\n }\n\n ia-activity-indicator {\n display: block;\n width: 40px;\n height: 40px;\n margin: 0 auto;\n }\n `;\n return [buttonCSS, mainCSS];\n }\n}\ncustomElements.define('ia-book-search-results', IABookSearchResults);\n","import { html, nothing } from 'lit';\nimport '@internetarchive/icon-search/icon-search';\nimport './search-results';\n\nlet searchState = {\n query: '',\n results: [],\n resultsCount: 0,\n queryInProgress: false,\n errorMessage: '',\n};\nexport default class SearchProvider {\n constructor({\n onProviderChange,\n bookreader\n }) {\n /* search menu events */\n this.onBookSearchInitiated = this.onBookSearchInitiated.bind(this);\n /* bookreader search events */\n this.onSearchStarted = this.onSearchStarted.bind(this);\n this.onSearchRequestError = this.onSearchRequestError.bind(this);\n this.onSearchResultsClicked = this.onSearchResultsClicked.bind(this);\n this.onSearchResultsChange = this.onSearchResultsChange.bind(this);\n this.onSearchResultsCleared = this.onSearchResultsCleared.bind(this);\n this.searchCanceledInMenu = this.searchCanceledInMenu.bind(this);\n\n /* class methods */\n this.bindEventListeners = this.bindEventListeners.bind(this);\n this.getMenuDetails = this.getMenuDetails.bind(this);\n this.getComponent = this.getComponent.bind(this);\n this.advanceToPage = this.advanceToPage.bind(this);\n this.updateMenu = this.updateMenu.bind(this);\n\n this.onProviderChange = onProviderChange;\n this.bookreader = bookreader;\n this.icon = html`<ia-icon-search style=\"width: var(--iconWidth); height: var(--iconHeight);\"></ia-icon-search>`;\n this.label = 'Search inside';\n this.menuDetails = this.getMenuDetails();\n this.id = 'search';\n this.component = this.getComponent();\n this.bindEventListeners();\n }\n\n getMenuDetails() {\n const { resultsCount, query, queryInProgress } = searchState;\n if (queryInProgress || !query) { return nothing; }\n const unit = resultsCount === 1 ? 'result' : 'results';\n return html`(${resultsCount} ${unit})`;\n }\n\n bindEventListeners() {\n window.addEventListener('BookReader:SearchStarted', this.onSearchStarted);\n window.addEventListener('BookReader:SearchCallback', this.onSearchResultsChange);\n window.addEventListener('BookReader:SearchCallbackEmpty', (event) => { this.onSearchRequestError(event, 'noResults'); });\n window.addEventListener('BookReader:SearchCallbackNotIndexed', (event) => { this.onSearchRequestError(event, 'notIndexed'); });\n window.addEventListener('BookReader:SearchCallbackError', (event) => { this.onSearchRequestError(event); });\n window.addEventListener('BookReader:SearchResultsCleared', () => { this.onSearchResultsCleared(); });\n window.addEventListener('BookReader:SearchCanceled', (e) => { this.onSearchCanceled(e); });\n }\n\n /**\n * Cancel search handler\n * resets `searchState`\n */\n onSearchCanceled() {\n searchState = {\n query: '',\n results: [],\n resultsCount: 0,\n queryInProgress: false,\n errorMessage: '',\n };\n const updateMenuFor = {\n searchCanceled: true\n };\n this.updateMenu(updateMenuFor);\n }\n\n onSearchStarted(e) {\n const { term = '', instance } = e.detail.props;\n if (instance) {\n this.bookreader = instance;\n }\n searchState.query = term;\n searchState.results = [];\n searchState.resultsCount = 0;\n searchState.queryInProgress = true;\n searchState.errorMessage = '';\n this.updateMenu();\n }\n\n onBookSearchInitiated({ detail }) {\n searchState.query = detail.query;\n this.bookreader.search(searchState.query);\n }\n\n onSearchRequestError(event, errorType = 'default') {\n const { detail: { props = {} } } = event;\n const { instance = null } = props;\n if (instance) {\n /* keep bookreader instance reference up-to-date */\n this.bookreader = instance;\n }\n const errorMessages = {\n noResults: '0 results',\n notIndexed: `This book hasn't been indexed for searching yet. We've just started indexing it,\n so search should be available soon. Please try again later. Thanks!`,\n default: 'Sorry, there was an error with your search. Please try again.',\n };\n\n const messageToShow = errorMessages[errorType] ?? errorMessages.default;\n searchState.query = instance?.searchResults?.q || '';\n searchState.results = [];\n searchState.resultsCount = 0;\n searchState.queryInProgress = false;\n searchState.errorMessage = html`<p class=\"error\">${messageToShow}</p>`;\n this.updateMenu();\n }\n\n onSearchResultsChange({ detail: { props = {} } }) {\n const { instance = null, results: searchResults = [] } = props;\n if (instance) {\n /* keep bookreader instance reference up-to-date */\n this.bookreader = instance;\n }\n const results = searchResults.matches || [];\n const resultsCount = results.length;\n const query = searchResults.q;\n const queryInProgress = false;\n searchState = { results, resultsCount, query, queryInProgress, errorMessage: '' };\n this.updateMenu();\n }\n\n searchCanceledInMenu() {\n this.bookreader?.cancelSearchRequest();\n }\n\n onSearchResultsCleared() {\n searchState = {\n query: '',\n results: [],\n resultsCount: 0,\n queryInProgress: false,\n errorMessage: '',\n };\n this.updateMenu({ openMenu: false });\n this.bookreader?.searchView?.clearSearchFieldAndResults(false);\n }\n\n /**\n * Relays how to update side menu given the context of a search update\n @param {{searchCanceled: boolean}} searchUpdates\n */\n updateMenu(searchUpdates = {}) {\n this.menuDetails = this.getMenuDetails();\n this.component = this.getComponent();\n this.onProviderChange(this.bookreader, searchUpdates);\n }\n\n getComponent() {\n const { query, results, queryInProgress, errorMessage } = searchState;\n return html`\n <ia-book-search-results\n .query=${query}\n .results=${results}\n .errorMessage=${errorMessage}\n ?queryInProgress=${queryInProgress}\n ?renderSearchAllFiles=${false}\n @resultSelected=${this.onSearchResultsClicked}\n @bookSearchInitiated=${this.onBookSearchInitiated}\n @bookSearchResultsCleared=${this.onSearchResultsCleared}\n @bookSearchCanceled=${this.searchCanceledInMenu}\n ></ia-book-search-results>\n `;\n }\n\n onSearchResultsClicked({ detail }) {\n const page = detail.match.par[0].page;\n this.advanceToPage(page);\n }\n\n advanceToPage(leaf) {\n const page = this.bookreader.leafNumToIndex(leaf);\n this.bookreader._searchPluginGoToResult(page);\n }\n}\n","import { html } from 'lit-html';\n\nexport default html`\n<svg\n viewBox=\"0 0 24 24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-labelledby=\"downloadTitleID downloadDescID\"\n>\n <title id=\"downloadTitleID\">Download icon</title>\n <desc id=\"downloadDescID\">An arrow pointing downward at an empty document tray</desc>\n <g class=\"fill-color\" fill-rule=\"nonzero\">\n <path d=\"m1.04347826 22c-.57629713 0-1.04347826.4477153-1.04347826 1s.46718113 1 1.04347826 1h21.91304344c.5762972 0 1.0434783-.4477153 1.0434783-1s-.4671811-1-1.0434783-1z\"/>\n <path d=\"m12 0c-.8284271 0-1.5.67526574-1.5 1.50824823v8.0007855h-4.75l6.25 10.49096627 6.25-10.49096627h-4.75v-8.0007855c0-.83298249-.6715729-1.50824823-1.5-1.50824823z\"/>\n </g>\n</svg>\n`;\n","import icon from './index.js';\nimport { css, LitElement } from 'lit-element';\n\nclass IAIconDl extends LitElement {\n static get styles() {\n return css`\n :host {\n width: var(--iconWidth, 'auto');\n height: var(--iconHeight, 'auto');\n }\n\n .fill-color {\n fill: var(--iconFillColor);\n }\n\n .stroke-color {\n stroke: var(--iconStrokeColor);\n }\n `;\n }\n\n render() {\n return icon;\n }\n}\n\ncustomElements.define('ia-icon-dl', IAIconDl);\n\nexport default IAIconDl;","import { css, html, LitElement, nothing } from 'lit';\nimport buttonStyles from '../assets/button-base.js';\nexport class IABookDownloads extends LitElement {\n static get properties() {\n return {\n downloads: { type: Array },\n expiration: { type: Number },\n renderHeader: { type: Boolean },\n isBookProtected: { type: Boolean },\n };\n }\n\n constructor() {\n super();\n this.downloads = [];\n this.expiration = 0;\n this.renderHeader = false;\n this.isBookProtected = false;\n }\n\n get formatsCount() {\n const count = this.downloads.length;\n return count ? html`<p>${count} format${count > 1 ? 's' : ''}</p>` : html``;\n }\n\n get loanExpiryMessage() {\n return this.expiration\n ? html`<h2>These files will expire in ${this.expiration} days.</h2>`\n : html``;\n }\n\n renderDownloadOptions() {\n return this.downloads.map(option => (\n html`\n <li>\n <a class=\"ia-button link primary\" href=\"${option.url}\">Get ${option.type}</a>\n ${option.note ? html`<p>${option.note}</p>` : html``}\n </li>\n `\n ));\n }\n\n get header() {\n if (!this.renderHeader) {\n return nothing;\n }\n return html`\n <header>\n <h3>Downloadable files</h3>\n ${this.formatsCount}\n </header>\n `;\n }\n\n get accessProtectedBook() {\n return html`\n <p>To access downloaded books, you need Adobe-compliant software on your device. The Internet Archive will administer this loan, but Adobe may also collect some information.</p>\n <a class=\"ia-button external primary\" href=\"https://www.adobe.com/solutions/ebook/digital-editions/download.html\" rel=\"noopener noreferrer\" target=\"_blank\">Install Adobe Digital Editions</a>\n `;\n }\n\n render() {\n return html`\n ${this.header}\n ${this.loanExpiryMessage}\n <ul>${this.renderDownloadOptions()}</ul>\n ${this.isBookProtected ? this.accessProtectedBook : nothing}\n `;\n }\n\n static get styles() {\n const mainCss = css`\n :host {\n display: block;\n height: 100%;\n padding: 1.5rem 0;\n overflow-y: auto;\n font-size: 1.4rem;\n box-sizing: border-box;\n }\n\n a.close ia-icon {\n --iconWidth: 18px;\n --iconHeight: 18px;\n }\n a.close {\n justify-self: end;\n }\n\n header {\n display: flex;\n align-items: center;\n padding: 0 2rem;\n }\n header p {\n padding: 0;\n margin: 0;\n font-size: 1.2rem;\n font-weight: bold;\n font-style: italic;\n }\n header div {\n display: flex;\n align-items: baseline;\n } \n\n h2 {\n font-size: 1.6rem;\n }\n\n h3 {\n padding: 0;\n margin: 0 1rem 0 0;\n font-size: 1.4rem;\n }\n\n ul {\n padding: 0;\n margin: 0;\n list-style: none;\n }\n\n p {\n margin: .3rem 0 0 0;\n }\n\n li,\n ul + p {\n padding-bottom: 1.2rem;\n font-size: 1.2rem;\n line-height: 140%;\n }\n `;\n\n return [buttonStyles, mainCss];\n }\n}\ncustomElements.define('ia-book-downloads', IABookDownloads);\n","import { html } from 'lit';\nimport '@internetarchive/icon-dl/icon-dl';\nimport './downloads';\n\nconst menuBase = {\n pdf: {\n type: 'Encrypted Adobe PDF',\n url: '#',\n note: 'PDF files contain high quality images of pages.',\n },\n epub: {\n type: 'Encrypted Adobe ePub',\n url: '#',\n note: 'ePub files are smaller in size, but may contain errors.',\n }\n};\n\nconst publicMenuBase = {\n pdf: \"PDF\",\n epub: \"ePub\"\n};\n\nexport default class DownloadsProvider {\n\n constructor({ bookreader }) {\n this.icon = html`<ia-icon-dl style=\"width: var(--iconWidth); height: var(--iconHeight);\"></ia-icon-dl>`;\n this.label = 'Downloadable files';\n this.menuDetails = '';\n this.downloads = [];\n this.id = 'downloads';\n this.component = '';\n this.isBookProtected = bookreader?.options?.isProtected || false;\n\n this.computeAvailableTypes = this.computeAvailableTypes.bind(this);\n this.update = this.update.bind(this);\n }\n\n update(downloadTypes) {\n this.computeAvailableTypes(downloadTypes);\n this.component = this.menu;\n this.component.isBookProtected = this.isBookProtected;\n\n const ending = this.downloads.length === 1 ? '' : 's';\n this.menuDetails = `(${this.downloads.length} format${ending})`;\n }\n\n /**\n * Generates Download Menu Info for available types\n * sets global `downloads`\n * @param availableTypes\n */\n computeAvailableTypes(availableTypes = []) {\n const menuData = availableTypes.reduce((found, incoming = []) => {\n const [ type = '', link = '' ] = incoming;\n const formattedType = type.toLowerCase();\n const downloadOption = menuBase[formattedType] || null;\n\n if (downloadOption) {\n const menuButtonText = this.isBookProtected ? menuBase[formattedType].type : publicMenuBase[formattedType];\n const menuInfo = Object.assign({}, downloadOption, { url: link, type: menuButtonText});\n found.push(menuInfo);\n }\n return found;\n }, []);\n\n this.downloads = menuData;\n }\n\n get menu () {\n return html`<ia-book-downloads .downloads=${this.downloads}></ia-book-downloads>`;\n }\n}\n","import { html } from 'lit';\n\nexport default html`\n<svg\n viewBox=\"0 0 24 24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-labelledby=\"visualAdjustmentTitleID visualAdjustmentDescID\"\n>\n <title id=\"visualAdjustmentTitleID\">Visual adjustment</title>\n <desc id=\"visualAdjustmentDescID\">A circle with its left hemisphere filled</desc>\n <path class=\"fill-color\" d=\"m12 0c6.627417 0 12 5.372583 12 12s-5.372583 12-12 12-12-5.372583-12-12 5.372583-12 12-12zm0 2v20l.2664041-.0034797c5.399703-.1412166 9.7335959-4.562751 9.7335959-9.9965203 0-5.5228475-4.4771525-10-10-10z\" fill-rule=\"evenodd\" />\n</svg>\n`;\n","import { css, LitElement } from 'lit';\nimport icon from './index.js';\n\nclass IAIconVisualAdjustment extends LitElement {\n static get styles() {\n return css`\n :host {\n width: var(--iconWidth, 'auto');\n height: var(--iconHeight, 'auto');\n }\n\n .fill-color {\n fill: var(--iconFillColor);\n }\n\n .stroke-color {\n stroke: var(--iconStrokeColor);\n }\n `;\n }\n\n render() {\n return icon;\n }\n}\n\ncustomElements.define('ia-icon-visual-adjustment', IAIconVisualAdjustment);\n\nexport default IAIconVisualAdjustment;\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {_$LH, Part, DirectiveParent, TemplateResult} from './lit-html.js';\nimport {\n DirectiveResult,\n DirectiveClass,\n PartInfo,\n AttributePartInfo,\n} from './directive.js';\ntype Primitive = null | undefined | boolean | number | string | symbol | bigint;\n\nconst {_ChildPart: ChildPart} = _$LH;\n\ntype ChildPart = InstanceType<typeof ChildPart>;\n\nconst ENABLE_SHADYDOM_NOPATCH = true;\n\nconst wrap =\n ENABLE_SHADYDOM_NOPATCH &&\n window.ShadyDOM?.inUse &&\n window.ShadyDOM?.noPatch === true\n ? window.ShadyDOM!.wrap\n : (node: Node) => node;\n\n/**\n * Tests if a value is a primitive value.\n *\n * See https://tc39.github.io/ecma262/#sec-typeof-operator\n */\nexport const isPrimitive = (value: unknown): value is Primitive =>\n value === null || (typeof value != 'object' && typeof value != 'function');\n\nexport const TemplateResultType = {\n HTML: 1,\n SVG: 2,\n} as const;\n\nexport type TemplateResultType =\n typeof TemplateResultType[keyof typeof TemplateResultType];\n\n/**\n * Tests if a value is a TemplateResult.\n */\nexport const isTemplateResult = (\n value: unknown,\n type?: TemplateResultType\n): value is TemplateResult =>\n type === undefined\n ? // This property needs to remain unminified.\n (value as TemplateResult)?.['_$litType$'] !== undefined\n : (value as TemplateResult)?.['_$litType$'] === type;\n\n/**\n * Tests if a value is a DirectiveResult.\n */\nexport const isDirectiveResult = (value: unknown): value is DirectiveResult =>\n // This property needs to remain unminified.\n (value as DirectiveResult)?.['_$litDirective$'] !== undefined;\n\n/**\n * Retrieves the Directive class for a DirectiveResult\n */\nexport const getDirectiveClass = (value: unknown): DirectiveClass | undefined =>\n // This property needs to remain unminified.\n (value as DirectiveResult)?.['_$litDirective$'];\n\n/**\n * Tests whether a part has only a single-expression with no strings to\n * interpolate between.\n *\n * Only AttributePart and PropertyPart can have multiple expressions.\n * Multi-expression parts have a `strings` property and single-expression\n * parts do not.\n */\nexport const isSingleExpression = (part: PartInfo) =>\n (part as AttributePartInfo).strings === undefined;\n\nconst createMarker = () => document.createComment('');\n\n/**\n * Inserts a ChildPart into the given container ChildPart's DOM, either at the\n * end of the container ChildPart, or before the optional `refPart`.\n *\n * This does not add the part to the containerPart's committed value. That must\n * be done by callers.\n *\n * @param containerPart Part within which to add the new ChildPart\n * @param refPart Part before which to add the new ChildPart; when omitted the\n * part added to the end of the `containerPart`\n * @param part Part to insert, or undefined to create a new part\n */\nexport const insertPart = (\n containerPart: ChildPart,\n refPart?: ChildPart,\n part?: ChildPart\n): ChildPart => {\n const container = wrap(containerPart._$startNode).parentNode!;\n\n const refNode =\n refPart === undefined ? containerPart._$endNode : refPart._$startNode;\n\n if (part === undefined) {\n const startNode = wrap(container).insertBefore(createMarker(), refNode);\n const endNode = wrap(container).insertBefore(createMarker(), refNode);\n part = new ChildPart(\n startNode,\n endNode,\n containerPart,\n containerPart.options\n );\n } else {\n const endNode = wrap(part._$endNode!).nextSibling;\n const oldParent = part._$parent;\n const parentChanged = oldParent !== containerPart;\n if (parentChanged) {\n part._$reparentDisconnectables?.(containerPart);\n // Note that although `_$reparentDisconnectables` updates the part's\n // `_$parent` reference after unlinking from its current parent, that\n // method only exists if Disconnectables are present, so we need to\n // unconditionally set it here\n part._$parent = containerPart;\n // Since the _$isConnected getter is somewhat costly, only\n // read it once we know the subtree has directives that need\n // to be notified\n let newConnectionState;\n if (\n part._$notifyConnectionChanged !== undefined &&\n (newConnectionState = containerPart._$isConnected) !==\n oldParent!._$isConnected\n ) {\n part._$notifyConnectionChanged(newConnectionState);\n }\n }\n if (endNode !== refNode || parentChanged) {\n let start: Node | null = part._$startNode;\n while (start !== endNode) {\n const n: Node | null = wrap(start!).nextSibling;\n wrap(container).insertBefore(start!, refNode);\n start = n;\n }\n }\n }\n\n return part;\n};\n\n/**\n * Sets the value of a Part.\n *\n * Note that this should only be used to set/update the value of user-created\n * parts (i.e. those created using `insertPart`); it should not be used\n * by directives to set the value of the directive's container part. Directives\n * should return a value from `update`/`render` to update their part state.\n *\n * For directives that require setting their part value asynchronously, they\n * should extend `AsyncDirective` and call `this.setValue()`.\n *\n * @param part Part to set\n * @param value Value to set\n * @param index For `AttributePart`s, the index to set\n * @param directiveParent Used internally; should not be set by user\n */\nexport const setChildPartValue = <T extends ChildPart>(\n part: T,\n value: unknown,\n directiveParent: DirectiveParent = part\n): T => {\n part._$setValue(value, directiveParent);\n return part;\n};\n\n// A sentinal value that can never appear as a part value except when set by\n// live(). Used to force a dirty-check to fail and cause a re-render.\nconst RESET_VALUE = {};\n\n/**\n * Sets the committed value of a ChildPart directly without triggering the\n * commit stage of the part.\n *\n * This is useful in cases where a directive needs to update the part such\n * that the next update detects a value change or not. When value is omitted,\n * the next update will be guaranteed to be detected as a change.\n *\n * @param part\n * @param value\n */\nexport const setCommittedValue = (part: Part, value: unknown = RESET_VALUE) =>\n (part._$committedValue = value);\n\n/**\n * Returns the committed value of a ChildPart.\n *\n * The committed value is used for change detection and efficient updates of\n * the part. It can differ from the value set by the template or directive in\n * cases where the template value is transformed before being commited.\n *\n * - `TemplateResult`s are committed as a `TemplateInstance`\n * - Iterables are committed as `Array<ChildPart>`\n * - All other types are committed as the template value or value returned or\n * set by a directive.\n *\n * @param part\n */\nexport const getCommittedValue = (part: ChildPart) => part._$committedValue;\n\n/**\n * Removes a ChildPart from the DOM, including any of its content.\n *\n * @param part The Part to remove\n */\nexport const removePart = (part: ChildPart) => {\n part._$notifyConnectionChanged?.(false, true);\n let start: ChildNode | null = part._$startNode;\n const end: ChildNode | null = wrap(part._$endNode!).nextSibling;\n while (start !== end) {\n const n: ChildNode | null = wrap(start!).nextSibling;\n (wrap(start!) as ChildNode).remove();\n start = n;\n }\n};\n\nexport const clearPart = (part: ChildPart) => {\n part._$clear();\n};\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {ChildPart, noChange} from '../lit-html.js';\nimport {directive, Directive, PartInfo, PartType} from '../directive.js';\nimport {\n insertPart,\n getCommittedValue,\n removePart,\n setCommittedValue,\n setChildPartValue,\n} from '../directive-helpers.js';\n\nexport type KeyFn<T> = (item: T, index: number) => unknown;\nexport type ItemTemplate<T> = (item: T, index: number) => unknown;\n\n// Helper for generating a map of array item to its index over a subset\n// of an array (used to lazily generate `newKeyToIndexMap` and\n// `oldKeyToIndexMap`)\nconst generateMap = (list: unknown[], start: number, end: number) => {\n const map = new Map<unknown, number>();\n for (let i = start; i <= end; i++) {\n map.set(list[i], i);\n }\n return map;\n};\n\nclass RepeatDirective extends Directive {\n private _itemKeys?: unknown[];\n\n constructor(partInfo: PartInfo) {\n super(partInfo);\n if (partInfo.type !== PartType.CHILD) {\n throw new Error('repeat() can only be used in text expressions');\n }\n }\n\n private _getValuesAndKeys<T>(\n items: Iterable<T>,\n keyFnOrTemplate: KeyFn<T> | ItemTemplate<T>,\n template?: ItemTemplate<T>\n ) {\n let keyFn: KeyFn<T> | undefined;\n if (template === undefined) {\n template = keyFnOrTemplate;\n } else if (keyFnOrTemplate !== undefined) {\n keyFn = keyFnOrTemplate as KeyFn<T>;\n }\n const keys = [];\n const values = [];\n let index = 0;\n for (const item of items) {\n keys[index] = keyFn ? keyFn(item, index) : index;\n values[index] = template!(item, index);\n index++;\n }\n return {\n values,\n keys,\n };\n }\n\n render<T>(items: Iterable<T>, template: ItemTemplate<T>): Array<unknown>;\n render<T>(\n items: Iterable<T>,\n keyFn: KeyFn<T> | ItemTemplate<T>,\n template: ItemTemplate<T>\n ): Array<unknown>;\n render<T>(\n items: Iterable<T>,\n keyFnOrTemplate: KeyFn<T> | ItemTemplate<T>,\n template?: ItemTemplate<T>\n ) {\n return this._getValuesAndKeys(items, keyFnOrTemplate, template).values;\n }\n\n override update<T>(\n containerPart: ChildPart,\n [items, keyFnOrTemplate, template]: [\n Iterable<T>,\n KeyFn<T> | ItemTemplate<T>,\n ItemTemplate<T>\n ]\n ) {\n // Old part & key lists are retrieved from the last update (which may\n // be primed by hydration)\n const oldParts = getCommittedValue(\n containerPart\n ) as Array<ChildPart | null>;\n const {values: newValues, keys: newKeys} = this._getValuesAndKeys(\n items,\n keyFnOrTemplate,\n template\n );\n\n // We check that oldParts, the committed value, is an Array as an\n // indicator that the previous value came from a repeat() call. If\n // oldParts is not an Array then this is the first render and we return\n // an array for lit-html's array handling to render, and remember the\n // keys.\n if (!Array.isArray(oldParts)) {\n this._itemKeys = newKeys;\n return newValues;\n }\n\n // In SSR hydration it's possible for oldParts to be an arrray but for us\n // to not have item keys because the update() hasn't run yet. We set the\n // keys to an empty array. This will cause all oldKey/newKey comparisons\n // to fail and execution to fall to the last nested brach below which\n // reuses the oldPart.\n const oldKeys = (this._itemKeys ??= []);\n\n // New part list will be built up as we go (either reused from\n // old parts or created for new keys in this update). This is\n // saved in the above cache at the end of the update.\n const newParts: ChildPart[] = [];\n\n // Maps from key to index for current and previous update; these\n // are generated lazily only when needed as a performance\n // optimization, since they are only required for multiple\n // non-contiguous changes in the list, which are less common.\n let newKeyToIndexMap!: Map<unknown, number>;\n let oldKeyToIndexMap!: Map<unknown, number>;\n\n // Head and tail pointers to old parts and new values\n let oldHead = 0;\n let oldTail = oldParts.length - 1;\n let newHead = 0;\n let newTail = newValues.length - 1;\n\n // Overview of O(n) reconciliation algorithm (general approach\n // based on ideas found in ivi, vue, snabbdom, etc.):\n //\n // * We start with the list of old parts and new values (and\n // arrays of their respective keys), head/tail pointers into\n // each, and we build up the new list of parts by updating\n // (and when needed, moving) old parts or creating new ones.\n // The initial scenario might look like this (for brevity of\n // the diagrams, the numbers in the array reflect keys\n // associated with the old parts or new values, although keys\n // and parts/values are actually stored in parallel arrays\n // indexed using the same head/tail pointers):\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, 2, 3, 4, 5, 6]\n // newParts: [ , , , , , , ]\n // newKeys: [0, 2, 1, 4, 3, 7, 6] <- reflects the user's new\n // item order\n // newHead ^ ^ newTail\n //\n // * Iterate old & new lists from both sides, updating,\n // swapping, or removing parts at the head/tail locations\n // until neither head nor tail can move.\n //\n // * Example below: keys at head pointers match, so update old\n // part 0 in-place (no need to move it) and record part 0 in\n // the `newParts` list. The last thing we do is advance the\n // `oldHead` and `newHead` pointers (will be reflected in the\n // next diagram).\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, 2, 3, 4, 5, 6]\n // newParts: [0, , , , , , ] <- heads matched: update 0\n // newKeys: [0, 2, 1, 4, 3, 7, 6] and advance both oldHead\n // & newHead\n // newHead ^ ^ newTail\n //\n // * Example below: head pointers don't match, but tail\n // pointers do, so update part 6 in place (no need to move\n // it), and record part 6 in the `newParts` list. Last,\n // advance the `oldTail` and `oldHead` pointers.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, 2, 3, 4, 5, 6]\n // newParts: [0, , , , , , 6] <- tails matched: update 6\n // newKeys: [0, 2, 1, 4, 3, 7, 6] and advance both oldTail\n // & newTail\n // newHead ^ ^ newTail\n //\n // * If neither head nor tail match; next check if one of the\n // old head/tail items was removed. We first need to generate\n // the reverse map of new keys to index (`newKeyToIndexMap`),\n // which is done once lazily as a performance optimization,\n // since we only hit this case if multiple non-contiguous\n // changes were made. Note that for contiguous removal\n // anywhere in the list, the head and tails would advance\n // from either end and pass each other before we get to this\n // case and removals would be handled in the final while loop\n // without needing to generate the map.\n //\n // * Example below: The key at `oldTail` was removed (no longer\n // in the `newKeyToIndexMap`), so remove that part from the\n // DOM and advance just the `oldTail` pointer.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, 2, 3, 4, 5, 6]\n // newParts: [0, , , , , , 6] <- 5 not in new map: remove\n // newKeys: [0, 2, 1, 4, 3, 7, 6] 5 and advance oldTail\n // newHead ^ ^ newTail\n //\n // * Once head and tail cannot move, any mismatches are due to\n // either new or moved items; if a new key is in the previous\n // \"old key to old index\" map, move the old part to the new\n // location, otherwise create and insert a new part. Note\n // that when moving an old part we null its position in the\n // oldParts array if it lies between the head and tail so we\n // know to skip it when the pointers get there.\n //\n // * Example below: neither head nor tail match, and neither\n // were removed; so find the `newHead` key in the\n // `oldKeyToIndexMap`, and move that old part's DOM into the\n // next head position (before `oldParts[oldHead]`). Last,\n // null the part in the `oldPart` array since it was\n // somewhere in the remaining oldParts still to be scanned\n // (between the head and tail pointers) so that we know to\n // skip that old part on future iterations.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, -, 3, 4, 5, 6]\n // newParts: [0, 2, , , , , 6] <- stuck: update & move 2\n // newKeys: [0, 2, 1, 4, 3, 7, 6] into place and advance\n // newHead\n // newHead ^ ^ newTail\n //\n // * Note that for moves/insertions like the one above, a part\n // inserted at the head pointer is inserted before the\n // current `oldParts[oldHead]`, and a part inserted at the\n // tail pointer is inserted before `newParts[newTail+1]`. The\n // seeming asymmetry lies in the fact that new parts are\n // moved into place outside in, so to the right of the head\n // pointer are old parts, and to the right of the tail\n // pointer are new parts.\n //\n // * We always restart back from the top of the algorithm,\n // allowing matching and simple updates in place to\n // continue...\n //\n // * Example below: the head pointers once again match, so\n // simply update part 1 and record it in the `newParts`\n // array. Last, advance both head pointers.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, -, 3, 4, 5, 6]\n // newParts: [0, 2, 1, , , , 6] <- heads matched: update 1\n // newKeys: [0, 2, 1, 4, 3, 7, 6] and advance both oldHead\n // & newHead\n // newHead ^ ^ newTail\n //\n // * As mentioned above, items that were moved as a result of\n // being stuck (the final else clause in the code below) are\n // marked with null, so we always advance old pointers over\n // these so we're comparing the next actual old value on\n // either end.\n //\n // * Example below: `oldHead` is null (already placed in\n // newParts), so advance `oldHead`.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, -, 3, 4, 5, 6] <- old head already used:\n // newParts: [0, 2, 1, , , , 6] advance oldHead\n // newKeys: [0, 2, 1, 4, 3, 7, 6]\n // newHead ^ ^ newTail\n //\n // * Note it's not critical to mark old parts as null when they\n // are moved from head to tail or tail to head, since they\n // will be outside the pointer range and never visited again.\n //\n // * Example below: Here the old tail key matches the new head\n // key, so the part at the `oldTail` position and move its\n // DOM to the new head position (before `oldParts[oldHead]`).\n // Last, advance `oldTail` and `newHead` pointers.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, -, 3, 4, 5, 6]\n // newParts: [0, 2, 1, 4, , , 6] <- old tail matches new\n // newKeys: [0, 2, 1, 4, 3, 7, 6] head: update & move 4,\n // advance oldTail & newHead\n // newHead ^ ^ newTail\n //\n // * Example below: Old and new head keys match, so update the\n // old head part in place, and advance the `oldHead` and\n // `newHead` pointers.\n //\n // oldHead v oldTail\n // oldKeys: [0, 1, -, 3, 4, 5, 6]\n // newParts: [0, 2, 1, 4, 3, ,6] <- heads match: update 3\n // newKeys: [0, 2, 1, 4, 3, 7, 6] and advance oldHead &\n // newHead\n // newHead ^ ^ newTail\n //\n // * Once the new or old pointers move past each other then all\n // we have left is additions (if old list exhausted) or\n // removals (if new list exhausted). Those are handled in the\n // final while loops at the end.\n //\n // * Example below: `oldHead` exceeded `oldTail`, so we're done\n // with the main loop. Create the remaining part and insert\n // it at the new head position, and the update is complete.\n //\n // (oldHead > oldTail)\n // oldKeys: [0, 1, -, 3, 4, 5, 6]\n // newParts: [0, 2, 1, 4, 3, 7 ,6] <- create and insert 7\n // newKeys: [0, 2, 1, 4, 3, 7, 6]\n // newHead ^ newTail\n //\n // * Note that the order of the if/else clauses is not\n // important to the algorithm, as long as the null checks\n // come first (to ensure we're always working on valid old\n // parts) and that the final else clause comes last (since\n // that's where the expensive moves occur). The order of\n // remaining clauses is is just a simple guess at which cases\n // will be most common.\n //\n // * Note, we could calculate the longest\n // increasing subsequence (LIS) of old items in new position,\n // and only move those not in the LIS set. However that costs\n // O(nlogn) time and adds a bit more code, and only helps\n // make rare types of mutations require fewer moves. The\n // above handles removes, adds, reversal, swaps, and single\n // moves of contiguous items in linear time, in the minimum\n // number of moves. As the number of multiple moves where LIS\n // might help approaches a random shuffle, the LIS\n // optimization becomes less helpful, so it seems not worth\n // the code at this point. Could reconsider if a compelling\n // case arises.\n\n while (oldHead <= oldTail && newHead <= newTail) {\n if (oldParts[oldHead] === null) {\n // `null` means old part at head has already been used\n // below; skip\n oldHead++;\n } else if (oldParts[oldTail] === null) {\n // `null` means old part at tail has already been used\n // below; skip\n oldTail--;\n } else if (oldKeys[oldHead] === newKeys[newHead]) {\n // Old head matches new head; update in place\n newParts[newHead] = setChildPartValue(\n oldParts[oldHead]!,\n newValues[newHead]\n );\n oldHead++;\n newHead++;\n } else if (oldKeys[oldTail] === newKeys[newTail]) {\n // Old tail matches new tail; update in place\n newParts[newTail] = setChildPartValue(\n oldParts[oldTail]!,\n newValues[newTail]\n );\n oldTail--;\n newTail--;\n } else if (oldKeys[oldHead] === newKeys[newTail]) {\n // Old head matches new tail; update and move to new tail\n newParts[newTail] = setChildPartValue(\n oldParts[oldHead]!,\n newValues[newTail]\n );\n insertPart(containerPart, newParts[newTail + 1], oldParts[oldHead]!);\n oldHead++;\n newTail--;\n } else if (oldKeys[oldTail] === newKeys[newHead]) {\n // Old tail matches new head; update and move to new head\n newParts[newHead] = setChildPartValue(\n oldParts[oldTail]!,\n newValues[newHead]\n );\n insertPart(containerPart, oldParts[oldHead]!, oldParts[oldTail]!);\n oldTail--;\n newHead++;\n } else {\n if (newKeyToIndexMap === undefined) {\n // Lazily generate key-to-index maps, used for removals &\n // moves below\n newKeyToIndexMap = generateMap(newKeys, newHead, newTail);\n oldKeyToIndexMap = generateMap(oldKeys, oldHead, oldTail);\n }\n if (!newKeyToIndexMap.has(oldKeys[oldHead])) {\n // Old head is no longer in new list; remove\n removePart(oldParts[oldHead]!);\n oldHead++;\n } else if (!newKeyToIndexMap.has(oldKeys[oldTail])) {\n // Old tail is no longer in new list; remove\n removePart(oldParts[oldTail]!);\n oldTail--;\n } else {\n // Any mismatches at this point are due to additions or\n // moves; see if we have an old part we can reuse and move\n // into place\n const oldIndex = oldKeyToIndexMap.get(newKeys[newHead]);\n const oldPart = oldIndex !== undefined ? oldParts[oldIndex] : null;\n if (oldPart === null) {\n // No old part for this value; create a new one and\n // insert it\n const newPart = insertPart(containerPart, oldParts[oldHead]!);\n setChildPartValue(newPart, newValues[newHead]);\n newParts[newHead] = newPart;\n } else {\n // Reuse old part\n newParts[newHead] = setChildPartValue(oldPart, newValues[newHead]);\n insertPart(containerPart, oldParts[oldHead]!, oldPart);\n // This marks the old part as having been used, so that\n // it will be skipped in the first two checks above\n oldParts[oldIndex as number] = null;\n }\n newHead++;\n }\n }\n }\n // Add parts for any remaining new values\n while (newHead <= newTail) {\n // For all remaining additions, we insert before last new\n // tail, since old pointers are no longer valid\n const newPart = insertPart(containerPart, newParts[newTail + 1]);\n setChildPartValue(newPart, newValues[newHead]);\n newParts[newHead++] = newPart;\n }\n // Remove any remaining unused old parts\n while (oldHead <= oldTail) {\n const oldPart = oldParts[oldHead++];\n if (oldPart !== null) {\n removePart(oldPart);\n }\n }\n\n // Save order of new parts for next round\n this._itemKeys = newKeys;\n // Directly set part value, bypassing it's dirty-checking\n setCommittedValue(containerPart, newParts);\n return noChange;\n }\n}\n\nexport interface RepeatDirectiveFn {\n <T>(\n items: Iterable<T>,\n keyFnOrTemplate: KeyFn<T> | ItemTemplate<T>,\n template?: ItemTemplate<T>\n ): unknown;\n <T>(items: Iterable<T>, template: ItemTemplate<T>): unknown;\n <T>(\n items: Iterable<T>,\n keyFn: KeyFn<T> | ItemTemplate<T>,\n template: ItemTemplate<T>\n ): unknown;\n}\n\n/**\n * A directive that repeats a series of values (usually `TemplateResults`)\n * generated from an iterable, and updates those items efficiently when the\n * iterable changes based on user-provided `keys` associated with each item.\n *\n * Note that if a `keyFn` is provided, strict key-to-DOM mapping is maintained,\n * meaning previous DOM for a given key is moved into the new position if\n * needed, and DOM will never be reused with values for different keys (new DOM\n * will always be created for new keys). This is generally the most efficient\n * way to use `repeat` since it performs minimum unnecessary work for insertions\n * and removals.\n *\n * The `keyFn` takes two parameters, the item and its index, and returns a unique key value.\n *\n * ```js\n * html`\n * <ol>\n * ${repeat(this.items, (item) => item.id, (item, index) => {\n * return html`<li>${index}: ${item.name}</li>`;\n * })}\n * </ol>\n * `\n * ```\n *\n * **Important**: If providing a `keyFn`, keys *must* be unique for all items in a\n * given call to `repeat`. The behavior when two or more items have the same key\n * is undefined.\n *\n * If no `keyFn` is provided, this directive will perform similar to mapping\n * items to values, and DOM will be reused against potentially different items.\n */\nexport const repeat = directive(RepeatDirective) as RepeatDirectiveFn;\n\n/**\n * The type of the class that powers this directive. Necessary for naming the\n * directive's return type.\n */\nexport type {RepeatDirective};\n","import { html } from 'lit-html';\n\nexport default html`\n<svg\n viewBox=\"0 0 18 18\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-labelledby=\"magnify-minusTitleID magnify-minusDescID\"\n>\n <title id=\"magnify-minusTitleID\">Zoom out</title>\n <desc id=\"magnify-minusDescID\">Take a look further.</desc>\n <g\n class=\"fill-color\"\n fill=\"none\"\n fill-rule=\"nonzero\"\n >\n <path d=\"m7 0c3.854149 0 7 3.1458514 7 7 0 1.5717634-.529107 3.020558-1.410156 4.191406.0416324.03077.0808125.0647264.117187.101563l4.335938 4.335937c.3904239.3905071.3904239 1.0235559 0 1.414063-.3905071.3904239-1.0235559.3904239-1.414063 0l-4.335937-4.335938c-.0362414-.0370712-.0695452-.0769047-.09961-.11914-1.171224.882043-2.6206167 1.412109-4.193359 1.412109-3.8541486 0-7-3.145851-7-7 0-3.8541486 3.1458514-7 7-7zm0 2c-2.7732684 0-5 2.2267316-5 5s2.2267316 5 5 5 5-2.2267316 5-5-2.2267316-5-5-5z\"/>\n <path d=\"m10 7.75v-1.5h-6v1.5z\"/>\n </g>\n</svg>\n`;\n","import icon from './index.js';\nimport { css, LitElement } from 'lit-element';\n\nclass IAIconMagnifyMinus extends LitElement {\n static get styles() {\n return css`\n :host {\n width: var(--iconWidth, 'auto');\n height: var(--iconHeight, 'auto');\n }\n\n .fill-color {\n fill: var(--iconFillColor);\n }\n\n .stroke-color {\n stroke: var(--iconStrokeColor);\n }\n `;\n }\n\n render() {\n return icon;\n }\n}\n\ncustomElements.define('ia-icon-magnify-minus', IAIconMagnifyMinus);\n\nexport default IAIconMagnifyMinus;","import { html } from 'lit-html';\n\nexport default html`\n<svg\n viewBox=\"0 0 18 18\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-labelledby=\"magnify-plusTitleID magnify-plusDescID\"\n>\n <title id=\"magnify-plusTitleID\">Zoom in</title>\n <desc id=\"magnify-plusDescID\">Take a look closer.</desc>\n <g\n class=\"fill-color\"\n fill=\"none\"\n fill-rule=\"nonzero\"\n >\n <path d=\"m7 0c3.854149 0 7 3.1458514 7 7 0 1.5717634-.529107 3.020558-1.410156 4.191406.0416324.03077.0808125.0647264.117187.101563l4.335938 4.335937c.3904239.3905071.3904239 1.0235559 0 1.414063-.3905071.3904239-1.0235559.3904239-1.414063 0l-4.335937-4.335938c-.0362414-.0370712-.0695452-.0769047-.09961-.11914-1.171224.882043-2.6206167 1.412109-4.193359 1.412109-3.8541486 0-7-3.145851-7-7 0-3.8541486 3.1458514-7 7-7zm0 2c-2.7732684 0-5 2.2267316-5 5s2.2267316 5 5 5 5-2.2267316 5-5-2.2267316-5-5-5z\"/>\n <path d=\"m7.75 4v2.25h2.25v1.5h-2.25v2.25h-1.5v-2.25h-2.25v-1.5h2.25v-2.25z\"/>\n </g>\n</svg>\n`;\n","import icon from './index.js';\nimport { css, LitElement } from 'lit-element';\n\nclass IAIconMagnifyPlus extends LitElement {\n static get styles() {\n return css`\n :host {\n width: var(--iconWidth, 'auto');\n height: var(--iconHeight, 'auto');\n }\n\n .fill-color {\n fill: var(--iconFillColor);\n }\n\n .stroke-color {\n stroke: var(--iconStrokeColor);\n }\n `;\n }\n\n render() {\n return icon;\n }\n}\n\ncustomElements.define('ia-icon-magnify-plus', IAIconMagnifyPlus);\n\nexport default IAIconMagnifyPlus;","import { css, html, LitElement } from \"lit\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { nothing } from \"lit\";\nimport checkmarkIcon from '../assets/icon_checkmark.js';\nimport \"@internetarchive/icon-magnify-minus/icon-magnify-minus\";\nimport \"@internetarchive/icon-magnify-plus/icon-magnify-plus\";\n\nconst namespacedEvent = (eventName) => `visualAdjustment${eventName}`;\n\nconst events = {\n optionChange: namespacedEvent(\"OptionChanged\"),\n zoomIn: namespacedEvent(\"ZoomIn\"),\n zoomOut: namespacedEvent(\"ZoomOut\"),\n};\n\nexport class IABookVisualAdjustments extends LitElement {\n static get properties() {\n return {\n activeCount: { type: Number },\n options: { type: Array },\n renderHeader: { type: Boolean },\n showZoomControls: { type: Boolean },\n };\n }\n\n constructor() {\n super();\n\n this.activeCount = 0;\n this.options = [];\n this.renderHeader = false;\n this.showZoomControls = true;\n }\n\n firstUpdated() {\n this.activeCount = this.activeOptions.length;\n this.emitOptionChangedEvent();\n }\n\n /** Gets list of active options\n * @return array\n */\n get activeOptions() {\n return this.options.reduce(\n (results, option) => (option.active ? [...results, option.id] : results),\n []\n );\n }\n\n /**\n * Returns blob that will be emitted by event\n */\n prepareEventDetails(changedOptionId = \"\") {\n return {\n options: this.options,\n activeCount: this.activeCount,\n changedOptionId,\n };\n }\n\n /**\n * Fires custom event when options change\n * Provides state details: { options, activeCount, changedOptionId }\n *\n * @param { string } changedOptionId\n */\n emitOptionChangedEvent(changedOptionId = \"\") {\n const detail = this.prepareEventDetails(changedOptionId);\n this.dispatchEvent(\n new CustomEvent(events.optionChange, {\n bubbles: true,\n composed: true,\n detail,\n })\n );\n }\n\n emitZoomIn() {\n this.dispatchEvent(new CustomEvent(events.zoomIn));\n }\n\n emitZoomOut() {\n this.dispatchEvent(new CustomEvent(events.zoomOut));\n }\n\n /**\n * Updates adjustment & component state\n * updates params of available ajdustment options list\n * updates active adjustment count\n * triggers custom event\n * @param { string } optionName\n */\n changeActiveStateFor(optionName) {\n const updatedOptions = [...this.options];\n const checkedOption = updatedOptions.find(\n (option) => option.id === optionName\n );\n checkedOption.active = !checkedOption.active;\n this.options = updatedOptions;\n this.activeCount = this.activeOptions.length;\n this.emitOptionChangedEvent(checkedOption.id);\n }\n\n setRangeValue(id, value) {\n const updatedOptions = [...this.options];\n updatedOptions.find((o) => o.id === id).value = value;\n this.options = [...updatedOptions];\n }\n\n /* render */\n rangeSlider(option) {\n return html`\n <div class=${`range${option.active ? \" visible\" : \"\"}`}>\n <input\n type=\"range\"\n name=\"${option.id}_range\"\n min=${option.min || 0}\n max=${option.max || 100}\n step=${option.step || 1}\n .value=${option.value}\n @input=${(e) => this.setRangeValue(option.id, e.target.value)}\n @change=${() => this.emitOptionChangedEvent()}\n />\n <p>${option.value}%</p>\n </div>\n `;\n }\n\n adjustmentCheckbox(option) {\n const formID = `adjustment_${option.id}`;\n return html`<li>\n <label for=\"${formID}\">\n <span class=\"name\">${option.name}</span>\n <input\n type=\"checkbox\"\n name=\"${formID}\"\n id=\"${formID}\"\n @change=${() => this.changeActiveStateFor(option.id)}\n ?checked=${option.active}\n />\n <span class=\"icon\"></span>\n </label>\n ${option.value !== undefined ? this.rangeSlider(option) : nothing}\n </li>`;\n }\n\n get headerSection() {\n const activeAdjustments = this.activeCount\n ? html`<p>(${this.activeCount} active)</p>`\n : nothing;\n const header = html`<header>\n <h3>Visual adjustments</h3>\n ${activeAdjustments}\n </header>`;\n return this.renderHeader ? header : nothing;\n }\n\n get zoomControls() {\n return html`\n <h4>Zoom</h4>\n <button class=\"zoom_out\" @click=${this.emitZoomOut} title=\"zoom out\">\n <ia-icon-magnify-minus></ia-icon-magnify-minus>\n </button>\n <button class=\"zoom_in\" @click=${this.emitZoomIn} title=\"zoom in\">\n <ia-icon-magnify-plus></ia-icon-magnify-plus>\n </button>\n `;\n }\n\n /** @inheritdoc */\n render() {\n return html`\n ${this.headerSection}\n <ul>\n ${repeat(this.options, (option) => option.id, this.adjustmentCheckbox.bind(this))}\n </ul>\n ${this.showZoomControls ? this.zoomControls : nothing}\n `;\n }\n\n static get styles() {\n return css`\n :host {\n display: block;\n height: 100%;\n overflow-y: auto;\n font-size: 1.4rem;\n box-sizing: border-box;\n }\n\n header {\n display: flex;\n align-items: baseline;\n }\n\n h3 {\n padding: 0;\n margin: 0 1rem 0 0;\n font-size: 1.6rem;\n }\n\n header p {\n padding: 0;\n margin: 0;\n font-size: 1.2rem;\n font-weight: bold;\n font-style: italic;\n }\n\n ul {\n padding: 1rem 2rem 0 0;\n list-style: none;\n margin-top: 0;\n }\n\n [type=\"checkbox\"] {\n display: none;\n }\n\n label {\n display: flex;\n justify-content: space-between;\n align-items: baseline;\n font-size: 1.4rem;\n font-weight: bold;\n line-height: 150%;\n vertical-align: middle;\n }\n\n .icon {\n display: inline-block;\n width: 14px;\n height: 14px;\n margin-left: .7rem;\n border: 1px solid var(--primaryTextColor);\n border-radius: 2px;\n background: var(--activeButtonBg) 50% 50% no-repeat;\n }\n :checked + .icon {\n background-image: url('${checkmarkIcon}');\n }\n\n .range {\n display: none;\n padding-top: .5rem;\n }\n .range.visible {\n display: flex;\n }\n\n .range p {\n margin-left: 1rem;\n }\n\n h4 {\n padding: 1rem 0;\n margin: 0;\n font-size: 1.4rem;\n }\n\n button {\n -webkit-appearance: none;\n appearance: none;\n border: none;\n border-radius: 0;\n background: transparent;\n outline: none;\n cursor: pointer;\n --iconFillColor: var(--primaryTextColor);\n --iconStrokeColor: var(--primaryTextColor);\n height: 4rem;\n width: 4rem;\n }\n\n button * {\n display: inline-block;\n }`;\n }\n}\ncustomElements.define('ia-book-visual-adjustments', IABookVisualAdjustments);\n","import { html } from 'lit';\nimport '@internetarchive/icon-visual-adjustment/icon-visual-adjustment';\nimport './visual-adjustments';\n\nconst visualAdjustmentOptions = [{\n id: 'brightness',\n name: 'Adjust brightness',\n active: false,\n min: 0,\n max: 150,\n step: 1,\n value: 100,\n}, {\n id: 'contrast',\n name: 'Adjust contrast',\n active: false,\n min: 0,\n max: 150,\n step: 1,\n value: 100,\n}, {\n id: 'invert',\n name: 'Inverted colors (dark mode)',\n active: false,\n}, {\n id: 'grayscale',\n name: 'Grayscale',\n active: false,\n}];\n\nexport default class VisualAdjustmentsProvider {\n constructor(options) {\n const { onProviderChange, bookreader } = options;\n this.onProviderChange = onProviderChange;\n this.bookContainer = bookreader.refs.$brContainer;\n this.bookreader = bookreader;\n\n this.onAdjustmentChange = this.onAdjustmentChange.bind(this);\n this.optionUpdateComplete = this.optionUpdateComplete.bind(this);\n this.updateOptionsCount = this.updateOptionsCount.bind(this);\n this.onZoomIn = this.onZoomIn.bind(this);\n this.onZoomOut = this.onZoomOut.bind(this);\n\n this.activeCount = 0;\n this.icon = html`<ia-icon-visual-adjustment style=\"width: var(--iconWidth); height: var(--iconHeight);\"></ia-icon-visual-adjustment>`;\n this.label = 'Visual Adjustments';\n this.menuDetails = this.updateOptionsCount();\n this.id = 'adjustment';\n this.component = html`\n <ia-book-visual-adjustments\n .options=${visualAdjustmentOptions}\n @visualAdjustmentOptionChanged=${this.onAdjustmentChange}\n @visualAdjustmentZoomIn=${this.onZoomIn}\n @visualAdjustmentZoomOut=${this.onZoomOut}\n ></ia-book-visual-adjustments>\n `;\n }\n\n onZoomIn() {\n this.bookreader.zoom(1);\n }\n\n onZoomOut() {\n this.bookreader.zoom(-1);\n }\n\n onAdjustmentChange(event) {\n const { detail } = event;\n const adjustments = {\n brightness: (value) => `brightness(${value}%)`,\n contrast: (value) => `contrast(${value}%)`,\n grayscale: () => 'grayscale(100%)',\n invert: () => 'invert(100%)',\n };\n const filters = detail.options.reduce((values, option) => {\n const newValue = `${option.active ? adjustments[option.id](option.value) : ''}`;\n return newValue ? [...values, newValue] : values;\n }, []).join(' ');\n\n this.bookContainer.css('filter', filters);\n\n this.optionUpdateComplete(event);\n }\n\n optionUpdateComplete(event) {\n this.activeCount = event.detail.activeCount;\n this.updateOptionsCount(event);\n this.onProviderChange();\n }\n\n updateOptionsCount() {\n this.menuDetails = `(${this.activeCount} active)`;\n }\n}\n","import { LitElement, html, css } from 'lit';\n\nexport default class DeleteModalActions extends LitElement {\n static get styles() {\n return css`\n div {\n display: flex;\n justify-content: center;\n padding-top: 2rem;\n }\n\n button {\n appearance: none;\n padding: 0.5rem 1rem;\n margin: 0 .5rem;\n box-sizing: border-box;\n font: 1.3rem \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n color: var(--primaryTextColor);\n border: none;\n border-radius: 4px;\n cursor: pointer;\n background: var(--primaryCTAFill);\n }\n\n .delete {\n background: var(--primaryErrorCTAFill);\n }\n `;\n }\n\n static get properties() {\n return {\n cancelAction: { type: Function },\n deleteAction: { type: Function },\n pageID: { type: String },\n };\n }\n\n render() {\n return html`\n <div>\n <button class=\"delete\" @click=${() => this.deleteAction({ detail: { id: `${this.pageID}` } })}>Delete</button>\n <button @click=${() => this.cancelAction()}>Cancel</button>\n </div>\n `;\n }\n}\n\ncustomElements.define('delete-modal-actions', DeleteModalActions);\n","import { LitElement, html, css } from 'lit';\n\nexport default class BookmarkButton extends LitElement {\n static get styles() {\n return css`\n button {\n -webkit-appearance: none;\n appearance: none;\n outline: 0;\n border: none;\n padding: 0;\n height: 4rem;\n width: 4rem;\n background: transparent;\n cursor: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 0 16 24' width='16'%3E%3Cg fill='%23333' fill-rule='evenodd'%3E%3Cpath d='m15 0c.5522847 0 1 .44771525 1 1v23l-8-5.4545455-8 5.4545455v-23c0-.55228475.44771525-1 1-1zm-2 2h-10c-.51283584 0-.93550716.38604019-.99327227.88337887l-.00672773.11662113v18l6-4.3181818 6 4.3181818v-18c0-.51283584-.3860402-.93550716-.8833789-.99327227z'/%3E%3Cpath d='m8.75 6v2.25h2.25v1.5h-2.25v2.25h-1.5v-2.25h-2.25v-1.5h2.25v-2.25z' fill-rule='nonzero'/%3E%3C/g%3E%3C/svg%3E\"), pointer;\n position: relative;\n }\n button > * {\n display: block;\n position: absolute;\n top: 0.2rem;\n }\n button.left > * {\n left: 0.2rem;\n }\n\n button.right > * {\n right: 0.2rem;\n }\n `;\n }\n\n static get properties() {\n return {\n side: { type: String },\n state: { type: String },\n };\n }\n\n constructor() {\n super();\n this.state = 'hollow';\n this.side = undefined;\n }\n\n handleClick(e) {\n e.preventDefault();\n this.dispatchEvent(new CustomEvent('bookmarkButtonClicked'));\n }\n\n get title() {\n return `${this.state === 'hollow' ? 'Add' : 'Remove'} bookmark`;\n }\n\n render() {\n const position = this.side || 'right';\n return html`\n <button title=${this.title} @click=${this.handleClick} class=${position}>\n <icon-bookmark state=${this.state}></icon-bookmark>\n </button>\n `;\n }\n}\n\ncustomElements.define('bookmark-button', BookmarkButton);\n","import { LitElement, html } from 'lit';\nimport buttonStyles from '../assets/button-base.js';\n\nclass BookmarksLogin extends LitElement {\n static get properties() {\n return {\n url: { type: String }\n };\n }\n\n static get styles() {\n return buttonStyles;\n }\n\n constructor() {\n super();\n this.url = 'https://archive.org/account/login';\n }\n render() {\n\n return html`\n <p>A free account is required to save and access bookmarks.</p>\n <a class=\"ia-button link primary\" href=\"${this.url}\">Log in</a>\n `;\n }\n}\n\ncustomElements.define('bookmarks-login', BookmarksLogin);\n","import { LitElement, html, css, render } from 'lit';\n// eslint-disable-next-line no-unused-vars\nimport { ModalConfig, ModalManager } from '@internetarchive/modal-manager';\nimport buttonStyles from '../assets/button-base.js';\nimport './bookmarks-loginCTA.js';\n\nconst api = {\n endpoint: '/services/bookmarks.php',\n headers: {\n 'Content-Type': 'application/json',\n },\n delete(page) {\n return fetch(`${this.endpoint}?identifier=${this.identifier}&page_num=${page}`, {\n credentials: 'same-origin',\n method: 'DELETE',\n headers: this.headers,\n });\n },\n get(page) {\n return fetch(`${this.endpoint}?identifier=${this.identifier}&page_num=${page}`, {\n credentials: 'same-origin',\n method: 'GET',\n headers: this.headers,\n });\n },\n getAll() {\n return fetch(`${this.endpoint}?identifier=${this.identifier}`, {\n credentials: 'same-origin',\n method: 'GET',\n headers: this.headers,\n });\n },\n post(bookmark) {\n return this.sendBookmarkData(bookmark, 'POST');\n },\n put(bookmark) {\n return this.sendBookmarkData(bookmark, 'POST');\n },\n sendBookmarkData(bookmark, method) {\n const notes = {\n note: bookmark.note,\n color: bookmark.color,\n };\n return fetch(`${this.endpoint}?identifier=${this.identifier}&page_num=${bookmark.id}`, {\n credentials: 'same-origin',\n method,\n headers: this.headers,\n body: JSON.stringify({\n notes,\n }),\n });\n },\n};\n\nclass IABookmarks extends LitElement {\n static get properties() {\n return {\n activeBookmarkID: { type: String },\n bookmarks: { type: Array },\n bookreader: { type: Object },\n displayMode: { type: String },\n editedBookmark: { type: Object },\n deleteModalConfig: { type: Object},\n modal: { attribute: false },\n loginOptions: { type: Object, attribute: false }\n };\n }\n\n static get styles() {\n const mainCss = css`\n .bookmarks {\n height: 100%;\n overflow: hidden;\n padding-bottom: 20px;\n }\n\n .list ia-bookmark-edit {\n display: none;\n }\n\n .edit ia-bookmarks-list {\n display: none;\n }\n `;\n\n return [buttonStyles, mainCss];\n }\n\n static formatPage(page) {\n return isNaN(+page) ? `(${page.replace(/\\D/g, '')})` : page;\n }\n\n constructor() {\n super();\n this.bookmarks = [];\n this.bookreader = {};\n this.editedBookmark = {};\n /** @type {ModalManager} */\n this.modal = undefined;\n this.loginOptions = {\n loginClicked: () => {},\n loginUrl: '',\n };\n /**\n * Toggles display to either bookmarks or login cta\n * @param {('bookmarks'|'login')} displayMode\n */\n this.displayMode = 'bookmarks';\n\n this.bookmarkColors = [{\n id: 0,\n className: 'red',\n }, {\n id: 1,\n className: 'blue',\n }, {\n id: 2,\n className: 'green',\n }];\n\n // eslint-disable-next-line\n this.defaultColor = this.bookmarkColors[0];\n this.api = api;\n this.deleteModalConfig = new ModalConfig({\n title: 'Delete Bookmark',\n headline: 'This bookmark contains a note. Deleting it will permanently delete the note. Are you sure?',\n headerColor: '#194880',\n });\n }\n\n updated(changed) {\n if (changed.has('displayMode')) {\n this.updateDisplay();\n }\n\n this.emitBookmarksChanged();\n }\n\n setup() {\n this.api.identifier = this.bookreader.bookId;\n if (this.displayMode === 'login') {\n return;\n }\n this.fetchUserBookmarks();\n this.setBREventListeners();\n }\n\n updateDisplay() {\n if (this.displayMode === 'bookmarks') {\n this.fetchUserBookmarks();\n }\n }\n\n async fetchUserBookmarks() {\n if (!this.api.identifier) {\n return;\n }\n await this.fetchBookmarks();\n this.initializeBookmarks();\n }\n\n setBREventListeners() {\n ['3PageViewSelected'].forEach((event) => {\n window.addEventListener(`BookReader:${event}`, (e) => {\n setTimeout(() => {\n // wait a lil bit so bookreader can draw its DOM to attach onto\n this.renderBookmarkButtons();\n }, 100);\n });\n });\n ['pageChanged', '1PageViewSelected', '2PageViewSelected'].forEach((event) => {\n window.addEventListener(`BookReader:${event}`, (e) => {\n setTimeout(() => {\n // wait a lil bit so bookreader can draw its DOM to attach onto\n this.renderBookmarkButtons();\n this.markActiveBookmark();\n }, 100);\n });\n });\n ['zoomOut', 'zoomIn', 'resize'].forEach((event) => {\n window.addEventListener(`BookReader:${event}`, () => {\n this.renderBookmarkButtons();\n });\n });\n }\n\n initializeBookmarks() {\n this.renderBookmarkButtons();\n this.markActiveBookmark(true);\n this.emitBookmarksChanged();\n }\n\n /**\n * @typedef {object} Bookmark\n * @property {number} id - bookreader page index, becomes key store\n * @property {number} color - color number\n * @property {string} page - bookmark's page label to display\n * @property {string} note - optional, note that one can add\n * @property {string} thumbnail - optional, image url\n */\n /**\n * Formats bookmark view model\n * @param {Object} bookmarkAttrs\n * @param {number} bookmarkAttrs.leafNum\n * @param {string} bookmarkAttrs.notes\n *\n * @returns Bookmark\n */\n formatBookmark({ leafNum = '', notes = {} }) {\n const { note = '', color } = notes;\n const nomalizedParams = {\n note,\n color: this.getBookmarkColor(color) ? color : this.defaultColor.id,\n };\n\n const page = IABookmarks.formatPage(this.bookreader.getPageNum(leafNum));\n const thumbnail = this.bookreader.getPageURI(`${leafNum}`.replace(/\\D/g, ''), 32); // Request thumbnail 1/32 the size of original image\n const bookmark = {\n ...nomalizedParams,\n id: leafNum,\n leafNum,\n page,\n thumbnail,\n };\n\n return bookmark;\n }\n\n async fetchBookmarks() {\n const resText = await this.api.getAll().then(r=> r.text());\n let parsedResponse;\n try {\n parsedResponse = JSON.parse(resText);\n } catch (e) {\n parsedResponse = {error : e.message};\n }\n\n const {\n success,\n error = 'Something happened while fetching bookmarks.',\n value: bkmrks = [],\n } = parsedResponse;\n\n if (!success) {\n console?.warn('Error fetching bookmarks', error);\n }\n\n const bookmarks = {};\n Object.keys(bkmrks).forEach((leafNum) => {\n const bookmark = bkmrks[leafNum];\n const formattedLeafNum = parseInt(leafNum, 10);\n const formattedBookmark = this.formatBookmark({ ...bookmark, leafNum: formattedLeafNum });\n bookmarks[leafNum] = formattedBookmark;\n });\n\n this.bookmarks = bookmarks;\n return bookmarks;\n }\n\n emitBookmarksChanged() {\n this.dispatchEvent(new CustomEvent('bookmarksChanged', {\n bubbles: true,\n composed: true,\n detail: {\n bookmarks: this.bookmarks,\n },\n }));\n }\n\n emitBookmarkButtonClicked() {\n this.dispatchEvent(new CustomEvent('bookmarkButtonClicked', {\n bubbles: true,\n composed: true,\n detail: {\n editedBookmark: this.editedBookmark,\n },\n }));\n }\n\n bookmarkButtonClicked(pageID) {\n if (this.getBookmark(pageID)) {\n this.confirmDeletion(pageID);\n } else {\n this.createBookmark(pageID);\n }\n }\n\n renderBookmarkButtons() {\n const pages = this.bookreader.$('.BRpagecontainer').not('.BRemptypage').get();\n\n pages.forEach((pageEl) => {\n const existingButton = pageEl.querySelector('.bookmark-button');\n if (existingButton) {\n existingButton.remove();\n }\n const pageID = +pageEl.classList.value.match(/pagediv\\d+/)[0].replace(/\\D/g, '');\n const pageBookmark = this.getBookmark(pageID);\n const bookmarkState = pageBookmark ? 'filled' : 'hollow';\n // eslint-disable-next-line\n const pageData = this.bookreader._models.book.getPage(pageID);\n const { isViewable } = pageData;\n\n if (!isViewable) { return; }\n\n const bookmarkButton = document.createElement('div');\n ['mousedown', 'mouseup'].forEach((event) => {\n bookmarkButton.addEventListener(event, (e) => e.stopPropagation());\n });\n bookmarkButton.classList.add('bookmark-button', bookmarkState);\n if (pageBookmark) {\n bookmarkButton.classList.add(this.getBookmarkColor(pageBookmark.color));\n }\n const pageSide = (pageEl.getAttribute('data-side') === 'L' && this.bookreader.mode === this.bookreader.constMode2up)\n ? 'left' : 'right';\n\n render(html`\n <bookmark-button\n @bookmarkButtonClicked=${() => this.bookmarkButtonClicked(pageID)}\n state=${bookmarkState}\n side=${pageSide}\n ></bookmark-button>`, bookmarkButton);\n pageEl.appendChild(bookmarkButton);\n });\n }\n\n /**\n * Notes which bookmark is active\n *\n * @param {boolean} atSetup - denotes the first time this is fired\n */\n markActiveBookmark(atSetup = false) {\n const { mode, constMode2up, constModeThumb } = this.bookreader;\n const currentIndex = this.bookreader.currentIndex();\n\n if (mode === constModeThumb) {\n // keep active bookmark the same\n // no syncing until we can verify when a bookmark is \"in view\"\n const requestedPageHasBookmark = this.bookmarks[currentIndex];\n if (atSetup && requestedPageHasBookmark) {\n this.activeBookmarkID = currentIndex;\n }\n return;\n }\n // In 2up, we prefer the right side of the page to bookmark\n // so let's make sure we light that one up.\n if (mode === constMode2up) {\n const pagesInView = this.bookreader.displayedIndices;\n const pagesHaveActiveBookmark = pagesInView.includes(+this.activeBookmarkID);\n if (pagesHaveActiveBookmark) {\n return;\n }\n }\n\n // If a bookmark exists with the current index, set it as active\n if (this.bookmarks[currentIndex]) {\n this.activeBookmarkID = currentIndex;\n return;\n }\n\n // No bookmark for this page\n this.activeBookmarkID = '';\n }\n\n bookmarkEdited({ detail }) {\n const closeEdit = detail.bookmark.id === this.editedBookmark.id;\n this.editedBookmark = closeEdit ? {} : detail.bookmark;\n }\n\n /**\n * Gets bookmark by pageindex\n * @param {number} id\n */\n getBookmark(id) {\n return this.bookmarks[id];\n }\n\n getBookmarkColor(id) {\n return this.bookmarkColors.find((m) => m.id === id)?.className;\n }\n\n /**\n * Adds bookmark for current page\n */\n addBookmark() {\n let pageID = this.bookreader.currentIndex();\n if (this.bookreader.mode === this.bookreader.constMode2up) {\n const pagesInView = this.bookreader.displayedIndices;\n\n // add bookmark to right hand page\n pageID = pagesInView[pagesInView.length - 1];\n }\n this.createBookmark(pageID);\n }\n\n /**\n * Creates bookmark for a given page\n * @param {number} pageID\n */\n createBookmark(pageID) {\n const existingBookmark = this.getBookmark(pageID);\n if (existingBookmark) {\n this.bookmarkEdited({ detail: { bookmark: existingBookmark } });\n this.emitBookmarkButtonClicked();\n return;\n }\n\n this.editedBookmark = this.formatBookmark({ leafNum: pageID });\n\n this.api.post(this.editedBookmark);\n\n this.bookmarks[pageID] = this.editedBookmark;\n this.activeBookmarkID = pageID;\n this.disableAddBookmarkButton = true;\n this.renderBookmarkButtons();\n this.emitBookmarkButtonClicked();\n }\n\n bookmarkSelected({ detail }) {\n const { leafNum } = detail.bookmark;\n this.bookreader.jumpToPage(`${this.bookreader.getPageNum(`${leafNum}`.replace(/\\D/g, ''))}`);\n this.activeBookmarkID = leafNum;\n }\n\n saveBookmark({ detail }) {\n const existingBookmark = this.bookmarks[detail.bookmark.id];\n Object.assign(existingBookmark, detail.bookmark);\n this.api.put(existingBookmark);\n this.editedBookmark = {};\n this.renderBookmarkButtons();\n }\n\n confirmDeletion(pageID) {\n const existingBookmark = this.getBookmark(pageID);\n if (existingBookmark.note) {\n this.displayDeletionModal(pageID);\n return;\n }\n this.deleteBookmark({ detail: { id: `${pageID}` } });\n }\n\n displayDeletionModal(pageID) {\n const customModalContent = html`\n <delete-modal-actions\n .deleteAction=${() => this.deleteBookmark({ detail: { id: `${pageID}` } })}\n .cancelAction=${() => this.modal.closeModal()}\n .pageID=${pageID}\n ></delete-modal-actions>\n `;\n\n\n this.modal.showModal({\n config: this.deleteModalConfig,\n customModalContent,\n });\n }\n\n deleteBookmark({ detail }) {\n const { id } = detail;\n const currBookmarks = this.bookmarks;\n delete currBookmarks[id];\n this.bookmarks = { ...currBookmarks };\n\n this.api.delete(detail.id);\n this.editedBookmark = {};\n this.modal.closeModal();\n this.renderBookmarkButtons();\n }\n\n /**\n * Tells us if we should allow user to add bookmark via menu panel\n * returns { Boolean }\n */\n get shouldEnableAddBookmarkButton() {\n const pageToCheck = this.bookreader.mode === this.bookreader.constMode2up\n ? this.bookreader.displayedIndices[this.bookreader.displayedIndices.length - 1]\n : this.bookreader.currentIndex();\n const pageHasBookmark = this.getBookmark(pageToCheck);\n return !!pageHasBookmark;\n }\n\n\n get allowAddingBookmark() {\n return this.bookreader.mode !== this.bookreader.constModeThumb;\n }\n\n get addBookmarkButton() {\n return html`\n <button\n class=\"ia-button primary\"\n tabindex=\"-1\"\n ?disabled=${this.shouldEnableAddBookmarkButton}\n @click=${this.addBookmark}>\n Add bookmark\n </button>\n `;\n }\n\n get bookmarksList() {\n return html`\n <ia-bookmarks-list\n @bookmarkEdited=${this.bookmarkEdited}\n @bookmarkSelected=${this.bookmarkSelected}\n @saveBookmark=${this.saveBookmark}\n @deleteBookmark=${this.deleteBookmark}\n .editedBookmark=${this.editedBookmark}\n .bookmarks=${{ ...this.bookmarks }}\n .activeBookmarkID=${this.activeBookmarkID}\n .bookmarkColors=${this.bookmarkColors}\n .defaultBookmarkColor=${this.defaultColor}>\n </ia-bookmarks-list>\n `;\n }\n\n get bookmarkHelperMessage() {\n return html`<p>Please use 1up or 2up view modes to add bookmark.</p>`;\n }\n\n render() {\n const bookmarks = html`\n ${this.bookmarksList}\n ${this.allowAddingBookmark ? this.addBookmarkButton : this.bookmarkHelperMessage}\n `;\n return html`\n <section class=\"bookmarks\">\n ${ this.displayMode === 'login'\n ? html`<bookmarks-login\n @click=${() => this.loginOptions.loginClicked()}\n .url=${this.loginOptions.loginUrl}></bookmarks-login>`\n : bookmarks\n }\n </section>\n `;\n }\n}\n\ncustomElements.define('ia-bookmarks', IABookmarks);\n","import { css } from 'lit';\n\nexport default css`\n .blue {\n --iconFillColor: var(--blueBookmarkColor, #0023f5);\n }\n\n .red {\n --iconFillColor: var(--redBookmarkColor, #eb3223);\n }\n\n .green {\n --iconFillColor: var(--greenBookmarkColor, #75ef4c);\n }\n`;\n","import { repeat } from 'lit/directives/repeat.js';\nimport { css, html, LitElement, nothing } from 'lit';\nimport bookmarkColorsCSS from '../assets/bookmark-colors.js';\nimport buttonCSS from '../assets/button-base.js';\n\nexport class IABookmarkEdit extends LitElement {\n static get properties() {\n return {\n bookmark: { type: Object },\n bookmarkColors: { type: Array },\n renderHeader: { type: Boolean },\n showBookmark: { type: Boolean },\n };\n }\n\n constructor() {\n super();\n this.bookmark = {};\n this.bookmarkColors = [];\n this.renderHeader = false;\n this.showBookmark = true;\n }\n\n emitSaveEvent(e) {\n e.preventDefault();\n this.dispatchEvent(new CustomEvent('saveBookmark', {\n detail: {\n bookmark: this.bookmark,\n },\n }));\n }\n\n emitDeleteEvent() {\n this.dispatchEvent(new CustomEvent('deleteBookmark', {\n detail: {\n id: this.bookmark.id,\n },\n }));\n }\n\n emitColorChangedEvent(colorId) {\n this.dispatchEvent(new CustomEvent('bookmarkColorChanged', {\n detail: {\n bookmarkId: this.bookmark.id,\n colorId,\n },\n }));\n }\n\n changeColorTo(id) {\n this.bookmark.color = id;\n this.emitColorChangedEvent(id);\n }\n\n updateNote(e) {\n this.bookmark.note = e.currentTarget.value;\n }\n\n static get headerSection() {\n return html`<header>\n <h3>Edit Bookmark</h3>\n </header>`;\n }\n\n bookmarkColor(color) {\n return html`\n <li>\n <input type=\"radio\" name=\"color\" id=\"color_${color.id}\" .value=${color.id} @change=${() => this.changeColorTo(color.id)} ?checked=${this.bookmark.color === color.id}>\n <label for=\"color_${color.id}\">\n <icon-bookmark class=${color.className}></icon-bookmark>\n </label>\n </li>\n `;\n }\n\n get bookmarkTemplate() {\n return html`\n <div class=\"bookmark\">\n <img src=${this.bookmark.thumbnail} />\n <h4>Page ${this.bookmark.page}</h4>\n </div>\n `;\n }\n\n render() {\n return html`\n ${this.renderHeader ? IABookmarkEdit.headerSection : nothing}\n ${this.showBookmark ? this.bookmarkTemplate : nothing}\n <form action=\"\" method=\"put\" @submit=${this.emitSaveEvent}>\n <fieldset>\n <label for=\"note\">Note <small>(optional)</small></label>\n <textarea rows=\"4\" cols=\"80\" name=\"note\" id=\"note\" @change=${this.updateNote}>${this.bookmark.note}</textarea>\n <label for=\"color\">Bookmark color</label>\n <ul>\n ${repeat(this.bookmarkColors, color => color.id, this.bookmarkColor.bind(this))}\n </ul>\n <div class=\"actions\">\n <button type=\"button\" class=\"ia-button cancel\" @click=${this.emitDeleteEvent}>Delete</button>\n <input class=\"ia-button\" type=\"submit\" value=\"Save\">\n </div>\n </fieldset>\n </form>\n `;\n }\n\n static get styles() {\n const bookmarkEditCSS = css`\n :host {\n display: block;\n padding: 0 1rem 2rem 1rem;\n color: var(--primaryTextColor);\n }\n\n small {\n font-style: italic;\n }\n\n .bookmark {\n display: grid;\n grid-template-columns: 37px 1fr;\n grid-gap: 0 1rem;\n align-items: center;\n }\n\n h4 {\n margin: 0;\n font-size: 1.4rem;\n }\n\n fieldset {\n padding: 2rem 0 0 0;\n border: none;\n }\n\n label {\n display: block;\n font-weight: bold;\n }\n\n p {\n padding: 0;\n margin: .5rem 0;\n font-size: 1.2rem;\n line-height: 120%;\n }\n\n textarea {\n width: 100%;\n margin-bottom: 2rem;\n box-sizing: border-box;\n font: normal 1.4rem \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n resize: vertical;\n }\n\n ul {\n display: grid;\n grid-template-columns: repeat(3, auto);\n grid-gap: 0 2rem;\n justify-content: start;\n padding: 1rem 0 0 0;\n margin: 0 0 2rem 0;\n list-style: none;\n }\n\n li input {\n display: none;\n }\n\n li label {\n display: block;\n min-width: 50px;\n padding-top: .4rem;\n text-align: center;\n border: 1px solid transparent;\n border-radius: 4px;\n cursor: pointer;\n }\n\n li input:checked + label {\n border-color: var(--primaryTextColor);\n }\n\n input[type=\"submit\"] {\n background: var(--primaryCTAFill);\n border-color: var(--primaryCTABorder);\n }\n\n button {\n background: var(--primaryErrorCTAFill);\n border-color: var(--primaryErrorCTABorder);\n }\n\n .button {\n -webkit-appearance: none;\n appearance: none;\n padding: .5rem 1rem;\n box-sizing: border-box;\n color: var(--primaryTextColor);\n border: none;\n border-radius: 4px;\n cursor: pointer;\n }\n\n .actions {\n display: grid;\n grid-template-columns: auto auto;\n grid-gap: 0 1rem;\n justify-items: stretch;\n }\n `;\n return [buttonCSS, bookmarkColorsCSS, bookmarkEditCSS];\n }\n}\ncustomElements.define('ia-bookmark-edit', IABookmarkEdit);\n","import { html } from 'lit';\n\nexport default html`\n<svg height=\"20\" viewBox=\"0 0 20 20\" width=\"20\" xmlns=\"http://www.w3.org/2000/svg\" aria-labelledby=\"editPencilTitleID editPencilDescID\"><title id=\"editPencilTitleID\">Pencil icon</title><desc id=\"editPencilDescID\">An illustration of a pencil, used to represent an edit action</desc><path class=\"fill-color\" d=\"m15.6111048 9.3708338-9.52237183 9.5222966-5.14363353 1.0897111c-.42296707.0896082-.83849202-.1806298-.92810097-.6035935-.02266463-.1069795-.02266463-.2175207 0-.3245001l1.08971974-5.1435929 9.52237189-9.52229656zm-10.89310224 5.9110366-2.78094924-.5403869-.67567462 3.166657.83033407.8303275 3.16668096-.6756703zm14.82724244-12.05935921c.6114418.61143705.6055516 1.6086709-.0131615 2.22737904l-2.2405581 2.24054036-4.9820147-4.98197536 2.2405581-2.24054036c.618713-.61870814 1.6159506-.62460252 2.2273925-.01316547z\" fill-rule=\"evenodd\"/></svg>\n`;\n","import icon from './index.js';\nimport { css, LitElement } from 'lit';\n\nclass IAIconEditPencil extends LitElement {\n static get styles() {\n return css`\n :host {\n width: var(--iconWidth, 'auto');\n height: var(--iconHeight, 'auto');\n }\n\n .fill-color {\n fill: var(--iconFillColor);\n }\n\n .stroke-color {\n stroke: var(--iconStrokeColor);\n }\n `;\n }\n\n render() {\n return icon;\n }\n}\n\ncustomElements.define('ia-icon-edit-pencil', IAIconEditPencil);\n\nexport default IAIconEditPencil;\n","import { repeat } from 'lit/directives/repeat.js';\nimport { css, html, LitElement, nothing } from 'lit';\nimport './bookmark-edit.js';\nimport '@internetarchive/icon-edit-pencil/icon-edit-pencil.js';\nimport bookmarkColorsCSS from '../assets/bookmark-colors.js';\n\nexport class IABookmarksList extends LitElement {\n static get properties() {\n return {\n activeBookmarkID: { type: Number },\n bookmarkColors: { type: Array },\n defaultBookmarkColor: { type: Object },\n bookmarks: { type: Object },\n editedBookmark: { type: Object },\n renderHeader: { type: Boolean },\n };\n }\n\n constructor() {\n super();\n this.activeBookmarkID = undefined;\n this.bookmarkColors = [];\n this.defaultBookmarkColor = {};\n this.bookmarks = {};\n this.editedBookmark = {};\n this.renderHeader = false;\n }\n\n emitEditEvent(e, bookmark) {\n this.dispatchEvent(new CustomEvent('bookmarkEdited', {\n detail: {\n bookmark,\n },\n }));\n }\n\n emitSelectedEvent(bookmark) {\n this.activeBookmarkID = bookmark.id;\n this.dispatchEvent(new CustomEvent('bookmarkSelected', {\n detail: {\n bookmark,\n },\n }));\n }\n\n emitSaveBookmark(bookmark) {\n this.dispatchEvent(new CustomEvent('saveBookmark', {\n detail: {\n bookmark,\n },\n }));\n }\n\n emitDeleteBookmark(id) {\n this.dispatchEvent(new CustomEvent('deleteBookmark', {\n detail: {\n id,\n },\n }));\n }\n\n emitBookmarkColorChanged({ detail }) {\n const { bookmarkId, colorId } = detail;\n this.dispatchEvent(new CustomEvent('bookmarkColorChanged', {\n detail: {\n bookmarkId,\n colorId,\n },\n }));\n }\n\n emitAddBookmark() {\n this.dispatchEvent(new CustomEvent('addBookmark'));\n }\n\n editBookmark(e, bookmark) {\n this.emitEditEvent(e, bookmark);\n this.editedBookmark = this.editedBookmark === bookmark ? {} : bookmark;\n }\n\n saveBookmark({ detail }) {\n const { bookmark } = detail;\n this.editedBookmark = {};\n this.emitSaveBookmark(bookmark);\n }\n\n deleteBookmark({ detail }) {\n const { id } = detail;\n this.editedBookmark = {};\n this.emitDeleteBookmark(id);\n }\n\n bookmarkColorInfo(colorVal = 0) {\n return this.bookmarkColors.find(labelInfo => labelInfo?.id === colorVal);\n }\n\n bookmarkItem(bookmark) {\n const editMode = this.editedBookmark.id === bookmark.id;\n const { className } = this.bookmarkColorInfo(bookmark.color);\n const activeClass = bookmark.id === this.activeBookmarkID ? 'active' : '';\n return html`\n <li\n @click=${() => this.emitSelectedEvent(bookmark)}\n tabindex=\"0\"\n data-pageIndex=${bookmark.id}\n >\n <div class=\"separator\"></div>\n <div class=\"content ${activeClass}\">\n <button\n class=\"edit\"\n @click=${e => this.editBookmark(e, bookmark)}\n title=\"Edit this bookmark\"\n >\n <ia-icon-edit-pencil></ia-icon-edit-pencil>\n </button>\n <h4>\n <icon-bookmark class=${className}></icon-bookmark>\n <span> Page ${bookmark.page}</span>\n </h4>\n ${!editMode && bookmark.note ? html`<p>${bookmark.note}</p>` : nothing}\n ${editMode ? this.editBookmarkComponent : nothing}\n </div>\n </li>\n `;\n }\n\n get editBookmarkComponent() {\n const showBookmark = false;\n return html`\n <ia-bookmark-edit\n .bookmark=${this.editedBookmark}\n .bookmarkColors=${this.bookmarkColors}\n .defaultBookmarkColor=${this.defaultBookmarkColor}\n .showBookmark=${showBookmark}\n @saveBookmark=${this.saveBookmark}\n @deleteBookmark=${this.deleteBookmark}\n @bookmarkColorChanged=${this.emitBookmarkColorChanged}\n ></ia-bookmark-edit>\n `;\n }\n\n sortBookmarks() {\n const sortedKeys = Object.keys(this.bookmarks).sort((a, b) => {\n if (+a > +b) { return 1; }\n if (+a < +b) { return -1; }\n return 0;\n });\n const sortedBookmarks = sortedKeys.map(key => this.bookmarks[key]);\n return sortedBookmarks;\n }\n\n get bookmarksCount() {\n const count = this.bookmarks.length;\n return html`<small>(${count})</small>`;\n }\n\n get headerSection() {\n return html`<header>\n <h3>\n Bookmarks\n ${this.bookmarks.length ? this.bookmarksCount : nothing}\n </h3>\n </header>`;\n }\n\n get bookmarkslist() {\n const sortedBookmarks = this.sortBookmarks();\n const bookmarks = repeat(sortedBookmarks, bookmark => bookmark?.id, this.bookmarkItem.bind(this));\n return html`\n <ul>\n ${bookmarks}\n <div class=\"separator\"></div>\n </ul>\n `;\n }\n\n render() {\n return html`\n ${this.renderHeader ? this.headerSection : nothing}\n ${Object.keys(this.bookmarks).length ? this.bookmarkslist : nothing}\n `;\n }\n\n static get styles() {\n const main = css`\n :host {\n display: block;\n overflow-y: auto;\n box-sizing: border-box;\n color: var(--primaryTextColor);\n margin-bottom: 2rem;\n --activeBorderWidth: 2px;\n }\n\n icon-bookmark {\n width: 16px;\n height: 24px;\n }\n\n .separator {\n background-color: var(--secondaryBGColor);\n width: 98%;\n margin: 1px auto;\n height: 1px;\n }\n\n small {\n font-style: italic;\n }\n\n h4 {\n margin: 0;\n font-size: 1.4rem;\n }\n h4 * {\n display: inline-block;\n }\n h4 icon-bookmark {\n vertical-align: bottom;\n }\n h4 span {\n vertical-align: top;\n padding-top: 1%;\n }\n\n p {\n padding: 0;\n margin: 5px 0 0 0;\n width: 98%;\n overflow-wrap: break-word;\n }\n\n ia-bookmark-edit {\n margin: 5px 5px 3px 6px;\n }\n\n ul {\n padding: 0;\n list-style: none;\n margin: var(--activeBorderWidth) 0.5rem 1rem 0;\n }\n ul > li:first-child .separator {\n display: none;\n }\n li {\n cursor: pointer;\n outline: none;\n position: relative;\n }\n li .content {\n padding: 2px 0 4px 2px;\n border: var(--activeBorderWidth) solid transparent;\n padding: .2rem 0 .4rem .2rem;\n }\n li .content.active {\n border: var(--activeBorderWidth) solid #538bc5;\n }\n li button.edit {\n padding: 5px 2px 0 0;\n background: transparent;\n cursor: pointer;\n height: 40px;\n width: 40px;\n position: absolute;\n right: 2px;\n top: 2px;\n text-align: right;\n -webkit-appearance: none;\n appearance: none;\n outline: none;\n box-sizing: border-box;\n border: none;\n }\n li button.edit > * {\n display: block;\n height: 100%;\n width: 100%;\n }\n `;\n\n return [main, bookmarkColorsCSS];\n }\n}\ncustomElements.define('ia-bookmarks-list', IABookmarksList);\n","import { html } from 'lit';\nimport '../delete-modal-actions.js';\nimport './bookmark-button.js';\nimport './ia-bookmarks.js';\n\nimport './bookmark-edit.js';\nimport './bookmarks-list.js';\nimport { IAIconBookmark } from '@internetarchive/icon-bookmark';\n\ncustomElements.define('icon-bookmark', IAIconBookmark);\n\nexport default class BookmarksProvider {\n constructor(options) {\n const {\n baseHost,\n signedIn,\n bookreader,\n modal,\n onProviderChange,\n } = options;\n\n const referrerStr = `referer=${encodeURIComponent(location.href)}`;\n const loginUrl = `https://${baseHost}/account/login?${referrerStr}`;\n\n this.component = document.createElement('ia-bookmarks');\n this.component.bookreader = bookreader;\n this.component.displayMode = signedIn ? 'bookmarks' : 'login';\n this.component.modal = modal;\n this.component.loginOptions = {\n loginClicked: this.bookmarksLoginClicked,\n loginUrl\n };\n this.bindEvents();\n\n this.icon = html`<icon-bookmark state=\"hollow\" style=\"--iconWidth: 16px; --iconHeight: 24px;\"></icon-bookmark>`;\n this.label = 'Bookmarks';\n this.id = 'bookmarks';\n this.onProviderChange = onProviderChange;\n this.component.setup();\n this.updateMenu(this.component.bookmarks.length);\n }\n\n updateMenu(count) {\n this.menuDetails = `(${count})`;\n }\n\n bindEvents() {\n this.component.addEventListener('bookmarksChanged', this.bookmarksChanged.bind(this));\n }\n\n bookmarksChanged({ detail }) {\n const bookmarksLength = Object.keys(detail.bookmarks).length;\n this.updateMenu(bookmarksLength);\n this.onProviderChange(detail.bookmarks, detail.showSidePanel);\n }\n\n bookmarksLoginClicked() {\n if (window.archive_analytics) {\n window.archive_analytics?.send_event_no_sampling(\n 'BookReader',\n `BookmarksLogin`,\n window.location.path,\n );\n }\n }\n}\n","import { html, css, LitElement } from 'lit-element';\n\nclass IAIconBookmark extends LitElement {\n static get styles() {\n return css`\n :host {\n width: var(--iconWidth, 'auto');\n height: var(--iconHeight, 'auto');\n }\n\n #hollow,\n #plus,\n #minus {\n display: none;\n }\n\n .hollow #filled,\n .plus #filled,\n .minus #filled {\n display: none;\n }\n\n .hollow #hollow,\n .plus #hollow,\n .minus #hollow {\n display: block;\n }\n\n .plus #plus {\n display: block;\n }\n\n .minus #minus {\n display: block;\n }\n\n .fill-color {\n fill: var(--iconFillColor);\n }\n\n .stroke-color {\n stroke: var(--iconStrokeColor);\n }\n `;\n }\n\n static get properties() {\n return {\n state: { type: String },\n };\n }\n\n render() {\n return html`\n <div class=${this.state}>\n <svg height=\"24\" viewBox=\"0 0 16 24\" width=\"16\" xmlns=\"http://www.w3.org/2000/svg\" aria-labelledby=\"bookmarkTitleID bookmarDescID\"><title id=\"bookmarkTitleID\">Bookmark icon</title><desc id=\"bookmarkDescID\">An outline of the shape of a bookmark</desc><path id=\"filled\" d=\"m1 0h14c.5522847 0 1 .44771525 1 1v23l-8-5.4545455-8 5.4545455v-23c0-.55228475.44771525-1 1-1z\" class=\"fill-color\" fill-rule=\"evenodd\"/><g class=\"fill-color\" fill-rule=\"evenodd\"><path id=\"hollow\" d=\"m15 0c.5522847 0 1 .44771525 1 1v23l-8-5.4545455-8 5.4545455v-23c0-.55228475.44771525-1 1-1zm-2 2h-10c-.51283584 0-.93550716.38604019-.99327227.88337887l-.00672773.11662113v18l6-4.3181818 6 4.3181818v-18c0-.51283584-.3860402-.93550716-.8833789-.99327227z\"/><path id=\"plus\" d=\"m8.75 6v2.25h2.25v1.5h-2.25v2.25h-1.5v-2.25h-2.25v-1.5h2.25v-2.25z\" fill-rule=\"nonzero\"/><path id=\"minus\" d=\"m11 8.25v1.5h-6v-1.5z\" fill-rule=\"nonzero\"/></g></svg>\n </div>\n `;\n }\n}\n\nexport { IAIconBookmark };\n","import { html } from 'lit';\n\nexport default html`\n<svg\n viewBox=\"0 0 24 24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-labelledby=\"shareTitleID shareDescID\"\n>\n <title id=\"shareTitleID\">Share icon</title>\n <desc id=\"shareDescID\">A square with an arrow arcing out from the center of the square</desc>\n <g class=\"fill-color\">\n <path d=\"m0 6.765625v17.143466h23.996455v-12.820312c0-.6024929-.564349-1.0909095-1.26051-1.0909095-.696159 0-1.260509.4884166-1.260509 1.0909095v10.638494h-18.9544172v-12.7798301h4.7793938c.6961602 0 1.2605092-.4884166 1.2605092-1.0909091 0-.6024924-.564349-1.0909088-1.2605092-1.0909088z\"/>\n <path d=\"m23.97066.18118436-10.372158.62642052 1.587358 2.76562492c-.632399.5111771-1.204137 1.0741171-1.700285 1.6981534-1.40286 1.7644678-2.279987 4.0202049-2.712357 6.6775568-.144711.891238.459803 1.731264 1.350853 1.87713.428345.07012.866999-.03282 1.21944-.286164.35244-.253341.589789-.636328.659821-1.064688.366789-2.2542958 1.073357-3.946915 2.043324-5.1669026.237573-.298812.501471-.5831095.792613-.8522728l1.40625 2.4502844z\"/>\n </g>\n</svg>\n`;\n","import icon from './index.js';\nimport { css, LitElement } from 'lit';\n\nclass IAIconShare extends LitElement {\n static get styles() {\n return css`\n :host {\n width: var(--iconWidth, 'auto');\n height: var(--iconHeight, 'auto');\n }\n\n .fill-color {\n fill: var(--iconFillColor);\n }\n\n .stroke-color {\n stroke: var(--iconStrokeColor);\n }\n `;\n }\n\n render() {\n return icon;\n }\n}\n\ncustomElements.define('ia-icon-share', IAIconShare);\n\nexport default IAIconShare;\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {AttributePart, noChange} from '../lit-html.js';\nimport {\n directive,\n Directive,\n DirectiveParameters,\n PartInfo,\n PartType,\n} from '../directive.js';\n\n/**\n * A key-value set of class names to truthy values.\n */\nexport interface ClassInfo {\n readonly [name: string]: string | boolean | number;\n}\n\nclass ClassMapDirective extends Directive {\n /**\n * Stores the ClassInfo object applied to a given AttributePart.\n * Used to unset existing values when a new ClassInfo object is applied.\n */\n private _previousClasses?: Set<string>;\n private _staticClasses?: Set<string>;\n\n constructor(partInfo: PartInfo) {\n super(partInfo);\n if (\n partInfo.type !== PartType.ATTRIBUTE ||\n partInfo.name !== 'class' ||\n (partInfo.strings?.length as number) > 2\n ) {\n throw new Error(\n '`classMap()` can only be used in the `class` attribute ' +\n 'and must be the only part in the attribute.'\n );\n }\n }\n\n render(classInfo: ClassInfo) {\n // Add spaces to ensure separation from static classes\n return (\n ' ' +\n Object.keys(classInfo)\n .filter((key) => classInfo[key])\n .join(' ') +\n ' '\n );\n }\n\n override update(part: AttributePart, [classInfo]: DirectiveParameters<this>) {\n // Remember dynamic classes on the first render\n if (this._previousClasses === undefined) {\n this._previousClasses = new Set();\n if (part.strings !== undefined) {\n this._staticClasses = new Set(\n part.strings\n .join(' ')\n .split(/\\s/)\n .filter((s) => s !== '')\n );\n }\n for (const name in classInfo) {\n if (classInfo[name] && !this._staticClasses?.has(name)) {\n this._previousClasses.add(name);\n }\n }\n return this.render(classInfo);\n }\n\n const classList = part.element.classList;\n\n // Remove old classes that no longer apply\n // We use forEach() instead of for-of so that we don't require down-level\n // iteration.\n this._previousClasses.forEach((name) => {\n if (!(name in classInfo)) {\n classList.remove(name);\n this._previousClasses!.delete(name);\n }\n });\n\n // Add or remove classes based on their classMap value\n for (const name in classInfo) {\n // We explicitly want a loose truthy check of `value` because it seems\n // more convenient that '' and 0 are skipped.\n const value = !!classInfo[name];\n if (\n value !== this._previousClasses.has(name) &&\n !this._staticClasses?.has(name)\n ) {\n if (value) {\n classList.add(name);\n this._previousClasses.add(name);\n } else {\n classList.remove(name);\n this._previousClasses.delete(name);\n }\n }\n }\n return noChange;\n }\n}\n\n/**\n * A directive that applies dynamic CSS classes.\n *\n * This must be used in the `class` attribute and must be the only part used in\n * the attribute. It takes each property in the `classInfo` argument and adds\n * the property name to the element's `classList` if the property value is\n * truthy; if the property value is falsey, the property name is removed from\n * the element's `class`.\n *\n * For example `{foo: bar}` applies the class `foo` if the value of `bar` is\n * truthy.\n *\n * @param classInfo\n */\nexport const classMap = directive(ClassMapDirective);\n\n/**\n * The type of the class that powers this directive. Necessary for naming the\n * directive's return type.\n */\nexport type {ClassMapDirective};\n","import { html } from 'lit';\n\nexport default html`\n<svg viewBox=\"0 0 34 34\" xmlns=\"http://www.w3.org/2000/svg\" aria-labelledby=\"linkTitleID linkDescID\">\n <title id=\"linkTitleID\">Link icon</title>\n <desc id=\"linkDescID\">Two chain links linked together</desc>\n <path d=\"m7.80511706 12.3659763c1.2669254-2.2579539 4.09819784-2.9949938 6.41200864-1.7733458l.2295791.12871 1.6067188.9559859 3.5467013-6.31849361c1.2682451-2.26030597 4.104098-2.99652769 6.4192376-1.76952182l.2223501.12488594 3.2168204 1.91103915c2.2770002 1.3527136 3.1866331 4.21502324 2.0564431 6.51290984l-.1198433.2278304-5.2002499 9.2680474c-1.2669254 2.2579539-4.0981978 2.9949938-6.4120086 1.7733458l-.2295791-.12871-1.6096554-.9558482-3.5437647 6.3183559c-1.2682451 2.260306-4.104098 2.9965277-6.41923761 1.7695218l-.22235013-.1248859-3.21682032-1.9110392c-2.27700024-1.3527136-3.18663314-4.2150232-2.05644312-6.5129098l.11984332-.2278304zm13.93955474-5.73311741-3.563271 6.35055051c1.889633 1.4530595 2.5776248 4.0429866 1.5410255 6.156875l-.1223014.2328355-.4183304.7430134 1.6096554.9558483c1.1431442.6791157 2.5155496.3977368 3.1667361-.5628389l.0921501-.1491451 5.2002498-9.2680474c.5752467-1.0252226.2110342-2.4011579-.8559335-3.14755806l-.1742742-.11247814-3.2168203-1.91103915c-1.1402863-.67741793-2.5086889-.39913772-3.1618387.55564729zm-11.79500786 7.00714351-5.20024982 9.2680474c-.57524673 1.0252226-.21103426 2.4011579.85593348 3.1475581l.17427416.1124781 3.21682032 1.9110392c1.14028632.6774179 2.50868892.3991377 3.16183872-.5556473l.0970474-.1563368 3.5622708-6.3513198c-1.8888875-1.4532134-2.5764504-4.042623-1.5400057-6.1561456l.1222818-.2327956.4153938-.7428758-1.6067188-.9559859c-1.1431442-.6791157-2.5155496-.3977368-3.1667361.5628389zm6.97653866 1.5796652-.3817806.6812386c-.5117123.9119895-.2800268 2.1014993.528439 2.8785267l.382717-.6803391c.5119098-.9123415.2798478-2.1024176-.5293754-2.8794262z\" class=\"fill-color\" />\n</svg>\n`;\n","import icon from './index.js';\nimport { css, LitElement } from 'lit';\n\nclass IAIconLink extends LitElement {\n static get styles() {\n return css`\n :host {\n width: var(--iconWidth, 'auto');\n height: var(--iconHeight, 'auto');\n }\n\n .fill-color {\n fill: var(--iconFillColor);\n }\n\n .stroke-color {\n stroke: var(--iconStrokeColor);\n }\n `;\n }\n\n render() {\n return icon;\n }\n}\n\ncustomElements.define('ia-icon-link', IAIconLink);\n\nexport default IAIconLink;\n","import { css } from 'lit';\n\nexport default css`\n:host {\n display: block;\n height: 100%;\n overflow-y: auto;\n font-size: 1.4rem;\n box-sizing: border-box;\n}\n\nheader {\n display: flex;\n align-items: baseline;\n}\n\nh3 {\n padding: 0;\n margin: 0 1rem 0 0;\n font-size: 1.6rem;\n}\n\nh4 {\n font-size: 1.4rem;\n}\n\nul {\n padding: 0 0 2rem 0;\n list-style: none;\n}\n\nli {\n padding: 0 0 1rem 0;\n}\n\nli a {\n font-size: 1.6rem;\n text-decoration: none;\n color: var(--shareLinkColor);\n}\n\nli a * {\n display: inline-block;\n padding: .2rem;\n margin-right: 1rem;\n vertical-align: middle;\n border: 1px solid var(--shareIconBorder);\n border-radius: 7px;\n background: var(--shareIconBg);\n}\n\n.embed {\n display: none;\n}\n.embed.visible {\n display: block;\n width: 95%;\n}\n\n.embed a {\n color: var(--shareLinkColor);\n}\n\n.code {\n position: relative;\n}\n\ntextarea {\n display: block;\n width: 100%;\n height: 120px;\n padding: .8rem 1rem;\n box-sizing: border-box;\n resize: none;\n cursor: pointer;\n font: normal 1.4rem \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n color: var(--textareaColor, #fff);\n background: var(--textareaBg, #151515);\n}\n\nsmall {\n position: absolute;\n bottom: 0;\n left: 0;\n height: 3rem;\n padding: .5rem 1rem;\n box-sizing: border-box;\n font: normal 1.2rem/2rem \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n color: var(--textareaBg, #151515);\n background: var(--textareaColor, #fff);\n opacity: 0;\n transition: opacity 300ms linear;\n}\nsmall.visible {\n opacity: 1;\n}\n`;\n","import { html } from 'lit';\n\nexport default html`\n<svg viewBox=\"0 0 34 34\" xmlns=\"http://www.w3.org/2000/svg\" aria-labelledby=\"emailTitleID emailDescID\">\n <title id=\"emailTitleID\">Email icon</title>\n <desc id=\"emailDescID\">An illustration of an envelope</desc>\n <path d=\"m32 7.04156803v19.91686397c0 .5752421-.4763773 1.041568-1.0640184 1.041568h-27.87196316c-.58764116 0-1.06401844-.4663259-1.06401844-1.041568v-19.91686397c0-.57524214.47637728-1.04156803 1.06401844-1.04156803h27.87196316c.5876411 0 1.0640184.46632589 1.0640184 1.04156803zm-26.25039901 1.19676167 10.04327011 10.1323738c.5135662.4194048.8817166.6291071 1.1044511.6291071.1198794 0 .2695514-.0503424.4490158-.1510273.1794644-.100685.3291364-.2013699.4490158-.3020548l.1798191-.1510273 10.1198794-10.15841306zm16.77212271 9.7303286 6.8831353 6.7889404v-13.5778809zm-17.92871075-6.6379131v13.350819l6.78098955-6.6629107zm22.09008685 14.2059464-5.9074304-5.8588202-.9757049.9551179-.3594018.3295984c-.0342324.0304241-.0665646.0587822-.0969964.0850743l-.1597867.1329606c-.0684912.0540844-.1198794.0895749-.1541644.1064714-.6674943.3687151-1.3523675.5530727-2.0546196.5530727-.65047 0-1.3782586-.218035-2.1833659-.6541048l-.6682036-.4520405-1.0278418-1.0311524-5.95850326 5.832781z\" class=\"fill-color\" />\n</svg>\n`;\n","import icon from './index.js';\nimport { css, LitElement } from 'lit';\n\nclass IAIconEmail extends LitElement {\n static get styles() {\n return css`\n :host {\n width: var(--iconWidth, 'auto');\n height: var(--iconHeight, 'auto');\n }\n\n .fill-color {\n fill: var(--iconFillColor);\n }\n\n .stroke-color {\n stroke: var(--iconStrokeColor);\n }\n `;\n }\n\n render() {\n return icon;\n }\n}\n\ncustomElements.define('ia-icon-email', IAIconEmail);\n\nexport default IAIconEmail;\n","/* eslint-disable class-methods-use-this */\nexport default class {\n constructor(params) {\n this.promoCopy = ' : Free Download, Borrow, and Streaming : Internet Archive';\n Object.assign(this, params);\n }\n\n get encodedDescription() {\n return this.encodeString(this.description);\n }\n\n get encodedCreator() {\n return this.encodeString(this.creator);\n }\n\n get encodedPromoCopy() {\n return this.encodeString(this.promoCopy);\n }\n\n get itemPath() {\n const encodedFileSubPrefix = this.fileSubPrefix ? encodeURIComponent(this.fileSubPrefix) : '';\n return encodedFileSubPrefix ? `${this.identifier}/${encodedFileSubPrefix}` : this.identifier;\n }\n\n encodeString(str) {\n return encodeURIComponent(str.replace(/\\s/g, '+')).replace(/%2B/g, '+');\n }\n}\n","import '@internetarchive/icon-email/icon-email';\nimport { html } from 'lit';\nimport Provider from './provider.js';\n\nexport default class extends Provider {\n constructor(params) {\n super(params);\n this.name = 'Email';\n this.icon = html`<ia-icon-email></ia-icon-email>`;\n this.class = 'email';\n }\n\n get url() {\n return `mailto:?body=https://${this.baseHost}/details/${this.itemPath}&subject=${this.description} : ${this.creator}${this.promoCopy}`;\n }\n}\n","import { html } from 'lit';\n\nexport default html`\n<svg viewBox=\"0 0 34 34\" xmlns=\"http://www.w3.org/2000/svg\" aria-labelledby=\"facebookTitleID facebookDescID\">\n <title id=\"facebookTitleID\">Facebook icon</title>\n <desc id=\"facebookDescID\">A lowercase f</desc>\n <path d=\"m30.91057 19.2442068.2670004-5.3339402h-5.7329237c-.0890001-3.4962895.25183-5.42243459 1.0224903-5.77843514.3560005-.17800028.8004955-.28925046 1.333485-.33375053s1.0442346-.0520853 1.5337353-.02275571c.4895008.02932959 1.045246.01466479 1.6672356-.04399439.0890001-1.59997977.1335002-3.24445961.1335002-4.93343953-2.1633102-.20732987-3.6742898-.28115953-4.5329389-.22148898-2.8146294.17800028-4.7847688 1.25965538-5.9104183 3.2449653-.1780003.3256596-.3261653.68873971-.444495 1.08924034-.1183298.40050062-.2144095.76358074-.2882391 1.08924034-.0738297.32565959-.125915.7848194-.1562559 1.37747942-.030341.59266002-.052591 1.04474028-.0667501 1.35624078-.0141592.3115005-.0217444.8449956-.0227558 1.6004854v1.5777298h-3.8229605v5.3339401h3.8669549v14.622824h5.8224296c0-.3560006-.0146648-1.6819003-.0439944-3.9776994-.0293296-2.295799-.0515796-4.2957737-.0667501-5.9999241s-.0075853-3.2525506.0227557-4.6452005h5.4219289z\" class=\"fill-color\" />\n</svg>\n`;\n","import icon from './index.js';\nimport { css, LitElement } from 'lit';\n\nclass IAIconFacebook extends LitElement {\n static get styles() {\n return css`\n :host {\n width: var(--iconWidth, 'auto');\n height: var(--iconHeight, 'auto');\n }\n\n .fill-color {\n fill: var(--iconFillColor);\n }\n\n .stroke-color {\n stroke: var(--iconStrokeColor);\n }\n `;\n }\n\n render() {\n return icon;\n }\n}\n\ncustomElements.define('ia-icon-facebook', IAIconFacebook);\n\nexport default IAIconFacebook;\n","import '@internetarchive/icon-facebook/icon-facebook';\nimport { html } from 'lit';\nimport Provider from './provider.js';\n\nexport default class extends Provider {\n constructor(params) {\n super(params);\n this.name = 'Facebook';\n this.icon = html`<ia-icon-facebook></ia-icon-facebook>`;\n this.class = 'facebook';\n }\n\n get url() {\n return `https://www.facebook.com/sharer/sharer.php?u=https://${this.baseHost}/details/${this.itemPath}`;\n }\n}\n","import { html } from 'lit';\n\nexport default html`\n<svg viewBox=\"0 0 34 34\" xmlns=\"http://www.w3.org/2000/svg\" aria-labelledby=\"pinterestTitleID pinterestDescID\">\n <title id=\"pinterestTitleID\">Pinterest icon</title>\n <desc id=\"pinterestDescID\">A stylized letter p</desc>\n <path d=\"m11.9051049 30.5873434.653491-1.0742755.4207845-.839975c.2805229-.591861.5371377-1.2533214.7698443-1.9843813.2327065-.7310599.4659444-1.6029125.6997135-2.6155579.2337692-1.0126455.4128151-1.752206.5371377-2.2186817.0308151.030815.0775689.0855382.1402615.1641697.0626927.0786314.1094465.1333547.1402615.1641697.1243227.1870153.2178304.311338.280523.372968 1.1210293.964829 2.3817888 1.4631823 3.7822785 1.4950599 1.4939973 0 2.8790795-.3426843 4.1552465-1.0280529 2.1166733-1.1826593 3.6733633-3.1128487 4.6700699-5.7905679.4048457-1.1518444.6848374-2.5996192.8399751-4.3433245.1243226-1.587505-.0781002-3.0974411-.6072685-4.5298084-.903199-2.36638128-2.5528653-4.20306294-4.948999-5.51004497-1.276167-.65349101-2.5990879-1.05833667-3.9687625-1.21453696-1.525875-.21783034-3.1293188-.17107651-4.8103315.14026149-2.7701643.52916833-5.02709913 1.743174-6.77080442 3.64201699-1.99235065 2.14748836-2.98852598 4.62225355-2.98852598 7.42429545 0 2.9571797.9494215 5.0584455 2.84826449 6.3037975l.83997504.4207845c.12432268 0 .22526845.0154075.3028373.0462225s.1551377.0074381.23270656-.0701308c.07756885-.0775688.13229208-.1243226.16416969-.1402614s.07066204-.0860696.11635328-.2103923c.04569124-.1243226.07703756-.2098609.09403895-.2566147.01700139-.0467539.04834771-.1476996.09403895-.3028373s.06906816-.2486454.07013074-.280523l.14026149-.5132295c.06269263-.311338.09403895-.5291684.09403895-.653491-.03081502-.1243227-.12432268-.2799917-.28052297-.467007-.15620029-.1870154-.23376915-.2959305-.23270656-.3267455-.62267599-.8096914-.9494215-1.7904592-.98023652-2.9423035-.03081502-1.55669.28052297-2.9731185.93401399-4.24928547 1.18265932-2.45882635 3.17501002-3.93741618 5.97705192-4.43576949 1.6183201-.311338 3.1356943-.25661476 4.5521228.16416969 1.4164285.42078446 2.5135496 1.09765239 3.2913633 2.03060379.8405063 1.02752164 1.3229208 2.28828114 1.4472435 3.78227848.1243227 1.4004897-.0313463 2.9725872-.467007 4.7162925-.3740306 1.3696746-.9186065 2.5528653-1.6337275 3.5495719-.9967066 1.245352-2.0863896 1.8834355-3.269049 1.9142505-1.7118277.0626926-2.7547568-.6375522-3.1287874-2.1007345-.0935077-.4664757 0-1.2134744.2805229-2.240996.7469987-2.5842117 1.1359055-3.9384788 1.1667206-4.0628015.1870153-1.0275216.2024228-1.7904591.0462225-2.2888124-.1870153-.65349104-.5759222-1.15928246-1.1667205-1.51737429-.5907984-.35809182-1.2756357-.39687625-2.054512-.11635327-1.1826594.43566067-1.9610044 1.40048968-2.335035 2.89448706-.311338 1.306982-.2491767 2.6299028.186484 3.9687625 0 .0626926.0313463.1402615.094039.2327065.0626926.0924451.0940389.1700139.0940389.2327066 0 .0935076-.0313463.2491766-.0940389.467007-.0626927.2178303-.094039.3580918-.094039.4207844-.0935076.4356607-.3038999 1.3308903-.6311767 2.6856887-.3272768 1.3547985-.5838915 2.3897582-.7698443 3.1048793-.7778136 3.2068876-1.12049796 5.5881451-1.02805289 7.1437725l.37296809 2.7558194c.653491-.591861 1.2294131-1.2299445 1.7277664-1.9142505z\" class=\"fill-color\" />\n</svg>\n`;\n","import { css, LitElement } from 'lit';\nimport icon from './index.js';\n\nclass IAIconPinterest extends LitElement {\n static get styles() {\n return css`\n :host {\n width: var(--iconWidth, 'auto');\n height: var(--iconHeight, 'auto');\n }\n\n .fill-color {\n fill: var(--iconFillColor);\n }\n\n .stroke-color {\n stroke: var(--iconStrokeColor);\n }\n `;\n }\n\n render() {\n return icon;\n }\n}\n\ncustomElements.define('ia-icon-pinterest', IAIconPinterest);\n\nexport default IAIconPinterest;\n","import '@internetarchive/icon-pinterest/icon-pinterest';\nimport { html } from 'lit';\nimport Provider from './provider.js';\n\nexport default class extends Provider {\n constructor(params) {\n super(params);\n this.name = 'Pinterest';\n this.icon = html`<ia-icon-pinterest></ia-icon-pinterest>`;\n this.class = 'pinterest';\n }\n\n get url() {\n return `http://www.pinterest.com/pin/create/button/?url=https://${this.baseHost}/details/${this.itemPath}&description=${this.encodedDescription}+%3A+${this.encodedCreator}${this.encodedPromoCopy}`;\n }\n}\n","import { html } from 'lit';\n\nexport default html`\n<svg viewBox=\"0 0 34 34\" xmlns=\"http://www.w3.org/2000/svg\" aria-labelledby=\"tumblrTitleID tumblrDescID\">\n <title id=\"tumblrTitleID\">Tumblr icon</title>\n <desc id=\"tumblrDescID\">A lowercase letter t</desc>\n <path d=\"m8.50321407 8.54544475v5.32088575c.15641786.0310693.6819176.0310693 1.57649923 0 .8945816-.0310693 1.3574071.0160703 1.3884764.1414189.0942792 1.5695354.1333837 3.2253149.1173133 4.9673385-.0160703 1.7420236-.0316049 3.3426283-.0466039 4.8018141s.2046288 2.824628.6588835 4.0963267c.4542546 1.2716986 1.1999178 2.2209194 2.2369897 2.8476622 1.2556283.784232 2.9896167 1.207953 5.2019653 1.271163 2.2123485.0632099 4.1659648-.2506972 5.8608487-.9417213-.0310693-.3449764-.0230341-1.4045467.0241055-3.1787109.0471397-1.7741643-.0080351-2.75499-.1655244-2.9424772-3.5472571 1.0360005-5.697467.6904885-6.4506298-1.0365361-.7220934-1.6638147-.8635123-4.9909084-.4242566-9.981281v-.046604h6.7318605v-5.32088568h-6.7318605v-6.54383772h-4.0497228c-.2828378 1.28669763-.6122795 2.35376743-.9883252 3.20120941-.3760457.84744199-.98029 1.60060471-1.812733 2.25948817-.832443.65888347-1.87594303 1.01993018-3.1305 1.08314014z\" class=\"fill-color\" />\n</svg>\n`;\n","import icon from './index.js';\nimport { css, LitElement } from 'lit';\n\nclass IAIconTumblr extends LitElement {\n static get styles() {\n return css`\n :host {\n width: var(--iconWidth, 'auto');\n height: var(--iconHeight, 'auto');\n }\n\n .fill-color {\n fill: var(--iconFillColor);\n }\n\n .stroke-color {\n stroke: var(--iconStrokeColor);\n }\n `;\n }\n\n render() {\n return icon;\n }\n}\n\ncustomElements.define('ia-icon-tumblr', IAIconTumblr);\n\nexport default IAIconTumblr;\n","import '@internetarchive/icon-tumblr/icon-tumblr';\nimport { html } from 'lit';\nimport Provider from './provider.js';\n\nexport default class extends Provider {\n constructor(params) {\n super(params);\n this.name = 'Tumblr';\n this.icon = html`<ia-icon-tumblr></ia-icon-tumblr>`;\n this.class = 'tumblr';\n }\n\n get url() {\n return `https://www.tumblr.com/share/video?embed=%3Ciframe+width%3D%22640%22+height%3D%22480%22+frameborder%3D%220%22+allowfullscreen+src%3D%22https%3A%2F%2F${this.baseHost}%2Fembed%2F%22+webkitallowfullscreen%3D%22true%22+mozallowfullscreen%3D%22true%22%26gt%3B%26lt%3B%2Fiframe%3E&name=${this.encodedDescription}+%3A+${this.encodedCreator}${this.encodedPromoCopy}`;\n }\n}\n","import { html } from 'lit';\n\nexport default html`\n<svg viewBox=\"0 0 34 34\" xmlns=\"http://www.w3.org/2000/svg\" aria-labelledby=\"twitterTitleID twitterDescID\">\n <title id=\"twitterTitleID\">Twitter icon</title>\n <desc id=\"twitterDescID\">The Twitter logo, a cartoon bird</desc>\n <path d=\"m31.5297453 8.76273313c-.3135031.40766104-.7447036.83083673-1.2936015 1.26952707-.5488979.4386904-.9169698.7837578-1.1042157 1.0352022.1562166 2.319709-.1417719 4.5297454-.8939653 6.6301092-.7521935 2.1003638-1.8023754 3.9182538-3.1505457 5.45367-1.3481704 1.5354162-2.9627648 2.8284828-4.8437835 3.8791996-1.8810186 1.0507169-3.8321207 1.7483416-5.8533062 2.092874s-4.1215493.2894286-6.30109136-.1653114c-2.17954205-.45474-4.2092874-1.3401455-6.08923604-2.6562165 2.72737.4697196 5.67408517-.2514445 8.8401455-2.1634924-3.0719024-.7521935-4.88979241-2.2881447-5.45367-4.6078537 1.12882516.0631287 1.86550396.0631287 2.21003638 0-2.91568586-1.2850417-4.38904344-3.3693558-4.42007276-6.2529424.21934517.0310293.53284828.1487267.94050931.3530922s.78375775.3060133 1.12829017.3049433c-.81532206-.7211641-1.41076396-1.9045581-1.7863257-3.5501819-.37556173-1.64562376-.17173122-3.17355015.61149155-4.58377912 1.81789001 1.88101862 3.6908838 3.36989086 5.61898138 4.46661672 1.92809757 1.0967259 4.22426707 1.7547614 6.88850847 1.9741066-.2503745-1.1908838-.1722662-2.32719882.2343248-3.40894502.4065911-1.0817462 1.0416221-1.93612241 1.9050931-2.56312861.863471-.62700621 1.8114702-1.0817462 2.8439975-1.36421999 1.0325272-.28247378 2.0827091-.27444896 3.1505456.02407447s1.9767815.87042585 2.726835 1.71570726c1.3791997-.37663172 2.6802911-.87845068 3.9032742-1.50545688-.0310293.37663171-.1407019.74470361-.3290178 1.1042157-.1883158.35951209-.3530922.62593623-.4943291.79927242s-.3841216.4317355-.728654.77519795c-.3445324.34346244-.5638776.57832227-.6580355.70457949.2193452-.09415792.6895998-.23539482 1.410764-.42371067.7211641-.18831586 1.2069334-.39214638 1.4573079-.61149155 0 .44350524-.1567516.86668093-.4702547 1.27434196z\" class=\"fill-color\" />\n</svg>\n`;\n","import icon from './index.js';\nimport { css, LitElement } from 'lit';\n\nclass IAIconTwitter extends LitElement {\n static get styles() {\n return css`\n :host {\n width: var(--iconWidth, 'auto');\n height: var(--iconHeight, 'auto');\n }\n\n .fill-color {\n fill: var(--iconFillColor);\n }\n\n .stroke-color {\n stroke: var(--iconStrokeColor);\n }\n `;\n }\n\n render() {\n return icon;\n }\n}\n\ncustomElements.define('ia-icon-twitter', IAIconTwitter);\n\nexport default IAIconTwitter;\n","import '@internetarchive/icon-twitter/icon-twitter';\nimport { html } from 'lit';\nimport Provider from './provider.js';\n\nexport default class extends Provider {\n constructor(params) {\n super(params);\n this.name = 'Twitter';\n this.icon = html`<ia-icon-twitter></ia-icon-twitter>`;\n this.class = 'twitter';\n }\n\n get url() {\n return `https://twitter.com/intent/tweet?url=https://${this.baseHost}/details/${this.itemPath}&via=internetarchive&text=${this.encodedDescription}+%3A+${this.encodedCreator}${this.encodedPromoCopy}`;\n }\n}\n","import { classMap } from 'lit/directives/class-map.js';\nimport { html, LitElement } from 'lit';\nimport { nothing } from 'lit/html.js';\nimport '@internetarchive/icon-link/icon-link.js';\nimport sharingOptionsCSS from './styles/ia-sharing-options.js';\nimport EmailProvider from './providers/email.js';\nimport FacebookProvider from './providers/facebook.js';\nimport PinterestProvider from './providers/pinterest.js';\nimport TumblrProvider from './providers/tumblr.js';\nimport TwitterProvider from './providers/twitter.js';\n\nconst copyToClipboard = ({ currentTarget }) => {\n const textarea = currentTarget.querySelector('textarea');\n const note = currentTarget.querySelector('small');\n textarea.select();\n document.execCommand('copy');\n textarea.blur();\n note.classList.add('visible');\n clearTimeout(note.timeout);\n note.timeout = setTimeout(() => note.classList.remove('visible'), 4000);\n};\n\nexport class IASharingOptions extends LitElement {\n static get styles() {\n return sharingOptionsCSS;\n }\n\n static get properties() {\n return {\n baseHost: { type: String },\n creator: { type: String },\n description: { type: String },\n embedOptionsVisible: { type: Boolean },\n identifier: { type: String },\n sharingOptions: { type: Array },\n type: { type: String },\n renderHeader: { type: Boolean },\n fileSubPrefix: { type: String },\n };\n }\n\n constructor() {\n super();\n this.baseHost = '';\n this.sharingOptions = [];\n this.fileSubPrefix = '';\n }\n\n firstUpdated() {\n const {\n baseHost,\n creator,\n description,\n identifier,\n type,\n fileSubPrefix,\n } = this;\n const params = {\n baseHost,\n creator,\n description,\n identifier,\n type,\n fileSubPrefix,\n };\n\n this.sharingOptions = [\n new TwitterProvider(params),\n new FacebookProvider(params),\n new TumblrProvider(params),\n new PinterestProvider(params),\n new EmailProvider(params),\n ];\n }\n\n get sharingItems() {\n return this.sharingOptions.map(option => (\n html`<li>\n <a class=\"${option.class}\" href=\"${option.url}\" target=\"_blank\">\n ${option.icon}\n ${option.name}\n </a>\n </li>`\n ));\n }\n\n get embedOption() {\n return html`<li>\n <a href=\"#\" @click=${this.toggleEmbedOptions}>\n <ia-icon-link></ia-icon-link>\n Get an embeddable link\n </a>\n </li>`;\n }\n\n get iframeEmbed() {\n return html`&lt;iframe src=\"https://${this.baseHost}/embed/${this.identifier}\" width=\"560\" height=\"384\" frameborder=\"0\" webkitallowfullscreen=\"true\" mozallowfullscreen=\"true\" allowfullscreen&gt;&lt;/iframe&gt;`;\n }\n\n get bbcodeEmbed() {\n return `[archiveorg ${this.identifier} width=560 height=384 frameborder=0 webkitallowfullscreen=true mozallowfullscreen=true]`;\n }\n\n get helpURL() {\n return `https://${this.baseHost}/help/audio.php?identifier=${this.identifier}`;\n }\n\n toggleEmbedOptions(e) {\n e.preventDefault();\n this.embedOptionsVisible = !this.embedOptionsVisible;\n }\n\n get header() {\n const header = html`<header><h3>Share this ${this.type}</h3></header>`;\n return this.renderHeader ? header : nothing;\n }\n\n render() {\n return html`\n ${this.header}\n <ul>\n ${this.sharingItems}\n ${this.embedOption}\n <div class=${classMap({ visible: this.embedOptionsVisible, embed: true })}>\n <h4>Embed</h4>\n <div class=\"code\" @click=${copyToClipboard}>\n <textarea readonly=\"readonly\">${this.iframeEmbed}</textarea>\n <small>Copied to clipboard</small>\n </div>\n <h4>Embed for wordpress.com hosted blogs and archive.org item &lt;description&gt; tags</h4>\n <div class=\"code\" @click=${copyToClipboard}>\n <textarea readonly=\"readonly\">${this.bbcodeEmbed}</textarea>\n <small>Copied to clipboard</small>\n </div>\n <p>Want more? <a href=${this.helpURL}>Advanced embedding details, examples, and help</a>!</p>\n </div>\n </ul>\n `;\n }\n}\n\ncustomElements.define('ia-sharing-options', IASharingOptions);\n","import { html } from 'lit';\nimport '@internetarchive/icon-share/icon-share';\nimport '@internetarchive/ia-sharing-options';\n\nexport default class SharingProvider {\n constructor({\n item,\n baseHost,\n bookreader\n }) {\n const { identifier, creator, title } = item?.metadata;\n const creatorToUse = Array.isArray(creator) ? creator[0] : creator;\n const subPrefix = bookreader.options.subPrefix || '';\n const label = `Share this book`;\n this.icon = html`<ia-icon-share style=\"width: var(--iconWidth); height: var(--iconHeight);\"></ia-icon-share>`;\n this.label = label;\n this.id = 'share';\n this.component = html`<ia-sharing-options\n .identifier=${identifier}\n .type=${`book`}\n .creator=${creatorToUse}\n .description=${title}\n .baseHost=${baseHost}\n .fileSubPrefix=${subPrefix}\n ></ia-sharing-options>`;\n }\n}\n","import { html } from 'lit';\n\nexport default html`\n<svg name=\"sort-desc\" height=\"18\" viewBox=\"0 0 18 18\" width=\"18\" xmlns=\"http://www.w3.org/2000/svg\"><g fill=\"none\" fill-rule=\"evenodd\"><path d=\"m2.32514544 8.30769231.7756949-2.08468003h2.92824822l.75630252 2.08468003h1.01809955l-2.70523594-6.92307693h-1.01809955l-2.69553976 6.92307693zm3.41305753-2.86037492h-2.34647705l1.17323853-3.22883h.01939237z\" fill=\"#fff\" fill-rule=\"nonzero\"/><path d=\"m7.1689722 16.6153846v-.7756949h-4.4117647l4.29541047-5.3716871v-.77569491h-5.06140918v.77569491h3.97543633l-4.30510666 5.3716871v.7756949z\" fill=\"#fff\" fill-rule=\"nonzero\"/><path d=\"m10.3846154 11.0769231 2.7692308 5.5384615 2.7692307-5.5384615m-2.7692307 4.1538461v-13.15384612\" stroke=\"#fff\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.661538\"/></g></svg>\n`;\n","import { html } from 'lit';\n\nexport default html`\n<svg name=\"sort-asc\" height=\"18\" viewBox=\"0 0 18 18\" width=\"18\" xmlns=\"http://www.w3.org/2000/svg\"><g fill=\"none\" fill-rule=\"evenodd\"><path d=\"m2.32514544 8.30769231.7756949-2.08468003h2.92824822l.75630252 2.08468003h1.01809955l-2.70523594-6.92307693h-1.01809955l-2.69553976 6.92307693zm3.41305753-2.86037492h-2.34647705l1.17323853-3.22883h.01939237z\" fill=\"#fff\" fill-rule=\"nonzero\"/><path d=\"m7.1689722 16.6153846v-.7756949h-4.4117647l4.29541047-5.3716871v-.77569491h-5.06140918v.77569491h3.97543633l-4.30510666 5.3716871v.7756949z\" fill=\"#fff\" fill-rule=\"nonzero\"/><path d=\"m10.3846154 11.0769231 2.7692308 5.5384615 2.7692307-5.5384615m-2.7692307 4.1538461v-13.15384612\" stroke=\"#fff\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.661538\" transform=\"matrix(1 0 0 -1 0 18.692308)\"/></g></svg>\n`;\n","import { html } from 'lit';\n\nexport default html`\n<svg name=\"sort-neutral\" height=\"18\" viewBox=\"0 0 18 18\" width=\"18\" xmlns=\"http://www.w3.org/2000/svg\"><g fill=\"#fff\" fill-rule=\"evenodd\"><path d=\"m2.32514544 8.30769231.7756949-2.08468003h2.92824822l.75630252 2.08468003h1.01809955l-2.70523594-6.92307693h-1.01809955l-2.69553976 6.92307693zm3.41305753-2.86037492h-2.34647705l1.17323853-3.22883h.01939237z\" fill-rule=\"nonzero\"/><path d=\"m7.1689722 16.6153846v-.7756949h-4.4117647l4.29541047-5.3716871v-.77569491h-5.06140918v.77569491h3.97543633l-4.30510666 5.3716871v.7756949z\" fill-rule=\"nonzero\"/><circle cx=\"13\" cy=\"9\" r=\"2\"/></g></svg>\n`;\n","import { html } from 'lit';\n\nexport default html`\n <svg height=\"24\" viewBox=\"0 0 24 24\" width=\"24\" xmlns=\"http://www.w3.org/2000/svg\" aria-labelledby=\"volumesTitleID volumesDescID\">\n <title id=\"volumesTitleID\">Volumes icon</title>\n <desc id=\"volumesDescID\">Three books stacked on each other</desc>\n <g fill=\"#ffffff\">\n <path fill=\"#ffffff\" d=\"m9.83536396 0h10.07241114c.1725502.47117517.3378411.76385809.4958725.87804878.1295523.11419069.3199719.1998337.5712586.25692905.2512868.05709534.4704647.08564301.6575337.08564301h.2806036v15.24362526h-4.3355343v3.8106985h-4.44275v3.7250554h-12.01318261c-.27306495 0-.50313194-.085643-.69020098-.256929-.18706903-.1712861-.30936193-.3425721-.36687867-.5138581l-.06449694-.2785477v-14.2159091c0-.32815965.08627512-.5922949.25882537-.79240577.17255024-.20011086.34510049-.32150776.51765073-.36419068l.25882537-.0640244h3.36472977v-2.54767184c0-.31374722.08627513-.57067627.25882537-.77078714.17255025-.20011086.34510049-.32150776.51765074-.36419068l.25882536-.06402439h3.36472978v-2.56929047c0-.32815964.08627512-.5922949.25882537-.79240576.17255024-.20011087.34510049-.31430156.51765073-.34257207zm10.78355264 15.6294346v-13.53076498c-.2730649-.08536585-.4456152-.16380266-.5176507-.23531042-.1725502-.1424612-.2730649-.27078714-.3015441-.38497783v13.36031043h-9.87808272c0 .0144124-.02149898.0144124-.06449694 0-.04299795-.0144124-.08962561.006929-.13988296.0640244-.05025735.0570953-.07538603.1427383-.07538603.256929s.02149898.210643.06449694.289357c.04299795.078714.08599591.1322062.12899387.1604767l.06449693.0216187h10.71905571zm-10.2449613-2.4412417h7.98003v-11.60421286h-7.98003zm1.6827837-9.41990022h4.6153002c.1725502 0 .3199718.05349224.4422647.16047672s.1834393.23891353.1834393.39578714c0 .15687362-.0611464.28519956-.1834393.38497783s-.2697145.1496674-.4422647.1496674h-4.6153002c-.1725503 0-.3199719-.04988913-.4422647-.1496674-.1222929-.09977827-.1834394-.22810421-.1834394-.38497783 0-.15687361.0611465-.28880266.1834394-.39578714.1222928-.10698448.2697144-.16047672.4422647-.16047672zm-6.08197737 13.50997782h7.72120467v-.8131929h-3.79610541c-.27306495 0-.49950224-.085643-.67931188-.256929-.17980964-.1712861-.29847284-.3425721-.35598958-.5138581l-.06449694-.2785477v-10.02023282h-2.82530086zm6.77217827-11.36890243h3.2139578c.1295522 0 .240956.05709534.3342113.17128603.0932554.11419069.139883.24972284.139883.40659645 0 .15687362-.0466276.28880267-.139883.39578714-.0932553.10698448-.2046591.16047672-.3342113.16047672h-3.2139578c-.1295523 0-.2373264-.05349224-.3233223-.16047672-.0859959-.10698447-.1289938-.23891352-.1289938-.39578714 0-.15687361.0429979-.29240576.1289938-.40659645s.19377-.17128603.3233223-.17128603zm-11.15043132 15.11557653h7.69942646v-.7491685h-3.79610539c-.25854616 0-.48135376-.0892462-.66842279-.2677384-.18706904-.1784922-.30936193-.3605876-.36687868-.546286l-.06449694-.2569291v-10.04101994h-2.80352266zm14.62237682-4.5606985h-.8191949v2.1410754h-9.89986085s-.04299796.0285477-.12899387.085643c-.08599592.0570954-.12201369.1427384-.10805331.2569291 0 .1141907.01786928.210643.05360784.289357.03573856.0787139.07538603.125.1189424.138858l.06449694.0432373h10.71905575v-2.9542683zm-4.3991936 3.8106985h-.8191949v2.077051h-9.8563045c0 .0144124-.02149898.0144124-.06449694 0-.04299795-.0144125-.08962561.0105321-.13988296.0748337-.05025735.0643015-.07538603.1607538-.07538603.289357 0 .1141906.02149898.2070399.06449694.2785476.04299795.0715078.08599591.1141907.12899387.1280488l.06449693.0216186h10.69811519v-2.8686252z\" />\n </g>\n </svg>\n`;\n","import { css, html, LitElement, nothing } from 'lit';\nimport { repeat } from 'lit/directives/repeat.js';\n\nexport class Volumes extends LitElement {\n static get properties() {\n return {\n subPrefix: { type: String },\n hostUrl: { type: String },\n viewableFiles: { type: Array },\n sortOrderBy: { type: String },\n };\n }\n\n constructor() {\n super();\n this.hostUrl = '';\n this.sortOrderBy = '';\n this.subPrefix = '';\n this.viewableFiles = [];\n }\n\n firstUpdated() {\n const activeFile = this.shadowRoot.querySelector('.content.active');\n // allow for css animations to run before scrolling to active file\n setTimeout(() => {\n // scroll active file into view if needed\n // note: `scrollIntoViewIfNeeded` handles auto-scroll gracefully for Chrome, Safari\n // Firefox does not have this capability yet as it does not support `scrollIntoViewIfNeeded`\n if (activeFile?.scrollIntoViewIfNeeded) {\n activeFile?.scrollIntoViewIfNeeded(true);\n return;\n }\n\n // Todo: support `scrollIntoView` or `parentContainer.crollTop = x` for FF & \"IE 11\"\n // currently, the hard `position: absolutes` misaligns subpanel when `scrollIntoView` is applied :(\n }, 350);\n }\n\n volumeItemWithImageTitle(item) {\n const hrefUrl = this.sortOrderBy === 'default'\n ? `${this.hostUrl}${item.url_path}`\n : `${this.hostUrl}${item.url_path}?sort=${this.sortOrderBy}`;\n\n return html`\n <li class=\"content active\">\n <div class=\"separator\"></div>\n <a class=\"container\" href=\"${hrefUrl}\">\n <div class=\"image\">\n <img src=\"${item.image}\">\n </div>\n <div class=\"text\">\n <p class=\"item-title\">${item.title}</p>\n <small>by: ${item.author}</small>\n </div>\n </a>\n </li>\n `;\n }\n\n volumeItem(item) {\n const activeClass = this.subPrefix === item.file_subprefix ? ' active' : '';\n\n const hrefUrl = this.sortOrderBy === 'default'\n ? `${this.hostUrl}${item.url_path}`\n : `${this.hostUrl}${item.url_path}?sort=${this.sortOrderBy}`;\n\n return html`\n <li>\n <div class=\"separator\"></div>\n <div class=\"content${activeClass}\">\n <a href=\"https://${hrefUrl}\">\n <p class=\"item-title\">${item.title}</p>\n </a>\n </div>\n </li>\n `;\n }\n\n get volumesList() {\n const volumes = repeat(this.viewableFiles, volume => volume?.file_prefix, this.volumeItem.bind(this));\n return html`\n <ul>\n ${volumes}\n <div class=\"separator\"></div> \n </ul>\n `;\n }\n\n render() {\n return html`\n ${this.viewableFiles.length ? this.volumesList : nothing}\n `;\n }\n\n static get styles() {\n return css`\n :host {\n display: block;\n overflow-y: auto;\n box-sizing: border-box;\n color: var(--primaryTextColor);\n margin-top: 14px;\n margin-bottom: 2rem;\n --activeBorderWidth: 2px;\n }\n\n a {\n color: #ffffff;\n text-decoration: none\n }\n\n img {\n width: 35px;\n height: 45px;\n }\n\n ul {\n padding: 0;\n list-style: none;\n margin: var(--activeBorderWidth) 0.5rem 1rem 0;\n }\n\n ul > li:first-child .separator {\n display: none;\n }\n\n li {\n cursor: pointer;\n outline: none;\n position: relative;\n }\n\n li .content {\n padding: 2px 0 4px 2px;\n border: var(--activeBorderWidth) solid transparent;\n padding: .2rem 0 .4rem .2rem;\n }\n \n li .content.active {\n border: var(--activeBorderWidth) solid #538bc5;\n }\n\n small {\n font-style: italic;\n white-space: initial;\n }\n\n .container {\n display: flex;\n align-items: center;\n justify-content: center\n }\n\n .item-title {\n margin-block-start: 0em;\n margin-block-end: 0em;\n font-size: 14px;\n font-weight: bold;\n word-wrap: break-word;\n padding-left: 5px;\n }\n\n .separator {\n background-color: var(--secondaryBGColor);\n width: 98%;\n margin: 1px auto;\n height: 1px;\n }\n\n .text {\n padding-left: 10px;\n }\n\n .icon {\n display: inline-block;\n width: 14px;\n height: 14px;\n margin-left: .7rem;\n border: 1px solid var(--primaryTextColor);\n border-radius: 2px;\n background: var(--activeButtonBg) 50% 50% no-repeat;\n }\n\n `;\n }\n}\n\ncustomElements.define('viewable-files', Volumes);\n","import { html } from 'lit';\n\nimport sortDescIcon from '../assets/icon_sort_desc.js';\nimport sortAscIcon from '../assets/icon_sort_asc.js';\nimport sortNeutralIcon from '../assets/icon_sort_neutral.js';\nimport volumesIcon from '../assets/icon_volumes.js';\n\nimport './volumes.js';\n\nconst sortType = {\n title_asc: 'title_asc',\n title_desc: 'title_desc',\n default: 'default'\n};\nexport default class VolumesProvider {\n /**\n * @param {import('../../BookReader').default} bookreader\n */\n constructor({ baseHost, bookreader, onProviderChange }) {\n this.onProviderChange = onProviderChange;\n this.component = document.createElement(\"viewable-files\");\n\n const files = bookreader.options.multipleBooksList.by_subprefix;\n this.viewableFiles = Object.keys(files).map(item => files[item]);\n this.volumeCount = Object.keys(files).length;\n\n /** @type {import('../../BookReader').default} */\n this.bookreader = bookreader;\n\n this.component.subPrefix = bookreader.options.subPrefix || \"\";\n this.component.hostUrl = baseHost;\n this.component.viewableFiles = this.viewableFiles;\n\n this.id = \"volumes\";\n this.label = `Viewable files (${this.volumeCount})`;\n this.icon = html`${volumesIcon}`;\n\n this.sortOrderBy = sortType.default;\n\n // get sort state from query param\n if (this.bookreader.urlPlugin) {\n this.bookreader.urlPlugin.pullFromAddressBar();\n\n const urlSortValue = this.bookreader.urlPlugin.getUrlParam('sort');\n if (urlSortValue === sortType.title_asc || urlSortValue === sortType.title_desc) {\n this.sortOrderBy = urlSortValue;\n }\n }\n this.sortVolumes(this.sortOrderBy);\n }\n\n get sortButton() {\n const sortIcons = {\n default: html`\n <button class=\"sort-by neutral-icon\" aria-label=\"Sort volumes in initial order\" @click=${() => this.sortVolumes(\"title_asc\")}>${sortNeutralIcon}</button>\n `,\n title_asc: html`\n <button class=\"sort-by asc-icon\" aria-label=\"Sort volumes in ascending order\" @click=${() => this.sortVolumes(\"title_desc\")}>${sortAscIcon}</button>\n `,\n title_desc: html`\n <button class=\"sort-by desc-icon\" aria-label=\"Sort volumes in descending order\" @click=${() => this.sortVolumes(\"default\")}>${sortDescIcon}</button>\n `,\n };\n\n return sortIcons[this.sortOrderBy];\n }\n\n /**\n * @param {'default' | 'title_asc' | 'title_desc'} sortByType\n */\n sortVolumes(sortByType) {\n let sortedFiles = [];\n\n const files = this.viewableFiles;\n sortedFiles = files.sort((a, b) => {\n if (sortByType === sortType.title_asc) return a.title.localeCompare(b.title);\n else if (sortByType === sortType.title_desc) return b.title.localeCompare(a.title);\n else return a.orig_sort - b.orig_sort;\n });\n\n this.sortOrderBy = sortByType;\n this.component.sortOrderBy = sortByType;\n this.component.viewableFiles = [...sortedFiles];\n this.actionButton = this.sortButton;\n\n if (this.bookreader.urlPlugin) {\n this.bookreader.urlPlugin.pullFromAddressBar();\n if (this.sortOrderBy !== sortType.default) {\n this.bookreader.urlPlugin.setUrlParam('sort', sortByType);\n } else {\n this.bookreader.urlPlugin.removeUrlParam('sort');\n }\n }\n\n this.onProviderChange(this.bookreader);\n\n this.multipleFilesClicked(sortByType);\n }\n\n /**\n * @param {'default' | 'title_asc' | 'title_desc'} orderBy\n */\n multipleFilesClicked(orderBy) {\n if (!window.archive_analytics) {\n return;\n }\n window.archive_analytics?.send_event_no_sampling(\n 'BookReader',\n `VolumesSort|${orderBy}`,\n window.location.path,\n );\n }\n\n}\n","import { svg } from 'lit';\n\nexport default svg`\n <svg class=\"ia-logo\" width=\"27\" height=\"30\" viewBox=\"0 0 27 30\" xmlns=\"http://www.w3.org/2000/svg\" aria-labelledby=\"logoTitleID logoDescID\">\n <title id=\"logoTitleID\">Internet Archive logo</title>\n <desc id=\"logoDescID\">A line drawing of the Internet Archive headquarters building façade.</desc>\n <g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n <mask id=\"mask-2\" fill=\"white\">\n <path d=\"M26.6666667,28.6046512 L26.6666667,30 L0,30 L0.000283687943,28.6046512 L26.6666667,28.6046512 Z M25.6140351,26.5116279 L25.6140351,28.255814 L1.05263158,28.255814 L1.05263158,26.5116279 L25.6140351,26.5116279 Z M3.62469203,7.6744186 L3.91746909,7.82153285 L4.0639977,10.1739544 L4.21052632,13.9963932 L4.21052632,17.6725617 L4.0639977,22.255044 L4.03962296,25.3421929 L3.62469203,25.4651163 L2.16024641,25.4651163 L1.72094074,25.3421929 L1.55031755,22.255044 L1.40350877,17.6970339 L1.40350877,14.0211467 L1.55031755,10.1739544 L1.68423854,7.80887484 L1.98962322,7.6744186 L3.62469203,7.6744186 Z M24.6774869,7.6744186 L24.9706026,7.82153285 L25.1168803,10.1739544 L25.2631579,13.9963932 L25.2631579,17.6725617 L25.1168803,22.255044 L25.0927809,25.3421929 L24.6774869,25.4651163 L23.2130291,25.4651163 L22.7736357,25.3421929 L22.602418,22.255044 L22.4561404,17.6970339 L22.4561404,14.0211467 L22.602418,10.1739544 L22.7369262,7.80887484 L23.0420916,7.6744186 L24.6774869,7.6744186 Z M9.94042303,7.6744186 L10.2332293,7.82153285 L10.3797725,10.1739544 L10.5263158,13.9963932 L10.5263158,17.6725617 L10.3797725,22.255044 L10.3556756,25.3421929 L9.94042303,25.4651163 L8.47583122,25.4651163 L8.0362015,25.3421929 L7.86556129,22.255044 L7.71929825,17.6970339 L7.71929825,14.0211467 L7.86556129,10.1739544 L8.00005604,7.80887484 L8.30491081,7.6744186 L9.94042303,7.6744186 Z M18.0105985,7.6744186 L18.3034047,7.82153285 L18.449948,10.1739544 L18.5964912,13.9963932 L18.5964912,17.6725617 L18.449948,22.255044 L18.425851,25.3421929 L18.0105985,25.4651163 L16.5460067,25.4651163 L16.1066571,25.3421929 L15.9357367,22.255044 L15.7894737,17.6970339 L15.7894737,14.0211467 L15.9357367,10.1739544 L16.0702315,7.80887484 L16.3753664,7.6744186 L18.0105985,7.6744186 Z M25.6140351,4.53488372 L25.6140351,6.97674419 L1.05263158,6.97674419 L1.05263158,4.53488372 L25.6140351,4.53488372 Z M13.0806755,0 L25.9649123,2.93331338 L25.4484139,3.8372093 L0.771925248,3.8372093 L0,3.1041615 L13.0806755,0 Z\" id=\"path-1\"></path>\n </mask>\n <use fill=\"#FFFFFF\" xlink:href=\"#path-1\"></use>\n <g mask=\"url(#mask-2)\" fill=\"#FFFFFF\">\n <path d=\"M0,0 L26.6666667,0 L26.6666667,30 L0,30 L0,0 Z\" id=\"swatch\"></path>\n </g>\n </g>\n </svg>\n`;\n","// eslint-disable-next-line no-unused-vars\nimport { SharedResizeObserver } from '@internetarchive/shared-resize-observer';\n// eslint-disable-next-line no-unused-vars\nimport { ModalManager } from '@internetarchive/modal-manager';\nimport { css, html, LitElement, nothing } from 'lit';\nimport SearchProvider from './search/search-provider.js';\nimport DownloadProvider from './downloads/downloads-provider.js';\nimport VisualAdjustmentProvider from './visual-adjustments/visual-adjustments-provider.js';\nimport BookmarksProvider from './bookmarks/bookmarks-provider.js';\nimport SharingProvider from './sharing.js';\nimport VolumesProvider from './volumes/volumes-provider.js';\nimport iaLogo from './assets/ia-logo.js';\n\nconst events = {\n menuUpdated: 'menuUpdated',\n updateSideMenu: 'updateSideMenu',\n PostInit: 'PostInit',\n ViewportInFullScreen: 'ViewportInFullScreen',\n};\nexport class BookNavigator extends LitElement {\n static get properties() {\n return {\n itemMD: { type: Object },\n bookReaderLoaded: { type: Boolean },\n bookreader: { type: Object },\n bookIsRestricted: { type: Boolean },\n downloadableTypes: { type: Array },\n isAdmin: { type: Boolean },\n lendingInitialized: { type: Boolean },\n lendingStatus: { type: Object },\n menuProviders: { type: Object },\n menuShortcuts: { type: Array },\n signedIn: { type: Boolean },\n loaded: { type: Boolean },\n sharedObserver: { type: Object, attribute: false },\n modal: { type: Object, attribute: false },\n fullscreenBranding: { type: Object },\n };\n }\n\n constructor() {\n super();\n this.itemMD = undefined;\n this.loaded = false;\n this.bookReaderCannotLoad = false;\n this.bookReaderLoaded = false;\n this.bookreader = null;\n this.bookIsRestricted = false;\n this.downloadableTypes = [];\n this.isAdmin = false;\n this.lendingInitialized = false;\n this.lendingStatus = {};\n this.menuProviders = {};\n this.menuShortcuts = [];\n this.signedIn = false;\n /** @type {ModalManager} */\n this.modal = undefined;\n /** @type {SharedResizeObserver} */\n this.sharedObserver = undefined;\n this.fullscreenBranding = iaLogo;\n // Untracked properties\n this.sharedObserverHandler = undefined;\n this.brWidth = 0;\n this.brHeight = 0;\n this.shortcutOrder = [\n /**\n * sets exit FS button (`this.fullscreenBranding1)\n * when `br.options.enableFSLogoShortcut`\n */\n 'fullscreen',\n 'volumes',\n 'search',\n 'bookmarks'\n ];\n }\n\n disconnectedCallback() {\n this.sharedObserver.removeObserver({\n target: this.mainBRContainer,\n handler: this.sharedObserverHandler\n });\n }\n\n firstUpdated() {\n this.bindEventListeners();\n this.emitPostInit();\n this.loaded = true;\n }\n\n updated(changed) {\n if (!this.bookreader || !this.itemMD || !this.bookReaderLoaded) {\n return;\n }\n\n const reload = changed.has('loaded') && this.loaded;\n if (reload\n || changed.has('itemMD')\n || changed.has('bookreader')\n || changed.has('signedIn')\n || changed.has('isAdmin')\n || changed.has('modal')) {\n this.initializeBookSubmenus();\n }\n\n if (changed.has('sharedObserver') && this.bookreader) {\n this.loadSharedObserver();\n this.initializeBookSubmenus();\n }\n }\n\n /**\n * Global event emitter for when Book Navigator loads\n */\n emitPostInit() {\n // emit global event when book nav has loaded with current bookreader selector\n this.dispatchEvent(new CustomEvent(`BrBookNav:${events.PostInit}`, {\n detail: { brSelector: this.bookreader?.el },\n bubbles: true,\n composed: true,\n }));\n }\n\n /**\n * @typedef {{\n * baseHost: string,\n * modal: ModalManager,\n * sharedObserver: SharedResizeObserver,\n * bookreader: BookReader,\n * item: Item,\n * signedIn: boolean,\n * isAdmin: boolean,\n * onProviderChange: (BookReader, object) => void,\n * }} baseProviderConfig\n *\n * @return {baseProviderConfig}\n */\n get baseProviderConfig() {\n return {\n baseHost: this.baseHost,\n modal: this.modal,\n sharedObserver: this.sharedObserver,\n bookreader: this.bookreader,\n item: this.itemMD,\n signedIn: this.signedIn,\n isAdmin: this.isAdmin,\n onProviderChange: () => {}\n };\n }\n\n get isWideEnoughToOpenMenu() {\n return this.brWidth >= 640;\n }\n /**\n * Instantiates books submenus & their update callbacks\n *\n * NOTE: we are doing our best to scope bookreader's instance.\n * If your submenu provider uses a bookreader instance to read, manually\n * manipulate BookReader, please update the navigator's instance of it\n * to keep it in sync.\n */\n initializeBookSubmenus() {\n const providers = {\n downloads: new DownloadProvider(this.baseProviderConfig),\n share: new SharingProvider(this.baseProviderConfig),\n visualAdjustments: new VisualAdjustmentProvider({\n ...this.baseProviderConfig,\n /** Update menu contents */\n onProviderChange: () => {\n this.updateMenuContents();\n },\n }),\n };\n\n if (this.bookreader.options.enableSearch) {\n providers.search = new SearchProvider({\n ...this.baseProviderConfig,\n /**\n * Search specific menu updates\n * @param {BookReader} brInstance\n * @param {{ searchCanceled: boolean }} searchUpdates\n */\n onProviderChange: (brInstance = null, searchUpdates = {}) => {\n if (brInstance) {\n /* refresh br instance reference */\n this.bookreader = brInstance;\n }\n\n this.updateMenuContents();\n\n if (searchUpdates.openMenu === false) {\n return;\n }\n\n if (this.isWideEnoughToOpenMenu && !searchUpdates?.searchCanceled) {\n /* open side search menu */\n setTimeout(() => {\n this.updateSideMenu('search', 'open');\n }, 0);\n }\n },\n });\n }\n\n if (this.bookreader.options.enableBookmarks) {\n providers.bookmarks = new BookmarksProvider({\n ...this.baseProviderConfig,\n onProviderChange: (bookmarks) => {\n const method = Object.keys(bookmarks).length ? 'add' : 'remove';\n this[`${method}MenuShortcut`]('bookmarks');\n this.updateMenuContents();\n }\n });\n }\n\n // add shortcut for volumes if multipleBooksList exists\n if (this.bookreader.options.enableMultipleBooks) {\n providers.volumes = new VolumesProvider({\n ...this.baseProviderConfig,\n onProviderChange: (brInstance = null, volumesUpdates = {}) => {\n if (brInstance) {\n /* refresh br instance reference */\n this.bookreader = brInstance;\n }\n this.updateMenuContents();\n if (this.isWideEnoughToOpenMenu) {\n /* open side search menu */\n setTimeout(() => {\n this.updateSideMenu('volumes', 'open');\n });\n }\n }\n });\n }\n\n this.menuProviders = providers;\n this.addMenuShortcut('search');\n this.addMenuShortcut('volumes');\n this.updateMenuContents();\n }\n\n /** gets element that houses the bookreader in light dom */\n get mainBRContainer() {\n return document.querySelector(this.bookreader?.el);\n }\n\n /** Fullscreen Shortcut */\n addFullscreenShortcut() {\n const closeFS = {\n icon: this.fullscreenShortcut,\n id: 'fullscreen',\n };\n this.menuShortcuts.push(closeFS);\n this.sortMenuShortcuts();\n this.emitMenuShortcutsUpdated();\n }\n\n deleteFullscreenShortcut() {\n const updatedShortcuts = this.menuShortcuts.filter(({ id }) => {\n return id !== 'fullscreen';\n });\n this.menuShortcuts = updatedShortcuts;\n this.sortMenuShortcuts();\n this.emitMenuShortcutsUpdated();\n }\n\n closeFullscreen() {\n this.bookreader.exitFullScreen();\n }\n\n get fullscreenShortcut() {\n return html`\n <button\n @click=${() => this.closeFullscreen()}\n title=\"Exit fullscreen view\"\n >${this.fullscreenBranding}</button>\n `;\n }\n /** End Fullscreen Shortcut */\n\n /**\n * Open side menu\n * @param {string} menuId\n * @param {('open'|'close'|'toggle')} action\n */\n updateSideMenu(menuId = '', action = 'open') {\n if (!menuId) {\n return;\n }\n const event = new CustomEvent(\n events.updateSideMenu, {\n detail: { menuId, action },\n },\n );\n this.dispatchEvent(event);\n }\n\n /**\n * Sets order of menu and emits custom event when done\n */\n updateMenuContents() {\n const {\n search, downloads, visualAdjustments, share, bookmarks, volumes\n } = this.menuProviders;\n const availableMenus = [volumes, search, bookmarks, visualAdjustments, share].filter((menu) => !!menu);\n\n if (this.shouldShowDownloadsMenu()) {\n downloads?.update(this.downloadableTypes);\n availableMenus.splice(1, 0, downloads);\n }\n\n const event = new CustomEvent(\n events.menuUpdated, {\n detail: availableMenus,\n },\n );\n this.dispatchEvent(event);\n }\n\n /**\n * Confirms if we should show the downloads menu\n * @returns {bool}\n */\n shouldShowDownloadsMenu() {\n if (this.bookIsRestricted === false) { return true; }\n if (this.isAdmin) { return true; }\n const { user_loan_record = {} } = this.lendingStatus;\n const hasNoLoanRecord = Array.isArray(user_loan_record); /* (bc PHP assoc. arrays) */\n\n if (hasNoLoanRecord) { return false; }\n\n const hasValidLoan = user_loan_record.type && (user_loan_record.type !== 'SESSION_LOAN');\n return hasValidLoan;\n }\n\n /**\n * Adds a provider object to the menuShortcuts array property if it isn't\n * already added. menuShortcuts are then sorted by shortcutOrder and\n * a menuShortcutsUpdated event is emitted.\n *\n * @param {string} menuId - a string matching the id property of a provider\n */\n addMenuShortcut(menuId) {\n if (this.menuShortcuts.find((m) => m.id === menuId)) {\n // menu is already there\n return;\n }\n\n if (!this.menuProviders[menuId]) {\n // no provider for this menu\n return;\n }\n\n this.menuShortcuts.push(this.menuProviders[menuId]);\n\n this.sortMenuShortcuts();\n this.emitMenuShortcutsUpdated();\n }\n\n /**\n * Removes a provider object from the menuShortcuts array and emits a\n * menuShortcutsUpdated event.\n *\n * @param {string} menuId - a string matching the id property of a provider\n */\n removeMenuShortcut(menuId) {\n this.menuShortcuts = this.menuShortcuts.filter((m) => m.id !== menuId);\n this.emitMenuShortcutsUpdated();\n }\n\n /**\n * Sorts the menuShortcuts property by comparing each provider's id to\n * the id in each iteration over the shortcutOrder array.\n */\n sortMenuShortcuts() {\n this.menuShortcuts = this.shortcutOrder.reduce((shortcuts, id) => {\n const menu = this.menuShortcuts.find((m) => m.id === id);\n if (menu) { shortcuts.push(menu); }\n return shortcuts;\n }, []);\n }\n\n emitMenuShortcutsUpdated() {\n const event = new CustomEvent('menuShortcutsUpdated', {\n detail: this.menuShortcuts,\n });\n this.dispatchEvent(event);\n }\n\n emitLoadingStatusUpdate(loaded) {\n const event = new CustomEvent('loadingStateUpdated', {\n detail: { loaded },\n });\n this.dispatchEvent(event);\n }\n\n /**\n * Core bookreader event handler registry\n *\n * NOTE: we are trying to keep bookreader's instance in scope\n * Please update Book Navigator's instance reference of it to keep it current\n */\n bindEventListeners() {\n window.addEventListener('BookReader:PostInit', (e) => {\n this.bookreader = e.detail.props;\n this.bookReaderLoaded = true;\n this.bookReaderCannotLoad = false;\n this.emitLoadingStatusUpdate(true);\n this.loadSharedObserver();\n setTimeout(() => {\n this.bookreader.resize();\n }, 0);\n });\n window.addEventListener('BookReader:fullscreenToggled', (event) => {\n const { detail: { props: brInstance = null } } = event;\n if (brInstance) {\n this.bookreader = brInstance;\n }\n this.manageFullScreenBehavior();\n }, { passive: true });\n window.addEventListener('BookReader:ToggleSearchMenu', (event) => {\n this.dispatchEvent(new CustomEvent(events.updateSideMenu, {\n detail: { menuId: 'search', action: 'toggle' },\n }));\n });\n window.addEventListener('LendingFlow:PostInit', ({ detail }) => {\n const {\n downloadTypesAvailable, lendingStatus, isAdmin, previewType,\n } = detail;\n this.lendingInitialized = true;\n this.downloadableTypes = downloadTypesAvailable;\n this.lendingStatus = lendingStatus;\n this.isAdmin = isAdmin;\n this.bookReaderCannotLoad = previewType === 'singlePagePreview';\n this.emitLoadingStatusUpdate(true);\n });\n window.addEventListener('BRJSIA:PostInit', ({ detail }) => {\n const { isRestricted, downloadURLs } = detail;\n this.bookReaderLoaded = true;\n this.downloadableTypes = downloadURLs;\n this.bookIsRestricted = isRestricted;\n });\n }\n\n loadSharedObserver() {\n this.sharedObserverHandler = { handleResize: this.handleResize.bind(this) };\n this.sharedObserver?.addObserver({\n target: this.mainBRContainer,\n handler: this.sharedObserverHandler\n });\n }\n\n /**\n * Uses resize observer to fire BookReader's `resize` functionality\n * We do not want to trigger resize IF:\n * - book animation is happening\n * - book is in fullscreen (fullscreen is handled separately)\n *\n * @param { target: HTMLElement, contentRect: DOMRectReadOnly } entry\n */\n handleResize({ contentRect, target }) {\n const startBrWidth = this.brWidth;\n const startBrHeight = this.brHeight;\n const { animating } = this.bookreader;\n\n if (target === this.mainBRContainer) {\n this.brWidth = contentRect.width;\n this.brHeight = contentRect.height;\n }\n\n if (!startBrWidth && this.brWidth) {\n // loading up, let's update side menus\n this.initializeBookSubmenus();\n }\n\n const widthChange = startBrWidth !== this.brWidth;\n const heightChange = startBrHeight !== this.brHeight;\n\n if (!animating && (widthChange || heightChange)) {\n this.bookreader?.resize();\n }\n }\n\n /**\n * Manages Fullscreen behavior\n * This makes sure that controls are _always_ in view\n * We need this to accommodate LOAN BAR during fullscreen\n */\n manageFullScreenBehavior() {\n this.emitFullScreenState();\n\n if (!this.bookreader.options.enableFSLogoShortcut) {\n return;\n }\n\n const isFullScreen = this.bookreader.isFullscreen();\n if (isFullScreen) {\n this.addFullscreenShortcut();\n } else {\n this.deleteFullscreenShortcut();\n }\n }\n\n /**\n * Relays fullscreen toggle events\n */\n emitFullScreenState() {\n const isFullScreen = this.bookreader.isFullscreen();\n const event = new CustomEvent('ViewportInFullScreen', {\n detail: { isFullScreen },\n });\n this.dispatchEvent(event);\n }\n\n get itemImage() {\n const identifier = this.itemMD?.metadata.identifier;\n const url = `https://${this.baseHost}/services/img/${identifier}`;\n return html`<img class=\"cover-img\" src=${url} alt=\"cover image for ${identifier}\">`;\n }\n\n get placeholder() {\n return html`<div class=\"placeholder\">${this.itemImage}</div>`;\n }\n\n render() {\n return html`<div id=\"book-navigator__root\">\n ${this.bookReaderCannotLoad ? this.placeholder : nothing}\n ${!this.bookReaderCannotLoad ? html`<slot name=\"main\"></slot>` : nothing}\n </div>\n `;\n }\n\n static get styles() {\n return css`\n :host,\n #book-navigator__root,\n slot,\n slot > * {\n display: block;\n height: inherit;\n width: inherit;\n }\n .placeholder {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-direction: column;\n margin: 5%;\n }\n .cover-img {\n max-height: 300px;\n }\n `;\n }\n}\n\ncustomElements.define('book-navigator', BookNavigator);\n","/**\n * BookReaderTemplate to load BookNavigator components\n */\n\nimport { LitElement, html, css } from 'lit';\n\nimport '@internetarchive/ia-item-navigator';\nimport '../BookNavigator/book-navigator.js';\n// eslint-disable-next-line no-unused-vars\nimport { ModalManager } from '@internetarchive/modal-manager';\nimport '@internetarchive/modal-manager';\nimport { SharedResizeObserver } from '@internetarchive/shared-resize-observer';\n\nexport class IaBookReader extends LitElement {\n static get properties() {\n return {\n item: { type: Object },\n baseHost: { type: String },\n signedIn: { type: Boolean },\n fullscreen: { type: Boolean, reflect: true, attribute: true },\n sharedObserver: { type: Object, attribute: false },\n modal: { type: Object, attribute: false },\n loaded: { type: Boolean },\n menuShortcuts: { type: Array },\n menuContents: { type: Array },\n };\n }\n\n constructor() {\n super();\n this.item = undefined;\n this.bookreader = undefined;\n this.baseHost = 'https://archive.org';\n this.fullscreen = false;\n this.signedIn = false;\n /** @type {ModalManager} */\n this.modal = undefined;\n /** @type {SharedResizeObserver} */\n this.sharedObserver = undefined;\n this.loaded = false;\n this.menuShortcuts = [];\n this.menuContents = [];\n this.openMenuName = '';\n }\n\n updated() {\n if (!this.modal) {\n this.setModalManager();\n }\n\n if (!this.sharedObserver) {\n this.sharedObserver = new SharedResizeObserver();\n }\n }\n\n get itemNav() {\n return this.shadowRoot.querySelector('ia-item-navigator');\n }\n\n /** Creates modal DOM & attaches to `<body>` */\n setModalManager() {\n let modalManager = document.querySelector('modal-manager');\n if (!modalManager) {\n modalManager = document.createElement(\n 'modal-manager'\n );\n document.body.appendChild(modalManager);\n }\n\n this.modal = modalManager;\n }\n\n manageFullscreen(e) {\n const { detail } = e;\n const fullscreen = !!detail.isFullScreen;\n this.fullscreen = fullscreen;\n this.dispatchEvent(new CustomEvent('fullscreenStateUpdated', { detail: { fullscreen }}));\n\n }\n\n loadingStateUpdated(e) {\n const { loaded } = e.detail;\n this.loaded = loaded || null;\n this.dispatchEvent(new CustomEvent('loadingStateUpdated', { detail: { loaded }}));\n }\n\n setMenuShortcuts(e) {\n this.menuShortcuts = [...e.detail];\n }\n\n setMenuContents(e) {\n const updatedContents = [...e.detail];\n this.menuContents = updatedContents;\n }\n\n manageSideMenuEvents(e) {\n const { menuId, action } = e.detail;\n if (!menuId) {\n return;\n }\n\n this.openMenuName = menuId;\n\n if (action === 'open') {\n this.itemNav?.openShortcut(menuId);\n } else if (action === 'toggle') {\n this.itemNav?.toggleMenu();\n }\n }\n\n render() {\n return html`\n <div class=\"main-component\">\n <ia-item-navigator\n ?viewportInFullscreen=${this.fullscreen}\n .basehost=${this.baseHost}\n .item=${this.item}\n .modal=${this.modal}\n .loaded=${this.loaded}\n .sharedObserver=${this.sharedObserver}\n ?signedIn=${this.signedIn}\n .menuShortcuts=${this.menuShortcuts}\n .menuContents=${this.menuContents}\n .openMenu=${this.openMenuName}\n >\n <div slot=\"header\">\n <slot name=\"header\"></slot>\n </div>\n <div slot=\"main\">\n <book-navigator\n .modal=${this.modal}\n .baseHost=${this.baseHost}\n .itemMD=${this.item}\n ?signedIn=${this.signedIn}\n ?sideMenuOpen=${this.menuOpened}\n .sharedObserver=${this.sharedObserver}\n @ViewportInFullScreen=${this.manageFullscreen}\n @loadingStateUpdated=${this.loadingStateUpdated}\n @updateSideMenu=${this.manageSideMenuEvents}\n @menuUpdated=${this.setMenuContents}\n @menuShortcutsUpdated=${this.setMenuShortcuts}\n >\n <div slot=\"main\">\n <slot name=\"main\"></slot>\n </div>\n </book-navigator>\n </div>\n </ia-item-navigator>\n </div>\n `;\n }\n\n static get styles() {\n return css`\n :host {\n display: block;\n --primaryBGColor: var(--black, #000);\n --secondaryBGColor: #222;\n --tertiaryBGColor: #333;\n --primaryTextColor: var(--white, #fff);\n --primaryCTAFill: #194880;\n --primaryCTABorder: #c5d1df;\n --secondaryCTAFill: #333;\n --secondaryCTABorder: #999;\n --primaryErrorCTAFill: #e51c26;\n --primaryErrorCTABorder: #f8c6c8;\n background-color: var(--primaryBGColor);\n position: relative;\n }\n\n :host([fullscreen]),\n ia-item-navigator[viewportinfullscreen] {\n position: fixed;\n inset: 0;\n height: 100%;\n min-height: unset;\n }\n\n .main-component {\n height: 100%;\n width: 100%;\n min-height: inherit;\n }\n\n div[slot=\"header\"],\n div[slot=\"main\"] {\n display: flex;\n width: 100%;\n }\n\n slot {\n display: block;\n flex: 1;\n }\n\n ia-item-navigator {\n min-height: var(--br-height, inherit);\n height: var(--br-height, inherit);\n display: block;\n width: 100%;\n color: var(--primaryTextColor);\n --menuButtonLabelDisplay: block;\n --menuWidth: 320px;\n --menuSliderBg: var(--secondaryBGColor);\n --activeButtonBg: var(--tertiaryBGColor);\n --subpanelRightBorderColor: var(--secondaryCTABorder);\n --animationTiming: 100ms;\n --iconFillColor: var(--primaryTextColor);\n --iconStrokeColor: var(--primaryTextColor);\n --menuSliderHeaderIconHeight: 2rem;\n --menuSliderHeaderIconWidth: 2rem;\n --iconWidth: 2.4rem;\n --iconHeight: 2.4rem;\n --shareLinkColor: var(--primaryTextColor);\n --shareIconBorder: var(--primaryTextColor);\n --shareIconBg: var(--secondaryBGColor);\n --activityIndicatorLoadingDotColor: var(--primaryTextColor);\n --activityIndicatorLoadingRingColor: var(--primaryTextColor);\n }\n `;\n }\n}\n\nwindow.customElements.define(\"ia-bookreader\", IaBookReader);\n","var isObject = require('../internals/is-object');\n\nvar floor = Math.floor;\n\n// `Number.isInteger` method implementation\n// https://tc39.es/ecma262/#sec-number.isinteger\nmodule.exports = function isInteger(it) {\n return !isObject(it) && isFinite(it) && floor(it) === it;\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar $reduceRight = require('../internals/array-reduce').right;\nvar arrayMethodIsStrict = require('../internals/array-method-is-strict');\nvar CHROME_VERSION = require('../internals/engine-v8-version');\nvar IS_NODE = require('../internals/engine-is-node');\n\nvar STRICT_METHOD = arrayMethodIsStrict('reduceRight');\n// Chrome 80-82 has a critical bug\n// https://bugs.chromium.org/p/chromium/issues/detail?id=1049982\nvar CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83;\n\n// `Array.prototype.reduceRight` method\n// https://tc39.es/ecma262/#sec-array.prototype.reduceright\n$({ target: 'Array', proto: true, forced: !STRICT_METHOD || CHROME_BUG }, {\n reduceRight: function reduceRight(callbackfn /* , initialValue */) {\n return $reduceRight(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n","var $ = require('../internals/export');\nvar isInteger = require('../internals/is-integer');\n\n// `Number.isInteger` method\n// https://tc39.es/ecma262/#sec-number.isinteger\n$({ target: 'Number', stat: true }, {\n isInteger: isInteger\n});\n","'use strict';\nvar fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');\nvar anObject = require('../internals/an-object');\nvar toLength = require('../internals/to-length');\nvar toString = require('../internals/to-string');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\nvar advanceStringIndex = require('../internals/advance-string-index');\nvar regExpExec = require('../internals/regexp-exec-abstract');\n\n// @@match logic\nfixRegExpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNative) {\n return [\n // `String.prototype.match` method\n // https://tc39.es/ecma262/#sec-string.prototype.match\n function match(regexp) {\n var O = requireObjectCoercible(this);\n var matcher = regexp == undefined ? undefined : regexp[MATCH];\n return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](toString(O));\n },\n // `RegExp.prototype[@@match]` method\n // https://tc39.es/ecma262/#sec-regexp.prototype-@@match\n function (string) {\n var rx = anObject(this);\n var S = toString(string);\n var res = maybeCallNative(nativeMatch, rx, S);\n\n if (res.done) return res.value;\n\n if (!rx.global) return regExpExec(rx, S);\n\n var fullUnicode = rx.unicode;\n rx.lastIndex = 0;\n var A = [];\n var n = 0;\n var result;\n while ((result = regExpExec(rx, S)) !== null) {\n var matchStr = toString(result[0]);\n A[n] = matchStr;\n if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);\n n++;\n }\n return n === 0 ? null : A;\n }\n ];\n});\n","(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n\ttypeof define === 'function' && define.amd ? define(['exports'], factory) :\n\t(global = global || self, factory(global.throttleDebounce = {}));\n}(this, (function (exports) { 'use strict';\n\n\t/* eslint-disable no-undefined,no-param-reassign,no-shadow */\n\n\t/**\n\t * Throttle execution of a function. Especially useful for rate limiting\n\t * execution of handlers on events like resize and scroll.\n\t *\n\t * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.\n\t * @param {boolean} [noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds while the\n\t * throttled-function is being called. If noTrailing is false or unspecified, callback will be executed one final time\n\t * after the last throttled-function call. (After the throttled-function has not been called for `delay` milliseconds,\n\t * the internal counter is reset).\n\t * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,\n\t * to `callback` when the throttled-function is executed.\n\t * @param {boolean} [debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is false (at end),\n\t * schedule `callback` to execute after `delay` ms.\n\t *\n\t * @returns {Function} A new, throttled, function.\n\t */\n\tfunction throttle (delay, noTrailing, callback, debounceMode) {\n\t /*\n\t * After wrapper has stopped being called, this timeout ensures that\n\t * `callback` is executed at the proper times in `throttle` and `end`\n\t * debounce modes.\n\t */\n\t var timeoutID;\n\t var cancelled = false; // Keep track of the last time `callback` was executed.\n\n\t var lastExec = 0; // Function to clear existing timeout\n\n\t function clearExistingTimeout() {\n\t if (timeoutID) {\n\t clearTimeout(timeoutID);\n\t }\n\t } // Function to cancel next exec\n\n\n\t function cancel() {\n\t clearExistingTimeout();\n\t cancelled = true;\n\t } // `noTrailing` defaults to falsy.\n\n\n\t if (typeof noTrailing !== 'boolean') {\n\t debounceMode = callback;\n\t callback = noTrailing;\n\t noTrailing = undefined;\n\t }\n\t /*\n\t * The `wrapper` function encapsulates all of the throttling / debouncing\n\t * functionality and when executed will limit the rate at which `callback`\n\t * is executed.\n\t */\n\n\n\t function wrapper() {\n\t for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {\n\t arguments_[_key] = arguments[_key];\n\t }\n\n\t var self = this;\n\t var elapsed = Date.now() - lastExec;\n\n\t if (cancelled) {\n\t return;\n\t } // Execute `callback` and update the `lastExec` timestamp.\n\n\n\t function exec() {\n\t lastExec = Date.now();\n\t callback.apply(self, arguments_);\n\t }\n\t /*\n\t * If `debounceMode` is true (at begin) this is used to clear the flag\n\t * to allow future `callback` executions.\n\t */\n\n\n\t function clear() {\n\t timeoutID = undefined;\n\t }\n\n\t if (debounceMode && !timeoutID) {\n\t /*\n\t * Since `wrapper` is being called for the first time and\n\t * `debounceMode` is true (at begin), execute `callback`.\n\t */\n\t exec();\n\t }\n\n\t clearExistingTimeout();\n\n\t if (debounceMode === undefined && elapsed > delay) {\n\t /*\n\t * In throttle mode, if `delay` time has been exceeded, execute\n\t * `callback`.\n\t */\n\t exec();\n\t } else if (noTrailing !== true) {\n\t /*\n\t * In trailing throttle mode, since `delay` time has not been\n\t * exceeded, schedule `callback` to execute `delay` ms after most\n\t * recent execution.\n\t *\n\t * If `debounceMode` is true (at begin), schedule `clear` to execute\n\t * after `delay` ms.\n\t *\n\t * If `debounceMode` is false (at end), schedule `callback` to\n\t * execute after `delay` ms.\n\t */\n\t timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);\n\t }\n\t }\n\n\t wrapper.cancel = cancel; // Return the wrapper function.\n\n\t return wrapper;\n\t}\n\n\t/* eslint-disable no-undefined */\n\t/**\n\t * Debounce execution of a function. Debouncing, unlike throttling,\n\t * guarantees that a function is only executed a single time, either at the\n\t * very beginning of a series of calls, or at the very end.\n\t *\n\t * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.\n\t * @param {boolean} [atBegin] - Optional, defaults to false. If atBegin is false or unspecified, callback will only be executed `delay` milliseconds\n\t * after the last debounced-function call. If atBegin is true, callback will be executed only at the first debounced-function call.\n\t * (After the throttled-function has not been called for `delay` milliseconds, the internal counter is reset).\n\t * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,\n\t * to `callback` when the debounced-function is executed.\n\t *\n\t * @returns {Function} A new, debounced function.\n\t */\n\n\tfunction debounce (delay, atBegin, callback) {\n\t return callback === undefined ? throttle(delay, atBegin, false) : throttle(delay, callback, atBegin !== false);\n\t}\n\n\texports.debounce = debounce;\n\texports.throttle = throttle;\n\n\tObject.defineProperty(exports, '__esModule', { value: true });\n\n})));\n//# sourceMappingURL=index.umd.js.map\n"],"names":["__decorate","decorators","target","key","desc","d","c","arguments","length","r","Object","getOwnPropertyDescriptor","Reflect","decorate","i","defineProperty","SearchServiceErrorType","SortDirection","BooleanParser","parseValue","rawValue","Boolean","shared","NumberParser","value","parseFloat","Number","isNaN","ByteParser","DateParser","this","parseJSDate","parseBracketDate","yearMatch","match","parsedValue","replace","parsed","Date","parse","date","indexOf","getTime","getTimezoneOffset","DurationParser","componentArray","split","seconds","parseNumberFormat","parseColonSeparatedFormat","undefined","hasNaNComponent","map","element","index","componentValue","multiplier","Math","floor","reduce","a","b","MediaTypeParser","StringParser","String","constructor","parser","values","processRawValue","Array","isArray","forEach","parseAndPersistValue","push","BooleanField","super","DateField","DurationField","NumberField","StringField","ByteField","MediaTypeField","Metadata","json","rawMetadata","identifier","addeddate","publicdate","indexdate","audio_codec","audio_sample_rate","collection","collections_raw","collection_size","contributor","coverage","creator","description","downloads","duration","files_count","item_count","item_size","language","lineage","mediatype","month","noindex","notes","num_favorites","num_reviews","runtime","scanner","source","start_localtime","start_time","stop_time","subject","taper","title","track","transferer","type","uploader","utc_offset","venue","week","year","File","name","btih","md5","format","mtime","crc32","sha1","original","size","height","width","external_identifier","album","Review","reviewbody","reviewtitle","reviewer","reviewdate","createdate","stars","MetadataResponse","_a","_b","rawResponse","created","d1","d2","dir","files","file","item_last_updated","metadata","server","uniq","workable_servers","speech_vs_music_asr","reviews","entry","SearchResponseDetails","numFound","start","docs","doc","aggregations","SearchResponse","responseHeader","response","SearchServiceError","Error","message","details","SearchService","searchBackend","params","performSearch","error","success","fetchMetadata","itemNotFound","default","baseUrl","queryAsString","asUrlSearchParams","toString","url","fetchUrl","fetch","err","getErrorResult","networkError","forensics","searchEngineError","decodingError","errorType","menuButtonWidth","sliderWidth","transitionTiming","IAIconCollapseSidebar","render","customElements","define","MenuButton","icon","href","label","menuDetails","id","selected","followable","onClick","e","preventDefault","dispatchMenuTypeSelectedEvent","dispatchEvent","CustomEvent","bubbles","composed","detail","iconClass","buttonClass","menuItem","linkButton","clickButton","sliderEvents","closeDrawer","IAMenuSlider","menus","open","manuallyHandleClose","selectedMenu","selectedMenuAction","animateMenuOpen","updated","actionButton","selectedMenuDetails","setSelectedMenu","closeMenu","drawerClosed","find","menu","component","headerClass","actionBlock","closeButton","sliderDetailsClass","menuItems","selectedMenuClass","renderMenuHeader","selectedMenuComponent","window","IAIconEllipses","IAItemNavLoader","bookIconSvg","loader","IANoTheaterAvailable","emitLoaded","loaded","changed","has","downloadUrl","prototype","ItemNavigator","viewAvailable","baseHost","signedIn","menuContents","menuShortcuts","viewportInFullscreen","menuOpened","openMenuState","disconnectedCallback","removeResizeObserver","oldObserver","get","removeObserver","resizeObserverConfig","setResizeObserver","handleResize","contentRect","sharedObserver","addObserver","headerSlot","handler","requestUpdate","frame","loaderTitle","slotChange","slottedContent","assignedNodes","slot","displayReaderClass","headerHeight","offsetHeight","menuClass","shouldRenderMenu","renderSideMenu","renderViewport","loadingArea","item","loadingStateUpdated","noTheaterView","slotVisibility","manageViewportFullscreen","fullscreenStatus","isFullScreen","event","toggleMenu","setOpenMenu","openMenu","setMenuContents","updatedContents","setMenuShortcuts","manageSideMenuEvents","menuId","action","openShortcut","drawerState","shortcuts","menuToggleButton","selectedMenuId","hasMenuOrShortcuts","subnavWidth","transitionEffect","menuMargin","theaterBg","converter","JSON","atob","arg","reflect","attribute","ResizeObserverBoxOptions","resizeObservers","msg","trigger","freeze","obj","ResizeObserverSize","inlineSize","blockSize","DOMRectReadOnly","x","y","top","left","bottom","right","toJSON","fromRect","rectangle","isSVG","SVGElement","isHidden","getBBox","offsetWidth","getClientRects","isElement","Element","scope","ownerDocument","defaultView","global","cache","WeakMap","scrollRegexp","verticalRegexp","IE","test","navigator","userAgent","parseDimension","pixel","switchSizes","zeroBoxes","devicePixelContentBoxSize","borderBoxSize","contentBoxSize","calculateBoxSizes","forceRecalculation","set","cs","getComputedStyle","svg","ownerSVGElement","removePadding","boxSizing","writingMode","canScrollVertically","overflowY","canScrollHorizontally","overflowX","paddingTop","paddingRight","paddingBottom","paddingLeft","borderTop","borderTopWidth","borderRight","borderRightWidth","borderBottom","borderBottomWidth","horizontalPadding","verticalPadding","horizontalBorderArea","borderLeftWidth","verticalBorderArea","horizontalScrollbarThickness","clientHeight","verticalScrollbarThickness","clientWidth","widthReduction","heightReduction","contentWidth","contentHeight","borderBoxWidth","borderBoxHeight","boxes","round","devicePixelRatio","calculateBoxSize","observedBox","DEVICE_PIXEL_CONTENT_BOX","BORDER_BOX","ResizeObserverEntry","calculateDepthForNode","node","Infinity","depth","parent","parentNode","broadcastActiveObservations","shallowestDepth","callbacks","ro","activeTargets","entries","ot","targetDepth","lastReportedSize","callback","call","observer","splice","_i","callbacks_1","gatherActiveObservationsAtDepth","skippedTargets","observationTargets","isActive","watching","observerConfig","attributes","characterData","childList","subtree","events","time","timeout","now","scheduled","scheduler","Scheduler","_this","stopped","listener","schedule","run","cb","until","elementsHaveResized","some","ErrorEvent","document","createEvent","initEvent","process","toggle_1","el_1","createTextNode","MutationObserver","observe","textContent","queueMicroTask","requestAnimationFrame","stop","body","addEventListener","disconnect","removeEventListener","updateCount","n","ResizeObservation","CONTENT_BOX","tagName","isReplacedElement","display","ResizeObserverDetail","resizeObserver","observerMap","getObservationIndex","ResizeObserverController","connect","options","firstObservation","box","unobserve","lastObservation","slice","ResizeObserver","TypeError","SharedResizeObserver","handlers","resizeHandlers","Map","Set","add","delete","ModalConfig","_c","_d","_e","subtitle","headline","headerColor","showProcessingIndicator","processingImageMode","showCloseButton","closeOnBackdropClick","isCEPolyfill","polyfillWrapFlushCallback","removeNodes","container","end","nextSibling","removeChild","marker","random","nodeMarker","markerRegex","RegExp","boundAttributeSuffix","Template","result","parts","nodesToRemove","stack","walker","createTreeWalker","content","lastPartIndex","partIndex","strings","nextNode","nodeType","hasAttributes","count","endsWith","stringForPart","lastAttributeNameRegex","exec","attributeLookupName","toLowerCase","attributeValue","getAttribute","removeAttribute","statics","currentNode","data","lastIndex","insert","s","createMarker","insertBefore","previousSibling","pop","str","suffix","isTemplatePartActive","part","createComment","walkerNodeFilter","removeNodesFromTemplate","template","nextActiveIndexInTemplateParts","nodeIndex","removeCount","nodesToRemoveInTemplate","currentRemovingNode","countNodes","startIndex","directives","isDirective","o","noChange","nothing","TemplateInstance","processor","__parts","setValue","commit","fragment","cloneNode","importNode","nodeName","handleTextExpression","insertAfterNode","handleAttributeExpressions","adoptNode","upgrade","policy","trustedTypes","createPolicy","createHTML","commentMarker","TemplateResult","l","html","isCommentBinding","commentOpen","lastIndexOf","attributeMatch","substr","createElement","getHTML","innerHTML","isPrimitive","isIterable","Symbol","iterator","AttributeCommitter","dirty","_createPart","AttributePart","v","text","t","setAttribute","_getValue","committer","directive","NodePart","__pendingValue","startNode","appendChild","endNode","ref","__insert","__commitText","__commitTemplateResult","Node","__commitNode","__commitIterable","clear","valueAsString","templateFactory","update","instance","_clone","itemPart","itemParts","appendIntoPart","insertAfterPart","BooleanAttributePart","PropertyCommitter","single","PropertyPart","eventOptionsSupported","EventPart","eventName","eventContext","__boundHandleEvent","handleEvent","newListener","oldListener","shouldRemoveListener","capture","once","passive","shouldAddListener","__options","getOptions","templateCache","templateCaches","stringsArray","keyString","join","getTemplateElement","prefix","getTemplateCacheKey","scopeName","compatibleShadyCSSVersion","ShadyCSS","prepareTemplateDom","console","warn","shadyTemplateFactory","cacheKey","TEMPLATE_TYPES","shadyRenderSet","JSCompiler_renameProperty","prop","_obj","defaultConverter","toAttribute","stringify","fromAttribute","notEqual","old","defaultPropertyDeclaration","hasChanged","UpdatingElement","initialize","finalize","_classProperties","p","attr","_attributeNameForProperty","_attributeToPropertyMap","hasOwnProperty","superProperties","getPrototypeOf","k","_ensureClassProperties","noAccessor","descriptor","getPropertyDescriptor","oldValue","requestUpdateInternal","configurable","enumerable","superCtor","props","properties","getOwnPropertyNames","getOwnPropertySymbols","createProperty","_updateState","_updatePromise","Promise","res","_enableUpdatingResolver","_changedProperties","_saveInstanceProperties","_v","_instanceProperties","enableUpdating","_attributeToProperty","ctor","attrValue","_propertyValueToAttribute","propName","getPropertyOptions","_propertyValueFromAttribute","shouldRequestUpdate","_valueHasChanged","_reflectingProperties","_hasRequestedUpdate","_enqueueUpdate","updateComplete","performUpdate","_applyInstanceProperties","shouldUpdate","changedProperties","_markUpdated","firstUpdated","_getUpdateComplete","getUpdateComplete","_propertyToAttribute","HTMLElement","customElement","classOrDescriptor","clazz","legacyCustomElement","kind","elements","finisher","standardCustomElement","property","protoOrDescriptor","proto","legacyProperty","placement","initializer","standardProperty","ElementProto","msMatchesSelector","webkitMatchesSelector","supportsAdoptingStyleSheets","ShadowRoot","nativeShadow","Document","CSSStyleSheet","constructionToken","CSSResult","cssText","safeToken","_styleSheet","replaceSync","textFromCSSResult","css","acc","idx","renderNotImplemented","LitElement","styles","userStyles","getStyles","addStyles","reduceRight","unshift","_styles","cssRules","rule","_getUniqueStyles","renderRoot","createRenderRoot","adoptStyles","attachShadow","shadowRootOptions","adoptedStyleSheets","styleSheet","_needsShimAdoptedStyleSheets","ScopingShim","prepareAdoptedCssText","localName","hasUpdated","styleElement","templateResult","style","hasRendered","needsScoping","host","firstScopeRender","renderContainer","createDocumentFragment","firstChild","appendInto","renderedDOM","templateElement","querySelectorAll","condensedStyle","templates","from","removeStylesFromLitTemplates","refNode","insertCount","walkerIndex","insertNodeIntoTemplate","prepareTemplateStyles","querySelector","removes","mode","IAActivityIndicatorMode","processing","complete","checkmarkColorCss","completedRingColorCss","loadingRingColorCss","loadingDotColorCss","ModalTemplate","config","closeButtonTemplate","handleCloseButton","Event","modalLogoSize","processingImageSize","modalCornerRadius","modalBorder","modalBottomMarginCss","modalTopMarginCss","modalHeaderBottomPaddingCss","modalBottomPadding","scrollOffset","titleFontSize","subtitleFontSize","headlineFontSize","messageFontSize","titleLineHeight","subtitleLineHeight","headlineLineHeight","messageLineHeight","ModalManagerMode","ModalManagerHostBridge","modalManager","windowResizeThrottler","throttle","updateModalContainerHeight","bind","handleModeChange","Open","startResizeListener","stopDocumentScroll","Closed","stopResizeListener","resumeDocumentScroll","setProperty","innerHeight","classList","remove","ModalManager","hostBridge","backdropClicked","closeButtonPressed","customModalContent","getMode","closeModal","callUserClosedModalCallback","userClosedModalCallback","showModal","thisArg","_arguments","generator","modalTemplate","focus","P","resolve","reject","fulfilled","step","next","rejected","done","then","apply","emitModeChangeEvent","modalBackdropColor","modalBackdropZindex","modalWidth","modalMaxWidth","modalZindex","selector","legacyQuery","standardQuery","UnsafeHTMLDirective","partInfo","PartType","directiveName","_templateResult","_value","raw","_$litType$","resultType","Directive","unsafeHTML","BookSearchResult","matchRegex","hit","par","resultDetails","pageNumber","isInteger","page","coverImage","cover","resultSelected","highlightedHit","IABookSearchResults","results","query","queryInProgress","renderHeader","renderSearchAllFields","displayResultImages","errorMessage","bindBookReaderListeners","renderSearchAllFiles","searchResultText","searchResultBg","searchResultBorder","activeButtonBg","mainCSS","checkmarkIcon","closeIcon","buttonCSS","focusOnInputIfNecessary","setResults","shadowRoot","currentTarget","input","dispatchSearchCanceled","header","resultsCount","controls","cancelSearch","resultsClass","selectResult","searchMultipleControls","setQuery","showSearchCTA","headerSection","searchForm","loadingIndicator","setErrorMessage","resultsSet","searchCTA","searchState","SearchProvider","onProviderChange","bookreader","onBookSearchInitiated","onSearchStarted","onSearchRequestError","onSearchResultsClicked","onSearchResultsChange","onSearchResultsCleared","searchCanceledInMenu","bindEventListeners","getMenuDetails","getComponent","advanceToPage","updateMenu","unit","onSearchCanceled","searchCanceled","term","search","errorMessages","noResults","notIndexed","messageToShow","searchResults","q","matches","cancelSearchRequest","searchView","clearSearchFieldAndResults","searchUpdates","leaf","leafNumToIndex","_searchPluginGoToResult","IABookDownloads","expiration","isBookProtected","mainCss","buttonStyles","option","note","formatsCount","loanExpiryMessage","renderDownloadOptions","accessProtectedBook","menuBase","pdf","epub","publicMenuBase","DownloadsProvider","isProtected","computeAvailableTypes","downloadTypes","ending","availableTypes","menuData","found","incoming","link","formattedType","downloadOption","menuButtonText","menuInfo","assign","IAIconVisualAdjustment","ChildPart","_$LH","insertPart","containerPart","refPart","_$startNode","_$endNode","newConnectionState","oldParent","_$parent","parentChanged","_$reparentDisconnectables","_$notifyConnectionChanged","_$isConnected","setChildPartValue","directiveParent","_$setValue","RESET_VALUE","removePart","generateMap","list","repeat","_getValuesAndKeys","items","keyFnOrTemplate","keyFn","keys","oldParts","_$committedValue","getCommittedValue","newValues","newKeys","_itemKeys","newKeyToIndexMap","oldKeyToIndexMap","oldKeys","newParts","oldHead","oldTail","newHead","newTail","oldIndex","oldPart","newPart","setCommittedValue","namespacedEvent","optionChange","zoomIn","zoomOut","IABookVisualAdjustments","activeCount","showZoomControls","activeOptions","emitOptionChangedEvent","active","changedOptionId","prepareEventDetails","optionName","updatedOptions","checkedOption","min","max","setRangeValue","formID","changeActiveStateFor","rangeSlider","activeAdjustments","emitZoomOut","emitZoomIn","adjustmentCheckbox","zoomControls","visualAdjustmentOptions","VisualAdjustmentsProvider","bookContainer","refs","$brContainer","onAdjustmentChange","optionUpdateComplete","updateOptionsCount","onZoomIn","onZoomOut","zoom","adjustments","brightness","contrast","grayscale","invert","filters","newValue","DeleteModalActions","cancelAction","Function","deleteAction","pageID","BookmarkButton","state","side","position","handleClick","BookmarksLogin","api","endpoint","headers","credentials","method","getAll","post","bookmark","sendBookmarkData","put","color","IABookmarks","bookmarks","editedBookmark","modal","loginOptions","loginClicked","loginUrl","displayMode","bookmarkColors","className","defaultColor","deleteModalConfig","activeBookmarkID","updateDisplay","emitBookmarksChanged","bookId","fetchUserBookmarks","setBREventListeners","fetchBookmarks","initializeBookmarks","setTimeout","renderBookmarkButtons","markActiveBookmark","leafNum","nomalizedParams","getBookmarkColor","formatPage","getPageNum","thumbnail","getPageURI","resText","parsedResponse","bkmrks","formattedLeafNum","parseInt","formattedBookmark","formatBookmark","getBookmark","confirmDeletion","createBookmark","$","not","pageEl","existingButton","pageBookmark","bookmarkState","_models","book","getPage","isViewable","bookmarkButton","stopPropagation","pageSide","constMode2up","bookmarkButtonClicked","atSetup","constModeThumb","currentIndex","pagesInView","displayedIndices","pagesHaveActiveBookmark","includes","requestedPageHasBookmark","closeEdit","m","existingBookmark","bookmarkEdited","emitBookmarkButtonClicked","disableAddBookmarkButton","jumpToPage","displayDeletionModal","deleteBookmark","currBookmarks","pageToCheck","shouldEnableAddBookmarkButton","addBookmark","bookmarkSelected","saveBookmark","bookmarksList","allowAddingBookmark","addBookmarkButton","bookmarkHelperMessage","IABookmarkEdit","showBookmark","bookmarkEditCSS","bookmarkColorsCSS","colorId","bookmarkId","emitColorChangedEvent","changeColorTo","bookmarkTemplate","emitSaveEvent","updateNote","bookmarkColor","emitDeleteEvent","IAIconEditPencil","IABookmarksList","defaultBookmarkColor","emitEditEvent","emitSaveBookmark","emitDeleteBookmark","colorVal","labelInfo","editMode","bookmarkColorInfo","activeClass","emitSelectedEvent","editBookmark","editBookmarkComponent","emitBookmarkColorChanged","sort","bookmarksCount","sortedBookmarks","sortBookmarks","bookmarkItem","bookmarkslist","BookmarksProvider","referrerStr","encodeURIComponent","location","bookmarksLoginClicked","bindEvents","setup","bookmarksChanged","bookmarksLength","showSidePanel","archive_analytics","send_event_no_sampling","path","IAIconShare","classMap","classInfo","filter","_previousClasses","_staticClasses","IAIconLink","IAIconEmail","promoCopy","encodeString","encodedFileSubPrefix","fileSubPrefix","class","itemPath","IAIconFacebook","IAIconPinterest","encodedDescription","encodedCreator","encodedPromoCopy","IAIconTumblr","IAIconTwitter","copyToClipboard","textarea","select","execCommand","blur","clearTimeout","IASharingOptions","embedOptionsVisible","sharingOptions","toggleEmbedOptions","sharingItems","embedOption","visible","embed","iframeEmbed","bbcodeEmbed","helpURL","SharingProvider","creatorToUse","subPrefix","Volumes","hostUrl","sortOrderBy","viewableFiles","activeFile","scrollIntoViewIfNeeded","hrefUrl","url_path","image","author","file_subprefix","volumes","volume","file_prefix","volumeItem","volumesList","sortType","VolumesProvider","multipleBooksList","by_subprefix","volumeCount","volumesIcon","urlPlugin","pullFromAddressBar","urlSortValue","getUrlParam","sortVolumes","sortNeutralIcon","title_asc","sortAscIcon","title_desc","sortDescIcon","sortByType","sortedFiles","localeCompare","orig_sort","sortButton","setUrlParam","removeUrlParam","multipleFilesClicked","orderBy","BookNavigator","itemMD","bookReaderCannotLoad","bookReaderLoaded","bookIsRestricted","downloadableTypes","isAdmin","lendingInitialized","lendingStatus","menuProviders","fullscreenBranding","iaLogo","sharedObserverHandler","brWidth","brHeight","shortcutOrder","mainBRContainer","emitPostInit","initializeBookSubmenus","loadSharedObserver","brSelector","el","providers","DownloadProvider","baseProviderConfig","share","visualAdjustments","VisualAdjustmentProvider","updateMenuContents","enableSearch","brInstance","isWideEnoughToOpenMenu","updateSideMenu","enableBookmarks","enableMultipleBooks","addMenuShortcut","closeFS","fullscreenShortcut","sortMenuShortcuts","emitMenuShortcutsUpdated","updatedShortcuts","exitFullScreen","closeFullscreen","availableMenus","shouldShowDownloadsMenu","user_loan_record","emitLoadingStatusUpdate","resize","manageFullScreenBehavior","downloadTypesAvailable","previewType","isRestricted","downloadURLs","startBrWidth","startBrHeight","animating","widthChange","heightChange","emitFullScreenState","enableFSLogoShortcut","isFullscreen","addFullscreenShortcut","deleteFullscreenShortcut","itemImage","placeholder","IaBookReader","fullscreen","openMenuName","setModalManager","itemNav","manageFullscreen","isObject","module","exports","it","isFinite","$reduceRight","arrayMethodIsStrict","CHROME_VERSION","IS_NODE","forced","callbackfn","stat","fixRegExpWellKnownSymbolLogic","anObject","toLength","requireObjectCoercible","advanceStringIndex","regExpExec","MATCH","nativeMatch","maybeCallNative","regexp","O","matcher","string","rx","S","fullUnicode","unicode","A","matchStr","delay","noTrailing","debounceMode","timeoutID","cancelled","lastExec","clearExistingTimeout","wrapper","_len","arguments_","_key","self","elapsed","cancel","debounce","atBegin","factory"],"sourceRoot":""}