PageSourceSearch

https://paradigmvendo.com/cordova.js

js paradigmvendo.com collected 2026-10-04 04:26:17 UTC 50,172 bytes, 1,546 lines download raw bytes

1// Platform: browser
2// cordova-js rel/6.1.0-10-gc7d3dc05
3/*
4 Licensed to the Apache Software Foundation (ASF) under one
5 or more contributor license agreements.  See the NOTICE file
6 distributed with this work for additional information
7 regarding copyright ownership.  The ASF licenses this file
8 to you under the Apache License, Version 2.0 (the
9 "License"); you may not use this file except in compliance
10 with the License.  You may obtain a copy of the License at
11
12     http://www.apache.org/licenses/LICENSE-2.0
13
14 Unless required by applicable law or agreed to in writing,
15 software distributed under the License is distributed on an
16 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 KIND, either express or implied.  See the License for the
18 specific language governing permissions and limitations
19 under the License.
20*/
21;(function() {
22var PLATFORM_VERSION_BUILD_LABEL = '7.0.0';
23// file: src/scripts/require.js
24var require;
25var define;
26
27(function () {
28    var modules = {};
29    // Stack of moduleIds currently being built.
30    var requireStack = [];
31    // Map of module ID -> index into requireStack of modules currently being built.
32    var inProgressModules = {};
33    var SEPARATOR = '.';
34
35    function build (module) {
36        var factory = module.factory;
37        var localRequire = function (id) {
38            var resultantId = id;
39            // Its a relative path, so lop off the last portion and add the id (minus "./")
40            if (id.charAt(0) === '.') {
41                resultantId = module.id.slice(0, module.id.lastIndexOf(SEPARATOR)) + SEPARATOR + id.slice(2);
42            }
43            return require(resultantId);
44        };
45        module.exports = {};
46        delete module.factory;
47        factory(localRequire, module.exports, module);
48        return module.exports;
49    }
50
51    require = function (id) {
52        if (!modules[id]) {
53            throw new Error('module ' + id + ' not found');
54        } else if (id in inProgressModules) {
55            var cycle = requireStack.slice(inProgressModules[id]).join('->') + '->' + id;
56            throw new Error('Cycle in require graph: ' + cycle);
57        }
58        if (modules[id].factory) {
59            try {
60                inProgressModules[id] = requireStack.length;
61                requireStack.push(id);
62                return build(modules[id]);
63            } finally {
64                delete inProgressModules[id];
65                requireStack.pop();
66            }
67        }
68        return modules[id].exports;
69    };
70
71    define = function (id, factory) {
72        if (Object.prototype.hasOwnProperty.call(modules, id)) {
73            throw new Error('module ' + id + ' already defined');
74        }
75
76        modules[id] = {
77            id: id,
78            factory: factory
79        };
80    };
81
82    define.remove = function (id) {
83        delete modules[id];
84    };
85
86    define.moduleMap = modules;
87})();
88
89// Export for use in node
90if (typeof module === 'object' && typeof require === 'function') {
91    module.exports.require = require;
92    module.exports.define = define;
93}
94
95// file: src/cordova.js
96define("cordova", function(require, exports, module) {
97
98// Workaround for Windows 10 in hosted environment case
99// http://www.w3.org/html/wg/drafts/html/master/browsers.html#named-access-on-the-window-object
100if (window.cordova && !(window.cordova instanceof HTMLElement)) {
101    throw new Error('cordova already defined');
102}
103
104var channel = require('cordova/channel');
105var platform = require('cordova/platform');
106
107/**
108 * Intercept calls to addEventListener + removeEventListener and handle deviceready,
109 * resume, and pause events.
110 */
111var m_document_addEventListener = document.addEventListener;
112var m_document_removeEventListener = document.removeEventListener;
113var m_window_addEventListener = window.addEventListener;
114var m_window_removeEventListener = window.removeEventListener;
115
116/**
117 * Houses custom event handlers to intercept on document + window event listeners.
118 */
119var documentEventHandlers = {};
120var windowEventHandlers = {};
121
122document.addEventListener = function (evt, handler, capture) {
123    var e = evt.toLowerCase();
124    if (typeof documentEventHandlers[e] !== 'undefined') {
125        documentEventHandlers[e].subscribe(handler);
126    } else {
127        m_document_addEventListener.call(document, evt, handler, capture);
128    }
129};
130
131window.addEventListener = function (evt, handler, capture) {
132    var e = evt.toLowerCase();
133    if (typeof windowEventHandlers[e] !== 'undefined') {
134        windowEventHandlers[e].subscribe(handler);
135    } else {
136        m_window_addEventListener.call(window, evt, handler, capture);
137    }
138};
139
140document.removeEventListener = function (evt, handler, capture) {
141    var e = evt.toLowerCase();
142    // If unsubscribing from an event that is handled by a plugin
143    if (typeof documentEventHandlers[e] !== 'undefined') {
144        documentEventHandlers[e].unsubscribe(handler);
145    } else {
146        m_document_removeEventListener.call(document, evt, handler, capture);
147    }
148};
149
150window.removeEventListener = function (evt, handler, capture) {
151    var e = evt.toLowerCase();
152    // If unsubscribing from an event that is handled by a plugin
153    if (typeof windowEventHandlers[e] !== 'undefined') {
154        windowEventHandlers[e].unsubscribe(handler);
155    } else {
156        m_window_removeEventListener.call(window, evt, handler, capture);
157    }
158};
159
160function createEvent (type, data) {
161    var event = document.createEvent('Events');
162    event.initEvent(type, false, false);
163    if (data) {
164        for (var i in data) {
165            if (Object.prototype.hasOwnProperty.call(data, i)) {
166                event[i] = data[i];
167            }
168        }
169    }
170    return event;
171}
172
173var cordova = {
174    define: define,
175    require: require,
176    version: PLATFORM_VERSION_BUILD_LABEL,
177    platformVersion: PLATFORM_VERSION_BUILD_LABEL,
178    platformId: platform.id,
179
180    /**
181     * Methods to add/remove your own addEventListener hijacking on document + window.
182     */
183    addWindowEventHandler: function (event) {
184        return (windowEventHandlers[event] = channel.create(event));
185    },
186    addStickyDocumentEventHandler: function (event) {
187        return (documentEventHandlers[event] = channel.createSticky(event));
188    },
189    addDocumentEventHandler: function (event) {
190        return (documentEventHandlers[event] = channel.create(event));
191    },
192    removeWindowEventHandler: function (event) {
193        delete windowEventHandlers[event];
194    },
195    removeDocumentEventHandler: function (event) {
196        delete documentEventHandlers[event];
197    },
198
199    /**
200     * Retrieve original event handlers that were replaced by Cordova
201     *
202     * @return object
203     */
204    getOriginalHandlers: function () {
205        return {
206            document: {
207                addEventListener: m_document_addEventListener,
208                removeEventListener: m_document_removeEventListener
209            },
210            window: {
211                addEventListener: m_window_addEventListener,
212                removeEventListener: m_window_removeEventListener
213            }
214        };
215    },
216
217    /**
218     * Method to fire event from native code
219     * bNoDetach is required for events which cause an exception which needs to be caught in native code
220     */
221    fireDocumentEvent: function (type, data, bNoDetach) {
222        var evt = createEvent(type, data);
223        if (typeof documentEventHandlers[type] !== 'undefined') {
224            if (bNoDetach) {
225                documentEventHandlers[type].fire(evt);
226            } else {
227                setTimeout(function () {
228                    // Fire deviceready on listeners that were registered before cordova.js was loaded.
229                    if (type === 'deviceready') {
230                        document.dispatchEvent(evt);
231                    }
232                    documentEventHandlers[type].fire(evt);
233                }, 0);
234            }
235        } else {
236            document.dispatchEvent(evt);
237        }
238    },
239
240    fireWindowEvent: function (type, data) {
241        var evt = createEvent(type, data);
242        if (typeof windowEventHandlers[type] !== 'undefined') {
243            setTimeout(function () {
244                windowEventHandlers[type].fire(evt);
245            }, 0);
246        } else {
247            window.dispatchEvent(evt);
248        }
249    },
250
251    /**
252     * Plugin callback mechanism.
253     */
254    // Randomize the starting callbackId to avoid collisions after refreshing or navigating.
255    // This way, it's very unlikely that any new callback would get the same callbackId as an old callback.
256    callbackId: Math.floor(Math.random() * 2000000000),
257    callbacks: {},
258    callbackStatus: {
259        NO_RESULT: 0,
260        OK: 1,
261        CLASS_NOT_FOUND_EXCEPTION: 2,
262        ILLEGAL_ACCESS_EXCEPTION: 3,
263        INSTANTIATION_EXCEPTION: 4,
264        MALFORMED_URL_EXCEPTION: 5,
265        IO_EXCEPTION: 6,
266        INVALID_ACTION: 7,
267        JSON_EXCEPTION: 8,
268        ERROR: 9
269    },
270
271    /**
272     * Called by native code when returning successful result from an action.
273     */
274    callbackSuccess: function (callbackId, args) {
275        cordova.callbackFromNative(callbackId, true, args.status, [args.message], args.keepCallback);
276    },
277
278    /**
279     * Called by native code when returning error result from an action.
280     */
281    callbackError: function (callbackId, args) {
282        // TODO: Deprecate callbackSuccess and callbackError in favour of callbackFromNative.
283        // Derive success from status.
284        cordova.callbackFromNative(callbackId, false, args.status, [args.message], args.keepCallback);
285    },
286
287    /**
288     * Called by native code when returning the result from an action.
289     */
290    callbackFromNative: function (callbackId, isSuccess, status, args, keepCallback) {
291        try {
292            var callback = cordova.callbacks[callbackId];
293            if (callback) {
294                if (isSuccess && status === cordova.callbackStatus.OK) {
295                    callback.success && callback.success.apply(null, args);
296                } else if (!isSuccess) {
297                    callback.fail && callback.fail.apply(null, args);
298                }
299                /*
300                else
301                    Note, this case is intentionally not caught.
302                    this can happen if isSuccess is true, but callbackStatus is NO_RESULT
303                    which is used to remove a callback from the list without calling the callbacks
304                    typically keepCallback is false in this case
305                */
306                // Clear callback if not expecting any more results
307                if (!keepCallback) {
308                    delete cordova.callbacks[callbackId];
309                }
310            }
311        } catch (err) {
312            var msg = 'Error in ' + (isSuccess ? 'Success' : 'Error') + ' callbackId: ' + callbackId + ' : ' + err;
313            cordova.fireWindowEvent('cordovacallbackerror', { message: msg, error: err });
314            throw err;
315        }
316    },
317
318    addConstructor: function (func) {
319        channel.onCordovaReady.subscribe(function () {
320            try {
321                func();
322            } catch (e) {
323                console.log('Failed to run constructor: ' + e);
324            }
325        });
326    }
327};
328
329module.exports = cordova;
330
331});
332
333// file: src/common/argscheck.js
334define("cordova/argscheck", function(require, exports, module) {
335
336var utils = require('cordova/utils');
337
338var moduleExports = module.exports;
339
340var typeMap = {
341    A: 'Array',
342    D: 'Date',
343    N: 'Number',
344    S: 'String',
345    F: 'Function',
346    O: 'Object'
347};
348
349function extractParamName (callee, argIndex) {
350    return (/\(\s*([^)]*?)\s*\)/).exec(callee)[1].split(/\s*,\s*/)[argIndex];
351}
352
353/**
354 * Checks the given arguments' types and throws if they are not as expected.
355 *
356 * `spec` is a string where each character stands for the required type of the
357 * argument at the same position. In other words: the character at `spec[i]`
358 * specifies the required type for `args[i]`. The characters in `spec` are the
359 * first letter of the required type's name. The supported types are:
360 *
361 *     Array, Date, Number, String, Function, Object
362 *
363 * Lowercase characters specify arguments that must not be `null` or `undefined`
364 * while uppercase characters allow those values to be passed.
365 *
366 * Finally, `*` can be used to allow any type at the corresponding position.
367 *
368 * @example
369 * function foo (arr, opts) {
370 *     // require `arr` to be an Array and `opts` an Object, null or undefined
371 *     checkArgs('aO', 'my.package.foo', arguments);
372 *     // ...
373 * }
374 * @param {String} spec - the type specification for `args` as described above
375 * @param {String} functionName - full name of the callee.
376 * Used in the error message
377 * @param {Array|arguments} args - the arguments to be checked against `spec`
378 * @param {Function} [opt_callee=args.callee] - the recipient of `args`.
379 * Used to extract parameter names for the error message
380 * @throws {TypeError} if args do not satisfy spec
381 */
382function checkArgs (spec, functionName, args, opt_callee) {
383    if (!moduleExports.enableChecks) {
384        return;
385    }
386    var errMsg = null;
387    var typeName;
388    for (var i = 0; i < spec.length; ++i) {
389        var c = spec.charAt(i);
390        var cUpper = c.toUpperCase();
391        var arg = args[i];
392        // Asterix means allow anything.
393        if (c === '*') {
394            continue;
395        }
396        typeName = utils.typeName(arg);
397        if ((arg === null || arg === undefined) && c === cUpper) {
398            continue;
399        }
400        if (typeName !== typeMap[cUpper]) {
401            errMsg = 'Expected ' + typeMap[cUpper];
402            break;
403        }
404    }
405    if (errMsg) {
406        errMsg += ', but got ' + typeName + '.';
407        errMsg = 'Wrong type for parameter "' + extractParamName(opt_callee || args.callee, i) + '" of ' + functionName + ': ' + errMsg;
408        // Don't log when running unit tests.
409        if (typeof jasmine === 'undefined') {
410            console.error(errMsg);
411        }
412        throw TypeError(errMsg);
413    }
414}
415
416function getValue (value, defaultValue) {
417    return value === undefined ? defaultValue : value;
418}
419
420moduleExports.checkArgs = checkArgs;
421moduleExports.getValue = getValue;
422moduleExports.enableChecks = true;
423
424});
425
426// file: src/common/base64.js
427define("cordova/base64", function(require, exports, module) {
428
429var base64 = exports;
430
431base64.fromArrayBuffer = function (arrayBuffer) {
432    return btoa(bufferToBinaryString(arrayBuffer));
433};
434
435base64.toArrayBuffer = function (str) {
436    return binaryStringToBuffer(atob(str));
437};
438
439function bufferToBinaryString (buffer) {
440    var bytes = new Uint8Array(buffer);
441    var CHUNK_SIZE = 1 << 15;
442    var string = '';
443    for (var i = 0; i < bytes.length; i += CHUNK_SIZE) {
444        var chunk = bytes.subarray(i, i + CHUNK_SIZE);
445        string += String.fromCharCode.apply(null, chunk);
446    }
447    return string;
448}
449
450function binaryStringToBuffer (binaryString) {
451    var bytes = new Uint8Array(binaryString.length);
452    for (var i = 0; i < bytes.length; i++) {
453        bytes[i] = binaryString.charCodeAt(i);
454    }
455    return bytes.buffer;
456}
457
458});
459
460// file: src/common/builder.js
461define("cordova/builder", function(require, exports, module) {
462
463var utils = require('cordova/utils');
464
465function each (objects, func, context) {
466    for (var prop in objects) {
467        if (Object.prototype.hasOwnProperty.call(objects, prop)) {
468            func.apply(context, [objects[prop], prop]);
469        }
470    }
471}
472
473function clobber (obj, key, value) {
474    var needsProperty = false;
vendor: 4,565 bytes, lines 475-596
475    try {
476        obj[key] = value;
477    } catch (e) {
478        needsProperty = true;
479    }
480    // Getters can only be overridden by getters.
481    if (needsProperty || obj[key] !== value) {
482        utils.defineGetter(obj, key, function () {
483            return value;
484        });
485    }
486}
487
488function assignOrWrapInDeprecateGetter (obj, key, value, message) {
489    if (message) {
490        utils.defineGetter(obj, key, function () {
491            console.log(message);
492            delete obj[key];
493            clobber(obj, key, value);
494            return value;
495        });
496    } else {
497        clobber(obj, key, value);
498    }
499}
500
501function include (parent, objects, clobber, merge) {
502    each(objects, function (obj, key) {
503        try {
504            var result = obj.path ? require(obj.path) : {};
505
506            if (clobber) {
507                // Clobber if it doesn't exist.
508                if (typeof parent[key] === 'undefined') {
509                    assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated);
510                } else if (typeof obj.path !== 'undefined') {
511                    // If merging, merge properties onto parent, otherwise, clobber.
512                    if (merge) {
513                        recursiveMerge(parent[key], result);
514                    } else {
515                        assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated);
516                    }
517                }
518                result = parent[key];
519            } else {
520                // Overwrite if not currently defined.
521                if (typeof parent[key] === 'undefined') {
522                    assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated);
523                } else {
524                    // Set result to what already exists, so we can build children into it if they exist.
525                    result = parent[key];
526                }
527            }
528
529            if (obj.children) {
530                include(result, obj.children, clobber, merge);
531            }
532        } catch (e) {
533            utils.alert('Exception building Cordova JS globals: ' + e + ' for key "' + key + '"');
534        }
535    });
536}
537
538/**
539 * Merge properties from one object onto another recursively.  Properties from
540 * the src object will overwrite existing target property.
541 *
542 * @param target Object to merge properties into.
543 * @param src Object to merge properties from.
544 */
545function recursiveMerge (target, src) {
546    for (var prop in src) {
547        if (Object.prototype.hasOwnProperty.call(src, prop)) {
548            if (target.prototype && target.prototype.constructor === target) {
549                // If the target object is a constructor override off prototype.
550                clobber(target.prototype, prop, src[prop]);
551            } else {
552                if (typeof src[prop] === 'object' && typeof target[prop] === 'object') {
553                    recursiveMerge(target[prop], src[prop]);
554                } else {
555                    clobber(target, prop, src[prop]);
556                }
557            }
558        }
559    }
560}
561
562exports.buildIntoButDoNotClobber = function (objects, target) {
563    include(target, objects, false, false);
564};
565exports.buildIntoAndClobber = function (objects, target) {
566    include(target, objects, true, false);
567};
568exports.buildIntoAndMerge = function (objects, target) {
569    include(target, objects, true, true);
570};
571exports.recursiveMerge = recursiveMerge;
572exports.assignOrWrapInDeprecateGetter = assignOrWrapInDeprecateGetter;
573
574});
575
576// file: src/common/channel.js
577define("cordova/channel", function(require, exports, module) {
578
579var utils = require('cordova/utils');
580var nextGuid = 1;
581
582/**
583 * Custom pub-sub "channel" that can have functions subscribed to it
584 * This object is used to define and control firing of events for
585 * cordova initialization, as well as for custom events thereafter.
586 *
587 * The order of events during page load and Cordova startup is as follows:
588 *
589 * onDOMContentLoaded*         Internal event that is received when the web page is loaded and parsed.
590 * onNativeReady*              Internal event that indicates the Cordova native side is ready.
591 * onCordovaReady*             Internal event fired when all Cordova JavaScript objects have been created.
592 * onDeviceReady*              User event fired to indicate that Cordova is ready
593 * onResume                    User event fired to indicate a start/resume lifecycle event
594 * onPause                     User event fired to indicate a pause lifecycle event
595 *
596 * The events marked with an * are sticky. Once they have fired, they will stay in the fired state.
597 * All listeners that subscribe after the event is fired will be executed right away.
598 *
599 * The only Cordova events that user code should register for are:
600 *      deviceready           Cordova native code is initialized and Cordova APIs can be called from JavaScript
601 *      pause                 App has moved to background
602 *      resume                App has returned to foreground
603 *
604 * Listeners can be registered as:
605 *      document.addEventListener("deviceready", myDeviceReadyListener, false);
606 *      document.addEventListener("resume", myResumeListener, false);
607 *      document.addEventListener("pause", myPauseListener, false);
608 *
609 * The DOM lifecycle events should be used for saving and restoring state
610 *      window.onload
611 *      window.onunload
612 *
613 */
614
615/**
616 * Channel
617 * @constructor
618 * @param type  String the channel name
619 */
620var Channel = function (type, sticky) {
621    this.type = type;
622    // Map of guid -> function.
623    this.handlers = {};
624    // 0 = Non-sticky, 1 = Sticky non-fired, 2 = Sticky fired.
625    this.state = sticky ? 1 : 0;
626    // Used in sticky mode to remember args passed to fire().
627    this.fireArgs = null;
628    // Used by onHasSubscribersChange to know if there are any listeners.
629    this.numHandlers = 0;
630    // Function that is called when the first listener is subscribed, or when
631    // the last listener is unsubscribed.
632    this.onHasSubscribersChange = null;
633};
634var channel = {
635    /**
636     * Calls the provided function only after all of the channels specified
637     * have been fired. All channels must be sticky channels.
638     */
639    join: function (h, c) {
640        var len = c.length;
641        var i = len;
642        var f = function () {
643            if (!(--i)) h();
644        };
645        for (var j = 0; j < len; j++) {
646            if (c[j].state === 0) {
647                throw Error('Can only use join with sticky channels.');
648            }
649            c[j].subscribe(f);
650        }
651        if (!len) h();
652    },
653
654    create: function (type) {
655        return (channel[type] = new Channel(type, false));
656    },
657    createSticky: function (type) {
658        return (channel[type] = new Channel(type, true));
659    },
660
661    /**
662     * cordova Channels that must fire before "deviceready" is fired.
663     */
664    deviceReadyChannelsArray: [],
665    deviceReadyChannelsMap: {},
666
667    /**
668     * Indicate that a feature needs to be initialized before it is ready to be used.
669     * This holds up Cordova's "deviceready" event until the feature has been initialized
670     * and Cordova.initComplete(feature) is called.
671     *
672     * @param feature {String}     The unique feature name
673     */
674    waitForInitialization: function (feature) {
675        if (feature) {
676            var c = channel[feature] || this.createSticky(feature);
677            this.deviceReadyChannelsMap[feature] = c;
678            this.deviceReadyChannelsArray.push(c);
679        }
680    },
681
682    /**
683     * Indicate that initialization code has completed and the feature is ready to be used.
684     *
685     * @param feature {String}     The unique feature name
686     */
687    initializationComplete: function (feature) {
688        var c = this.deviceReadyChannelsMap[feature];
689        if (c) {
690            c.fire();
691        }
692    }
693};
694
695function checkSubscriptionArgument (argument) {
696    if (typeof argument !== 'function' && typeof argument.handleEvent !== 'function') {
697        throw new Error(
698            'Must provide a function or an EventListener object ' +
699                'implementing the handleEvent interface.'
700        );
701    }
702}
703
704/**
705 * Subscribes the given function to the channel. Any time that
706 * Channel.fire is called so too will the function.
707 * Optionally specify an execution context for the function
708 * and a guid that can be used to stop subscribing to the channel.
709 * Returns the guid.
710 */
711Channel.prototype.subscribe = function (eventListenerOrFunction, eventListener) {
712    checkSubscriptionArgument(eventListenerOrFunction);
713    var handleEvent, guid;
714
715    if (eventListenerOrFunction && typeof eventListenerOrFunction === 'object') {
716        // Received an EventListener object implementing the handleEvent interface
717        handleEvent = eventListenerOrFunction.handleEvent;
718        eventListener = eventListenerOrFunction;
719    } else {
720        // Received a function to handle event
721        handleEvent = eventListenerOrFunction;
722    }
723
724    if (this.state === 2) {
725        handleEvent.apply(eventListener || this, this.fireArgs);
726        return;
727    }
728
729    guid = eventListenerOrFunction.observer_guid;
730    if (typeof eventListener === 'object') {
731        handleEvent = utils.close(eventListener, handleEvent);
732    }
733
734    if (!guid) {
735        // First time any channel has seen this subscriber
736        guid = '' + nextGuid++;
737    }
738    handleEvent.observer_guid = guid;
739    eventListenerOrFunction.observer_guid = guid;
740
741    // Don't add the same handler more than once.
742    if (!this.handlers[guid]) {
743        this.handlers[guid] = handleEvent;
744        this.numHandlers++;
745        if (this.numHandlers === 1) {
746            this.onHasSubscribersChange && this.onHasSubscribersChange();
747        }
748    }
749};
750
751/**
752 * Unsubscribes the function with the given guid from the channel.
753 */
754Channel.prototype.unsubscribe = function (eventListenerOrFunction) {
755    checkSubscriptionArgument(eventListenerOrFunction);
756    var handleEvent, guid, handler;
757
758    if (eventListenerOrFunction && typeof eventListenerOrFunction === 'object') {
759        // Received an EventListener object implementing the handleEvent interface
760        handleEvent = eventListenerOrFunction.handleEvent;
761    } else {
762        // Received a function to handle event
763        handleEvent = eventListenerOrFunction;
764    }
765
766    guid = handleEvent.observer_guid;
767    handler = this.handlers[guid];
768    if (handler) {
769        delete this.handlers[guid];
770        this.numHandlers--;
771        if (this.numHandlers === 0) {
772            this.onHasSubscribersChange && this.onHasSubscribersChange();
773        }
774    }
775};
776
777/**
778 * Calls all functions subscribed to this channel.
779 */
780Channel.prototype.fire = function (e) {
781    var fireArgs = Array.prototype.slice.call(arguments);
782    // Apply stickiness.
783    if (this.state === 1) {
784        this.state = 2;
785        this.fireArgs = fireArgs;
786    }
787    if (this.numHandlers) {
788        // Copy the values first so that it is safe to modify it from within
789        // callbacks.
790        var toCall = [];
791        for (var item in this.handlers) {
792            toCall.push(this.handlers[item]);
793        }
794        for (var i = 0; i < toCall.length; ++i) {
795            toCall[i].apply(this, fireArgs);
796        }
797        if (this.state === 2 && this.numHandlers) {
798            this.numHandlers = 0;
799            this.handlers = {};
800            this.onHasSubscribersChange && this.onHasSubscribersChange();
801        }
802    }
803};
804
805// defining them here so they are ready super fast!
806// DOM event that is received when the web page is loaded and parsed.
807channel.createSticky('onDOMContentLoaded');
808
809// Event to indicate the Cordova native side is ready.
810channel.createSticky('onNativeReady');
811
812// Event to indicate that all Cordova JavaScript objects have been created
813// and it's time to run plugin constructors.
814channel.createSticky('onCordovaReady');
815
816// Event to indicate that all automatically loaded JS plugins are loaded and ready.
817// FIXME remove this
818channel.createSticky('onPluginsReady');
819
820// Event to indicate that Cordova is ready
821channel.createSticky('onDeviceReady');
822
823// Event to indicate a resume lifecycle event
824channel.create('onResume');
825
826// Event to indicate a pause lifecycle event
827channel.create('onPause');
828
829// Channels that must fire before "deviceready" is fired.
830channel.waitForInitialization('onCordovaReady');
831channel.waitForInitialization('onDOMContentLoaded');
832
833module.exports = channel;
834
835});
836
837// file: ../cordova-browser/cordova-js-src/confighelper.js
838define("cordova/confighelper", function(require, exports, module) {
839
840let config;
841
842function Config (xhr) {
843    function loadPreferences (xhr) {
844        const parser = new DOMParser();
845        const doc = parser.parseFromString(xhr.responseText, 'application/xml');
846
847        const preferences = doc.getElementsByTagName('preference');
848        return Array.prototype.slice.call(preferences);
849    }
850
851    this.xhr = xhr;
852    this.preferences = loadPreferences(this.xhr);
853}
854
855function readConfig (success, error) {
856    const xhr = new XMLHttpRequest();
857
858    if (typeof config !== 'undefined') {
859        success(config);
860    }
861
862    function fail (msg) {
863        console.error(msg);
864
865        if (error) {
866            error(msg);
867        }
868    }
869
870    const xhrStatusChangeHandler = function () {
871        if (xhr.readyState === 4) {
872            if (xhr.status === 200 || xhr.status === 304 || xhr.status === 0 /* file:// */) {
873                config = new Config(xhr);
874                success(config);
875            } else {
876                fail('[Browser][cordova.js][xhrStatusChangeHandler] Could not XHR config.xml: ' + xhr.statusText);
877            }
878        }
879    };
880
881    xhr.addEventListener('load', xhrStatusChangeHandler);
882
883    try {
884        xhr.open('get', 'config.xml', true);
885        xhr.send();
886    } catch (e) {
887        fail('[Browser][cordova.js][readConfig] Could not XHR config.xml: ' + JSON.stringify(e));
888    }
889}
890
891/**
892 * Reads a preference value from config.xml.
893 * Returns preference value or undefined if it does not exist.
894 * @param {String} preferenceName Preference name to read */
895Config.prototype.getPreferenceValue = function getPreferenceValue (preferenceName) {
896    const preferenceItem = this.preferences && this.preferences.filter(function (item) {
897        return item.attributes.name && item.attributes.name.value === preferenceName;
898    });
899
900    if (preferenceItem && preferenceItem[0] && preferenceItem[0].attributes && preferenceItem[0].attributes.value) {
901        return preferenceItem[0].attributes.value.value;
902    }
903};
904
905exports.readConfig = readConfig;
906
907});
908
909// file: ../cordova-browser/cordova-js-src/exec.js
910define("cordova/exec", function(require, exports, module) {
911
912/* jslint sloppy:true, plusplus:true */
913/* global require, module, console */
914
915const cordova = require('cordova');
916const execProxy = require('cordova/exec/proxy');
917
918/**
919 * Execute a cordova command.  It is up to the native side whether this action
920 * is synchronous or asynchronous.  The native side can return:
921 *      Synchronous: PluginResult object as a JSON string
922 *      Asynchronous: Empty string ""
923 * If async, the native side will cordova.callbackSuccess or cordova.callbackError,
924 * depending upon the result of the action.
925 *
926 * @param {Function} success    The success callback
927 * @param {Function} fail       The fail callback
928 * @param {String} service      The name of the service to use
929 * @param {String} action       Action to be run in cordova
930 * @param {String[]} [args]     Zero or more arguments to pass to the method
931 */
932module.exports = function (success, fail, service, action, args) {
933    const proxy = execProxy.get(service, action);
934
935    args = args || [];
936
937    if (proxy) {
938        const callbackId = service + cordova.callbackId++;
939
940        if (typeof success === 'function' || typeof fail === 'function') {
941            cordova.callbacks[callbackId] = { success, fail };
942        }
943        try {
944            // callbackOptions param represents additional optional parameters command could pass back, like keepCallback or
945            // custom callbackId, for example {callbackId: id, keepCallback: true, status: cordova.callbackStatus.JSON_EXCEPTION }
946            const onSuccess = function (result, callbackOptions) {
947                callbackOptions = callbackOptions || {};
948                let callbackStatus;
949                // covering both undefined and null.
950                // strict null comparison was causing callbackStatus to be undefined
951                // and then no callback was called because of the check in cordova.callbackFromNative
952                // see CB-8996 Mobilespec app hang on windows
953                if (callbackOptions.status !== undefined && callbackOptions.status !== null) {
954                    callbackStatus = callbackOptions.status;
955                } else {
956                    callbackStatus = cordova.callbackStatus.OK;
957                }
958                cordova.callbackSuccess(callbackOptions.callbackId || callbackId,
959                    {
960                        status: callbackStatus,
961                        message: result,
962                        keepCallback: callbackOptions.keepCallback || false
963                    });
964            };
965            const onError = function (err, callbackOptions) {
966                callbackOptions = callbackOptions || {};
967                let callbackStatus;
968                // covering both undefined and null.
969                // strict null comparison was causing callbackStatus to be undefined
970                // and then no callback was called because of the check in cordova.callbackFromNative
971                // note: status can be 0
972                if (callbackOptions.status !== undefined && callbackOptions.status !== null) {
973                    callbackStatus = callbackOptions.status;
974                } else {
975                    callbackStatus = cordova.callbackStatus.OK;
976                }
977                cordova.callbackError(callbackOptions.callbackId || callbackId,
978                    {
979                        status: callbackStatus,
980                        message: err,
981                        keepCallback: callbackOptions.keepCallback || false
982                    });
983            };
984            proxy(onSuccess, onError, args);
985        } catch (e) {
986            console.log('Exception calling native with command :: ' + service + ' :: ' + action + ' ::exception=' + e);
987        }
988    } else {
989        console.log('Error: exec proxy not found for :: ' + service + ' :: ' + action);
990
991        if (typeof fail === 'function') {
992            fail('Missing Command Error');
993        }
994    }
995};
996
997});
998
999// file: src/common/exec/proxy.js
1000define("cordova/exec/proxy", function(require, exports, module) {
1001
1002// internal map of proxy function
1003var CommandProxyMap = {};
1004
1005module.exports = {
1006
1007    // example: cordova.commandProxy.add("Accelerometer",{getCurrentAcceleration: function(successCallback, errorCallback, options) {...},...);
1008    add: function (id, proxyObj) {
1009        console.log('adding proxy for ' + id);
1010        CommandProxyMap[id] = proxyObj;
1011        return proxyObj;
1012    },
1013
1014    // cordova.commandProxy.remove("Accelerometer");
1015    remove: function (id) {
1016        var proxy = CommandProxyMap[id];
1017        delete CommandProxyMap[id];
1018        CommandProxyMap[id] = null;
1019        return proxy;
1020    },
1021
1022    get: function (service, action) {
1023        return (CommandProxyMap[service] ? CommandProxyMap[service][action] : null);
1024    }
1025};
1026
1027});
1028
1029// file: src/common/init.js
1030define("cordova/init", function(require, exports, module) {
1031
1032var channel = require('cordova/channel');
1033var cordova = require('cordova');
1034var modulemapper = require('cordova/modulemapper');
1035var platform = require('cordova/platform');
1036var pluginloader = require('cordova/pluginloader');
1037
1038var platformInitChannelsArray = [channel.onNativeReady, channel.onPluginsReady];
1039
1040function logUnfiredChannels (arr) {
1041    for (var i = 0; i < arr.length; ++i) {
1042        if (arr[i].state !== 2) {
1043            console.log('Channel not fired: ' + arr[i].type);
1044        }
1045    }
1046}
1047
1048window.setTimeout(function () {
1049    if (channel.onDeviceReady.state !== 2) {
1050        console.log('deviceready has not fired after 5 seconds.');
1051        logUnfiredChannels(platformInitChannelsArray);
1052        logUnfiredChannels(channel.deviceReadyChannelsArray);
1053    }
1054}, 5000);
1055
1056if (!window.console) {
1057    window.console = {
1058        log: function () {}
1059    };
1060}
1061if (!window.console.warn) {
1062    window.console.warn = function (msg) {
1063        this.log('warn: ' + msg);
1064    };
1065}
1066
1067// Register pause, resume and deviceready channels as events on document.
1068channel.onPause = cordova.addDocumentEventHandler('pause');
1069channel.onResume = cordova.addDocumentEventHandler('resume');
1070channel.onActivated = cordova.addDocumentEventHandler('activated');
1071channel.onDeviceReady = cordova.addStickyDocumentEventHandler('deviceready');
1072
1073// Listen for DOMContentLoaded and notify our channel subscribers.
1074if (document.readyState === 'complete' || document.readyState === 'interactive') {
1075    channel.onDOMContentLoaded.fire();
1076} else {
1077    document.addEventListener('DOMContentLoaded', function () {
1078        channel.onDOMContentLoaded.fire();
1079    }, false);
1080}
1081
1082// _nativeReady is global variable that the native side can set
1083// to signify that the native code is ready. It is a global since
1084// it may be called before any cordova JS is ready.
1085if (window._nativeReady) {
1086    channel.onNativeReady.fire();
1087}
1088
1089modulemapper.clobbers('cordova', 'cordova');
1090modulemapper.clobbers('cordova/exec', 'cordova.exec');
1091modulemapper.clobbers('cordova/exec', 'Cordova.exec');
1092
1093// Call the platform-specific initialization.
1094platform.bootstrap && platform.bootstrap();
1095
1096// Wrap in a setTimeout to support the use-case of having plugin JS appended to cordova.js.
1097// The delay allows the attached modules to be defined before the plugin loader looks for them.
1098setTimeout(function () {
1099    pluginloader.load(function () {
1100        channel.onPluginsReady.fire();
1101    });
1102}, 0);
1103
1104/**
1105 * Create all cordova objects once native side is ready.
1106 */
1107channel.join(function () {
1108    modulemapper.mapModules(window);
1109
1110    platform.initialize && platform.initialize();
1111
1112    // Fire event to notify that all objects are created
1113    channel.onCordovaReady.fire();
1114
1115    // Fire onDeviceReady event once page has fully loaded, all
1116    // constructors have run and cordova info has been received from native
1117    // side.
1118    channel.join(function () {
1119        require('cordova').fireDocumentEvent('deviceready');
1120    }, channel.deviceReadyChannelsArray);
1121}, platformInitChannelsArray);
1122
1123});
1124
1125// file: src/common/modulemapper.js
1126define("cordova/modulemapper", function(require, exports, module) {
1127
1128var builder = require('cordova/builder');
1129var moduleMap = define.moduleMap;
1130var symbolList;
1131var deprecationMap;
1132
1133exports.reset = function () {
1134    symbolList = [];
1135    deprecationMap = {};
1136};
1137
1138function addEntry (strategy, moduleName, symbolPath, opt_deprecationMessage) {
1139    if (!(moduleName in moduleMap)) {
1140        throw new Error('Module ' + moduleName + ' does not exist.');
1141    }
1142    symbolList.push(strategy, moduleName, symbolPath);
1143    if (opt_deprecationMessage) {
1144        deprecationMap[symbolPath] = opt_deprecationMessage;
1145    }
1146}
1147
1148// Note: Android 2.3 does have Function.bind().
1149exports.clobbers = function (moduleName, symbolPath, opt_deprecationMessage) {
1150    addEntry('c', moduleName, symbolPath, opt_deprecationMessage);
1151};
1152
1153exports.merges = function (moduleName, symbolPath, opt_deprecationMessage) {
1154    addEntry('m', moduleName, symbolPath, opt_deprecationMessage);
1155};
1156
1157exports.defaults = function (moduleName, symbolPath, opt_deprecationMessage) {
1158    addEntry('d', moduleName, symbolPath, opt_deprecationMessage);
1159};
1160
1161exports.runs = function (moduleName) {
1162    addEntry('r', moduleName, null);
1163};
1164
1165function prepareNamespace (symbolPath, context) {
1166    if (!symbolPath) {
1167        return context;
1168    }
1169    return symbolPath.split('.').reduce(function (cur, part) {
1170        return (cur[part] = cur[part] || {});
1171    }, context);
1172}
1173
1174exports.mapModules = function (context) {
1175    var origSymbols = {};
1176    context.CDV_origSymbols = origSymbols;
1177    for (var i = 0, len = symbolList.length; i < len; i += 3) {
1178        var strategy = symbolList[i];
1179        var moduleName = symbolList[i + 1];
1180        var module = require(moduleName);
1181        // <runs/>
1182        if (strategy === 'r') {
1183            continue;
1184        }
1185        var symbolPath = symbolList[i + 2];
1186        var lastDot = symbolPath.lastIndexOf('.');
1187        var namespace = symbolPath.substr(0, lastDot);
1188        var lastName = symbolPath.substr(lastDot + 1);
1189
1190        var deprecationMsg = symbolPath in deprecationMap ? 'Access made to deprecated symbol: ' + symbolPath + '. ' + deprecationMsg : null;
1191        var parentObj = prepareNamespace(namespace, context);
1192        var target = parentObj[lastName];
1193
1194        if (strategy === 'm' && target) {
1195            builder.recursiveMerge(target, module);
1196        } else if ((strategy === 'd' && !target) || (strategy !== 'd')) {
1197            if (!(symbolPath in origSymbols)) {
1198                origSymbols[symbolPath] = target;
1199            }
1200            builder.assignOrWrapInDeprecateGetter(parentObj, lastName, module, deprecationMsg);
1201        }
1202    }
1203};
1204
1205exports.getOriginalSymbol = function (context, symbolPath) {
1206    var origSymbols = context.CDV_origSymbols;
1207    if (origSymbols && (symbolPath in origSymbols)) {
1208        return origSymbols[symbolPath];
1209    }
1210    var parts = symbolPath.split('.');
1211    var obj = context;
1212    for (var i = 0; i < parts.length; ++i) {
1213        obj = obj && obj[parts[i]];
1214    }
1215    return obj;
1216};
1217
1218exports.reset();
1219
1220});
1221
1222// file: ../cordova-browser/cordova-js-src/platform.js
1223define("cordova/platform", function(require, exports, module) {
1224
1225module.exports = {
1226    id: 'browser',
1227    cordovaVersion: '4.2.0', // cordova-js
1228
1229    bootstrap: function () {
1230        const modulemapper = require('cordova/modulemapper');
1231        const channel = require('cordova/channel');
1232
1233        modulemapper.clobbers('cordova/exec/proxy', 'cordova.commandProxy');
1234
1235        channel.onNativeReady.fire();
1236
1237        document.addEventListener('visibilitychange', function () {
1238            if (document.hidden) {
1239                channel.onPause.fire();
1240            } else {
1241                channel.onResume.fire();
1242            }
1243        });
1244
1245    // End of bootstrap
1246    }
1247};
1248
1249});
1250
1251// file: src/common/pluginloader.js
1252define("cordova/pluginloader", function(require, exports, module) {
1253
1254var modulemapper = require('cordova/modulemapper');
1255
1256// Helper function to inject a <script> tag.
1257// Exported for testing.
1258exports.injectScript = function (url, onload, onerror) {
1259    var script = document.createElement('script');
1260    // onload fires even when script fails loads with an error.
1261    script.onload = onload;
1262    // onerror fires for malformed URLs.
1263    script.onerror = onerror;
1264    script.src = url;
1265    document.head.appendChild(script);
1266};
1267
1268function injectIfNecessary (id, url, onload, onerror) {
1269    onerror = onerror || onload;
1270    if (id in define.moduleMap) {
1271        onload();
1272    } else {
1273        exports.injectScript(url, function () {
1274            if (id in define.moduleMap) {
1275                onload();
1276            } else {
1277                onerror();
1278            }
1279        }, onerror);
1280    }
1281}
1282
1283function onScriptLoadingComplete (moduleList, finishPluginLoading) {
1284    // Loop through all the plugins and then through their clobbers and merges.
1285    for (var i = 0, module; (module = moduleList[i]); i++) {
1286        if (module.clobbers && module.clobbers.length) {
1287            for (var j = 0; j < module.clobbers.length; j++) {
1288                modulemapper.clobbers(module.id, module.clobbers[j]);
1289            }
1290        }
1291
1292        if (module.merges && module.merges.length) {
1293            for (var k = 0; k < module.merges.length; k++) {
1294                modulemapper.merges(module.id, module.merges[k]);
1295            }
1296        }
1297
1298        // Finally, if runs is truthy we want to simply require() the module.
1299        if (module.runs) {
1300            modulemapper.runs(module.id);
1301        }
1302    }
1303
1304    finishPluginLoading();
1305}
1306
1307// Handler for the cordova_plugins.js content.
1308// See plugman's plugin_loader.js for the details of this object.
1309// This function is only called 
1309if the really is a plugins array that isn't empty.
1310// Otherwise the onerror response handler will just call finishPluginLoading().
1311function handlePluginsObject (path, moduleList, finishPluginLoading) {
1312    // Now inject the scripts.
1313    var scriptCounter = moduleList.length;
1314
1315    if (!scriptCounter) {
1316        finishPluginLoading();
1317        return;
1318    }
1319    function scriptLoadedCallback () {
1320        if (!--scriptCounter) {
1321            onScriptLoadingComplete(moduleList, finishPluginLoading);
1322        }
1323    }
1324
1325    for (var i = 0; i < moduleList.length; i++) {
1326        injectIfNecessary(moduleList[i].id, path + moduleList[i].file, scriptLoadedCallback);
1327    }
1328}
1329
1330function findCordovaPath () {
1331    var path = null;
1332    var scripts = document.getElementsByTagName('script');
1333    var term = '/cordova.js';
1334    for (var n = scripts.length - 1; n > -1; n--) {
1335        var src = scripts[n].src.replace(/\?.*$/, ''); // Strip any query param (CB-6007).
1336        if (src.indexOf(term) === (src.length - term.length)) {
1337            path = src.substring(0, src.length - term.length) + '/';
1338            break;
1339        }
1340    }
1341    return path;
1342}
1343
1344// Tries to load all plugins' js-modules.
1345// This is an async process, but onDeviceReady is blocked on onPluginsReady.
1346// onPluginsReady is fired when there are no plugins to load, or they are all done.
1347exports.load = function (callback) {
1348    var pathPrefix = findCordovaPath();
1349    if (pathPrefix === null) {
1350        console.log('Could not find cordova.js script tag. Plugin loading may fail.');
1351        pathPrefix = '';
1352    }
1353    injectIfNecessary('cordova/plugin_list', pathPrefix + 'cordova_plugins.js', function () {
1354        var moduleList = require('cordova/plugin_list');
1355        handlePluginsObject(pathPrefix, moduleList, callback);
1356    }, callback);
1357};
1358
1359});
1360
1361// file: src/common/urlutil.js
1362define("cordova/urlutil", function(require, exports, module) {
1363
1364/**
1365 * For already absolute URLs, returns what is passed in.
1366 * For relative URLs, converts them to absolute ones.
1367 */
1368exports.makeAbsolute = function makeAbsolute (url) {
1369    var anchorEl = document.createElement('a');
1370    anchorEl.href = url;
1371    return anchorEl.href;
1372};
1373
1374});
1375
1376// file: src/common/utils.js
1377define("cordova/utils", function(require, exports, module) {
1378
1379var utils = exports;
1380
1381/**
1382 * Defines a property getter / setter for obj[key].
1383 */
1384utils.defineGetterSetter = function (obj, key, getFunc, opt_setFunc) {
1385    if (Object.defineProperty) {
1386        var desc = {
1387            get: getFunc,
1388            configurable: true
1389        };
1390        if (opt_setFunc) {
1391            desc.set = opt_setFunc;
1392        }
1393        Object.defineProperty(obj, key, desc);
1394    } else {
1395        obj.__defineGetter__(key, getFunc);
1396        if (opt_setFunc) {
1397            obj.__defineSetter__(key, opt_setFunc);
1398        }
1399    }
1400};
1401
1402/**
1403 * Defines a property getter for obj[key].
1404 */
1405utils.defineGetter = utils.defineGetterSetter;
1406
1407utils.arrayIndexOf = function (a, item) {
1408    if (a.indexOf) {
1409        return a.indexOf(item);
1410    }
1411    var len = a.length;
1412    for (var i = 0; i < len; ++i) {
1413        if (a[i] === item) {
1414            return i;
1415        }
1416    }
1417    return -1;
1418};
1419
1420/**
1421 * Returns whether the item was found in the array.
1422 */
1423utils.arrayRemove = function (a, item) {
1424    var index = utils.arrayIndexOf(a, item);
1425    if (index !== -1) {
1426        a.splice(index, 1);
1427    }
1428    return index !== -1;
1429};
1430
1431utils.typeName = function (val) {
1432    return Object.prototype.toString.call(val).slice(8, -1);
1433};
1434
1435/**
1436 * Returns an indication of whether the argument is an array or not
1437 */
1438utils.isArray = Array.isArray ||
1439                function (a) { return utils.typeName(a) === 'Array'; };
1440
1441/**
1442 * Returns an indication of whether the argument is a Date or not
1443 */
1444utils.isDate = function (d) {
1445    return (d instanceof Date);
1446};
1447
1448/**
1449 * Does a deep clone of the object.
1450 */
1451utils.clone = function (obj) {
1452    if (!obj || typeof obj === 'function' || utils.isDate(obj) || typeof obj !== 'object') {
1453        return obj;
1454    }
1455
1456    var retVal, i;
1457
1458    if (utils.isArray(obj)) {
1459        retVal = [];
1460        for (i = 0; i < obj.length; ++i) {
1461            retVal.push(utils.clone(obj[i]));
1462        }
1463        return retVal;
1464    }
1465
1466    retVal = {};
1467    for (i in obj) {
1468        // 'unknown' type may be returned in custom protocol activation case on
1469        // Windows Phone 8.1 causing "No such interface supported" exception on
1470        // cloning (https://issues.apache.org/jira/browse/CB-11522)
1471        // eslint-disable-next-line valid-typeof
1472        if ((!(i in retVal) || retVal[i] !== obj[i]) && typeof obj[i] !== 'undefined' && typeof obj[i] !== 'unknown') {
1473            retVal[i] = utils.clone(obj[i]);
1474        }
1475    }
1476    return retVal;
1477};
1478
1479/**
1480 * Returns a wrapped version of the function
1481 */
1482utils.close = function (context, func, params) {
1483    return function () {
1484        var args = params || arguments;
1485        return func.apply(context, args);
1486    };
1487};
1488
1489// ------------------------------------------------------------------------------
1490function UUIDcreatePart (length) {
1491    var uuidpart = '';
1492    for (var i = 0; i < length; i++) {
1493        var uuidchar = parseInt((Math.random() * 256), 10).toString(16);
1494        if (uuidchar.length === 1) {
1495            uuidchar = '0' + uuidchar;
1496        }
1497        uuidpart += uuidchar;
1498    }
1499    return uuidpart;
1500}
1501
1502/**
1503 * Create a UUID
1504 */
1505utils.createUUID = function () {
1506    return UUIDcreatePart(4) + '-' +
1507        UUIDcreatePart(2) + '-' +
1508        UUIDcreatePart(2) + '-' +
1509        UUIDcreatePart(2) + '-' +
1510        UUIDcreatePart(6);
1511};
1512
1513/**
1514 * Extends a child object from a parent object using classical inheritance
1515 * pattern.
1516 */
1517utils.extend = (function () {
1518    // proxy used to establish prototype chain
1519    var F = function () {};
1520    // extend Child from Parent
1521    return function (Child, Parent) {
1522        F.prototype = Parent.prototype;
1523        Child.prototype = new F();
1524        Child.__super__ = Parent.prototype;
1525        Child.prototype.constructor = Child;
1526    };
1527}());
1528
1529/**
1530 * Alerts a message in any available way: alert or console.log.
1531 */
1532utils.alert = function (msg) {
1533    if (window.alert) {
1534        window.alert(msg);
1535    } else if (console && console.log) {
1536        console.log(msg);
1537    }
1538};
1539
1540});
1541
1542window.cordova = require('cordova');
1543// file: src/scripts/bootstrap.js
1544require('cordova/init');
1545
1546})();

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.