PageSourceSearch

https://dorsetcountymuseum.org/packages/dynamic-import.js?hash=c0b3ab429b314fd5a479e457267c1dc73e8e238c

js dorsetcountymuseum.org collected 2026-09-24 09:56:54 UTC 19,594 bytes, 575 lines download raw bytes

1//////////////////////////////////////////////////////////////////////////
2//                                                                      //
3// This is a generated file. You can view the original                  //
4// source in your browser if your browser supports source maps.         //
5// Source maps are supported by all recent versions of Chrome, Safari,  //
6// and Firefox, and by Internet Explorer 11.                            //
7//                                                                      //
8//////////////////////////////////////////////////////////////////////////
9
10
11Package["core-runtime"].queue("dynamic-import",function () {/* Imports */
12var Meteor = Package.meteor.Meteor;
13var global = Package.meteor.global;
14var meteorEnv = Package.meteor.meteorEnv;
15var meteorInstall = Package.modules.meteorInstall;
16var meteorBabelHelpers = Package.modules.meteorBabelHelpers;
17var Promise = Package.promise.Promise;
18var fetch = Package.fetch.fetch;
19
20var require = meteorInstall({"node_modules":{"meteor":{"dynamic-import":{
20"client.js":function module(require,exports,module){
21
22///////////////////////////////////////////////////////////////////////////////////////////////////////////
23//                                                                                                       //
24// packages/dynamic-import/client.js                                                                     //
25//                                                                                                       //
26///////////////////////////////////////////////////////////////////////////////////////////////////////////
27                                                                                                         //
28var Module = module.constructor;
29var cache = require("./cache.js");
30var meteorInstall = require("meteor/modules").meteorInstall;
31var dynamicVersions = require("./dynamic-versions.js");
32
33// Fix for Safari 14 bug (https://bugs.webkit.org/show_bug.cgi?id=226547), do not delete this unused var
34var idb = global.indexedDB;
35
36var dynamicImportSettings = Meteor.settings
37    && Meteor.settings.public
38    && Meteor.settings.public.packages
39    && Meteor.settings.public.packages['dynamic-import'] || {};
40
41// Call module.dynamicImport(id) to fetch a module and any/all of its
42// dependencies that have not already been fetched, and evaluate them as
43// soon as they arrive. This runtime API makes it very easy to implement
44// ECMAScript dynamic import(...) syntax.
45Module.prototype.dynamicImport = function (id) {
46  var module = this;
47  return module.prefetch(id).then(function () {
48    return getNamespace(module, id);
49  });
50};
51
52// Called by Module.prototype.prefetch if there are any missing dynamic
53// modules that need to be fetched.
54meteorInstall.fetch = function (ids) {
55  var tree = Object.create(null);
56  var versions = Object.create(null);
57  var missing;
58
59  function addSource(id, source) {
60    addToTree(tree, id, makeModuleFunction(id, source, ids[id].options));
61  }
62
63  function addMissing(id) {
64    addToTree(missing = missing || Object.create(null), id, 1);
65  }
66
67  Object.keys(ids).forEach(function (id) {
68    var version = dynamicVersions.get(id);
69    if (version) {
70      versions[id] = version;
71    } else {
72      addMissing(id);
73    }
74  });
75
76  return cache.checkMany(versions).then(function (sources) {
77    Object.keys(sources).forEach(function (id) {
78      var source = sources[id];
79      if (source) {
80        addSource(id, source);
81      } else {
82        addMissing(id);
83      }
84    });
85
86    return missing && fetchMissing(missing).then(function (results) {
87      var versionsAndSourcesById = Object.create(null);
88      var flatResults = flattenModuleTree(results);
89
90      Object.keys(flatResults).forEach(function (id) {
91        var source = flatResults[id];
92        addSource(id, source);
93
94        var version = dynamicVersions.get(id);
95        if (version) {
96          versionsAndSourcesById[id] = {
97            version: version,
98            source: source
99          };
100        }
101      });
102
103      cache.setMany(versionsAndSourcesById);
104    });
105
106  }).then(function () {
107    return tree;
108  });
109};
110
111function flattenModuleTree(tree) {
112  var parts = [""];
113  var result = Object.create(null);
114
115  function walk(t) {
116    if (t && typeof t === "object") {
117      Object.keys(t).forEach(function (key) {
118        parts.push(key);
119        walk(t[key]);
120        parts.pop();
121      });
122    } else if (typeof t === "string") {
123      result[parts.join("/")] = t;
124    }
125  }
126
127  walk(tree);
128
129  return result;
130}
131
132function makeModuleFunction(id, source, options) {
133  // By calling (options && options.eval || eval) in a wrapper function,
134  // we delay the cost of parsing and evaluating the module code until the
135  // module is first imported.
136  return function () {
137    // If an options.eval function was provided in the second argument to
138    // meteorInstall when this bundle was first installed, use that
139    // function to parse and evaluate the dynamic module code in the scope
140    // of the package. Otherwise fall back to indirect (global) eval.
141    return (options && options.eval || eval)(
142      // Wrap the function(require,exports,module){...} expression in
143      // parentheses to force it to be parsed as an expression.
144      "(" + source + ")\n//# sourceURL=" + id
145    ).apply(this, arguments);
146  };
147}
148
149var secretKey = null;
150exports.setSecretKey = function (key) {
151  secretKey = key;
152};
153
154var fetchURL = require("./common.js").fetchURL;
155
156function inIframe() {
157  try {
158    return window.self !== window.top;
159  } catch (e) {
160    return true;
161  }
162}
163
164function fetchMissing(missingTree) {
165  // If the hostname of the URL returned by Meteor.absoluteUrl differs
166  // from location.host, then we'll be making a cross-origin request here,
167  // but that's fine because the dynamic-import server sets appropriate
168  // CORS headers to enable fetching dynamic modules from any
169  // origin. Browsers that check CORS do so by sending an additional
170  // preflight OPTIONS request, which may add latency to the first dynamic
171  // import() request, so it's a good idea for ROOT_URL to match
172  // location.host if possible, though not strictly necessary.
173
174  var url = fetchURL;
175
176  var useLocationOrigin = dynamicImportSettings.useLocationOrigin;
177
178  var disableLocationOriginIframe = dynamicImportSettings.disableLocationOriginIframe;
179
180  if (useLocationOrigin && location && !(disableLocationOriginIframe && inIframe())) {
181    url = location.origin.concat(__meteor_runtime_config__.ROOT_URL_PATH_PREFIX || '', url);
182  } else {
183    url = Meteor.absoluteUrl(url);
184  }
185
186  if (secretKey) {
187    url += "key=" + secretKey;
188  }
189
190  return fetch(url, {
191    method: "POST",
192    body: JSON.stringify(missingTree)
193  }).then(function (res) {
194    if (! res.ok) throw res;
195    return res.json();
196  });
197}
198
199function addToTree(tree, id, value) {
200  var parts = id.split("/");
201  var lastIndex = parts.length - 1;
202  parts.forEach(function (part, i) {
203    if (part) {
204      tree = tree[part] = tree[part] ||
205        (i < lastIndex ? Object.create(null) : value);
206    }
207  });
208}
209
210function getNamespace(module, id) {
211  var namespace;
212
213  module.link(id, {
214    "*": function (ns) {
215      namespace = ns;
216    }
217  });
218
219  // This helps with Babel interop, since we're not just returning the
220  // module.exports object.
221  Object.defineProperty(namespace, "__esModule", {
222    value: true,
223    enumerable: false
224  });
225
226  return namespace;
227}
228
229///////////////////////////////////////////////////////////////////////////////////////////////////////////
230
231},
231"cache.js":function module(require,exports,module){
232
233///////////////////////////////////////////////////////////////////////////////////////////////////////////
234//                                                                                                       //
235// packages/dynamic-import/cache.js                                                                      //
236//                                                                                                       //
237///////////////////////////////////////////////////////////////////////////////////////////////////////////
238                                                                                                         //
239var dbPromise;
240
241var canUseCache =
242  // The server doesn't benefit from dynamic module fetching, and almost
243  // certainly doesn't support IndexedDB.
244  Meteor.isClient &&
245  // Cordova bundles all modules into the monolithic initial bundle, so
246  // the dynamic module cache won't be necessary.
247  ! Meteor.isCordova &&
248  // Caching can be confusing in development, and is designed to be a
249  // transparent optimization for production performance.
250  Meteor.isProduction;
251
252function getIDB() {
253  if (typeof indexedDB !== "undefined") return indexedDB;
254  if (typeof webkitIndexedDB !== "undefined") return webkitIndexedDB;
255  if (typeof mozIndexedDB !== "undefined") return mozIndexedDB;
256  if (typeof OIndexedDB !== "undefined") return OIndexedDB;
257  if (typeof msIndexedDB !== "undefined") return msIndexedDB;
258}
259
260function withDB(callback) {
261  dbPromise = dbPromise || new Promise(function (resolve, reject) {
262    var idb = getIDB();
263    if (! idb) {
264      throw new Error("IndexedDB not available");
265    }
266
267    // Incrementing the version number causes all existing object stores
268    // to be deleted and recreates those specified by objectStoreMap.
269    var request = idb.open("MeteorDynamicImportCache", 2);
270
271    request.onupgradeneeded = function (event) {
272      var db = event.target.result;
273
274      // It's fine to delete existing object stores since onupgradeneeded
275      // is only called when we change the DB version number, and the data
276      // we're storing is disposable/reconstructible.
277      Array.from(db.objectStoreNames).forEach(db.deleteObjectStore, db);
278
279      Object.keys(objectStoreMap).forEach(function (name) {
280        db.createObjectStore(name, objectStoreMap[name]);
281      });
282    };
283
284    request.onerror = makeOnError(reject, "indexedDB.open");
285    request.onsuccess = function (event) {
286      resolve(event.target.result);
287    };
288  });
289
290  return dbPromise.then(callback, function (error) {
291    return callback(null);
292  });
293}
294
295var objectStoreMap = {
296  sourcesByVersion: { keyPath: "version" }
297};
298
299function makeOnError(reject, source) {
300  return function (event) {
301    reject(new Error(
302      "IndexedDB failure in " + source + " " +
303        JSON.stringify(event.target)
304    ));
305
306    // Returning true from an onerror callback function prevents an
307    // InvalidStateError in Firefox during Private Browsing. Silencing
308    // that error is safe because we handle the error more gracefully by
309    // passing it to the Promise reject function above.
310    // https://github.com/meteor/meteor/issues/8697
311    return true;
312  };
313}
314
315var checkCount = 0;
316
317exports.checkMany = function (versions) {
318  var ids = Object.keys(versions);
319  var sourcesById = Object.create(null);
320
321  // Initialize sourcesById with null values to indicate all sources are
322  // missing (unless replaced with actual sources below).
323  ids.forEach(function (id) {
324    sourcesById[id] = null;
325  });
326
327  if (! canUseCache) {
328    return Promise.resolve(sourcesById);
329  }
330
331  return withDB(function (db) {
332    if (! db) {
333      // We thought we could used IndexedDB, but something went wrong
334      // while opening the database, so err on the side of safety.
335      return sourcesById;
336    }
337
338    var txn = db.transaction([
339      "sourcesByVersion"
340    ], "readonly");
341
342    var sourcesByVersion = txn.objectStore("sourcesByVersion");
343
344    ++checkCount;
345
346    function finish() {
347      --checkCount;
348      return sourcesById;
349    }
350
351    return Promise.all(ids.map(function (id) {
352      return new Promise(function (resolve, reject) {
353        var version = versions[id];
354        if (version) {
355          var sourceRequest = sourcesByVersion.get(version);
356          sourceRequest.onerror = makeOnError(reject, "sourcesByVersion.get");
357          sourceRequest.onsuccess = function (event) {
358            var result = event.target.result;
359            if (result) {
360              sourcesById[id] = result.source;
361            }
362            resolve();
363          };
364        } else resolve();
365      });
366    })).then(finish, finish);
367  });
368};
369
370var pendingVersionsAndSourcesById = Object.create(null);
371
372exports.setMany = function (versionsAndSourcesById) {
373  if (canUseCache) {
374    Object.assign(
375      pendingVersionsAndSourcesById,
376      versionsAndSourcesById
377    );
378
379    // Delay the call to flushSetMany so that it doesn't contribute to the
380    // amount of time it takes to call module.dynamicImport.
381    if (! flushSetMany.timer) {
382      flushSetMany.timer = setTimeout(flushSetMany, 100);
383    }
384  }
385};
386
387function flushSetMany() {
388  if (checkCount > 0) {
389    // If checkMany is currently underway, postpone the flush until later,
390    // since updating the cache is less important than reading from it.
391    return flushSetMany.timer = setTimeout(flushSetMany, 100);
392  }
393
394  flushSetMany.timer = null;
395
396  var versionsAndSourcesById = pendingVersionsAndSourcesById;
397  pendingVersionsAndSourcesById = Object.create(null);
398
399  return withDB(function (db) {
400    if (! db) {
401      // We thought we could used IndexedDB, but something went wrong
402      // while opening the database, so err on the side of safety.
403      return;
404    }
405
406    var setTxn = db.transaction([
407      "sourcesByVersion"
408    ], "readwrite");
409
410    var sourcesByVersion = setTxn.objectStore("sourcesByVersion");
411
412    return Promise.all(
413      Object.keys(versionsAndSourcesById).map(function (id) {
414        var info = versionsAndSourcesById[id];
415        return new Promise(function (resolve, reject) {
416          var request = sourcesByVersion.put({
417            version: info.version,
418            source: info.source
419          });
420          request.onerror = makeOnError(reject, "sourcesByVersion.put");
421          request.onsuccess = resolve;
422        });
423      })
424    );
425  });
426}
427
428///////////////////////////////////////////////////////////////////////////////////////////////////////////
429
430},
430"common.js":function module(require,exports){
431
432///////////////////////////////////////////////////////////////////////////////////////////////////////////
433//                                                                                                       //
434// packages/dynamic-import/common.js                                                                     //
435//                                                                                                       //
436///////////////////////////////////////////////////////////////////////////////////////////////////////////
437                                                                                                         //
438exports.fetchURL = "/__meteor__/dynamic-import/fetch";
439
440///////////////////////////////////////////////////////////////////////////////////////////////////////////
441
442},
442"dynamic-versions.js":function module(require,exports,module){
443
444///////////////////////////////////////////////////////////////////////////////////////////////////////////
445//                                                                                                       //
446// packages/dynamic-import/dynamic-versions.js                                                           //
447//                                                                                                       //
448///////////////////////////////////////////////////////////////////////////////////////////////////////////
449                                                                                                         //
450// This magic double-underscored identifier gets replaced in
451// tools/isobuild/bundler.js with a tree of hashes of all dynamic
452// modules, for use in client.js and cache.js.
453var versions = {"imports":{"api":{"services":{"appointmentRescheduleNotificationService.js":"74f752a9c96466e24004436d34f2a1092f206238","pdfGenerationService.js":"e1949c147646b66e49c36ad2e5a7414878b1a468","shorePassContext.js":"238029e9f3014d5e1a2757c6de5ae04b93fe0b47","workflowContext.js":"52f0c47e61edf04a61b2aff36830ad7fefc3c405"}}}};
454
455var METEOR_PREFIX = '/node_modules/meteor/';
456
457exports.get = function (id) {
458  var tree = versions;
459  var version = null;
460
461  id.split("/").some(function (part) {
462    if (part) {
463      // If the tree contains identifiers for Meteor packages with colons
464      // in their names, the colons should not have been replaced by
465      // underscores, but there's a bug that results in that behavior, so
466      // for now it seems safest to be tolerant of underscores here.
467      // https://github.com/meteor/meteor/pull/9103
468      tree = tree[part] || tree[part.replace(":", "_")];
469    }
470
471    if (! tree) {
472      // Terminate the search without reassigning version.
473      return true;
474    }
475
476    if (typeof tree === "string") {
477      version = tree;
478      return true;
479    }
480  });
481
482  return version;
483};
484
485function getFlatModuleArray(tree) {
486  var parts = [""];
487  var result = [];
488
489  function walk(t) {
490    if (t && typeof t === "object") {
491      Object.keys(t).forEach(function (key) {
492        parts.push(key);
493        walk(t[key]);
494        parts.pop();
495      });
496    } else if (typeof t === "string") {
497      result.push(parts.join("/"));
498    }
499  }
500
501  walk(tree);
502
503  return result;
504}
505
506// If Package.appcache is loaded, preload additional modules after the
507// core bundle has been loaded.
508function precacheOnLoad(event) {
509  // Check inside onload to make sure Package.appcache has had a chance to
510  // become available.
511  if (! Package.appcache) {
512    return;
513  }
514
515  // Prefetch in chunks to reduce overhead. If we call module.prefetch(id)
516  // multiple times in the same tick of the event loop, all those modules
517  // will be fetched in one HTTP POST request.
518  function prefetchInChunks(modules, amount) {
519    Promise.all(modules.splice(0, amount).map(function (id) {
520      return new Promise(function (resolve, reject) {
521        module.prefetch(id).then(resolve).catch(
522          function (err) {
523            // we probably have a : _ mismatch
524            // what can get wrong if we do the replacement
525            // 1. a package with a name like a_b:package will not resolve
526            // 2. someone falsely imports a_package that does not exist but a
527            // package a:package exists, so this one gets imported and its usage
528            // will fail
529            if (id.indexOf(METEOR_PREFIX) === 0) {
530              module.prefetch(
531                METEOR_PREFIX + id.replace(METEOR_PREFIX, '').replace('_', ':')
532              ).then(resolve).catch(reject);
533            } else {
534              reject(err);
535            }
536          })
537      });
538    })).then(function () {
539      if (modules.length > 0) {
540        setTimeout(function () {
541          prefetchInChunks(modules, amount);
542        }, 0);
543      }
544    });
545  }
546
547  // Get a flat array of modules and start prefetching.
548  prefetchInChunks(getFlatModuleArray(versions), 50);
549}
550
551// Use window.onload to only prefetch after the main bundle has loaded.
552if (global.addEventListener) {
553  global.addEventListener('load', precacheOnLoad, false);
554} else if (global.attachEvent) {
555  global.attachEvent('onload', precacheOnLoad);
556}
557
558///////////////////////////////////////////////////////////////////////////////////////////////////////////
559
560}
560}}}},{
561  "extensions": [
562    ".js",
563    ".json"
564  ]
565});
566
567
568/* Exports */
569return {
570  require: require,
571  eagerModulePaths: [
572    "/node_modules/meteor/dynamic-import/client.js"
573  ],
574  mainModulePath: "/node_modules/meteor/dynamic-import/client.js"
575}});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.