Add progressive web app companion for cross-platform access

Vite + TypeScript PWA that mirrors the Android app's core features:
- Pre-processed shelter data (build-time UTM33N→WGS84 conversion)
- Leaflet map with shelter markers, user location, and offline tiles
- Canvas compass arrow (ported from DirectionArrowView.kt)
- IndexedDB shelter cache with 7-day staleness check
- Service worker with CacheFirst tiles and precached app shell
- i18n for en, nb, nn (ported from Android strings.xml)
- iOS/Android compass handling with low-pass filter
- Respects user map interaction (no auto-snap on pan/zoom)
- Build revision cache-breaker for reliable SW updates

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Ole-Morten Duesund 2026-03-08 17:41:38 +01:00
commit e8428de775
12051 changed files with 1799735 additions and 0 deletions

21
pwa/node_modules/chai/LICENSE generated vendored Normal file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2017 Chai.js Assertion Library
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

162
pwa/node_modules/chai/README.md generated vendored Normal file
View file

@ -0,0 +1,162 @@
<h1 align=center>
<a href="http://chaijs.com" title="Chai Documentation">
<img alt="ChaiJS" src="http://chaijs.com/img/chai-logo.png">
</a>
<br>
chai
</h1>
<p align=center>
Chai is a BDD / TDD assertion library for <a href="http://nodejs.org">node</a> and the browser that can be delightfully paired with any javascript testing framework.
</p>
<p align=center>
<a href="https://www.npmjs.com/package/chai">
<img
alt="downloads:?"
src="https://img.shields.io/npm/dm/chai.svg?style=flat-square"
/>
</a>
<a href="https://www.npmjs.com/package/chai">
<img
alt="node:?"
src="https://img.shields.io/badge/node-%3E=18.0-blue.svg?style=flat-square"
/>
</a>
<br/>
<a href="https://chai-slack.herokuapp.com/">
<img
alt="Join the Slack chat"
src="https://img.shields.io/badge/slack-join%20chat-E2206F.svg?style=flat-square"
/>
</a>
<a href="https://gitter.im/chaijs/chai">
<img
alt="Join the Gitter chat"
src="https://img.shields.io/badge/gitter-join%20chat-D0104D.svg?style=flat-square"
/>
</a>
<a href="https://opencollective.com/chaijs">
<img
alt="OpenCollective Backers"
src="https://opencollective.com/chaijs/backers/badge.svg?style=flat-square"
/>
</a>
</p>
For more information or to download plugins, view the [documentation](http://chaijs.com).
## What is Chai?
Chai is an _assertion library_, similar to Node's built-in `assert`. It makes testing much easier by giving you lots of assertions you can run against your code.
## Installation
### Node.js
`chai` is available on [npm](http://npmjs.org). To install it, type:
$ npm install --save-dev chai
### Browsers
You can also use it within the browser; install via npm and use the `chai.js` file found within the download. For example:
```html
<script src="./node_modules/chai/chai.js"></script>
```
## Usage
Import the library in your code, and then pick one of the styles you'd like to use - either `assert`, `expect` or `should`:
```js
import { assert } from 'chai'; // Using Assert style
import { expect } from 'chai'; // Using Expect style
import { should } from 'chai'; // Using Should style
```
### Register the chai testing style globally
```js
import 'chai/register-assert'; // Using Assert style
import 'chai/register-expect'; // Using Expect style
import 'chai/register-should'; // Using Should style
```
### Import assertion styles as local variables
```js
import { assert } from 'chai'; // Using Assert style
import { expect } from 'chai'; // Using Expect style
import { should } from 'chai'; // Using Should style
should(); // Modifies `Object.prototype`
import { expect, use } from 'chai'; // Creates local variables `expect` and `use`; useful for plugin use
```
### Usage with Mocha
```bash
mocha spec.js --require chai/register-assert.js # Using Assert style
mocha spec.js --require chai/register-expect.js # Using Expect style
mocha spec.js --require chai/register-should.js # Using Should style
```
[Read more about these styles in our docs](http://chaijs.com/guide/styles/).
## Plugins
Chai offers a robust Plugin architecture for extending Chai's assertions and interfaces.
- Need a plugin? View the [official plugin list](http://chaijs.com/plugins).
- Want to build a plugin? Read the [plugin api documentation](http://chaijs.com/guide/plugins/).
- Have a plugin and want it listed? Simply add the following keywords to your package.json:
- `chai-plugin`
- `browser` if your plugin works in the browser as well as Node.js
- `browser-only` if your plugin does not work with Node.js
### Related Projects
- [chaijs / chai-docs](https://github.com/chaijs/chai-docs): The chaijs.com website source code.
- [chaijs / assertion-error](https://github.com/chaijs/assertion-error): Custom `Error` constructor thrown upon an assertion failing.
- [chaijs / deep-eql](https://github.com/chaijs/deep-eql): Improved deep equality testing for Node.js and the browser.
- [chaijs / check-error](https://github.com/chaijs/check-error): Error comparison and information related utility for Node.js and the browser.
- [chaijs / loupe](https://github.com/chaijs/loupe): Inspect utility for Node.js and browsers.
- [chaijs / pathval](https://github.com/chaijs/pathval): Object value retrieval given a string path.
### Contributing
Thank you very much for considering to contribute!
Please make sure you follow our [Code Of Conduct](https://github.com/chaijs/chai/blob/master/CODE_OF_CONDUCT.md) and we also strongly recommend reading our [Contributing Guide](https://github.com/chaijs/chai/blob/master/CONTRIBUTING.md).
Here are a few issues other contributors frequently ran into when opening pull requests:
- Please do not commit changes to the `chai.js` build. We do it once per release.
- Before pushing your commits, please make sure you [rebase](https://github.com/chaijs/chai/blob/master/CONTRIBUTING.md#pull-requests) them.
### Contributors
Please see the full
[Contributors Graph](https://github.com/chaijs/chai/graphs/contributors) for our
list of contributors.
### Core Contributors
Feel free to reach out to any of the core contributors with your questions or
concerns. We will do our best to respond in a timely manner.
[![Keith Cirkel](https://avatars3.githubusercontent.com/u/118266?v=3&s=50)](https://github.com/keithamus)
[![James Garbutt](https://avatars3.githubusercontent.com/u/5677153?v=3&s=50)](https://github.com/43081j)
[![Kristján Oddsson](https://avatars3.githubusercontent.com/u/318208?v=3&s=50)](https://github.com/koddsson)
### Core Contributor Alumni
This project would not be what it is without the contributions from our prior
core contributors, for whom we are forever grateful:
[![Jake Luer](https://avatars3.githubusercontent.com/u/58988?v=3&s=50)](https://github.com/logicalparadox)
[![Veselin Todorov](https://avatars3.githubusercontent.com/u/330048?v=3&s=50)](https://github.com/vesln)
[![Lucas Fernandes da Costa](https://avatars3.githubusercontent.com/u/6868147?v=3&s=50)](https://github.com/lucasfcosta)
[![Grant Snodgrass](https://avatars3.githubusercontent.com/u/17260989?v=3&s=50)](https://github.com/meeber)

1
pwa/node_modules/chai/chai.js generated vendored Normal file
View file

@ -0,0 +1 @@
export * from './index.js';

4381
pwa/node_modules/chai/index.js generated vendored Normal file

File diff suppressed because it is too large Load diff

66
pwa/node_modules/chai/lib/chai.js generated vendored Normal file
View file

@ -0,0 +1,66 @@
/*!
* chai
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
* MIT Licensed
*/
import * as util from './chai/utils/index.js';
import {AssertionError} from 'assertion-error';
import {config} from './chai/config.js';
import './chai/core/assertions.js';
import {expect} from './chai/interface/expect.js';
import {Assertion} from './chai/assertion.js';
import * as should from './chai/interface/should.js';
import {assert} from './chai/interface/assert.js';
const used = [];
// Assertion Error
export {AssertionError};
/**
* # .use(function)
*
* Provides a way to extend the internals of Chai.
*
* @param {Function} fn
* @returns {this} for chaining
* @public
*/
export function use(fn) {
const exports = {
use,
AssertionError,
util,
config,
expect,
assert,
Assertion,
...should
};
if (!~used.indexOf(fn)) {
fn(exports, util);
used.push(fn);
}
return exports;
}
// Utility Functions
export {util};
// Configuration
export {config};
// Primary `Assertion` prototype
export * from './chai/assertion.js';
// Expect interface
export * from './chai/interface/expect.js';
// Should interface
export * from './chai/interface/should.js';
// Assert interface
export * from './chai/interface/assert.js';

204
pwa/node_modules/chai/lib/chai/assertion.js generated vendored Normal file
View file

@ -0,0 +1,204 @@
/*!
* chai
* http://chaijs.com
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
* MIT Licensed
*/
import {config} from './config.js';
import {AssertionError} from 'assertion-error';
import * as util from './utils/index.js';
export class Assertion {
/** @type {{}} */
__flags = {};
/**
* Creates object for chaining.
* `Assertion` objects contain metadata in the form of flags. Three flags can
* be assigned during instantiation by passing arguments to this constructor:
*
* - `object`: This flag contains the target of the assertion. For example, in
* the assertion `expect(numKittens).to.equal(7);`, the `object` flag will
* contain `numKittens` so that the `equal` assertion can reference it when
* needed.
*
* - `message`: This flag contains an optional custom error message to be
* prepended to the error message that's generated by the assertion when it
* fails.
*
* - `ssfi`: This flag stands for "start stack function indicator". It
* contains a function reference that serves as the starting point for
* removing frames from the stack trace of the error that's created by the
* assertion when it fails. The goal is to provide a cleaner stack trace to
* end users by removing Chai's internal functions. Note that it only works
* in environments that support `Error.captureStackTrace`, and only when
* `Chai.config.includeStack` hasn't been set to `false`.
*
* - `lockSsfi`: This flag controls whether or not the given `ssfi` flag
* should retain its current value, even as assertions are chained off of
* this object. This is usually set to `true` when creating a new assertion
* from within another assertion. It's also temporarily set to `true` before
* an overwritten assertion gets called by the overwriting assertion.
*
* - `eql`: This flag contains the deepEqual function to be used by the assertion.
*
* @param {unknown} obj target of the assertion
* @param {string} [msg] (optional) custom error message
* @param {Function} [ssfi] (optional) starting point for removing stack frames
* @param {boolean} [lockSsfi] (optional) whether or not the ssfi flag is locked
*/
constructor(obj, msg, ssfi, lockSsfi) {
util.flag(this, 'ssfi', ssfi || Assertion);
util.flag(this, 'lockSsfi', lockSsfi);
util.flag(this, 'object', obj);
util.flag(this, 'message', msg);
util.flag(this, 'eql', config.deepEqual || util.eql);
return util.proxify(this);
}
/** @returns {boolean} */
static get includeStack() {
console.warn(
'Assertion.includeStack is deprecated, use chai.config.includeStack instead.'
);
return config.includeStack;
}
/** @param {boolean} value */
static set includeStack(value) {
console.warn(
'Assertion.includeStack is deprecated, use chai.config.includeStack instead.'
);
config.includeStack = value;
}
/** @returns {boolean} */
static get showDiff() {
console.warn(
'Assertion.showDiff is deprecated, use chai.config.showDiff instead.'
);
return config.showDiff;
}
/** @param {boolean} value */
static set showDiff(value) {
console.warn(
'Assertion.showDiff is deprecated, use chai.config.showDiff instead.'
);
config.showDiff = value;
}
/**
* @param {string} name
* @param {Function} fn
*/
static addProperty(name, fn) {
util.addProperty(this.prototype, name, fn);
}
/**
* @param {string} name
* @param {Function} fn
*/
static addMethod(name, fn) {
util.addMethod(this.prototype, name, fn);
}
/**
* @param {string} name
* @param {Function} fn
* @param {Function} chainingBehavior
*/
static addChainableMethod(name, fn, chainingBehavior) {
util.addChainableMethod(this.prototype, name, fn, chainingBehavior);
}
/**
* @param {string} name
* @param {Function} fn
*/
static overwriteProperty(name, fn) {
util.overwriteProperty(this.prototype, name, fn);
}
/**
* @param {string} name
* @param {Function} fn
*/
static overwriteMethod(name, fn) {
util.overwriteMethod(this.prototype, name, fn);
}
/**
* @param {string} name
* @param {Function} fn
* @param {Function} chainingBehavior
*/
static overwriteChainableMethod(name, fn, chainingBehavior) {
util.overwriteChainableMethod(this.prototype, name, fn, chainingBehavior);
}
/**
* ### .assert(expression, message, negateMessage, expected, actual, showDiff)
*
* Executes an expression and check expectations. Throws AssertionError for reporting if test doesn't pass.
*
* @name assert
* @param {unknown} _expr to be tested
* @param {string | Function} msg or function that returns message to display if expression fails
* @param {string | Function} _negateMsg or function that returns negatedMessage to display if negated expression fails
* @param {unknown} expected value (remember to check for negation)
* @param {unknown} _actual (optional) will default to `this.obj`
* @param {boolean} showDiff (optional) when set to `true`, assert will display a diff in addition to the message if expression fails
* @returns {void}
*/
assert(_expr, msg, _negateMsg, expected, _actual, showDiff) {
const ok = util.test(this, arguments);
if (false !== showDiff) showDiff = true;
if (undefined === expected && undefined === _actual) showDiff = false;
if (true !== config.showDiff) showDiff = false;
if (!ok) {
msg = util.getMessage(this, arguments);
const actual = util.getActual(this, arguments);
/** @type {Record<PropertyKey, unknown>} */
const assertionErrorObjectProperties = {
actual: actual,
expected: expected,
showDiff: showDiff
};
const operator = util.getOperator(this, arguments);
if (operator) {
assertionErrorObjectProperties.operator = operator;
}
throw new AssertionError(
msg,
assertionErrorObjectProperties,
// @ts-expect-error Not sure what to do about these types yet
config.includeStack ? this.assert : util.flag(this, 'ssfi')
);
}
}
/**
* Quick reference to stored `actual` value for plugin developers.
*
* @returns {unknown}
*/
get _obj() {
return util.flag(this, 'object');
}
/**
* Quick reference to stored `actual` value for plugin developers.
*
* @param {unknown} val
*/
set _obj(val) {
util.flag(this, 'object', val);
}
}

112
pwa/node_modules/chai/lib/chai/config.js generated vendored Normal file
View file

@ -0,0 +1,112 @@
export const config = {
/**
* ### config.includeStack
*
* User configurable property, influences whether stack trace
* is included in Assertion error message. Default of false
* suppresses stack trace in the error message.
*
* chai.config.includeStack = true; // enable stack on error
*
* @param {boolean}
* @public
*/
includeStack: false,
/**
* ### config.showDiff
*
* User configurable property, influences whether or not
* the `showDiff` flag should be included in the thrown
* AssertionErrors. `false` will always be `false`; `true`
* will be true when the assertion has requested a diff
* be shown.
*
* @param {boolean}
* @public
*/
showDiff: true,
/**
* ### config.truncateThreshold
*
* User configurable property, sets length threshold for actual and
* expected values in assertion errors. If this threshold is exceeded, for
* example for large data structures, the value is replaced with something
* like `[ Array(3) ]` or `{ Object (prop1, prop2) }`.
*
* Set it to zero if you want to disable truncating altogether.
*
* This is especially userful when doing assertions on arrays: having this
* set to a reasonable large value makes the failure messages readily
* inspectable.
*
* chai.config.truncateThreshold = 0; // disable truncating
*
* @param {number}
* @public
*/
truncateThreshold: 40,
/**
* ### config.useProxy
*
* User configurable property, defines if chai will use a Proxy to throw
* an error when a non-existent property is read, which protects users
* from typos when using property-based assertions.
*
* Set it to false if you want to disable this feature.
*
* chai.config.useProxy = false; // disable use of Proxy
*
* This feature is automatically disabled regardless of this config value
* in environments that don't support proxies.
*
* @param {boolean}
* @public
*/
useProxy: true,
/**
* ### config.proxyExcludedKeys
*
* User configurable property, defines which properties should be ignored
* instead of throwing an error if they do not exist on the assertion.
* This is only applied if the environment Chai is running in supports proxies and
* if the `useProxy` configuration setting is enabled.
* By default, `then` and `inspect` will not throw an error if they do not exist on the
* assertion object because the `.inspect` property is read by `util.inspect` (for example, when
* using `console.log` on the assertion object) and `.then` is necessary for promise type-checking.
*
* // By default these keys will not throw an error if they do not exist on the assertion object
* chai.config.proxyExcludedKeys = ['then', 'inspect'];
*
* @param {Array}
* @public
*/
proxyExcludedKeys: ['then', 'catch', 'inspect', 'toJSON'],
/**
* ### config.deepEqual
*
* User configurable property, defines which a custom function to use for deepEqual
* comparisons.
* By default, the function used is the one from the `deep-eql` package without custom comparator.
*
* // use a custom comparator
* chai.config.deepEqual = (expected, actual) => {
* return chai.util.eql(expected, actual, {
* comparator: (expected, actual) => {
* // for non number comparison, use the default behavior
* if(typeof expected !== 'number') return null;
* // allow a difference of 10 between compared numbers
* return typeof actual === 'number' && Math.abs(actual - expected) < 10
* }
* })
* };
*
* @param {Function}
* @public
*/
deepEqual: null
};

4156
pwa/node_modules/chai/lib/chai/core/assertions.js generated vendored Normal file

File diff suppressed because it is too large Load diff

3228
pwa/node_modules/chai/lib/chai/interface/assert.js generated vendored Normal file

File diff suppressed because it is too large Load diff

59
pwa/node_modules/chai/lib/chai/interface/expect.js generated vendored Normal file
View file

@ -0,0 +1,59 @@
/*!
* chai
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
* MIT Licensed
*/
import * as chai from '../../chai.js';
import {Assertion} from '../assertion.js';
import {AssertionError} from 'assertion-error';
/**
* @param {unknown} val
* @param {string} message
* @returns {Assertion}
*/
function expect(val, message) {
return new Assertion(val, message);
}
export {expect};
/**
* ### .fail([message])
* ### .fail(actual, expected, [message], [operator])
*
* Throw a failure.
*
* expect.fail();
* expect.fail("custom error message");
* expect.fail(1, 2);
* expect.fail(1, 2, "custom error message");
* expect.fail(1, 2, "custom error message", ">");
* expect.fail(1, 2, undefined, ">");
*
* @name fail
* @param {unknown} actual
* @param {unknown} expected
* @param {string} message
* @param {string} operator
* @namespace expect
* @public
*/
expect.fail = function (actual, expected, message, operator) {
if (arguments.length < 2) {
message = actual;
actual = undefined;
}
message = message || 'expect.fail()';
throw new AssertionError(
message,
{
actual: actual,
expected: expected,
operator: operator
},
chai.expect.fail
);
};

227
pwa/node_modules/chai/lib/chai/interface/should.js generated vendored Normal file
View file

@ -0,0 +1,227 @@
/*!
* chai
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
* MIT Licensed
*/
import {Assertion} from '../assertion.js';
import {AssertionError} from 'assertion-error';
/**
* @returns {void}
*/
function loadShould() {
// explicitly define this method as function as to have it's name to include as `ssfi`
/**
* @returns {Assertion}
*/
function shouldGetter() {
if (
this instanceof String ||
this instanceof Number ||
this instanceof Boolean ||
(typeof Symbol === 'function' && this instanceof Symbol) ||
(typeof BigInt === 'function' && this instanceof BigInt)
) {
return new Assertion(this.valueOf(), null, shouldGetter);
}
return new Assertion(this, null, shouldGetter);
}
/**
* @param {unknown} value
*/
function shouldSetter(value) {
// See https://github.com/chaijs/chai/issues/86: this makes
// `whatever.should = someValue` actually set `someValue`, which is
// especially useful for `global.should = require('chai').should()`.
//
// Note that we have to use [[DefineProperty]] instead of [[Put]]
// since otherwise we would trigger this very setter!
Object.defineProperty(this, 'should', {
value: value,
enumerable: true,
configurable: true,
writable: true
});
}
// modify Object.prototype to have `should`
Object.defineProperty(Object.prototype, 'should', {
set: shouldSetter,
get: shouldGetter,
configurable: true
});
let should = {};
/**
* ### .fail([message])
* ### .fail(actual, expected, [message], [operator])
*
* Throw a failure.
*
* should.fail();
* should.fail("custom error message");
* should.fail(1, 2);
* should.fail(1, 2, "custom error message");
* should.fail(1, 2, "custom error message", ">");
* should.fail(1, 2, undefined, ">");
*
* @name fail
* @param {unknown} actual
* @param {unknown} expected
* @param {string} message
* @param {string} operator
* @namespace BDD
* @public
*/
should.fail = function (actual, expected, message, operator) {
if (arguments.length < 2) {
message = actual;
actual = undefined;
}
message = message || 'should.fail()';
throw new AssertionError(
message,
{
actual: actual,
expected: expected,
operator: operator
},
should.fail
);
};
/**
* ### .equal(actual, expected, [message])
*
* Asserts non-strict equality (`==`) of `actual` and `expected`.
*
* should.equal(3, '3', '== coerces values to strings');
*
* @name equal
* @param {unknown} actual
* @param {unknown} expected
* @param {string} message
* @namespace Should
* @public
*/
should.equal = function (actual, expected, message) {
new Assertion(actual, message).to.equal(expected);
};
/**
* ### .throw(function, [constructor/string/regexp], [string/regexp], [message])
*
* Asserts that `function` will throw an error that is an instance of
* `constructor`, or alternately that it will throw an error with message
* matching `regexp`.
*
* should.throw(fn, 'function throws a reference error');
* should.throw(fn, /function throws a reference error/);
* should.throw(fn, ReferenceError);
* should.throw(fn, ReferenceError, 'function throws a reference error');
* should.throw(fn, ReferenceError, /function throws a reference error/);
*
* @name throw
* @alias Throw
* @param {Function} fn
* @param {Error} errt
* @param {RegExp} errs
* @param {string} msg
* @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
* @namespace Should
* @public
*/
should.Throw = function (fn, errt, errs, msg) {
new Assertion(fn, msg).to.Throw(errt, errs);
};
/**
* ### .exist
*
* Asserts that the target is neither `null` nor `undefined`.
*
* var foo = 'hi';
* should.exist(foo, 'foo exists');
*
* @param {unknown} val
* @param {string} msg
* @name exist
* @namespace Should
* @public
*/
should.exist = function (val, msg) {
new Assertion(val, msg).to.exist;
};
// negation
should.not = {};
/**
* ### .not.equal(actual, expected, [message])
*
* Asserts non-strict inequality (`!=`) of `actual` and `expected`.
*
* should.not.equal(3, 4, 'these numbers are not equal');
*
* @name not.equal
* @param {unknown} actual
* @param {unknown} expected
* @param {string} msg
* @namespace Should
* @public
*/
should.not.equal = function (actual, expected, msg) {
new Assertion(actual, msg).to.not.equal(expected);
};
/**
* ### .throw(function, [constructor/regexp], [message])
*
* Asserts that `function` will _not_ throw an error that is an instance of
* `constructor`, or alternately that it will not throw an error with message
* matching `regexp`.
*
* should.not.throw(fn, Error, 'function does not throw');
*
* @name not.throw
* @alias not.Throw
* @param {Function} fn
* @param {Error} errt
* @param {RegExp} errs
* @param {string} msg
* @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
* @namespace Should
* @public
*/
should.not.Throw = function (fn, errt, errs, msg) {
new Assertion(fn, msg).to.not.Throw(errt, errs);
};
/**
* ### .not.exist
*
* Asserts that the target is neither `null` nor `undefined`.
*
* var bar = null;
* should.not.exist(bar, 'bar does not exist');
*
* @namespace Should
* @name not.exist
* @param {unknown} val
* @param {string} msg
* @public
*/
should.not.exist = function (val, msg) {
new Assertion(val, msg).to.not.exist;
};
should['throw'] = should['Throw'];
should.not['throw'] = should.not['Throw'];
return should;
}
export const should = loadShould;
export const Should = loadShould;

View file

@ -0,0 +1,146 @@
/*!
* Chai - addChainingMethod utility
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
* MIT Licensed
*/
import {Assertion} from '../assertion.js';
import {addLengthGuard} from './addLengthGuard.js';
import {flag} from './flag.js';
import {proxify} from './proxify.js';
import {transferFlags} from './transferFlags.js';
/**
* Module variables
*/
// Check whether `Object.setPrototypeOf` is supported
let canSetPrototype = typeof Object.setPrototypeOf === 'function';
// Without `Object.setPrototypeOf` support, this module will need to add properties to a function.
// However, some of functions' own props are not configurable and should be skipped.
let testFn = function () {};
let excludeNames = Object.getOwnPropertyNames(testFn).filter(function (name) {
let propDesc = Object.getOwnPropertyDescriptor(testFn, name);
// Note: PhantomJS 1.x includes `callee` as one of `testFn`'s own properties,
// but then returns `undefined` as the property descriptor for `callee`. As a
// workaround, we perform an otherwise unnecessary type-check for `propDesc`,
// and then filter it out if it's not an object as it should be.
if (typeof propDesc !== 'object') return true;
return !propDesc.configurable;
});
// Cache `Function` properties
let call = Function.prototype.call,
apply = Function.prototype.apply;
/**
* ### .addChainableMethod(ctx, name, method, chainingBehavior)
*
* Adds a method to an object, such that the method can also be chained.
*
* utils.addChainableMethod(chai.Assertion.prototype, 'foo', function (str) {
* var obj = utils.flag(this, 'object');
* new chai.Assertion(obj).to.be.equal(str);
* });
*
* Can also be accessed directly from `chai.Assertion`.
*
* chai.Assertion.addChainableMethod('foo', fn, chainingBehavior);
*
* The result can then be used as both a method assertion, executing both `method` and
* `chainingBehavior`, or as a language chain, which only executes `chainingBehavior`.
*
* expect(fooStr).to.be.foo('bar');
* expect(fooStr).to.be.foo.equal('foo');
*
* @param {object} ctx object to which the method is added
* @param {string} name of method to add
* @param {Function} method function to be used for `name`, when called
* @param {Function} chainingBehavior function to be called every time the property is accessed
* @namespace Utils
* @name addChainableMethod
* @public
*/
export function addChainableMethod(ctx, name, method, chainingBehavior) {
if (typeof chainingBehavior !== 'function') {
chainingBehavior = function () {};
}
let chainableBehavior = {
method: method,
chainingBehavior: chainingBehavior
};
// save the methods so we can overwrite them later, if we need to.
if (!ctx.__methods) {
ctx.__methods = {};
}
ctx.__methods[name] = chainableBehavior;
Object.defineProperty(ctx, name, {
get: function chainableMethodGetter() {
chainableBehavior.chainingBehavior.call(this);
let chainableMethodWrapper = function () {
// Setting the `ssfi` flag to `chainableMethodWrapper` causes this
// function to be the starting point for removing implementation
// frames from the stack trace of a failed assertion.
//
// However, we only want to use this function as the starting point if
// the `lockSsfi` flag isn't set.
//
// If the `lockSsfi` flag is set, then this assertion is being
// invoked from inside of another assertion. In this case, the `ssfi`
// flag has already been set by the outer assertion.
//
// Note that overwriting a chainable method merely replaces the saved
// methods in `ctx.__methods` instead of completely replacing the
// overwritten assertion. Therefore, an overwriting assertion won't
// set the `ssfi` or `lockSsfi` flags.
if (!flag(this, 'lockSsfi')) {
flag(this, 'ssfi', chainableMethodWrapper);
}
let result = chainableBehavior.method.apply(this, arguments);
if (result !== undefined) {
return result;
}
let newAssertion = new Assertion();
transferFlags(this, newAssertion);
return newAssertion;
};
addLengthGuard(chainableMethodWrapper, name, true);
// Use `Object.setPrototypeOf` if available
if (canSetPrototype) {
// Inherit all properties from the object by replacing the `Function` prototype
let prototype = Object.create(this);
// Restore the `call` and `apply` methods from `Function`
prototype.call = call;
prototype.apply = apply;
Object.setPrototypeOf(chainableMethodWrapper, prototype);
}
// Otherwise, redefine all properties (slow!)
else {
let asserterNames = Object.getOwnPropertyNames(ctx);
asserterNames.forEach(function (asserterName) {
if (excludeNames.indexOf(asserterName) !== -1) {
return;
}
let pd = Object.getOwnPropertyDescriptor(ctx, asserterName);
Object.defineProperty(chainableMethodWrapper, asserterName, pd);
});
}
transferFlags(this, chainableMethodWrapper);
return proxify(chainableMethodWrapper);
},
configurable: true
});
}

73
pwa/node_modules/chai/lib/chai/utils/addLengthGuard.js generated vendored Normal file
View file

@ -0,0 +1,73 @@
const fnLengthDesc = Object.getOwnPropertyDescriptor(function () {}, 'length');
/*!
* Chai - addLengthGuard utility
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
* MIT Licensed
*/
/**
* ### .addLengthGuard(fn, assertionName, isChainable)
*
* Define `length` as a getter on the given uninvoked method assertion. The
* getter acts as a guard against chaining `length` directly off of an uninvoked
* method assertion, which is a problem because it references `function`'s
* built-in `length` property instead of Chai's `length` assertion. When the
* getter catches the user making this mistake, it throws an error with a
* helpful message.
*
* There are two ways in which this mistake can be made. The first way is by
* chaining the `length` assertion directly off of an uninvoked chainable
* method. In this case, Chai suggests that the user use `lengthOf` instead. The
* second way is by chaining the `length` assertion directly off of an uninvoked
* non-chainable method. Non-chainable methods must be invoked prior to
* chaining. In this case, Chai suggests that the user consult the docs for the
* given assertion.
*
* If the `length` property of functions is unconfigurable, then return `fn`
* without modification.
*
* Note that in ES6, the function's `length` property is configurable, so once
* support for legacy environments is dropped, Chai's `length` property can
* replace the built-in function's `length` property, and this length guard will
* no longer be necessary. In the mean time, maintaining consistency across all
* environments is the priority.
*
* @param {Function} fn
* @param {string} assertionName
* @param {boolean} isChainable
* @returns {unknown}
* @namespace Utils
* @name addLengthGuard
*/
export function addLengthGuard(fn, assertionName, isChainable) {
if (!fnLengthDesc.configurable) return fn;
Object.defineProperty(fn, 'length', {
get: function () {
if (isChainable) {
throw Error(
'Invalid Chai property: ' +
assertionName +
'.length. Due' +
' to a compatibility issue, "length" cannot directly follow "' +
assertionName +
'". Use "' +
assertionName +
'.lengthOf" instead.'
);
}
throw Error(
'Invalid Chai property: ' +
assertionName +
'.length. See' +
' docs for proper usage of "' +
assertionName +
'".'
);
}
});
return fn;
}

66
pwa/node_modules/chai/lib/chai/utils/addMethod.js generated vendored Normal file
View file

@ -0,0 +1,66 @@
/*!
* Chai - addMethod utility
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
* MIT Licensed
*/
import {addLengthGuard} from './addLengthGuard.js';
import {flag} from './flag.js';
import {proxify} from './proxify.js';
import {transferFlags} from './transferFlags.js';
import {Assertion} from '../assertion.js';
/**
* ### .addMethod(ctx, name, method)
*
* Adds a method to the prototype of an object.
*
* utils.addMethod(chai.Assertion.prototype, 'foo', function (str) {
* var obj = utils.flag(this, 'object');
* new chai.Assertion(obj).to.be.equal(str);
* });
*
* Can also be accessed directly from `chai.Assertion`.
*
* chai.Assertion.addMethod('foo', fn);
*
* Then can be used as any other assertion.
*
* expect(fooStr).to.be.foo('bar');
*
* @param {object} ctx object to which the method is added
* @param {string} name of method to add
* @param {Function} method function to be used for name
* @namespace Utils
* @name addMethod
* @public
*/
export function addMethod(ctx, name, method) {
let methodWrapper = function () {
// Setting the `ssfi` flag to `methodWrapper` causes this function to be the
// starting point for removing implementation frames from the stack trace of
// a failed assertion.
//
// However, we only want to use this function as the starting point if the
// `lockSsfi` flag isn't set.
//
// If the `lockSsfi` flag is set, then either this assertion has been
// overwritten by another assertion, or this assertion is being invoked from
// inside of another assertion. In the first case, the `ssfi` flag has
// already been set by the overwriting assertion. In the second case, the
// `ssfi` flag has already been set by the outer assertion.
if (!flag(this, 'lockSsfi')) {
flag(this, 'ssfi', methodWrapper);
}
let result = method.apply(this, arguments);
if (result !== undefined) return result;
let newAssertion = new Assertion();
transferFlags(this, newAssertion);
return newAssertion;
};
addLengthGuard(methodWrapper, name, false);
ctx[name] = proxify(methodWrapper, name);
}

70
pwa/node_modules/chai/lib/chai/utils/addProperty.js generated vendored Normal file
View file

@ -0,0 +1,70 @@
/*!
* Chai - addProperty utility
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
* MIT Licensed
*/
import {Assertion} from '../assertion.js';
import {flag} from './flag.js';
import {isProxyEnabled} from './isProxyEnabled.js';
import {transferFlags} from './transferFlags.js';
/**
* ### .addProperty(ctx, name, getter)
*
* Adds a property to the prototype of an object.
*
* utils.addProperty(chai.Assertion.prototype, 'foo', function () {
* var obj = utils.flag(this, 'object');
* new chai.Assertion(obj).to.be.instanceof(Foo);
* });
*
* Can also be accessed directly from `chai.Assertion`.
*
* chai.Assertion.addProperty('foo', fn);
*
* Then can be used as any other assertion.
*
* expect(myFoo).to.be.foo;
*
* @param {object} ctx object to which the property is added
* @param {string} name of property to add
* @param {Function} getter function to be used for name
* @namespace Utils
* @name addProperty
* @public
*/
export function addProperty(ctx, name, getter) {
getter = getter === undefined ? function () {} : getter;
Object.defineProperty(ctx, name, {
get: function propertyGetter() {
// Setting the `ssfi` flag to `propertyGetter` causes this function to
// be the starting point for removing implementation frames from the
// stack trace of a failed assertion.
//
// However, we only want to use this function as the starting point if
// the `lockSsfi` flag isn't set and proxy protection is disabled.
//
// If the `lockSsfi` flag is set, then either this assertion has been
// overwritten by another assertion, or this assertion is being invoked
// from inside of another assertion. In the first case, the `ssfi` flag
// has already been set by the overwriting assertion. In the second
// case, the `ssfi` flag has already been set by the outer assertion.
//
// If proxy protection is enabled, then the `ssfi` flag has already been
// set by the proxy getter.
if (!isProxyEnabled() && !flag(this, 'lockSsfi')) {
flag(this, 'ssfi', propertyGetter);
}
let result = getter.call(this);
if (result !== undefined) return result;
let newAssertion = new Assertion();
transferFlags(this, newAssertion);
return newAssertion;
},
configurable: true
});
}

View file

@ -0,0 +1,26 @@
/*!
* Chai - compareByInspect utility
* Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>
* MIT Licensed
*/
import {inspect} from './inspect.js';
/**
* ### .compareByInspect(mixed, mixed)
*
* To be used as a compareFunction with Array.prototype.sort. Compares elements
* using inspect instead of default behavior of using toString so that Symbols
* and objects with irregular/missing toString can still be sorted without a
* TypeError.
*
* @param {unknown} a first element to compare
* @param {unknown} b second element to compare
* @returns {number} -1 if 'a' should come before 'b'; otherwise 1
* @name compareByInspect
* @namespace Utils
* @public
*/
export function compareByInspect(a, b) {
return inspect(a) < inspect(b) ? -1 : 1;
}

58
pwa/node_modules/chai/lib/chai/utils/expectTypes.js generated vendored Normal file
View file

@ -0,0 +1,58 @@
/*!
* Chai - expectTypes utility
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
* MIT Licensed
*/
import {AssertionError} from 'assertion-error';
import {flag} from './flag.js';
import {type} from './type-detect.js';
/**
* ### .expectTypes(obj, types)
*
* Ensures that the object being tested against is of a valid type.
*
* utils.expectTypes(this, ['array', 'object', 'string']);
*
* @param {unknown} obj constructed Assertion
* @param {Array} types A list of allowed types for this assertion
* @namespace Utils
* @name expectTypes
* @public
*/
export function expectTypes(obj, types) {
let flagMsg = flag(obj, 'message');
let ssfi = flag(obj, 'ssfi');
flagMsg = flagMsg ? flagMsg + ': ' : '';
obj = flag(obj, 'object');
types = types.map(function (t) {
return t.toLowerCase();
});
types.sort();
// Transforms ['lorem', 'ipsum'] into 'a lorem, or an ipsum'
let str = types
.map(function (t, index) {
let art = ~['a', 'e', 'i', 'o', 'u'].indexOf(t.charAt(0)) ? 'an' : 'a';
let or = types.length > 1 && index === types.length - 1 ? 'or ' : '';
return or + art + ' ' + t;
})
.join(', ');
let objType = type(obj).toLowerCase();
if (
!types.some(function (expected) {
return objType === expected;
})
) {
throw new AssertionError(
flagMsg + 'object tested must be ' + str + ', but ' + objType + ' given',
undefined,
ssfi
);
}
}

34
pwa/node_modules/chai/lib/chai/utils/flag.js generated vendored Normal file
View file

@ -0,0 +1,34 @@
/*!
* Chai - flag utility
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
* MIT Licensed
*/
/**
* ### .flag(object, key, [value])
*
* Get or set a flag value on an object. If a
* value is provided it will be set, else it will
* return the currently set value or `undefined` if
* the value is not set.
*
* utils.flag(this, 'foo', 'bar'); // setter
* utils.flag(this, 'foo'); // getter, returns `bar`
*
* @template {{__flags?: {[key: PropertyKey]: unknown}}} T
* @param {T} obj object constructed Assertion
* @param {string} key
* @param {unknown} [value]
* @namespace Utils
* @name flag
* @returns {unknown | undefined}
* @private
*/
export function flag(obj, key, value) {
let flags = obj.__flags || (obj.__flags = Object.create(null));
if (arguments.length === 3) {
flags[key] = value;
} else {
return flags[key];
}
}

20
pwa/node_modules/chai/lib/chai/utils/getActual.js generated vendored Normal file
View file

@ -0,0 +1,20 @@
/*!
* Chai - getActual utility
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
* MIT Licensed
*/
/**
* ### .getActual(object, [actual])
*
* Returns the `actual` value for an Assertion.
*
* @param {object} obj object (constructed Assertion)
* @param {unknown} args chai.Assertion.prototype.assert arguments
* @returns {unknown}
* @namespace Utils
* @name getActual
*/
export function getActual(obj, args) {
return args.length > 4 ? args[4] : obj._obj;
}

52
pwa/node_modules/chai/lib/chai/utils/getMessage.js generated vendored Normal file
View file

@ -0,0 +1,52 @@
/*!
* Chai - message composition utility
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
* MIT Licensed
*/
import {flag} from './flag.js';
import {getActual} from './getActual.js';
import {objDisplay} from './objDisplay.js';
/**
* ### .getMessage(object, message, negateMessage)
*
* Construct the error message based on flags
* and template tags. Template tags will return
* a stringified inspection of the object referenced.
*
* Message template tags:
* - `#{this}` current asserted object
* - `#{act}` actual value
* - `#{exp}` expected value
*
* @param {object} obj object (constructed Assertion)
* @param {IArguments} args chai.Assertion.prototype.assert arguments
* @returns {string}
* @namespace Utils
* @name getMessage
* @public
*/
export function getMessage(obj, args) {
let negate = flag(obj, 'negate');
let val = flag(obj, 'object');
let expected = args[3];
let actual = getActual(obj, args);
let msg = negate ? args[2] : args[1];
let flagMsg = flag(obj, 'message');
if (typeof msg === 'function') msg = msg();
msg = msg || '';
msg = msg
.replace(/#\{this\}/g, function () {
return objDisplay(val);
})
.replace(/#\{act\}/g, function () {
return objDisplay(actual);
})
.replace(/#\{exp\}/g, function () {
return objDisplay(expected);
});
return flagMsg ? flagMsg + ': ' + msg : msg;
}

58
pwa/node_modules/chai/lib/chai/utils/getOperator.js generated vendored Normal file
View file

@ -0,0 +1,58 @@
import {flag} from './flag.js';
import {type} from './type-detect.js';
/**
* @param {unknown} obj
* @returns {boolean}
*/
function isObjectType(obj) {
let objectType = type(obj);
let objectTypes = ['Array', 'Object', 'Function'];
return objectTypes.indexOf(objectType) !== -1;
}
/**
* ### .getOperator(message)
*
* Extract the operator from error message.
* Operator defined is based on below link
* https://nodejs.org/api/assert.html#assert_assert.
*
* Returns the `operator` or `undefined` value for an Assertion.
*
* @param {object} obj object (constructed Assertion)
* @param {unknown} args chai.Assertion.prototype.assert arguments
* @returns {unknown}
* @namespace Utils
* @name getOperator
* @public
*/
export function getOperator(obj, args) {
let operator = flag(obj, 'operator');
let negate = flag(obj, 'negate');
let expected = args[3];
let msg = negate ? args[2] : args[1];
if (operator) {
return operator;
}
if (typeof msg === 'function') msg = msg();
msg = msg || '';
if (!msg) {
return undefined;
}
if (/\shave\s/.test(msg)) {
return undefined;
}
let isObject = isObjectType(expected);
if (/\snot\s/.test(msg)) {
return isObject ? 'notDeepStrictEqual' : 'notStrictEqual';
}
return isObject ? 'deepStrictEqual' : 'strictEqual';
}

View file

@ -0,0 +1,24 @@
/*!
* Chai - getOwnEnumerableProperties utility
* Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>
* MIT Licensed
*/
import {getOwnEnumerablePropertySymbols} from './getOwnEnumerablePropertySymbols.js';
/**
* ### .getOwnEnumerableProperties(object)
*
* This allows the retrieval of directly-owned enumerable property names and
* symbols of an object. This function is necessary because Object.keys only
* returns enumerable property names, not enumerable property symbols.
*
* @param {object} obj
* @returns {Array}
* @namespace Utils
* @name getOwnEnumerableProperties
* @public
*/
export function getOwnEnumerableProperties(obj) {
return Object.keys(obj).concat(getOwnEnumerablePropertySymbols(obj));
}

View file

@ -0,0 +1,26 @@
/*!
* Chai - getOwnEnumerablePropertySymbols utility
* Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>
* MIT Licensed
*/
/**
* ### .getOwnEnumerablePropertySymbols(object)
*
* This allows the retrieval of directly-owned enumerable property symbols of an
* object. This function is necessary because Object.getOwnPropertySymbols
* returns both enumerable and non-enumerable property symbols.
*
* @param {object} obj
* @returns {Array}
* @namespace Utils
* @name getOwnEnumerablePropertySymbols
* @public
*/
export function getOwnEnumerablePropertySymbols(obj) {
if (typeof Object.getOwnPropertySymbols !== 'function') return [];
return Object.getOwnPropertySymbols(obj).filter(function (sym) {
return Object.getOwnPropertyDescriptor(obj, sym).enumerable;
});
}

38
pwa/node_modules/chai/lib/chai/utils/getProperties.js generated vendored Normal file
View file

@ -0,0 +1,38 @@
/*!
* Chai - getProperties utility
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
* MIT Licensed
*/
/**
* ### .getProperties(object)
*
* This allows the retrieval of property names of an object, enumerable or not,
* inherited or not.
*
* @param {object} object
* @returns {Array}
* @namespace Utils
* @name getProperties
* @public
*/
export function getProperties(object) {
let result = Object.getOwnPropertyNames(object);
/**
* @param {unknown} property
*/
function addProperty(property) {
if (result.indexOf(property) === -1) {
result.push(property);
}
}
let proto = Object.getPrototypeOf(object);
while (proto !== null) {
Object.getOwnPropertyNames(proto).forEach(addProperty);
proto = Object.getPrototypeOf(proto);
}
return result;
}

118
pwa/node_modules/chai/lib/chai/utils/index.js generated vendored Normal file
View file

@ -0,0 +1,118 @@
/*!
* chai
* Copyright(c) 2011 Jake Luer <jake@alogicalparadox.com>
* MIT Licensed
*/
// Dependencies that are used for multiple exports are required here only once
import * as checkError from 'check-error';
// test utility
export {test} from './test.js';
// type utility
import {type} from './type-detect.js';
export {type};
// expectTypes utility
export {expectTypes} from './expectTypes.js';
// message utility
export {getMessage} from './getMessage.js';
// actual utility
export {getActual} from './getActual.js';
// Inspect util
export {inspect} from './inspect.js';
// Object Display util
export {objDisplay} from './objDisplay.js';
// Flag utility
export {flag} from './flag.js';
// Flag transferring utility
export {transferFlags} from './transferFlags.js';
// Deep equal utility
export {default as eql} from 'deep-eql';
// Deep path info
export {getPathInfo, hasProperty} from 'pathval';
/**
* Function name
*
* @param {Function} fn
* @returns {string}
*/
export function getName(fn) {
return fn.name;
}
// add Property
export {addProperty} from './addProperty.js';
// add Method
export {addMethod} from './addMethod.js';
// overwrite Property
export {overwriteProperty} from './overwriteProperty.js';
// overwrite Method
export {overwriteMethod} from './overwriteMethod.js';
// Add a chainable method
export {addChainableMethod} from './addChainableMethod.js';
// Overwrite chainable method
export {overwriteChainableMethod} from './overwriteChainableMethod.js';
// Compare by inspect method
export {compareByInspect} from './compareByInspect.js';
// Get own enumerable property symbols method
export {getOwnEnumerablePropertySymbols} from './getOwnEnumerablePropertySymbols.js';
// Get own enumerable properties method
export {getOwnEnumerableProperties} from './getOwnEnumerableProperties.js';
// Checks error against a given set of criteria
export {checkError};
// Proxify util
export {proxify} from './proxify.js';
// addLengthGuard util
export {addLengthGuard} from './addLengthGuard.js';
// isProxyEnabled helper
export {isProxyEnabled} from './isProxyEnabled.js';
// isNaN method
export {isNaN} from './isNaN.js';
// getOperator method
export {getOperator} from './getOperator.js';
/**
* Determines if an object is a `RegExp`
* This is used since `instanceof` will not work in virtual contexts
*
* @param {*} obj Object to test
* @returns {boolean}
*/
export function isRegExp(obj) {
return Object.prototype.toString.call(obj) === '[object RegExp]';
}
/**
* Determines if an object is numeric or not
*
* @param {unknown} obj Object to test
* @returns {boolean}
*/
export function isNumeric(obj) {
return ['Number', 'BigInt'].includes(type(obj));
}

31
pwa/node_modules/chai/lib/chai/utils/inspect.js generated vendored Normal file
View file

@ -0,0 +1,31 @@
// This is (almost) directly from Node.js utils
// https://github.com/joyent/node/blob/f8c335d0caf47f16d31413f89aa28eda3878e3aa/lib/util.js
import {inspect as _inspect} from 'loupe';
import {config} from '../config.js';
/**
* ### .inspect(obj, [showHidden], [depth], [colors])
*
* Echoes the value of a value. Tries to print the value out
* in the best way possible given the different types.
*
* @param {object} obj The object to print out.
* @param {boolean} showHidden Flag that shows hidden (not enumerable)
* properties of objects. Default is false.
* @param {number} depth Depth in which to descend in object. Default is 2.
* @param {boolean} colors Flag to turn on ANSI escape codes to color the
* output. Default is false (no coloring).
* @returns {string}
* @namespace Utils
* @name inspect
*/
export function inspect(obj, showHidden, depth, colors) {
let options = {
colors: colors,
depth: typeof depth === 'undefined' ? 2 : depth,
showHidden: showHidden,
truncate: config.truncateThreshold ? config.truncateThreshold : Infinity
};
return _inspect(obj, options);
}

7
pwa/node_modules/chai/lib/chai/utils/isNaN.js generated vendored Normal file
View file

@ -0,0 +1,7 @@
/*!
* Chai - isNaN utility
* Copyright(c) 2012-2015 Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
* MIT Licensed
*/
export const isNaN = Number.isNaN;

26
pwa/node_modules/chai/lib/chai/utils/isProxyEnabled.js generated vendored Normal file
View file

@ -0,0 +1,26 @@
import {config} from '../config.js';
/*!
* Chai - isProxyEnabled helper
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
* MIT Licensed
*/
/**
* ### .isProxyEnabled()
*
* Helper function to check if Chai's proxy protection feature is enabled. If
* proxies are unsupported or disabled via the user's Chai config, then return
* false. Otherwise, return true.
*
* @namespace Utils
* @name isProxyEnabled
* @returns {boolean}
*/
export function isProxyEnabled() {
return (
config.useProxy &&
typeof Proxy !== 'undefined' &&
typeof Reflect !== 'undefined'
);
}

47
pwa/node_modules/chai/lib/chai/utils/objDisplay.js generated vendored Normal file
View file

@ -0,0 +1,47 @@
/*!
* Chai - flag utility
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
* MIT Licensed
*/
import {inspect} from './inspect.js';
import {config} from '../config.js';
/**
* ### .objDisplay(object)
*
* Determines if an object or an array matches
* criteria to be inspected in-line for error
* messages or should be truncated.
*
* @param {unknown} obj javascript object to inspect
* @returns {string} stringified object
* @name objDisplay
* @namespace Utils
* @public
*/
export function objDisplay(obj) {
let str = inspect(obj),
type = Object.prototype.toString.call(obj);
if (config.truncateThreshold && str.length >= config.truncateThreshold) {
if (type === '[object Function]') {
return !obj.name || obj.name === ''
? '[Function]'
: '[Function: ' + obj.name + ']';
} else if (type === '[object Array]') {
return '[ Array(' + obj.length + ') ]';
} else if (type === '[object Object]') {
let keys = Object.keys(obj),
kstr =
keys.length > 2
? keys.splice(0, 2).join(', ') + ', ...'
: keys.join(', ');
return '{ Object (' + kstr + ') }';
} else {
return str;
}
} else {
return str;
}
}

View file

@ -0,0 +1,69 @@
/*!
* Chai - overwriteChainableMethod utility
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
* MIT Licensed
*/
import {Assertion} from '../assertion.js';
import {transferFlags} from './transferFlags.js';
/**
* ### .overwriteChainableMethod(ctx, name, method, chainingBehavior)
*
* Overwrites an already existing chainable method
* and provides access to the previous function or
* property. Must return functions to be used for
* name.
*
* utils.overwriteChainableMethod(chai.Assertion.prototype, 'lengthOf',
* function (_super) {
* }
* , function (_super) {
* }
* );
*
* Can also be accessed directly from `chai.Assertion`.
*
* chai.Assertion.overwriteChainableMethod('foo', fn, fn);
*
* Then can be used as any other assertion.
*
* expect(myFoo).to.have.lengthOf(3);
* expect(myFoo).to.have.lengthOf.above(3);
*
* @param {object} ctx object whose method / property is to be overwritten
* @param {string} name of method / property to overwrite
* @param {Function} method function that returns a function to be used for name
* @param {Function} chainingBehavior function that returns a function to be used for property
* @namespace Utils
* @name overwriteChainableMethod
* @public
*/
export function overwriteChainableMethod(ctx, name, method, chainingBehavior) {
let chainableBehavior = ctx.__methods[name];
let _chainingBehavior = chainableBehavior.chainingBehavior;
chainableBehavior.chainingBehavior =
function overwritingChainableMethodGetter() {
let result = chainingBehavior(_chainingBehavior).call(this);
if (result !== undefined) {
return result;
}
let newAssertion = new Assertion();
transferFlags(this, newAssertion);
return newAssertion;
};
let _method = chainableBehavior.method;
chainableBehavior.method = function overwritingChainableMethodWrapper() {
let result = method(_method).apply(this, arguments);
if (result !== undefined) {
return result;
}
let newAssertion = new Assertion();
transferFlags(this, newAssertion);
return newAssertion;
};
}

View file

@ -0,0 +1,90 @@
/*!
* Chai - overwriteMethod utility
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
* MIT Licensed
*/
import {Assertion} from '../assertion.js';
import {addLengthGuard} from './addLengthGuard.js';
import {flag} from './flag.js';
import {proxify} from './proxify.js';
import {transferFlags} from './transferFlags.js';
/**
* ### .overwriteMethod(ctx, name, fn)
*
* Overwrites an already existing method and provides
* access to previous function. Must return function
* to be used for name.
*
* utils.overwriteMethod(chai.Assertion.prototype, 'equal', function (_super) {
* return function (str) {
* var obj = utils.flag(this, 'object');
* if (obj instanceof Foo) {
* new chai.Assertion(obj.value).to.equal(str);
* } else {
* _super.apply(this, arguments);
* }
* }
* });
*
* Can also be accessed directly from `chai.Assertion`.
*
* chai.Assertion.overwriteMethod('foo', fn);
*
* Then can be used as any other assertion.
*
* expect(myFoo).to.equal('bar');
*
* @param {object} ctx object whose method is to be overwritten
* @param {string} name of method to overwrite
* @param {Function} method function that returns a function to be used for name
* @namespace Utils
* @name overwriteMethod
* @public
*/
export function overwriteMethod(ctx, name, method) {
let _method = ctx[name],
_super = function () {
throw new Error(name + ' is not a function');
};
if (_method && 'function' === typeof _method) _super = _method;
let overwritingMethodWrapper = function () {
// Setting the `ssfi` flag to `overwritingMethodWrapper` causes this
// function to be the starting point for removing implementation frames from
// the stack trace of a failed assertion.
//
// However, we only want to use this function as the starting point if the
// `lockSsfi` flag isn't set.
//
// If the `lockSsfi` flag is set, then either this assertion has been
// overwritten by another assertion, or this assertion is being invoked from
// inside of another assertion. In the first case, the `ssfi` flag has
// already been set by the overwriting assertion. In the second case, the
// `ssfi` flag has already been set by the outer assertion.
if (!flag(this, 'lockSsfi')) {
flag(this, 'ssfi', overwritingMethodWrapper);
}
// Setting the `lockSsfi` flag to `true` prevents the overwritten assertion
// from changing the `ssfi` flag. By this point, the `ssfi` flag is already
// set to the correct starting point for this assertion.
let origLockSsfi = flag(this, 'lockSsfi');
flag(this, 'lockSsfi', true);
let result = method(_super).apply(this, arguments);
flag(this, 'lockSsfi', origLockSsfi);
if (result !== undefined) {
return result;
}
let newAssertion = new Assertion();
transferFlags(this, newAssertion);
return newAssertion;
};
addLengthGuard(overwritingMethodWrapper, name, false);
ctx[name] = proxify(overwritingMethodWrapper, name);
}

View file

@ -0,0 +1,89 @@
/*!
* Chai - overwriteProperty utility
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
* MIT Licensed
*/
import {Assertion} from '../assertion.js';
import {flag} from './flag.js';
import {isProxyEnabled} from './isProxyEnabled.js';
import {transferFlags} from './transferFlags.js';
/**
* ### .overwriteProperty(ctx, name, fn)
*
* Overwrites an already existing property getter and provides
* access to previous value. Must return function to use as getter.
*
* utils.overwriteProperty(chai.Assertion.prototype, 'ok', function (_super) {
* return function () {
* var obj = utils.flag(this, 'object');
* if (obj instanceof Foo) {
* new chai.Assertion(obj.name).to.equal('bar');
* } else {
* _super.call(this);
* }
* }
* });
*
* Can also be accessed directly from `chai.Assertion`.
*
* chai.Assertion.overwriteProperty('foo', fn);
*
* Then can be used as any other assertion.
*
* expect(myFoo).to.be.ok;
*
* @param {object} ctx object whose property is to be overwritten
* @param {string} name of property to overwrite
* @param {Function} getter function that returns a getter function to be used for name
* @namespace Utils
* @name overwriteProperty
* @public
*/
export function overwriteProperty(ctx, name, getter) {
let _get = Object.getOwnPropertyDescriptor(ctx, name),
_super = function () {};
if (_get && 'function' === typeof _get.get) _super = _get.get;
Object.defineProperty(ctx, name, {
get: function overwritingPropertyGetter() {
// Setting the `ssfi` flag to `overwritingPropertyGetter` causes this
// function to be the starting point for removing implementation frames
// from the stack trace of a failed assertion.
//
// However, we only want to use this function as the starting point if
// the `lockSsfi` flag isn't set and proxy protection is disabled.
//
// If the `lockSsfi` flag is set, then either this assertion has been
// overwritten by another assertion, or this assertion is being invoked
// from inside of another assertion. In the first case, the `ssfi` flag
// has already been set by the overwriting assertion. In the second
// case, the `ssfi` flag has already been set by the outer assertion.
//
// If proxy protection is enabled, then the `ssfi` flag has already been
// set by the proxy getter.
if (!isProxyEnabled() && !flag(this, 'lockSsfi')) {
flag(this, 'ssfi', overwritingPropertyGetter);
}
// Setting the `lockSsfi` flag to `true` prevents the overwritten
// assertion from changing the `ssfi` flag. By this point, the `ssfi`
// flag is already set to the correct starting point for this assertion.
let origLockSsfi = flag(this, 'lockSsfi');
flag(this, 'lockSsfi', true);
let result = getter(_super).call(this);
flag(this, 'lockSsfi', origLockSsfi);
if (result !== undefined) {
return result;
}
let newAssertion = new Assertion();
transferFlags(this, newAssertion);
return newAssertion;
},
configurable: true
});
}

158
pwa/node_modules/chai/lib/chai/utils/proxify.js generated vendored Normal file
View file

@ -0,0 +1,158 @@
import {config} from '../config.js';
import {flag} from './flag.js';
import {getProperties} from './getProperties.js';
import {isProxyEnabled} from './isProxyEnabled.js';
/*!
* Chai - proxify utility
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
* MIT Licensed
*/
/** @type {PropertyKey[]} */
const builtins = ['__flags', '__methods', '_obj', 'assert'];
/**
* ### .proxify(object)
*
* Return a proxy of given object that throws an error when a non-existent
* property is read. By default, the root cause is assumed to be a misspelled
* property, and thus an attempt is made to offer a reasonable suggestion from
* the list of existing properties. However, if a nonChainableMethodName is
* provided, then the root cause is instead a failure to invoke a non-chainable
* method prior to reading the non-existent property.
*
* If proxies are unsupported or disabled via the user's Chai config, then
* return object without modification.
*
* @namespace Utils
* @template {object} T
* @param {T} obj
* @param {string} [nonChainableMethodName]
* @returns {T}
*/
export function proxify(obj, nonChainableMethodName) {
if (!isProxyEnabled()) return obj;
return new Proxy(obj, {
get: function proxyGetter(target, property) {
// This check is here because we should not throw errors on Symbol properties
// such as `Symbol.toStringTag`.
// The values for which an error should be thrown can be configured using
// the `config.proxyExcludedKeys` setting.
if (
typeof property === 'string' &&
config.proxyExcludedKeys.indexOf(property) === -1 &&
!Reflect.has(target, property)
) {
// Special message for invalid property access of non-chainable methods.
if (nonChainableMethodName) {
throw Error(
'Invalid Chai property: ' +
nonChainableMethodName +
'.' +
property +
'. See docs for proper usage of "' +
nonChainableMethodName +
'".'
);
}
// If the property is reasonably close to an existing Chai property,
// suggest that property to the user. Only suggest properties with a
// distance less than 4.
let suggestion = null;
let suggestionDistance = 4;
getProperties(target).forEach(function (prop) {
if (
// we actually mean to check `Object.prototype` here
// eslint-disable-next-line no-prototype-builtins
!Object.prototype.hasOwnProperty(prop) &&
builtins.indexOf(prop) === -1
) {
let dist = stringDistanceCapped(property, prop, suggestionDistance);
if (dist < suggestionDistance) {
suggestion = prop;
suggestionDistance = dist;
}
}
});
if (suggestion !== null) {
throw Error(
'Invalid Chai property: ' +
property +
'. Did you mean "' +
suggestion +
'"?'
);
} else {
throw Error('Invalid Chai property: ' + property);
}
}
// Use this proxy getter as the starting point for removing implementation
// frames from the stack trace of a failed assertion. For property
// assertions, this prevents the proxy getter from showing up in the stack
// trace since it's invoked before the property getter. For method and
// chainable method assertions, this flag will end up getting changed to
// the method wrapper, which is good since this frame will no longer be in
// the stack once the method is invoked. Note that Chai builtin assertion
// properties such as `__flags` are skipped since this is only meant to
// capture the starting point of an assertion. This step is also skipped
// if the `lockSsfi` flag is set, thus indicating that this assertion is
// being called from within another assertion. In that case, the `ssfi`
// flag is already set to the outer assertion's starting point.
if (builtins.indexOf(property) === -1 && !flag(target, 'lockSsfi')) {
flag(target, 'ssfi', proxyGetter);
}
return Reflect.get(target, property);
}
});
}
/**
* # stringDistanceCapped(strA, strB, cap)
* Return the Levenshtein distance between two strings, but no more than cap.
*
* @param {string} strA
* @param {string} strB
* @param {number} cap
* @returns {number} min(string distance between strA and strB, cap)
* @private
*/
function stringDistanceCapped(strA, strB, cap) {
if (Math.abs(strA.length - strB.length) >= cap) {
return cap;
}
let memo = [];
// `memo` is a two-dimensional array containing distances.
// memo[i][j] is the distance between strA.slice(0, i) and
// strB.slice(0, j).
for (let i = 0; i <= strA.length; i++) {
memo[i] = Array(strB.length + 1).fill(0);
memo[i][0] = i;
}
for (let j = 0; j < strB.length; j++) {
memo[0][j] = j;
}
for (let i = 1; i <= strA.length; i++) {
let ch = strA.charCodeAt(i - 1);
for (let j = 1; j <= strB.length; j++) {
if (Math.abs(i - j) >= cap) {
memo[i][j] = cap;
continue;
}
memo[i][j] = Math.min(
memo[i - 1][j] + 1,
memo[i][j - 1] + 1,
memo[i - 1][j - 1] + (ch === strB.charCodeAt(j - 1) ? 0 : 1)
);
}
}
return memo[strA.length][strB.length];
}

24
pwa/node_modules/chai/lib/chai/utils/test.js generated vendored Normal file
View file

@ -0,0 +1,24 @@
/*!
* Chai - test utility
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
* MIT Licensed
*/
import {flag} from './flag.js';
/**
* ### .test(object, expression)
*
* Test an object for expression.
*
* @param {object} obj (constructed Assertion)
* @param {unknown} args
* @returns {unknown}
* @namespace Utils
* @name test
*/
export function test(obj, args) {
let negate = flag(obj, 'negate'),
expr = args[0];
return negate ? !expr : expr;
}

48
pwa/node_modules/chai/lib/chai/utils/transferFlags.js generated vendored Normal file
View file

@ -0,0 +1,48 @@
/*!
* Chai - transferFlags utility
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
* MIT Licensed
*/
/**
* ### .transferFlags(assertion, object, includeAll = true)
*
* Transfer all the flags for `assertion` to `object`. If
* `includeAll` is set to `false`, then the base Chai
* assertion flags (namely `object`, `ssfi`, `lockSsfi`,
* and `message`) will not be transferred.
*
* var newAssertion = new Assertion();
* utils.transferFlags(assertion, newAssertion);
*
* var anotherAssertion = new Assertion(myObj);
* utils.transferFlags(assertion, anotherAssertion, false);
*
* @param {import('../assertion.js').Assertion} assertion the assertion to transfer the flags from
* @param {object} object the object to transfer the flags to; usually a new assertion
* @param {boolean} includeAll
* @namespace Utils
* @name transferFlags
* @private
*/
export function transferFlags(assertion, object, includeAll) {
let flags = assertion.__flags || (assertion.__flags = Object.create(null));
if (!object.__flags) {
object.__flags = Object.create(null);
}
includeAll = arguments.length === 3 ? includeAll : true;
for (let flag in flags) {
if (
includeAll ||
(flag !== 'object' &&
flag !== 'ssfi' &&
flag !== 'lockSsfi' &&
flag != 'message')
) {
object.__flags[flag] = flags[flag];
}
}
}

20
pwa/node_modules/chai/lib/chai/utils/type-detect.js generated vendored Normal file
View file

@ -0,0 +1,20 @@
/**
* @param {unknown} obj
* @returns {string}
*/
export function type(obj) {
if (typeof obj === 'undefined') {
return 'undefined';
}
if (obj === null) {
return 'null';
}
const stringTag = obj[Symbol.toStringTag];
if (typeof stringTag === 'string') {
return stringTag;
}
const type = Object.prototype.toString.call(obj).slice(8, -1);
return type;
}

74
pwa/node_modules/chai/package.json generated vendored Normal file
View file

@ -0,0 +1,74 @@
{
"author": "Jake Luer <jake@alogicalparadox.com>",
"name": "chai",
"type": "module",
"description": "BDD/TDD assertion library for node.js and the browser. Test framework agnostic.",
"keywords": [
"test",
"assertion",
"assert",
"testing",
"chai"
],
"files": [
"chai.js",
"index.js",
"lib",
"register-*.js"
],
"homepage": "http://chaijs.com",
"license": "MIT",
"contributors": [
"Jake Luer <jake@alogicalparadox.com>",
"Domenic Denicola <domenic@domenicdenicola.com> (http://domenicdenicola.com)",
"Veselin Todorov <hi@vesln.com>",
"John Firebaugh <john.firebaugh@gmail.com>"
],
"version": "5.3.3",
"repository": {
"type": "git",
"url": "https://github.com/chaijs/chai"
},
"bugs": {
"url": "https://github.com/chaijs/chai/issues"
},
"main": "./index.js",
"scripts": {
"build": "esbuild --bundle --format=esm --keep-names --outfile=index.js lib/chai.js",
"prebuild": "npm run clean",
"format": "prettier --write lib",
"pretest": "npm run lint",
"test": "npm run test-node && npm run test-chrome",
"test-node": "c8 --99 --check-coverage mocha --require ./test/bootstrap/index.js test/*.js",
"test-chrome": "web-test-runner --playwright",
"lint": "npm run lint:js && npm run lint:format",
"lint:js": "eslint lib/",
"lint:format": "prettier --check lib",
"lint:types": "tsc",
"clean": "rm -rf index.js coverage/"
},
"engines": {
"node": ">=18"
},
"dependencies": {
"assertion-error": "^2.0.1",
"check-error": "^2.1.1",
"deep-eql": "^5.0.1",
"loupe": "^3.1.0",
"pathval": "^2.0.0"
},
"devDependencies": {
"@eslint/js": "^9.17.0",
"@rollup/plugin-commonjs": "^25.0.7",
"@web/dev-server-rollup": "^0.6.1",
"@web/test-runner": "^0.18.0",
"@web/test-runner-playwright": "^0.11.0",
"c8": "^10.1.3",
"esbuild": "^0.25.9",
"eslint": "^8.56.0",
"eslint-plugin-jsdoc": "^48.0.4",
"mocha": "^10.2.0",
"prettier": "^3.4.2",
"typescript": "~5.7.3"
}
}

3
pwa/node_modules/chai/register-assert.js generated vendored Normal file
View file

@ -0,0 +1,3 @@
import {assert} from './index.js';
globalThis.assert = assert;

3
pwa/node_modules/chai/register-expect.js generated vendored Normal file
View file

@ -0,0 +1,3 @@
import {expect} from './index.js';
globalThis.expect = expect;

3
pwa/node_modules/chai/register-should.js generated vendored Normal file
View file

@ -0,0 +1,3 @@
import {should} from './index.js';
globalThis.should = should();