diff --git a/.github/tasks.md b/.github/tasks.md index 22b61a96..8866fe7c 100644 --- a/.github/tasks.md +++ b/.github/tasks.md @@ -1,48 +1,36 @@ ## Tasks -- [x] Read the description in [#164](https://github.com/SenteraLLC/ulabel/issues/164) +- [x] Read the description in [#234](https://github.com/SenteraLLC/ulabel/issues/234) - [x] Write a clear summary of the requested change - - [x] Propose some options of how to proceed. Wait for user input to decide which to try first. + - [x] Break the requested feature down into concrete steps. Add the steps to the tasks list, and then start working on then one by one. -### Decision: Proceeding with Option 3 (Webpack modernization + dependency cleanup) +### Summary +Create an annotation list toolbox item that displays all annotations in a list format, similar to other annotation tools. The list should: +- Display each annotation (by ID or index) +- Allow show/hide of deprecated annotations (default: hide) +- Support grouping by class +- Enable clicking to "fly to" the annotation +- Show annotation labels/IDs (on hover or drawn on canvas) +- Display "current idx / total" when navigating through annotations +- Highlight annotations when hovering in the list -#### Step 1: Move dependencies to devDependencies -- [x] Move `@turf/turf` from dependencies to devDependencies -- [x] Move `jquery` from dependencies to devDependencies -- [x] Move `polygon-clipping` from dependencies to devDependencies -- [x] Move `uuidv4` from dependencies to devDependencies -- [x] Test: Run `npm install` and verify it works -- [x] Test: Run `npm run build` and verify output is identical (both files 1039.6 KB) - -#### Step 2: Enable and modernize webpack minification ✅ COMPLETE -- [x] Remove commented-out UglifyJsPlugin code (deprecated) -- [x] Enable webpack 5's built-in TerserPlugin for minification -- [x] Configure it to only minify `ulabel.min.js`, not `ulabel.js` -- [x] Test: Run `npm run build` and verify both files are created -- [x] Test: Verify `ulabel.js` is NOT minified (readable) - 2.33 MB with webpack runtime and formatted code -- [x] Test: Verify `ulabel.min.js` IS minified (smaller size) - 1.02 MB minified -- [x] Test: Run `npm run lint` - No errors -- [x] Note: File size difference (2.33 MB vs 1.02 MB) is expected - readable version includes webpack runtime overhead - -#### Step 3: Verify and document ✅ COMPLETE -- [x] Compare file sizes before/after - - Before: Both files 1039 KB (both minified, minification was disabled) - - After: ulabel.js 2.33 MB (readable), ulabel.min.js 1.02 MB (minified) - - Result: Minification now working correctly, file size increase for non-min version is expected -- [x] Update CHANGELOG.md with changes -- [x] Document any findings or recommendations - -#### Step 4: Security and dependency updates ✅ COMPLETE -- [x] Run `npm audit` to identify vulnerabilities -- [x] Fix 12 vulnerabilities using `npm audit fix` -- [x] Apply breaking changes for remaining issues with `npm audit fix --force` -- [x] Update `typescript-eslint` packages to be compatible with ESLint 9.37.0 -- [x] Fix linting issues in `tests/e2e/fixtures.js` -- [x] Verify all tests still pass (28 unit tests + 36 e2e tests) -- [x] Final audit: 0 vulnerabilities - -#### Step 5: Configure package exports for minified by default ✅ COMPLETE -- [x] Update `main` and `module` fields to point to `dist/ulabel.min.js` -- [x] Add `exports` field with options: `.` (minified), `./min` (minified), `./debug` (unminified) -- [x] Update `unpkg` field to serve minified version by default -- [x] Update README.md with usage examples for both minified and unminified versions -- [x] Document clear import patterns for users \ No newline at end of file +### Implementation Steps +- [x] 1. Research existing toolbox items and understand the toolbox structure + - [x] Read `src/toolbox.ts` to understand how toolbox items work + - [x] Review existing toolbox items in `src/toolbox_items/` + - [x] Understand how annotation data is accessed and structured +- [x] 2. Create the basic annotation list toolbox item + - [x] Create new file `src/toolbox_items/annotation_list.ts` + - [x] Implement basic UI structure (container, list elements) + - [x] Register the toolbox item in the main toolbox +- [x] 3. Implement core list functionality + - [x] Display all annotations with their ID/index + - [x] Add show/hide toggle for deprecated annotations (default: hide) + - [x] Add option to group by class +- [x] 4. Implement click-to-fly functionality + - [x] Integrate with existing "fly to" functionality from PR #230 + - [x] Add click handlers to list items + - [x] Display "current idx / total" indicator +- [x] 5. Implement hover highlighting + - [x] Add hover handlers to list items + - [x] Integrate with existing annotation highlighting system + - [x] Ensure bidirectional highlighting (list hover → canvas, canvas hover → list) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..c084c285 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,37 @@ +name: Publish to npm + +on: + pull_request: + types: + - closed + branches: + - main + workflow_dispatch: + +jobs: + publish: + # Only run if PR was merged (or manual dispatch) + if: github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + registry-url: 'https://registry.npmjs.org' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Build + run: npm run build + + - name: Publish to npm + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} diff --git a/.gitignore b/.gitignore index 533a83b9..cb723ffd 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ build build/* output.txt test-results/ -playwright-report/ \ No newline at end of file +playwright-report/ +dist \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index d7ffbae4..853af099 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,18 @@ All notable changes to this project will be documented here. -## [unreleased]https://github.com/SenteraLLC/ulabel/pull/233 +## [unreleased] + +## [0.21.0] - Oct 27th, 2025 +- Add toast notification that shows on `fly_to` calls and shows annotation position in the ordering (e.g., "3 / 10") +- Add `AnnotationList` toolbox item for managing and navigating annotations + - Displays all annotations in a scrollable list with spatial type icons and class names + - Bidirectional hover highlighting between list and canvas + - Filter options: + - Toggle show/hide deprecated annotations (default: hidden) + - Group annotations by class + - Collapsible interface to maximize toolbox space +- Add automated package deployment via GHA ## [0.20.0] - Oct 15th, 2025 - Add `fly-to` functions, which sets the zoom and focus to a specific annotation diff --git a/api_spec.md b/api_spec.md index 912ec91a..e7ada40a 100644 --- a/api_spec.md +++ b/api_spec.md @@ -347,7 +347,8 @@ enum AllowedToolboxItem { SubmitButtons, // 7 FilterDistance, // 8 Brush, // 9 - ImageFilters // 10 + ImageFilters, // 10 + AnnotationList // 11 } ``` You can access the AllowedToolboxItem enum by calling the static method: @@ -413,6 +414,29 @@ type ImageFiltersConfig = { This toolbox item provides CSS filter controls that apply only to the image, not to the UI elements. Users can adjust brightness, contrast, hue rotation, inversion, and saturation using sliders. The filters are hardware-accelerated by modern browsers for optimal performance. +### `annotation_list_toolbox_item` + +The `AnnotationList` toolbox item displays all annotations in the current subtask in a scrollable list. This toolbox item provides several features: + +**Display Features:** +- Shows each annotation with its spatial type icon (bbox, polygon, point, etc.) and class name +- Displays annotation index (0-based) for easy reference +- Collapsible interface to maximize canvas space + +**Filtering Options:** +- **Show Deprecated**: Toggle to show/hide deprecated annotations (default: hidden) +- **Group by Class**: Organize annotations by their classification for easier management + +**Navigation:** +- Click any annotation in the list to fly-to and zoom on that annotation +- Toast notification appears showing current position (e.g., "3 / 10") when navigating + +**Bidirectional Highlighting:** +- Hover over an annotation in the list to highlight it on the canvas with the ID dialog +- Hover over an annotation on the canvas to highlight its corresponding entry in the list + +This toolbox item requires no configuration and can be added to the `toolbox_order` array using `AllowedToolboxItem.AnnotationList`. + ### `change_zoom_keybind` Keybind to change the zoom level. Must be a letter, and the lowercase version of the letter will set the zoom level to the `initial_crop`, while the capitalized version will show the full image. Default is `r`. diff --git a/demo/multi-class.html b/demo/multi-class.html index c66a3ac9..571c5bca 100644 --- a/demo/multi-class.html +++ b/demo/multi-class.html @@ -120,6 +120,7 @@ "toolbox_order": [ AllowedToolboxItem.SubmitButtons, AllowedToolboxItem.ModeSelect, + AllowedToolboxItem.AnnotationList, AllowedToolboxItem.ImageFilters, AllowedToolboxItem.ZoomPan, AllowedToolboxItem.AnnotationID, diff --git a/dist/ulabel.js b/dist/ulabel.js deleted file mode 100644 index 9fd89b48..00000000 --- a/dist/ulabel.js +++ /dev/null @@ -1,61536 +0,0 @@ -/******/ (() => { // webpackBootstrap -/******/ var __webpack_modules__ = ({ - -/***/ 39: -/***/ (function(__unused_webpack_module, exports) { - -!function(t,e){ true?e(exports):0}(this,function(t){"use strict";function e(){}function n(t){this.message=t||""}function i(t){this.message=t||""}function r(t){this.message=t||""}function o(){}function s(t){return null===t?Mt:t.color}function a(t){return null===t?null:t.parent}function u(t,e){null!==t&&(t.color=e)}function l(t){return null===t?null:t.left}function c(t){return null===t?null:t.right}function p(){this.root_=null,this.size_=0}function h(){}function f(){this.array_=[],arguments[0]instanceof It&&this.addAll(arguments[0])}function g(){}function d(t){this.message=t||""}function y(){this.array_=[]}"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(t){if(void 0===this||null===this)throw new TypeError(this+" is not an object");var e=Object(this),n=Math.max(Math.min(e.length,9007199254740991),0)||0,i=1 in arguments?parseInt(Number(arguments[1]),10)||0:0;i=i<0?Math.max(n+i,0):Math.min(i,n);var r=2 in arguments&&void 0!==arguments[2]?parseInt(Number(arguments[2]),10)||0:n;for(r=r<0?Math.max(n+arguments[2],0):Math.min(r,n);ie.x?1:this.ye.y?1:0},C.prototype.clone=function(){},C.prototype.copy=function(){return new C(this)},C.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},C.prototype.distance3D=function(t){var e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return Math.sqrt(e*e+n*n+i*i)},C.prototype.distance=function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)},C.prototype.hashCode=function(){var t=17;return t=37*t+C.hashCode(this.x),t=37*t+C.hashCode(this.y)},C.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z},C.prototype.interfaces_=function(){return[E,x,e]},C.prototype.getClass=function(){return C},C.hashCode=function(){if(1===arguments.length){var t=arguments[0],e=v.doubleToLongBits(t);return Math.trunc((e^e)>>>32)}},S.DimensionalComparator.get=function(){return L},S.serialVersionUID.get=function(){return 0x5cbf2c235c7e5800},S.NULL_ORDINATE.get=function(){return v.NaN},S.X.get=function(){return 0},S.Y.get=function(){return 1},S.Z.get=function(){return 2},Object.defineProperties(C,S);var L=function(t){if(this._dimensionsToTest=2,0===arguments.length);else if(1===arguments.length){var e=arguments[0];if(2!==e&&3!==e)throw new m("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}};L.prototype.compare=function(t,e){var n=t,i=e,r=L.compare(n.x,i.x);if(0!==r)return r;var o=L.compare(n.y,i.y);if(0!==o)return o;if(this._dimensionsToTest<=2)return 0;return L.compare(n.z,i.z)},L.prototype.interfaces_=function(){return[N]},L.prototype.getClass=function(){return L},L.compare=function(t,e){return te?1:v.isNaN(t)?v.isNaN(e)?0:-1:v.isNaN(e)?1:0};var b=function(){};b.prototype.create=function(){},b.prototype.interfaces_=function(){return[]},b.prototype.getClass=function(){return b};var w=function(){},O={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};w.prototype.interfaces_=function(){return[]},w.prototype.getClass=function(){return w},w.toLocationSymbol=function(t){switch(t){case w.EXTERIOR:return"e";case w.BOUNDARY:return"b";case w.INTERIOR:return"i";case w.NONE:return"-"}throw new m("Unknown location value: "+t)},O.INTERIOR.get=function(){return 0},O.BOUNDARY.get=function(){return 1},O.EXTERIOR.get=function(){return 2},O.NONE.get=function(){return-1},Object.defineProperties(w,O);var T=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},R=function(){},P={LOG_10:{configurable:!0}};R.prototype.interfaces_=function(){return[]},R.prototype.getClass=function(){return R},R.log10=function(t){var e=Math.log(t);return v.isInfinite(e)?e:v.isNaN(e)?e:e/R.LOG_10},R.min=function(t,e,n,i){var r=t;return en?n:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var i=arguments[0],r=arguments[1],o=arguments[2];return io?o:i}},R.wrap=function(t,e){return t<0?e- -t%e:t%e},R.max=function(){if(3===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2],i=t;return e>i&&(i=e),n>i&&(i=n),i}if(4===arguments.length){var r=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3],u=r;return o>u&&(u=o),s>u&&(u=s),a>u&&(u=a),u}},R.average=function(t,e){return(t+e)/2},P.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(R,P);var D=function(t){this.str=t};D.prototype.append=function(t){this.str+=t},D.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)},D.prototype.toString=function(t){return this.str};var M=function(t){this.value=t};M.prototype.intValue=function(){return this.value},M.prototype.compareTo=function(t){return this.valuet?1:0},M.isNaN=function(t){return Number.isNaN(t)};var A=function(){};A.isWhitespace=function(t){return t<=32&&t>=0||127===t},A.toUpperCase=function(t){return t.toUpperCase()};var F=function t(){if(this._hi=0,this._lo=0,0===arguments.length)this.init(0);else if(1===arguments.length){if("number"==typeof arguments[0]){var e=arguments[0];this.init(e)}else if(arguments[0]instanceof t){var n=arguments[0];this.init(n)}else if("string"==typeof arguments[0]){var i=arguments[0];t.call(this,t.parse(i))}}else if(2===arguments.length){var r=arguments[0],o=arguments[1];this.init(r,o)}},G={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};F.prototype.le=function(t){return(this._hi9?(c=!0,p="9"):p="0"+l,s.append(p),n=n.subtract(F.valueOf(l)).multiply(F.TEN),c&&n.selfAdd(F.TEN);var h=!0,f=F.magnitude(n._hi);if(f<0&&Math.abs(f)>=a-u&&(h=!1),!h)break}return e[0]=i,s.toString()},F.prototype.sqr=function(){return this.multiply(this)},F.prototype.doubleValue=function(){return this._hi+this._lo},F.prototype.subtract=function(){if(arguments[0]instanceof F){var t=arguments[0];return this.add(t.negate())}if("number"==typeof arguments[0]){var e=arguments[0];return this.add(-e)}},F.prototype.equals=function(){if(1===arguments.length){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}},F.prototype.isZero=function(){return 0===this._hi&&0===this._lo},F.prototype.selfSubtract=function(){if(arguments[0]instanceof F){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e,0)}},F.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},F.prototype.min=function(t){return this.le(t)?this:t},F.prototype.selfDivide=function(){if(1===arguments.length){if(arguments[0]instanceof F){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfDivide(e,0)}}else if(2===arguments.length){var n=arguments[0],i=arguments[1],r=null,o=null,s=null,a=null,u=null,l=null,c=null,p=null;return u=this._hi/n,l=F.SPLIT*u,r=l-u,p=F.SPLIT*n,r=l-r,o=u-r,s=p-n,c=u*n,s=p-s,a=n-s,p=r*s-c+r*a+o*s+o*a,l=(this._hi-c-p+this._lo-u*i)/n,p=u+l,this._hi=p,this._lo=u-p+l,this}},F.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},F.prototype.divide=function(){if(arguments[0]instanceof F){var t=arguments[0],e=null,n=null,i=null,r=null,o=null,s=null,a=null,u=null;n=(o=this._hi/t._hi)-(e=(s=F.SPLIT*o)-(e=s-o)),u=e*(i=(u=F.SPLIT*t._hi)-(i=u-t._hi))-(a=o*t._hi)+e*(r=t._hi-i)+n*i+n*r,s=(this._hi-a-u+this._lo-o*t._lo)/t._hi;return new F(u=o+s,o-u+s)}if("number"==typeof arguments[0]){var l=arguments[0];return v.isNaN(l)?F.createNaN():F.copy(this).selfDivide(l,0)}},F.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo},F.prototype.pow=function(t){if(0===t)return F.valueOf(1);var e=new F(this),n=F.valueOf(1),i=Math.abs(t);if(i>1)for(;i>0;)i%2==1&&n.selfMultiply(e),(i/=2)>0&&(e=e.sqr());else n=e;return t<0?n.reciprocal():n},F.prototype.ceil=function(){if(this.isNaN())return F.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new F(t,e)},F.prototype.compareTo=function(t){var e=t;return this._hie._hi?1:this._loe._lo?1:0},F.prototype.rint=function(){if(this.isNaN())return this;return this.add(.5).floor()},F.prototype.setValue=function(){if(arguments[0]instanceof F){var t=arguments[0];return this.init(t),this}if("number"==typeof arguments[0]){var e=arguments[0];return this.init(e),this}},F.prototype.max=function(t){return this.ge(t)?this:t},F.prototype.sqrt=function(){if(this.isZero())return F.valueOf(0);if(this.isNegative())return F.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,n=F.valueOf(e),i=this.subtract(n.sqr())._hi*(.5*t);return n.add(i)},F.prototype.selfAdd=function(){if(1===arguments.length){if(arguments[0]instanceof F){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0],n=null,i=null,r=null,o=null,s=null,a=null;return r=this._hi+e,s=r-this._hi,o=r-s,o=e-s+(this._hi-o),a=o+this._lo,n=r+a,i=a+(r-n),this._hi=n+i,this._lo=i+(n-this._hi),this}}else if(2===arguments.length){var u=arguments[0],l=arguments[1],c=null,p=null,h=null,f=null,g=null,d=null,y=null;f=this._hi+u,p=this._lo+l,g=f-(d=f-this._hi),h=p-(y=p-this._lo);var _=(c=f+(d=(g=u-d+(this._hi-g))+p))+(d=(h=l-y+(this._lo-h))+(d+(f-c))),m=d+(c-_);return this._hi=_,this._lo=m,this}},F.prototype.selfMultiply=function(){if(1===arguments.length){if(arguments[0]instanceof F){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfMultiply(e,0)}}else if(2===arguments.length){var n=arguments[0],i=arguments[1],r=null,o=null,s=null,a=null,u=null,l=null;r=(u=F.SPLIT*this._hi)-this._hi,l=F.SPLIT*n,r=u-r,o=this._hi-r,s=l-n;var c=(u=this._hi*n)+(l=r*(s=l-s)-u+r*(a=n-s)+o*s+o*a+(this._hi*i+this._lo*n)),p=l+(r=u-c);return this._hi=c,this._lo=p,this}},F.prototype.selfSqr=function(){return this.selfMultiply(this)},F.prototype.floor=function(){if(this.isNaN())return F.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new F(t,e)},F.prototype.negate=function(){return this.isNaN()?this:new F(-this._hi,-this._lo)},F.prototype.clone=function(){},F.prototype.multiply=function(){if(arguments[0]instanceof F){var t=arguments[0];return t.isNaN()?F.createNaN():F.copy(this).selfMultiply(t)}if("number"==typeof arguments[0]){var e=arguments[0];return v.isNaN(e)?F.createNaN():F.copy(this).selfMultiply(e,0)}},F.prototype.isNaN=function(){return v.isNaN(this._hi)},F.prototype.intValue=function(){return Math.trunc(this._hi)},F.prototype.toString=function(){var t=F.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()},F.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!0,e),i=e[0]+1,r=n;if("."===n.charAt(0))r="0"+n;else if(i<0)r="0."+F.stringOfChar("0",-i)+n;else if(-1===n.indexOf(".")){var o=i-n.length;r=n+F.stringOfChar("0",o)+".0"}return this.isNegative()?"-"+r:r},F.prototype.reciprocal=function(){var t=null,e=null,n=null,i=null,r=null,o=null,s=null,a=null;e=(r=1/this._hi)-(t=(o=F.SPLIT*r)-(t=o-r)),n=(a=F.SPLIT*this._hi)-this._hi;var u=r+(o=(1-(s=r*this._hi)-(a=t*(n=a-n)-s+t*(i=this._hi-n)+e*n+e*i)-r*this._lo)/this._hi);return new F(u,r-u+o)},F.prototype.toSciNotation=function(){if(this.isZero())return F.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!1,e),i=F.SCI_NOT_EXPONENT_CHAR+e[0];if("0"===n.charAt(0))throw new Error("Found leading zero: "+n);var r="";n.length>1&&(r=n.substring(1));var o=n.charAt(0)+"."+r;return this.isNegative()?"-"+o+i:o+i},F.prototype.abs=function(){return this.isNaN()?F.NaN:this.isNegative()?this.negate():new F(this)},F.prototype.isPositive=function(){return(this._hi>0||0===this._hi)&&this._lo>0},F.prototype.lt=function(t){return(this._hit._hi||this._hi===t._hi)&&this._lo>t._lo},F.prototype.isNegative=function(){return(this._hi<0||0===this._hi)&&this._lo<0},F.prototype.trunc=function(){return this.isNaN()?F.NaN:this.isPositive()?this.floor():this.ceil()},F.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},F.prototype.interfaces_=function(){return[e,E,x]},F.prototype.getClass=function(){return F},F.sqr=function(t){return F.valueOf(t).selfMultiply(t)},F.valueOf=function(){if("string"==typeof arguments[0]){var t=arguments[0];return F.parse(t)}if("number"==typeof arguments[0]){var e=arguments[0];return new F(e)}},F.sqrt=function(t){return F.valueOf(t).sqrt()},F.parse=function(t){for(var e=0,n=t.length;A.isWhitespace(t.charAt(e));)e++;var i=!1;if(e=n);){var l=t.charAt(e);if(e++,A.isDigit(l)){var c=l-"0";o.selfMultiply(F.TEN),o.selfAdd(c),s++}else{if("."!==l){if("e"===l||"E"===l){var p=t.substring(e);try{u=M.parseInt(p)}catch(e){throw e instanceof Error?new Error("Invalid exponent "+p+" in string "+t):e}break}throw new Error("Unexpected character '"+l+"' at position "+e+" in string "+t)}a=s}}var h=o,f=s-a-u;if(0===f)h=o;else if(f>0){var g=F.TEN.pow(f);h=o.divide(g)}else if(f<0){var d=F.TEN.pow(-f);h=o.multiply(d)}return i?h.negate():h},F.createNaN=function(){return new F(v.NaN,v.NaN)},F.copy=function(t){return new F(t)},F.magnitude=function(t){var e=Math.abs(t),n=Math.log(e)/Math.log(10),i=Math.trunc(Math.floor(n));return 10*Math.pow(10,i)<=e&&(i+=1),i},F.stringOfChar=function(t,e){for(var n=new D,i=0;i0){if(o<=0)return q.signum(s);i=r+o}else{if(!(r<0))return q.signum(s);if(o>=0)return q.signum(s);i=-r-o}var a=q.DP_SAFE_EPSILON*i;return s>=a||-s>=a?q.signum(s):2},q.signum=function(t){return t>0?1:t<0?-1:0},B.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(q,B);var V=function(){},U={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};U.X.get=function(){return 0},U.Y.get=function(){return 1},U.Z.get=function(){return 2},U.M.get=function(){return 3},V.prototype.setOrdinate=function(t,e,n){},V.prototype.size=function(){},V.prototype.getOrdinate=function(t,e){},V.prototype.getCoordinate=function(){},V.prototype.getCoordinateCopy=function(t){},V.prototype.getDimension=function(){},V.prototype.getX=function(t){},V.prototype.clone=function(){},V.prototype.expandEnvelope=function(t){},V.prototype.copy=function(){},V.prototype.getY=function(t){},V.prototype.toCoordinateArray=function(){},V.prototype.interfaces_=function(){return[x]},V.prototype.getClass=function(){return V},Object.defineProperties(V,U);var z=function(){},X=function(t){function e(){t.call(this,"Projective point not representable on the Cartesian plane.")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(z),Y=function(){};Y.arraycopy=function(t,e,n,i,r){for(var o=0,s=e;st._minx?this._minx:t._minx,n=this._miny>t._miny?this._miny:t._miny,i=this._maxx=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy)}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];return!this.isNull()&&(n>=this._minx&&n<=this._maxx&&i>=this._miny&&i<=this._maxy)}},j.prototype.intersects=function(){if(1===arguments.length){if(arguments[0]instanceof j){var t=arguments[0];return!this.isNull()&&!t.isNull()&&!(t._minx>this._maxx||t._maxxthis._maxy||t._maxythis._maxx||nthis._maxy||ithis._maxx&&(this._maxx=e._maxx),e._minythis._maxy&&(this._maxy=e._maxy))}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.isNull()?(this._minx=n,this._maxx=n,this._miny=i,this._maxy=i):(nthis._maxx&&(this._maxx=n),ithis._maxy&&(this._maxy=i))}},j.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return te._minx?1:this._minye._miny?1:this._maxxe._maxx?1:this._maxye._maxy?1:0},j.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)},j.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},j.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},j.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},j.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e},j.prototype.expandBy=function(){if(1===arguments.length){var t=arguments[0];this.expandBy(t,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(this.isNull())return null;this._minx-=e,this._maxx+=e,this._miny-=n,this._maxy+=n,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},j.prototype.contains=function(){if(1===arguments.length){if(arguments[0]instanceof j){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof C){var e=arguments[0];return this.covers(e)}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];return this.covers(n,i)}},j.prototype.centre=function(){return this.isNull()?null:new C((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},j.prototype.init=function(){if(0===arguments.length)this.setToNull();else if(1===arguments.length){if(arguments[0]instanceof C){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof j){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.init(n.x,i.x,n.y,i.y)}else if(4===arguments.length){var r=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];rt._maxx&&(e=this._minx-t._maxx);var n=0;return this._maxyt._maxy&&(n=this._miny-t._maxy),0===e?n:0===n?e:Math.sqrt(e*e+n*n)},j.prototype.hashCode=function(){var t=17;return t=37*t+C.hashCode(this._minx),t=37*t+C.hashCode(this._maxx),t=37*t+C.hashCode(this._miny),t=37*t+C.hashCode(this._maxy)},j.prototype.interfaces_=function(){return[E,e]},j.prototype.getClass=function(){return j},j.intersects=function(){if(3===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2];return n.x>=(t.xe.x?t.x:e.x)&&n.y>=(t.ye.y?t.y:e.y)}if(4===arguments.length){var i=arguments[0],r=arguments[1],o=arguments[2],s=arguments[3],a=Math.min(o.x,s.x),u=Math.max(o.x,s.x),l=Math.min(i.x,r.x),c=Math.max(i.x,r.x);return!(l>u)&&(!(cu)&&!(cthis.getEdgeDistance(t,1)?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}},nt.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},nt.prototype.setPrecisionModel=function(t){this._precisionModel=t},nt.prototype.isInteriorIntersection=function(){if(0===arguments.length)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(1===arguments.length){for(var t=arguments[0],e=0;er?i:r;else{var s=Math.abs(t.x-e.x),a=Math.abs(t.y-e.y);0!==(o=i>r?s:a)||t.equals(e)||(o=Math.max(s,a))}return et.isTrue(!(0===o&&!t.equals(e)),"Bad distance calculation"),o},nt.nonRobustComputeEdgeDistance=function(t,e,n){var i=t.x-e.x,r=t.y-e.y,o=Math.sqrt(i*i+r*r);return et.isTrue(!(0===o&&!t.equals(e)),"Invalid distance calculation"),o},it.DONT_INTERSECT.get=function(){return 0},it.DO_INTERSECT.get=function(){return 1},it.COLLINEAR.get=function(){return 2},it.NO_INTERSECTION.get=function(){return 0},it.POINT_INTERSECTION.get=function(){return 1},it.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(nt,it);var rt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isInSegmentEnvelopes=function(t){var e=new j(this._inputLines[0][0],this._inputLines[0][1]),n=new j(this._inputLines[1][0],this._inputLines[1][1]);return e.contains(t)&&n.contains(t)},e.prototype.computeIntersection=function(){if(3!==arguments.length)return t.prototype.computeIntersection.apply(this,arguments);var e=arguments[0],n=arguments[1],i=arguments[2];if(this._isProper=!1,j.intersects(n,i,e)&&0===at.orientationIndex(n,i,e)&&0===at.orientationIndex(i,n,e))return this._isProper=!0,(e.equals(n)||e.equals(i))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION},e.prototype.normalizeToMinimum=function(t,e,n,i,r){r.x=this.smallestInAbsValue(t.x,e.x,n.x,i.x),r.y=this.smallestInAbsValue(t.y,e.y,n.y,i.y),t.x-=r.x,t.y-=r.y,e.x-=r.x,e.y-=r.y,n.x-=r.x,n.y-=r.y,i.x-=r.x,i.y-=r.y},e.prototype.safeHCoordinateIntersection=function(t,n,i,r){var o=null;try{o=k.intersection(t,n,i,r)}catch(s){if(!(s instanceof X))throw s;o=e.nearestEndpoint(t,n,i,r)}return o},e.prototype.intersection=function(t,n,i,r){var o=this.intersectionWithNormalization(t,n,i,r);return this.isInSegmentEnvelopes(o)||(o=new C(e.nearestEndpoint(t,n,i,r))),null!==this._precisionModel&&this._precisionModel.makePrecise(o),o},e.prototype.smallestInAbsValue=function(t,e,n,i){var r=t,o=Math.abs(r);return Math.abs(e)1e-4&&Y.out.println("Distance = "+r.distance(o))},e.prototype.intersectionWithNormalization=function(t,e,n,i){var r=new C(t),o=new C(e),s=new C(n),a=new C(i),u=new C;this.normalizeToEnvCentre(r,o,s,a,u);var l=this.safeHCoordinateIntersection(r,o,s,a);return l.x+=u.x,l.y+=u.y,l},e.prototype.computeCollinearIntersection=function(e,n,i,r){var o=j.intersects(e,n,i),s=j.intersects(e,n,r),a=j.intersects(i,r,e),u=j.intersects(i,r,n);return o&&s?(this._intPt[0]=i,this._intPt[1]=r,t.COLLINEAR_INTERSECTION):a&&u?(this._intPt[0]=e,this._intPt[1]=n,t.COLLINEAR_INTERSECTION):o&&a?(this._intPt[0]=i,this._intPt[1]=e,!i.equals(e)||s||u?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):o&&u?(this._intPt[0]=i,this._intPt[1]=n,!i.equals(n)||s||a?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):s&&a?(this._intPt[0]=r,this._intPt[1]=e,!r.equals(e)||o||u?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):s&&u?(this._intPt[0]=r,this._intPt[1]=n,!r.equals(n)||o||a?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):t.NO_INTERSECTION},e.prototype.normalizeToEnvCentre=function(t,e,n,i,r){var o=t.xe.x?t.x:e.x,u=t.y>e.y?t.y:e.y,l=n.xi.x?n.x:i.x,h=n.y>i.y?n.y:i.y,f=((o>l?o:l)+(ac?s:c)+(u0&&s>0||o<0&&s<0)return t.NO_INTERSECTION;var a=at.orientationIndex(i,r,e),u=at.orientationIndex(i,r,n);if(a>0&&u>0||a<0&&u<0)return t.NO_INTERSECTION;return 0===o&&0===s&&0===a&&0===u?this.computeCollinearIntersection(e,n,i,r):(0===o||0===s||0===a||0===u?(this._isProper=!1,e.equals2D(i)||e.equals2D(r)?this._intPt[0]=e:n.equals2D(i)||n.equals2D(r)?this._intPt[0]=n:0===o?this._intPt[0]=new C(i):0===s?this._intPt[0]=new C(r):0===a?this._intPt[0]=new C(e):0===u&&(this._intPt[0]=new C(n))):(this._isProper=!0,this._intPt[0]=this.intersection(e,n,i,r)),t.POINT_INTERSECTION)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.nearestEndpoint=function(t,e,n,i){var r=t,o=at.distancePointLine(t,n,i),s=at.distancePointLine(e,n,i);return s0?n>0?-r:r:n>0?r:-r;if(0===e||0===n)return i>0?t>0?r:-r:t>0?-r:r;if(e>0?i>0?e<=i||(r=-r,o=t,t=n,n=o,o=e,e=i,i=o):e<=-i?(r=-r,n=-n,i=-i):(o=t,t=-n,n=o,o=e,e=-i,i=o):i>0?-e<=i?(r=-r,t=-t,e=-e):(o=-t,t=n,n=o,o=-e,e=i,i=o):e>=i?(t=-t,e=-e,n=-n,i=-i):(r=-r,o=-t,t=-n,n=o,o=-e,e=-i,i=o),t>0){if(!(n>0))return r;if(!(t<=n))return r}else{if(n>0)return-r;if(!(t>=n))return-r;r=-r,t=-t,n=-n}for(;;){if(s=Math.floor(n/t),n-=s*t,(i-=s*e)<0)return-r;if(i>e)return r;if(t>n+n){if(ei+i)return-r;n=t-n,i=e-i,r=-r}if(0===i)return 0===n?0:-r;if(0===n)return r;if(s=Math.floor(t/n),t-=s*n,(e-=s*i)<0)return r;if(e>i)return-r;if(n>t+t){if(ie+e)return r;t=n-t,e=i-e,r=-r}if(0===e)return 0===t?0:r;if(0===t)return-r}};var st=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};st.prototype.countSegment=function(t,e){if(t.xi&&(n=e.x,i=t.x),this._p.x>=n&&this._p.x<=i&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&e.y<=this._p.y||e.y>this._p.y&&t.y<=this._p.y){var r=t.x-this._p.x,o=t.y-this._p.y,s=e.x-this._p.x,a=e.y-this._p.y,u=ot.signOfDet2x2(r,o,s,a);if(0===u)return this._isPointOnSegment=!0,null;a0&&this._crossingCount++}},st.prototype.isPointInPolygon=function(){return this.getLocation()!==w.EXTERIOR},st.prototype.getLocation=function(){return this._isPointOnSegment?w.BOUNDARY:this._crossingCount%2==1?w.INTERIOR:w.EXTERIOR},st.prototype.isOnSegment=function(){return this._isPointOnSegment},st.prototype.interfaces_=function(){return[]},st.prototype.getClass=function(){return st},st.locatePointInRing=function(){if(arguments[0]instanceof C&&T(arguments[1],V)){for(var t=arguments[0],e=arguments[1],n=new st(t),i=new C,r=new C,o=1;o1||a<0||a>1)&&(r=!0)}}else r=!0;return r?R.min(at.distancePointLine(t,n,i),at.distancePointLine(e,n,i),at.distancePointLine(n,t,e),at.distancePointLine(i,t,e)):0},at.isPointInRing=function(t,e){return at.locatePointInRing(t,e)!==w.EXTERIOR},at.computeLength=function(t){var e=t.size();if(e<=1)return 0;var n=0,i=new C;t.getCoordinate(0,i);for(var r=i.x,o=i.y,s=1;sn.y&&(n=o,i=r)}var s=i;do{(s-=1)<0&&(s=e)}while(t[s].equals2D(n)&&s!==i);var a=i;do{a=(a+1)%e}while(t[a].equals2D(n)&&a!==i);var u=t[s],l=t[a];if(u.equals2D(n)||l.equals2D(n)||u.equals2D(l))return!1;var c=at.computeOrientation(u,n,l),p=!1;return p=0===c?u.x>l.x:c>0,p},at.locatePointInRing=function(t,e){return st.locatePointInRing(t,e)},at.distancePointLinePerpendicular=function(t,e,n){var i=(n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y),r=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/i;return Math.abs(r)*Math.sqrt(i)},at.computeOrientation=function(t,e,n){return at.orientationIndex(t,e,n)},at.distancePointLine=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(0===e.length)throw new m("Line array must contain at least one vertex");for(var n=t.distance(e[0]),i=0;i=1)return o.distance(a);var c=((s.y-o.y)*(a.x-s.x)-(s.x-o.x)*(a.y-s.y))/u;return Math.abs(c)*Math.sqrt(u)}},at.isOnLine=function(t,e){for(var n=new rt,i=1;i0},_t.prototype.interfaces_=function(){return[gt]},_t.prototype.getClass=function(){return _t};var mt=function(){};mt.prototype.isInBoundary=function(t){return t>1},mt.prototype.interfaces_=function(){return[gt]},mt.prototype.getClass=function(){return mt};var vt=function(){};vt.prototype.isInBoundary=function(t){return 1===t},vt.prototype.interfaces_=function(){return[gt]},vt.prototype.getClass=function(){return vt};var It=function(){};It.prototype.add=function(){},It.prototype.addAll=function(){},It.prototype.isEmpty=function(){},It.prototype.iterator=function(){},It.prototype.size=function(){},It.prototype.toArray=function(){},It.prototype.remove=function(){},(n.prototype=new Error).name="IndexOutOfBoundsException";var Et=function(){};Et.prototype.hasNext=function(){},Et.prototype.next=function(){},Et.prototype.remove=function(){};var xt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(){},e.prototype.set=function(){},e.prototype.isEmpty=function(){},e}(It);(i.prototype=new Error).name="NoSuchElementException";var Nt=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof It&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.ensureCapacity=function(){},e.prototype.interfaces_=function(){return[t,It]},e.prototype.add=function(t){return 1===arguments.length?this.array_.push(t):this.array_.splice(arguments[0],arguments[1]),!0},e.prototype.clear=function(){this.array_=[]},e.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},e.prototype.set=function(t,e){var n=this.array_[t];return this.array_[t]=e,n},e.prototype.iterator=function(){return new Ct(this)},e.prototype.get=function(t){if(t<0||t>=this.size())throw new n;return this.array_[t]},e.prototype.isEmpty=function(){return 0===this.array_.length},e.prototype.size=function(){return this.array_.length},e.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e=1){if(this.get(this.size()-1).equals2D(r))return null}t.prototype.add.call(this,r)}else if(arguments[0]instanceof Object&&"boolean"==typeof arguments[1]){var o=arguments[0],s=arguments[1];return this.add(o,s),!0}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var a=arguments[0],u=arguments[1];if(arguments[2])for(var l=0;l=0;c--)this.add(a[c],u);return!0}if("boolean"==typeof arguments[2]&&Number.isInteger(arguments[0])&&arguments[1]instanceof C){var p=arguments[0],h=arguments[1];if(!arguments[2]){var f=this.size();if(f>0){if(p>0){if(this.get(p-1).equals2D(h))return null}if(p_&&(m=-1);for(var v=y;v!==_;v+=m)this.add(g[v],d);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new C(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,n),e}(Nt),Lt=function(){},bt={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};bt.ForwardComparator.get=function(){return wt},bt.BidirectionalComparator.get=function(){return Ot},bt.coordArrayType.get=function(){return new Array(0).fill(null)},Lt.prototype.interfaces_=function(){return[]},Lt.prototype.getClass=function(){return Lt},Lt.isRing=function(t){return!(t.length<4)&&!!t[0].equals2D(t[t.length-1])},Lt.ptNotInList=function(t,e){for(var n=0;n=t?e:[]},Lt.indexOf=function(t,e){for(var n=0;n0)&&(e=t[n]);return e},Lt.extract=function(t,e,n){e=R.clamp(e,0,t.length);var i=(n=R.clamp(n,-1,t.length))-e+1;n<0&&(i=0),e>=t.length&&(i=0),ni.length)return 1;if(0===n.length)return 0;var r=Lt.compare(n,i);return Lt.isEqualReversed(n,i)?0:r},Ot.prototype.OLDcompare=function(t,e){var n=t,i=e;if(n.lengthi.length)return 1;if(0===n.length)return 0;for(var r=Lt.increasingDirection(n),o=Lt.increasingDirection(i),s=r>0?0:n.length-1,a=o>0?0:n.length-1,u=0;u0))return e.value;e=e.right}}return null},p.prototype.put=function(t,e){if(null===this.root_)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:Mt,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var n,i,r=this.root_;do{if(n=r,(i=t.compareTo(r.key))<0)r=r.left;else{if(!(i>0)){var o=r.value;return r.value=e,o}r=r.right}}while(null!==r);var s={key:t,left:null,right:null,value:e,parent:n,color:Mt,getValue:function(){return this.value},getKey:function(){return this.key}};return i<0?n.left=s:n.right=s,this.fixAfterInsertion(s),this.size_++,null},p.prototype.fixAfterInsertion=function(t){for(t.color=1;null!=t&&t!==this.root_&&1===t.parent.color;)if(a(t)===l(a(a(t)))){var e=c(a(a(t)));1===s(e)?(u(a(t),Mt),u(e,Mt),u(a(a(t)),1),t=a(a(t))):(t===c(a(t))&&(t=a(t),this.rotateLeft(t)),u(a(t),Mt),u(a(a(t)),1),this.rotateRight(a(a(t))))}else{var n=l(a(a(t)));1===s(n)?(u(a(t),Mt),u(n,Mt),u(a(a(t)),1),t=a(a(t))):(t===l(a(t))&&(t=a(t),this.rotateRight(t)),u(a(t),Mt),u(a(a(t)),1),this.rotateLeft(a(a(t))))}this.root_.color=Mt},p.prototype.values=function(){var t=new Nt,e=this.getFirstEntry();if(null!==e)for(t.add(e.value);null!==(e=p.successor(e));)t.add(e.value);return t},p.prototype.entrySet=function(){var t=new Pt,e=this.getFirstEntry();if(null!==e)for(t.add(e);null!==(e=p.successor(e));)t.add(e);return t},p.prototype.rotateLeft=function(t){if(null!=t){var e=t.right;t.right=e.left,null!=e.left&&(e.left.parent=t),e.parent=t.parent,null===t.parent?this.root_=e:t.parent.left===t?t.parent.left=e:t.parent.right=e,e.left=t,t.parent=e}},p.prototype.rotateRight=function(t){if(null!=t){var e=t.left;t.left=e.right,null!=e.right&&(e.right.parent=t),e.parent=t.parent,null===t.parent?this.root_=e:t.parent.right===t?t.parent.right=e:t.parent.left=e,e.right=t,t.parent=e}},p.prototype.getFirstEntry=function(){var t=this.root_;if(null!=t)for(;null!=t.left;)t=t.left;return t},p.successor=function(t){if(null===t)return null;if(null!==t.right){for(var e=t.right;null!==e.left;)e=e.left;return e}for(var n=t.parent,i=t;null!==n&&i===n.right;)i=n,n=n.parent;return n},p.prototype.size=function(){return this.size_};var At=function(){};At.prototype.interfaces_=function(){return[]},At.prototype.getClass=function(){return At},h.prototype=new o,(f.prototype=new h).contains=function(t){for(var e=0,n=this.array_.length;e=0;){var s=r.substring(0,o);i.add(s),o=(r=r.substring(o+n)).indexOf(e)}r.length>0&&i.add(r);for(var a=new Array(i.size()).fill(null),u=0;u0)for(var o=r;o0&&i.append(" ");for(var o=0;o0&&i.append(","),i.append(jt.toString(t.getOrdinate(r,o)))}return i.append(")"),i.toString()}},Wt.ensureValidRing=function(t,e){var n=e.size();if(0===n)return e;if(n<=3)return Wt.createClosedRing(t,e,4);return e.getOrdinate(0,V.X)===e.getOrdinate(n-1,V.X)&&e.getOrdinate(0,V.Y)===e.getOrdinate(n-1,V.Y)?e:Wt.createClosedRing(t,e,n+1)},Wt.createClosedRing=function(t,e,n){var i=t.create(n,e.getDimension()),r=e.size();Wt.copy(e,0,i,0,r);for(var o=r;o0&&Wt.reverse(this._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?qt.FALSE:0},e.prototype.isClosed=function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},e.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},e.prototype.getDimension=function(){return 1},e.prototype.getLength=function(){return at.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var t=this._points.copy();Wt.reverse(t);return this.getFactory().createLineString(t)},e.prototype.compareToSameClass=function(){if(1===arguments.length){for(var t=arguments[0],e=0,n=0;e= 2)");this._points=t},e.prototype.isCoordinate=function(t){for(var e=0;e=1&&this.getCoordinateSequence().size()= 4)")},e.prototype.getGeometryType=function(){return"LinearRing"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.MINIMUM_VALID_SIZE.get=function(){return 4},n.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(e,n),e}(Kt),ne=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return ct.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,n)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),n=0;n0?e.createPoint(n[0]):e.createPoint():t},se.prototype.interfaces_=function(){return[ie.GeometryEditorOperation]},se.prototype.getClass=function(){return se};var ae=function(){};ae.prototype.edit=function(t,e){return t instanceof ee?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof Kt?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof Qt?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t},ae.prototype.interfaces_=function(){return[ie.GeometryEditorOperation]},ae.prototype.getClass=function(){return ae};var ue=function(){if(this._dimension=3,this._coordinates=null,1===arguments.length){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var t=arguments[0];this._coordinates=new Array(t).fill(null);for(var e=0;e0){var t=new D(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var e=1;e3&&(i=3),i<2?new ue(n):new ue(n,i)}},ce.prototype.interfaces_=function(){return[b,e]},ce.prototype.getClass=function(){return ce},ce.instance=function(){return ce.instanceObject},pe.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},pe.instanceObject.get=function(){return new ce},Object.defineProperties(ce,pe);var he=function(t){function e(){t.call(this),this.map_=new Map}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t){return this.map_.get(t)||null},e.prototype.put=function(t,e){return this.map_.set(t,e),e},e.prototype.values=function(){for(var t=new Nt,e=this.map_.values(),n=e.next();!n.done;)t.add(n.value),n=e.next();return t},e.prototype.entrySet=function(){var t=new Pt;return this.map_.entries().forEach(function(e){return t.add(e)}),t},e.prototype.size=function(){return this.map_.size()},e}(Tt),fe=function t(){if(this._modelType=null,this._scale=null,0===arguments.length)this._modelType=t.FLOATING;else if(1===arguments.length)if(arguments[0]instanceof de){var e=arguments[0];this._modelType=e,e===t.FIXED&&this.setScale(1)}else if("number"==typeof arguments[0]){var n=arguments[0];this._modelType=t.FIXED,this.setScale(n)}else if(arguments[0]instanceof t){var i=arguments[0];this._modelType=i._modelType,this._scale=i._scale}},ge={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};fe.prototype.equals=function(t){if(!(t instanceof fe))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale},fe.prototype.compareTo=function(t){var e=t,n=this.getMaximumSignificantDigits(),i=e.getMaximumSignificantDigits();return new M(n).compareTo(new M(i))},fe.prototype.getScale=function(){return this._scale},fe.prototype.isFloating=function(){return this._modelType===fe.FLOATING||this._modelType===fe.FLOATING_SINGLE},fe.prototype.getType=function(){return this._modelType},fe.prototype.toString=function(){var t="UNKNOWN";return this._modelType===fe.FLOATING?t="Floating":this._modelType===fe.FLOATING_SINGLE?t="Floating-Single":this._modelType===fe.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t},fe.prototype.makePrecise=function(){if("number"==typeof arguments[0]){var t=arguments[0];if(v.isNaN(t))return t;if(this._modelType===fe.FLOATING_SINGLE){return t}return this._modelType===fe.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof C){var e=arguments[0];if(this._modelType===fe.FLOATING)return null;e.x=this.makePrecise(e.x),e.y=this.makePrecise(e.y)}},fe.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===fe.FLOATING?t=16:this._modelType===fe.FLOATING_SINGLE?t=6:this._modelType===fe.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t},fe.prototype.setScale=function(t){this._scale=Math.abs(t)},fe.prototype.interfaces_=function(){return[e,E]},fe.prototype.getClass=function(){return fe},fe.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e},ge.serialVersionUID.get=function(){return 0x6bee6404e9a25c00},ge.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(fe,ge);var de=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},ye={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};de.prototype.readResolve=function(){return de.nameToTypeMap.get(this._name)},de.prototype.toString=function(){return this._name},de.prototype.interfaces_=function(){return[e]},de.prototype.getClass=function(){return de},ye.serialVersionUID.get=function(){return-552860263173159e4},ye.nameToTypeMap.get=function(){return new he},Object.defineProperties(de,ye),fe.Type=de,fe.FIXED=new de("FIXED"),fe.FLOATING=new de("FLOATING"),fe.FLOATING_SINGLE=new de("FLOATING SINGLE");var _e=function t(){this._precisionModel=new fe,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),0===arguments.length||(1===arguments.length?T(arguments[0],b)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof fe&&(this._precisionModel=arguments[0]):2===arguments.length?(this._precisionModel=arguments[0],this._SRID=arguments[1]):3===arguments.length&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},me={serialVersionUID:{configurable:!0}};_e.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new C(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new C(t.getMinX(),t.getMinY()),new C(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new C(t.getMinX(),t.getMinY()),new C(t.getMinX(),t.getMaxY()),new C(t.getMaxX(),t.getMaxY()),new C(t.getMaxX(),t.getMinY()),new C(t.getMinX(),t.getMinY())]),null)},_e.prototype.createLineString=function(t){return t?t instanceof Array?new Kt(this.getCoordinateSequenceFactory().create(t),this):T(t,V)?new Kt(t,this):void 0:new Kt(this.getCoordinateSequenceFactory().create([]),this)},_e.prototype.createMultiLineString=function(){if(0===arguments.length)return new Xt(null,this);if(1===arguments.length){var t=arguments[0];return new Xt(t,this)}},_e.prototype.buildGeometry=function(t){for(var e=null,n=!1,i=!1,r=t.iterator();r.hasNext();){var o=r.next(),s=o.getClass();null===e&&(e=s),s!==e&&(n=!0),o.isGeometryCollectionOrDerived()&&(i=!0)}if(null===e)return this.createGeometryCollection();if(n||i)return this.createGeometryCollection(_e.toGeometryArray(t));var a=t.iterator().next();if(t.size()>1){if(a instanceof $t)return this.createMultiPolygon(_e.toPolygonArray(t));if(a instanceof Kt)return this.createMultiLineString(_e.toLineStringArray(t));if(a instanceof Qt)return this.createMultiPoint(_e.toPointArray(t));et.shouldNeverReachHere("Unhandled class: "+a.getClass().getName())}return a},_e.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)},_e.prototype.createPoint=function(){if(0===arguments.length)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof C){var t=arguments[0];return this.createPoint(null!==t?this.getCoordinateSequenceFactory().create([t]):null)}if(T(arguments[0],V)){var e=arguments[0];return new Qt(e,this)}}},_e.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},_e.prototype.createPolygon=function(){if(0===arguments.length)return new $t(null,null,this);if(1===arguments.length){if(T(arguments[0],V)){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}if(arguments[0]instanceof Array){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}if(arguments[0]instanceof ee){var n=arguments[0];return this.createPolygon(n,null)}}else if(2===arguments.length){var i=arguments[0],r=arguments[1];return new $t(i,r,this)}},_e.prototype.getSRID=function(){return this._SRID},_e.prototype.createGeometryCollection=function(){if(0===arguments.length)return new zt(null,this);if(1===arguments.length){var t=arguments[0];return new zt(t,this)}},_e.prototype.createGeometry=function(t){return new ie(this).edit(t,{edit:function(){if(2===arguments.length){var t=arguments[0];return this._coordinateSequenceFactory.create(t)}}})},_e.prototype.getPrecisionModel=function(){return this._precisionModel},_e.prototype.createLinearRing=function(){if(0===arguments.length)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(T(arguments[0],V)){var e=arguments[0];return new ee(e,this)}}},_e.prototype.createMultiPolygon=function(){if(0===arguments.length)return new ne(null,this);if(1===arguments.length){var t=arguments[0];return new ne(t,this)}},_e.prototype.createMultiPoint=function(){if(0===arguments.length)return new te(null,this);if(1===arguments.length){if(arguments[0]instanceof Array){var t=arguments[0];return new te(t,this)}if(arguments[0]instanceof Array){var e=arguments[0];return this.createMultiPoint(null!==e?this.getCoordinateSequenceFactory().create(e):null)}if(T(arguments[0],V)){var n=arguments[0];if(null===n)return this.createMultiPoint(new Array(0).fill(null));for(var i=new Array(n.size()).fill(null),r=0;r=this.size())throw new Error;return this.array_[t]},y.prototype.push=function(t){return this.array_.push(t),t},y.prototype.pop=function(t){if(0===this.array_.length)throw new d;return this.array_.pop()},y.prototype.peek=function(){if(0===this.array_.length)throw new d;return this.array_[this.array_.length-1]},y.prototype.empty=function(){return 0===this.array_.length},y.prototype.isEmpty=function(){return this.empty()},y.prototype.search=function(t){return this.array_.indexOf(t)},y.prototype.size=function(){return this.array_.length},y.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e0&&this._minIndexthis._minCoord.y&&n.y>this._minCoord.y&&i===at.CLOCKWISE&&(r=!0),r&&(this._minIndex=this._minIndex-1)},be.prototype.getRightmostSideOfSegment=function(t,e){var n=t.getEdge().getCoordinates();if(e<0||e+1>=n.length)return-1;if(n[e].y===n[e+1].y)return-1;var i=Se.LEFT;return n[e].ythis._minCoord.x)&&(this._minDe=t,this._minIndex=n,this._minCoord=e[n])},be.prototype.findRightmostEdgeAtNode=function(){var t=this._minDe.getNode().getEdges();this._minDe=t.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},be.prototype.findEdge=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();n.isForward()&&this.checkForRightmostCoordinate(n)}et.isTrue(0!==this._minIndex||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),0===this._minIndex?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe;this.getRightmostSide(this._minDe,this._minIndex)===Se.LEFT&&(this._orientedDe=this._minDe.getSym())},be.prototype.interfaces_=function(){return[]},be.prototype.getClass=function(){return be};var we=function(t){function e(n,i){t.call(this,e.msgWithCoord(n,i)),this.pt=i?new C(i):null,this.name="TopologyException"}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getCoordinate=function(){return this.pt},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.msgWithCoord=function(t,e){return e?t:t+" [ "+e+" ]"},e}($),Oe=function(){this.array_=[]};Oe.prototype.addLast=function(t){this.array_.push(t)},Oe.prototype.removeFirst=function(){return this.array_.shift()},Oe.prototype.isEmpty=function(){return 0===this.array_.length};var Te=function(){this._finder=null,this._dirEdgeList=new Nt,this._nodes=new Nt,this._rightMostCoord=null,this._env=null,this._finder=new be};Te.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){t.next().setVisited(!1)}},Te.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},Te.prototype.computeNodeDepth=function(t){for(var e=null,n=t.getEdges().iterator();n.hasNext();){var i=n.next();if(i.isVisited()||i.getSym().isVisited()){e=i;break}}if(null===e)throw new we("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(e);for(var r=t.getEdges().iterator();r.hasNext();){var o=r.next();o.setVisited(!0),this.copySymDepths(o)}},Te.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(Se.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)},Te.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},Te.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(Se.RIGHT)>=1&&e.getDepth(Se.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}},Te.prototype.computeDepths=function(t){var e=new Pt,n=new Oe,i=t.getNode();for(n.addLast(i),e.add(i),t.setVisited(!0);!n.isEmpty();){var r=n.removeFirst();e.add(r),this.computeNodeDepth(r);for(var o=r.getEdges().iterator();o.hasNext();){var s=o.next().getSym();if(!s.isVisited()){var a=s.getNode();e.contains(a)||(n.addLast(a),e.add(a))}}}},Te.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.xe._rightMostCoord.x?1:0},Te.prototype.getEnvelope=function(){if(null===this._env){for(var t=new j,e=this._dirEdgeList.iterator();e.hasNext();)for(var n=e.next().getEdge().getCoordinates(),i=0;ithis.location.length){var e=new Array(3).fill(null);e[Se.ON]=this.location[Se.ON],e[Se.LEFT]=w.NONE,e[Se.RIGHT]=w.NONE,this.location=e}for(var n=0;n1&&t.append(w.toLocationSymbol(this.location[Se.LEFT])),t.append(w.toLocationSymbol(this.location[Se.ON])),this.location.length>1&&t.append(w.toLocationSymbol(this.location[Se.RIGHT])),t.toString()},Re.prototype.setLocations=function(t,e,n){this.location[Se.ON]=t,this.location[Se.LEFT]=e,this.location[Se.RIGHT]=n},Re.prototype.get=function(t){return t1},Re.prototype.isAnyNull=function(){for(var t=0;tthis._maxNodeDegree&&(this._maxNodeDegree=e),t=this.getNext(t)}while(t!==this._startDe);this._maxNodeDegree*=2},De.prototype.addPoints=function(t,e,n){var i=t.getCoordinates();if(e){var r=1;n&&(r=0);for(var o=r;o=0;a--)this._pts.add(i[a])}},De.prototype.isHole=function(){return this._isHole},De.prototype.setInResult=function(){var t=this._startDe;do{t.getEdge().setInResult(!0),t=t.getNext()}while(t!==this._startDe)},De.prototype.containsPoint=function(t){var e=this.getLinearRing();if(!e.getEnvelopeInternal().contains(t))return!1;if(!at.isPointInRing(t,e.getCoordinates()))return!1;for(var n=this._holes.iterator();n.hasNext();){if(n.next().containsPoint(t))return!1}return!0},De.prototype.addHole=function(t){this._holes.add(t)},De.prototype.isShell=function(){return null===this._shell},De.prototype.getLabel=function(){return this._label},De.prototype.getEdges=function(){return this._edges},De.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},De.prototype.getShell=function(){return this._shell},De.prototype.mergeLabel=function(){if(1===arguments.length){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(2===arguments.length){var e=arguments[0],n=arguments[1],i=e.getLocation(n,Se.RIGHT);if(i===w.NONE)return null;if(this._label.getLocation(n)===w.NONE)return this._label.setLocation(n,i),null}},De.prototype.setShell=function(t){this._shell=t,null!==t&&t.addHole(this)},De.prototype.toPolygon=function(t){for(var e=new Array(this._holes.size()).fill(null),n=0;n=2,"found partial label"),this.computeIM(t)},Fe.prototype.isInResult=function(){return this._isInResult},Fe.prototype.isVisited=function(){return this._isVisited},Fe.prototype.interfaces_=function(){return[]},Fe.prototype.getClass=function(){return Fe};var Ge=function(t){function e(){t.call(this),this._coord=null,this._edges=null;var e=arguments[0],n=arguments[1];this._coord=e,this._edges=n,this._label=new Pe(0,w.NONE)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isIncidentEdgeInResult=function(){for(var t=this.getEdges().getEdges().iterator();t.hasNext();){if(t.next().getEdge().isInResult())return!0}return!1},e.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},e.prototype.getCoordinate=function(){return this._coord},e.prototype.print=function(t){t.println("node "+this._coord+" lbl: "+this._label)},e.prototype.computeIM=function(t){},e.prototype.computeMergedLocation=function(t,e){var n=w.NONE;if(n=this._label.getLocation(e),!t.isNull(e)){var i=t.getLocation(e);n!==w.BOUNDARY&&(n=i)}return n},e.prototype.setLabel=function(){if(2!==arguments.length)return t.prototype.setLabel.apply(this,arguments);var e=arguments[0],n=arguments[1];null===this._label?this._label=new Pe(e,n):this._label.setLocation(e,n)},e.prototype.getEdges=function(){return this._edges},e.prototype.mergeLabel=function(){if(arguments[0]instanceof e){var t=arguments[0];this.mergeLabel(t._label)}else if(arguments[0]instanceof Pe)for(var n=arguments[0],i=0;i<2;i++){var r=this.computeMergedLocation(n,i);this._label.getLocation(i)===w.NONE&&this._label.setLocation(i,r)}},e.prototype.add=function(t){this._edges.insert(t),t.setNode(this)},e.prototype.setLabelBoundary=function(t){if(null===this._label)return null;var e=w.NONE;null!==this._label&&(e=this._label.getLocation(t));var n=null;switch(e){case w.BOUNDARY:n=w.INTERIOR;break;case w.INTERIOR:default:n=w.BOUNDARY}this._label.setLocation(t,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Fe),qe=function(){this.nodeMap=new p,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};qe.prototype.find=function(t){return this.nodeMap.get(t)},qe.prototype.addNode=function(){if(arguments[0]instanceof C){var t=arguments[0],e=this.nodeMap.get(t);return null===e&&(e=this.nodeFact.createNode(t),this.nodeMap.put(t,e)),e}if(arguments[0]instanceof Ge){var n=arguments[0],i=this.nodeMap.get(n.getCoordinate());return null===i?(this.nodeMap.put(n.getCoordinate(),n),n):(i.mergeLabel(n),i)}},qe.prototype.print=function(t){for(var e=this.iterator();e.hasNext();){e.next().print(t)}},qe.prototype.iterator=function(){return this.nodeMap.values().iterator()},qe.prototype.values=function(){return this.nodeMap.values()},qe.prototype.getBoundaryNodes=function(t){for(var e=new Nt,n=this.iterator();n.hasNext();){var i=n.next();i.getLabel().getLocation(t)===w.BOUNDARY&&e.add(i)}return e},qe.prototype.add=function(t){var e=t.getCoordinate();this.addNode(e).add(t)},qe.prototype.interfaces_=function(){return[]},qe.prototype.getClass=function(){return qe};var Be=function(){},Ve={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};Be.prototype.interfaces_=function(){return[]},Be.prototype.getClass=function(){return Be},Be.isNorthern=function(t){return t===Be.NE||t===Be.NW},Be.isOpposite=function(t,e){if(t===e)return!1;return 2===(t-e+4)%4},Be.commonHalfPlane=function(t,e){if(t===e)return t;if(2===(t-e+4)%4)return-1;var n=te?t:e)?3:n},Be.isInHalfPlane=function(t,e){return e===Be.SE?t===Be.SE||t===Be.SW:t===e||t===e+1},Be.quadrant=function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new m("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?Be.NE:Be.SE:e>=0?Be.NW:Be.SW}if(arguments[0]instanceof C&&arguments[1]instanceof C){var n=arguments[0],i=arguments[1];if(i.x===n.x&&i.y===n.y)throw new m("Cannot compute the quadrant for two identical points "+n);return i.x>=n.x?i.y>=n.y?Be.NE:Be.SE:i.y>=n.y?Be.NW:Be.SW}},Ve.NE.get=function(){return 0},Ve.NW.get=function(){return 1},Ve.SW.get=function(){return 2},Ve.SE.get=function(){return 3},Object.defineProperties(Be,Ve);var Ue=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,1===arguments.length){var t=arguments[0];this._edge=t}else if(3===arguments.length){var e=arguments[0],n=arguments[1],i=arguments[2];this._edge=e,this.init(n,i),this._label=null}else if(4===arguments.length){var r=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this._edge=r,this.init(o,s),this._label=a}};Ue.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant2){o.linkDirectedEdgesForMinimalEdgeRings();var s=o.buildMinimalRings(),a=this.findShell(s);null!==a?(this.placePolygonHoles(a,s),e.add(a)):n.addAll(s)}else i.add(o)}return i},ke.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();){if(e.next().containsPoint(t))return!0}return!1},ke.prototype.buildMaximalEdgeRings=function(t){for(var e=new Nt,n=t.iterator();n.hasNext();){var i=n.next();if(i.isInResult()&&i.getLabel().isArea()&&null===i.getEdgeRing()){var r=new Ae(i,this._geometryFactory);e.add(r),r.setInResult()}}return e},ke.prototype.placePolygonHoles=function(t,e){for(var n=e.iterator();n.hasNext();){var i=n.next();i.isHole()&&i.setShell(t)}},ke.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},ke.prototype.findEdgeRingContaining=function(t,e){for(var n=t.getLinearRing(),i=n.getEnvelopeInternal(),r=n.getCoordinateN(0),o=null,s=null,a=e.iterator();a.hasNext();){var u=a.next(),l=u.getLinearRing(),c=l.getEnvelopeInternal();null!==o&&(s=o.getLinearRing().getEnvelopeInternal());var p=!1;c.contains(i)&&at.isPointInRing(r,l.getCoordinates())&&(p=!0),p&&(null===o||s.contains(c))&&(o=u)}return o},ke.prototype.findShell=function(t){for(var e=0,n=null,i=t.iterator();i.hasNext();){var r=i.next();r.isHole()||(n=r,e++)}return et.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),n},ke.prototype.add=function(){if(1===arguments.length){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(2===arguments.length){var e=arguments[0],n=arguments[1];Ye.linkResultDirectedEdges(n);var i=this.buildMaximalEdgeRings(e),r=new Nt,o=this.buildMinimalEdgeRings(i,this._shellList,r);this.sortShellsAndHoles(o,this._shellList,r),this.placeFreeHoles(this._shellList,r)}},ke.prototype.interfaces_=function(){return[]},ke.prototype.getClass=function(){return ke};var je=function(){};je.prototype.getBounds=function(){},je.prototype.interfaces_=function(){return[]},je.prototype.getClass=function(){return je};var He=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};He.prototype.getItem=function(){return this._item},He.prototype.getBounds=function(){return this._bounds},He.prototype.interfaces_=function(){return[je,e]},He.prototype.getClass=function(){return He};var We=function(){this._size=null,this._items=null,this._size=0,this._items=new Nt,this._items.add(null)};We.prototype.poll=function(){if(this.isEmpty())return null;var t=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),t},We.prototype.size=function(){return this._size},We.prototype.reorder=function(t){for(var e=null,n=this._items.get(t);2*t<=this._size&&((e=2*t)!==this._size&&this._items.get(e+1).compareTo(this._items.get(e))<0&&e++,this._items.get(e).compareTo(n)<0);t=e)this._items.set(t,this._items.get(e));this._items.set(t,n)},We.prototype.clear=function(){this._size=0,this._items.clear()},We.prototype.isEmpty=function(){return 0===this._size},We.prototype.add=function(t){this._items.add(null),this._size+=1;var e=this._size;for(this._items.set(0,t);t.compareTo(this._items.get(Math.trunc(e/2)))<0;e/=2)this._items.set(e,this._items.get(Math.trunc(e/2)));this._items.set(e,t)},We.prototype.interfaces_=function(){return[]},We.prototype.getClass=function(){return We};var Ke=function(){};Ke.prototype.visitItem=function(t){},Ke.prototype.interfaces_=function(){return[]},Ke.prototype.getClass=function(){return Ke};var Je=function(){};Je.prototype.insert=function(t,e){},Je.prototype.remove=function(t,e){},Je.prototype.query=function(){},Je.prototype.interfaces_=function(){return[]},Je.prototype.getClass=function(){return Je};var Qe=function(){if(this._childBoundables=new Nt,this._bounds=null,this._level=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._level=t}},Ze={serialVersionUID:{configurable:!0}};Qe.prototype.getLevel=function(){return this._level},Qe.prototype.size=function(){return this._childBoundables.size()},Qe.prototype.getChildBoundables=function(){return this._childBoundables},Qe.prototype.addChildBoundable=function(t){et.isTrue(null===this._bounds),this._childBoundables.add(t)},Qe.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},Qe.prototype.getBounds=function(){return null===this._bounds&&(this._bounds=this.computeBounds()),this._bounds},Qe.prototype.interfaces_=function(){return[je,e]},Qe.prototype.getClass=function(){return Qe},Ze.serialVersionUID.get=function(){return 0x5a1e55ec41369800},Object.defineProperties(Qe,Ze);var $e=function(){};$e.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}},$e.min=function(t){return $e.sort(t),t.get(0)},$e.sort=function(t,e){var n=t.toArray();e?Gt.sort(n,e):Gt.sort(n);for(var i=t.iterator(),r=0,o=n.length;rtn.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,e),null):(this.expand(this._boundable2,this._boundable1,t,e),null);if(n)return this.expand(this._boundable1,this._boundable2,t,e),null;if(i)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new m("neither boundable is composite")},tn.prototype.isLeaves=function(){return!(tn.isComposite(this._boundable1)||tn.isComposite(this._boundable2))},tn.prototype.compareTo=function(t){var e=t;return this._distancee._distance?1:0},tn.prototype.expand=function(t,e,n,i){for(var r=t.getChildBoundables().iterator();r.hasNext();){var o=r.next(),s=new tn(o,e,this._itemDistance);s.getDistance()1,"Node capacity must be greater than 1"),this._nodeCapacity=n}},nn={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};en.prototype.getNodeCapacity=function(){return this._nodeCapacity},en.prototype.lastNode=function(t){return t.get(t.size()-1)},en.prototype.size=function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.size(this._root));if(1===arguments.length){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var n=e.next();n instanceof Qe?t+=this.size(n):n instanceof He&&(t+=1)}return t}},en.prototype.removeItem=function(t,e){for(var n=null,i=t.getChildBoundables().iterator();i.hasNext();){var r=i.next();r instanceof He&&r.getItem()===e&&(n=r)}return null!==n&&(t.getChildBoundables().remove(n),!0)},en.prototype.itemsTree=function(){if(0===arguments.length){this.build();var t=this.itemsTree(this._root);return null===t?new Nt:t}if(1===arguments.length){for(var e=arguments[0],n=new Nt,i=e.getChildBoundables().iterator();i.hasNext();){var r=i.next();if(r instanceof Qe){var o=this.itemsTree(r);null!==o&&n.add(o)}else r instanceof He?n.add(r.getItem()):et.shouldNeverReachHere()}return n.size()<=0?null:n}},en.prototype.insert=function(t,e){et.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new He(t,e))},en.prototype.boundablesAtLevel=function(){if(1===arguments.length){var t=arguments[0],e=new Nt;return this.boundablesAtLevel(t,this._root,e),e}if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];if(et.isTrue(n>-2),i.getLevel()===n)return r.add(i),null;for(var o=i.getChildBoundables().iterator();o.hasNext();){var s=o.next();s instanceof Qe?this.boundablesAtLevel(n,s,r):(et.isTrue(s instanceof He),-1===n&&r.add(s))}return null}},en.prototype.query=function(){if(1===arguments.length){var t=arguments[0];this.build();var e=new Nt;return this.isEmpty()?e:(this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.query(t,this._root,e),e)}if(2===arguments.length){var n=arguments[0],i=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.query(n,this._root,i)}else if(3===arguments.length)if(T(arguments[2],Ke)&&arguments[0]instanceof Object&&arguments[1]instanceof Qe)for(var r=arguments[0],o=arguments[1],s=arguments[2],a=o.getChildBoundables(),u=0;ut&&(t=i)}}return t+1}},en.prototype.createParentBoundables=function(t,e){et.isTrue(!t.isEmpty());var n=new Nt;n.add(this.createNode(e));var i=new Nt(t);$e.sort(i,this.getComparator());for(var r=i.iterator();r.hasNext();){var o=r.next();this.lastNode(n).getChildBoundables().size()===this.getNodeCapacity()&&n.add(this.createNode(e)),this.lastNode(n).addChildBoundable(o)}return n},en.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},en.prototype.interfaces_=function(){return[e]},en.prototype.getClass=function(){return en},en.compareDoubles=function(t,e){return t>e?1:t0);for(var n=new Nt,i=0;i0;){var p=c.poll(),h=p.getDistance();if(h>=u)break;p.isLeaves()?(u=h,l=p):p.expandToQueue(c,u)}return[l.getBoundable(0).getItem(),l.getBoundable(1).getItem()]}}else if(3===arguments.length){var f=arguments[0],g=arguments[1],d=arguments[2],y=new He(f,g),_=new tn(this.getRoot(),y,d);return this.nearestNeighbour(_)[0]}},n.prototype.interfaces_=function(){return[Je,e]},n.prototype.getClass=function(){return n},n.centreX=function(t){return n.avg(t.getMinX(),t.getMaxX())},n.avg=function(t,e){return(t+e)/2},n.centreY=function(t){return n.avg(t.getMinY(),t.getMaxY())},i.STRtreeNode.get=function(){return an},i.serialVersionUID.get=function(){return 0x39920f7d5f261e0},i.xComparator.get=function(){return{interfaces_:function(){return[N]},compare:function(e,i){return t.compareDoubles(n.centreX(e.getBounds()),n.centreX(i.getBounds()))}}},i.yComparator.get=function(){return{interfaces_:function(){return[N]},compare:function(e,i){return t.compareDoubles(n.centreY(e.getBounds()),n.centreY(i.getBounds()))}}},i.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(t,e){return t.intersects(e)}}},i.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(n,i),n}(en),an=function(t){function e(){var e=arguments[0];t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.computeBounds=function(){for(var t=null,e=this.getChildBoundables().iterator();e.hasNext();){var n=e.next();null===t?t=new j(n.getBounds()):t.expandToInclude(n.getBounds())}return t},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Qe),un=function(){};un.prototype.interfaces_=function(){return[]},un.prototype.getClass=function(){return un},un.relativeSign=function(t,e){return te?1:0},un.compare=function(t,e,n){if(e.equals2D(n))return 0;var i=un.relativeSign(e.x,n.x),r=un.relativeSign(e.y,n.y);switch(t){case 0:return un.compareValue(i,r);case 1:return un.compareValue(r,i);case 2:return un.compareValue(r,-i);case 3:return un.compareValue(-i,r);case 4:return un.compareValue(-i,-r);case 5:return un.compareValue(-r,-i);case 6:return un.compareValue(-r,i);case 7:return un.compareValue(i,-r)}return et.shouldNeverReachHere("invalid octant value"),0},un.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var ln=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];this._segString=t,this.coord=new C(e),this.segmentIndex=n,this._segmentOctant=i,this._isInterior=!e.equals2D(t.getCoordinate(n))};ln.prototype.getCoordinate=function(){return this.coord},ln.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)},ln.prototype.compareTo=function(t){var e=t;return this.segmentIndexe.segmentIndex?1:this.coord.equals2D(e.coord)?0:un.compare(this._segmentOctant,this.coord,e.coord)},ln.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&!this._isInterior||this.segmentIndex===t},ln.prototype.isInterior=function(){return this._isInterior},ln.prototype.interfaces_=function(){return[E]},ln.prototype.getClass=function(){return ln};var cn=function(){this._nodeMap=new p,this._edge=null;var t=arguments[0];this._edge=t};cn.prototype.getSplitCoordinates=function(){var t=new St;this.addEndpoints();for(var e=this.iterator(),n=e.next();e.hasNext();){var i=e.next();this.addEdgeCoordinates(n,i,t),n=i}return t.toCoordinateArray()},cn.prototype.addCollapsedNodes=function(){var t=new Nt;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(var e=t.iterator();e.hasNext();){var n=e.next().intValue();this.add(this._edge.getCoordinate(n),n)}},cn.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){e.next().print(t)}},cn.prototype.findCollapsesFromExistingVertices=function(t){for(var e=0;e=0?e>=0?n>=i?0:1:n>=i?7:6:e>=0?n>=i?3:2:n>=i?4:5}if(arguments[0]instanceof C&&arguments[1]instanceof C){var r=arguments[0],o=arguments[1],s=o.x-r.x,a=o.y-r.y;if(0===s&&0===a)throw new m("Cannot compute the octant for two identical points "+r);return pn.octant(s,a)}};var hn=function(){};hn.prototype.getCoordinates=function(){},hn.prototype.size=function(){},hn.prototype.getCoordinate=function(t){},hn.prototype.isClosed=function(){},hn.prototype.setData=function(t){},hn.prototype.getData=function(){},hn.prototype.interfaces_=function(){return[]},hn.prototype.getClass=function(){return hn};var fn=function(){};fn.prototype.addIntersection=function(t,e){},fn.prototype.interfaces_=function(){return[hn]},fn.prototype.getClass=function(){return fn};var gn=function(){this._nodeList=new cn(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};gn.prototype.getCoordinates=function(){return this._pts},gn.prototype.size=function(){return this._pts.length},gn.prototype.getCoordinate=function(t){return this._pts[t]},gn.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},gn.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))},gn.prototype.setData=function(t){this._data=t},gn.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:pn.octant(t,e)},gn.prototype.getData=function(){return this._data},gn.prototype.addIntersection=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(4===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[3],o=new C(n.getIntersection(r));this.addIntersection(o,i)}},gn.prototype.toString=function(){return Z.toLineString(new ue(this._pts))},gn.prototype.getNodeList=function(){return this._nodeList},gn.prototype.addIntersectionNode=function(t,e){var n=e,i=n+1;if(i=0&&n>=0?Math.max(e,n):e<=0&&n<=0?Math.max(e,n):0}if(arguments[0]instanceof C){var i=arguments[0];return at.orientationIndex(this.p0,this.p1,i)}},dn.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])},dn.prototype.isVertical=function(){return this.p0.x===this.p1.x},dn.prototype.equals=function(t){if(!(t instanceof dn))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)},dn.prototype.intersection=function(t){var e=new rt;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null},dn.prototype.project=function(){if(arguments[0]instanceof C){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new C(t);var e=this.projectionFactor(t),n=new C;return n.x=this.p0.x+e*(this.p1.x-this.p0.x),n.y=this.p0.y+e*(this.p1.y-this.p0.y),n}if(arguments[0]instanceof dn){var i=arguments[0],r=this.projectionFactor(i.p0),o=this.projectionFactor(i.p1);if(r>=1&&o>=1)return null;if(r<=0&&o<=0)return null;var s=this.project(i.p0);r<0&&(s=this.p0),r>1&&(s=this.p1);var a=this.project(i.p1);return o<0&&(a=this.p0),o>1&&(a=this.p1),new dn(s,a)}},dn.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},dn.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},dn.prototype.getCoordinate=function(t){return 0===t?this.p0:this.p1},dn.prototype.distancePerpendicular=function(t){return at.distancePointLinePerpendicular(t,this.p0,this.p1)},dn.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},dn.prototype.midPoint=function(){return dn.midPoint(this.p0,this.p1)},dn.prototype.projectionFactor=function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var e=this.p1.x-this.p0.x,n=this.p1.y-this.p0.y,i=e*e+n*n;if(i<=0)return v.NaN;return((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/i},dn.prototype.closestPoints=function(t){var e=this.intersection(t);if(null!==e)return[e,e];var n=new Array(2).fill(null),i=v.MAX_VALUE,r=null,o=this.closestPoint(t.p0);i=o.distance(t.p0),n[0]=o,n[1]=t.p0;var s=this.closestPoint(t.p1);(r=s.distance(t.p1))0&&e<1)return this.project(t);return this.p0.distance(t)1||v.isNaN(e))&&(e=1),e},dn.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},dn.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},dn.prototype.distance=function(){if(arguments[0]instanceof dn){var t=arguments[0];return at.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof C){var e=arguments[0];return at.distancePointLine(e,this.p0,this.p1)}},dn.prototype.pointAlong=function(t){var e=new C;return e.x=this.p0.x+t*(this.p1.x-this.p0.x),e.y=this.p0.y+t*(this.p1.y-this.p0.y),e},dn.prototype.hashCode=function(){var t=v.doubleToLongBits(this.p0.x);t^=31*v.doubleToLongBits(this.p0.y);var e=Math.trunc(t)^Math.trunc(t>>32),n=v.doubleToLongBits(this.p1.x);n^=31*v.doubleToLongBits(this.p1.y);return e^(Math.trunc(n)^Math.trunc(n>>32))},dn.prototype.interfaces_=function(){return[E,e]},dn.prototype.getClass=function(){return dn},dn.midPoint=function(t,e){return new C((t.x+e.x)/2,(t.y+e.y)/2)},yn.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(dn,yn);var _n=function(){this.tempEnv1=new j,this.tempEnv2=new j,this._overlapSeg1=new dn,this._overlapSeg2=new dn};_n.prototype.overlap=function(){if(2===arguments.length);else if(4===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];t.getLineSegment(e,this._overlapSeg1),n.getLineSegment(i,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}},_n.prototype.interfaces_=function(){return[]},_n.prototype.getClass=function(){return _n};var mn=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];this._pts=t,this._start=e,this._end=n,this._context=i};mn.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]},mn.prototype.computeSelect=function(t,e,n,i){var r=this._pts[e],o=this._pts[n];if(i.tempEnv1.init(r,o),n-e==1)return i.select(this,e),null;if(!t.intersects(i.tempEnv1))return null;var s=Math.trunc((e+n)/2);e=t.length-1)return t.length-1;for(var i=Be.quadrant(t[n],t[n+1]),r=e+1;rn.getId()&&(n.computeOverlaps(r,t),this._nOverlaps++),this._segInt.isDone())return null}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.SegmentOverlapAction.get=function(){return Nn},Object.defineProperties(e,n),e}(En),Nn=function(t){function e(){t.call(this),this._si=null;var e=arguments[0];this._si=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.overlap=function(){if(4!==arguments.length)return t.prototype.overlap.apply(this,arguments);var e=arguments[0],n=arguments[1],i=arguments[2],r=arguments[3],o=e.getContext(),s=i.getContext();this._si.processIntersections(o,n,s,r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(_n),Cn=function t(){if(this._quadrantSegments=t.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=t.CAP_ROUND,this._joinStyle=t.JOIN_ROUND,this._mitreLimit=t.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=t.DEFAULT_SIMPLIFY_FACTOR,0===arguments.length);else if(1===arguments.length){var e=arguments[0];this.setQuadrantSegments(e)}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.setQuadrantSegments(n),this.setEndCapStyle(i)}else if(4===arguments.length){var r=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this.setQuadrantSegments(r),this.setEndCapStyle(o),this.setJoinStyle(s),this.setMitreLimit(a)}},Sn={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};Cn.prototype.getEndCapStyle=function(){return this._endCapStyle},Cn.prototype.isSingleSided=function(){return this._isSingleSided},Cn.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,0===this._quadrantSegments&&(this._joinStyle=Cn.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Cn.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==Cn.JOIN_ROUND&&(this._quadrantSegments=Cn.DEFAULT_QUADRANT_SEGMENTS)},Cn.prototype.getJoinStyle=function(){return this._joinStyle},Cn.prototype.setJoinStyle=function(t){this._joinStyle=t},Cn.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t},Cn.prototype.getSimplifyFactor=function(){return this._simplifyFactor},Cn.prototype.getQuadrantSegments=function(){return this._quadrantSegments},Cn.prototype.setEndCapStyle=function(t){this._endCapStyle=t},Cn.prototype.getMitreLimit=function(){return this._mitreLimit},Cn.prototype.setMitreLimit=function(t){this._mitreLimit=t},Cn.prototype.setSingleSided=function(t){this._isSingleSided=t},Cn.prototype.interfaces_=function(){return[]},Cn.prototype.getClass=function(){return Cn},Cn.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)},Sn.CAP_ROUND.get=function(){return 1},Sn.CAP_FLAT.get=function(){return 2},Sn.CAP_SQUARE.get=function(){return 3},Sn.JOIN_ROUND.get=function(){return 1},Sn.JOIN_MITRE.get=function(){return 2},Sn.JOIN_BEVEL.get=function(){return 3},Sn.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},Sn.DEFAULT_MITRE_LIMIT.get=function(){return 5},Sn.DEFAULT_SIMPLIFY_FACTOR.get=function(){return.01},Object.defineProperties(Cn,Sn);var Ln=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=at.COUNTERCLOCKWISE,this._inputLine=t||null},bn={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};Ln.prototype.isDeletable=function(t,e,n,i){var r=this._inputLine[t],o=this._inputLine[e],s=this._inputLine[n];return!!this.isConcave(r,o,s)&&(!!this.isShallow(r,o,s,i)&&this.isShallowSampled(r,o,t,n,i))},Ln.prototype.deleteShallowConcavities=function(){for(var t=1,e=this.findNextNonDeletedIndex(t),n=this.findNextNonDeletedIndex(e),i=!1;n=0;i--)this.addPt(t[i])},wn.prototype.isRedundant=function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1);return t.distance(e)Math.PI;)t-=Tn.PI_TIMES_2;for(;t<=-Math.PI;)t+=Tn.PI_TIMES_2;return t},Tn.angle=function(){if(1===arguments.length){var t=arguments[0];return Math.atan2(t.y,t.x)}if(2===arguments.length){var e=arguments[0],n=arguments[1],i=n.x-e.x,r=n.y-e.y;return Math.atan2(r,i)}},Tn.isAcute=function(t,e,n){var i=t.x-e.x,r=t.y-e.y;return i*(n.x-e.x)+r*(n.y-e.y)>0},Tn.isObtuse=function(t,e,n){var i=t.x-e.x,r=t.y-e.y;return i*(n.x-e.x)+r*(n.y-e.y)<0},Tn.interiorAngle=function(t,e,n){var i=Tn.angle(e,t),r=Tn.angle(e,n);return Math.abs(r-i)},Tn.normalizePositive=function(t){if(t<0){for(;t<0;)t+=Tn.PI_TIMES_2;t>=Tn.PI_TIMES_2&&(t=0)}else{for(;t>=Tn.PI_TIMES_2;)t-=Tn.PI_TIMES_2;t<0&&(t=0)}return t},Tn.angleBetween=function(t,e,n){var i=Tn.angle(e,t),r=Tn.angle(e,n);return Tn.diff(i,r)},Tn.diff=function(t,e){var n=null;return(n=tMath.PI&&(n=2*Math.PI-n),n},Tn.toRadians=function(t){return t*Math.PI/180},Tn.getTurn=function(t,e){var n=Math.sin(e-t);return n>0?Tn.COUNTERCLOCKWISE:n<0?Tn.CLOCKWISE:Tn.NONE},Tn.angleBetweenOriented=function(t,e,n){var i=Tn.angle(e,t),r=Tn.angle(e,n)-i;return r<=-Math.PI?r+Tn.PI_TIMES_2:r>Math.PI?r-Tn.PI_TIMES_2:r},Rn.PI_TIMES_2.get=function(){return 2*Math.PI},Rn.PI_OVER_2.get=function(){return Math.PI/2},Rn.PI_OVER_4.get=function(){return Math.PI/4},Rn.COUNTERCLOCKWISE.get=function(){return at.COUNTERCLOCKWISE},Rn.CLOCKWISE.get=function(){return at.CLOCKWISE},Rn.NONE.get=function(){return at.COLLINEAR},Object.defineProperties(Tn,Rn);var Pn=function t(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new dn,this._seg1=new dn,this._offset0=new dn,this._offset1=new dn,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],n=arguments[1],i=arguments[2];this._precisionModel=e,this._bufParams=n,this._li=new rt,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===Cn.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(i)},Dn={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};Pn.prototype.addNextSegment=function(t,e){if(this._s0=this._s1,this._s1=this._s2,this._s2=t,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var n=at.computeOrientation(this._s0,this._s1,this._s2),i=n===at.CLOCKWISE&&this._side===Se.LEFT||n===at.COUNTERCLOCKWISE&&this._side===Se.RIGHT;0===n?this.addCollinear(e):i?this.addOutsideTurn(n,e):this.addInsideTurn(n,e)},Pn.prototype.addLineEndCap=function(t,e){var n=new dn(t,e),i=new dn;this.computeOffsetSegment(n,Se.LEFT,this._distance,i);var r=new dn;this.computeOffsetSegment(n,Se.RIGHT,this._distance,r);var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o);switch(this._bufParams.getEndCapStyle()){case Cn.CAP_ROUND:this._segList.addPt(i.p1),this.addFilletArc(e,a+Math.PI/2,a-Math.PI/2,at.CLOCKWISE,this._distance),this._segList.addPt(r.p1);break;case Cn.CAP_FLAT:this._segList.addPt(i.p1),this._segList.addPt(r.p1);break;case Cn.CAP_SQUARE:var u=new C;u.x=Math.abs(this._distance)*Math.cos(a),u.y=Math.abs(this._distance)*Math.sin(a);var l=new C(i.p1.x+u.x,i.p1.y+u.y),c=new C(r.p1.x+u.x,r.p1.y+u.y);this._segList.addPt(l),this._segList.addPt(c)}},Pn.prototype.getCoordinates=function(){return this._segList.getCoordinates()},Pn.prototype.addMitreJoin=function(t,e,n,i){var r=!0,o=null;try{o=k.intersection(e.p0,e.p1,n.p0,n.p1);(i<=0?1:o.distance(t)/Math.abs(i))>this._bufParams.getMitreLimit()&&(r=!1)}catch(t){if(!(t instanceof X))throw t;o=new C(0,0),r=!1}r?this._segList.addPt(o):this.addLimitedMitreJoin(e,n,i,this._bufParams.getMitreLimit())},Pn.prototype.addFilletCorner=function(t,e,n,i,r){var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o),u=n.x-t.x,l=n.y-t.y,c=Math.atan2(l,u);i===at.CLOCKWISE?a<=c&&(a+=2*Math.PI):a>=c&&(a-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,a,c,i,r),this._segList.addPt(n)},Pn.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)0){var n=new C((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(n);var i=new C((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(i)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},Pn.prototype.createCircle=function(t){var e=new C(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},Pn.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)},Pn.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new wn,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*Pn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},Pn.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2);this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===Cn.JOIN_BEVEL||this._bufParams.getJoinStyle()===Cn.JOIN_MITRE?(t&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,at.CLOCKWISE,this._distance))},Pn.prototype.closeRing=function(){this._segList.closeRing()},Pn.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},Pn.prototype.interfaces_=function(){return[]},Pn.prototype.getClass=function(){return Pn},Dn.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return.001},Dn.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return.001},Dn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},Dn.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(Pn,Dn);var Mn=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};Mn.prototype.getOffsetCurve=function(t,e){if(this._distance=e,0===e)return null;var n=e<0,i=Math.abs(e),r=this.getSegGen(i);t.length<=1?this.computePointCurve(t[0],r):this.computeOffsetCurve(t,n,r);var o=r.getCoordinates();return n&&Lt.reverse(o),o},Mn.prototype.computeSingleSidedBufferCurve=function(t,e,n){var i=this.simplifyTolerance(this._distance);if(e){n.addSegments(t,!0);var r=Ln.simplify(t,-i),o=r.length-1;n.initSideSegments(r[o],r[o-1],Se.LEFT),n.addFirstSegment();for(var s=o-2;s>=0;s--)n.addNextSegment(r[s],!0)}else{n.addSegments(t,!1);var a=Ln.simplify(t,i),u=a.length-1;n.initSideSegments(a[0],a[1],Se.LEFT),n.addFirstSegment();for(var l=2;l<=u;l++)n.addNextSegment(a[l],!0)}n.addLastSegment(),n.closeRing()},Mn.prototype.computeRingBufferCurve=function(t,e,n){var i=this.simplifyTolerance(this._distance);e===Se.RIGHT&&(i=-i);var r=Ln.simplify(t,i),o=r.length-1;n.initSideSegments(r[o-1],r[0],e);for(var s=1;s<=o;s++){var a=1!==s;n.addNextSegment(r[s],a)}n.closeRing()},Mn.prototype.computeLineBufferCurve=function(t,e){var n=this.simplifyTolerance(this._distance),i=Ln.simplify(t,n),r=i.length-1;e.initSideSegments(i[0],i[1],Se.LEFT);for(var o=2;o<=r;o++)e.addNextSegment(i[o],!0);e.addLastSegment(),e.addLineEndCap(i[r-1],i[r]);var s=Ln.simplify(t,-n),a=s.length-1;e.initSideSegments(s[a],s[a-1],Se.LEFT);for(var u=a-2;u>=0;u--)e.addNextSegment(s[u],!0);e.addLastSegment(),e.addLineEndCap(s[1],s[0]),e.closeRing()},Mn.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case Cn.CAP_ROUND:e.createCircle(t);break;case Cn.CAP_SQUARE:e.createSquare(t)}},Mn.prototype.getLineCurve=function(t,e){if(this._distance=e,e<0&&!this._bufParams.isSingleSided())return null;if(0===e)return null;var n=Math.abs(e),i=this.getSegGen(n);if(t.length<=1)this.computePointCurve(t[0],i);else if(this._bufParams.isSingleSided()){var r=e<0;this.computeSingleSidedBufferCurve(t,r,i)}else this.computeLineBufferCurve(t,i);return i.getCoordinates()},Mn.prototype.getBufferParameters=function(){return this._bufParams},Mn.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()},Mn.prototype.getRingCurve=function(t,e,n){if(this._distance=n,t.length<=2)return this.getLineCurve(t,n);if(0===n)return Mn.copyCoordinates(t);var i=this.getSegGen(n);return this.computeRingBufferCurve(t,e,i),i.getCoordinates()},Mn.prototype.computeOffsetCurve=function(t,e,n){var i=this.simplifyTolerance(this._distance);if(e){var r=Ln.simplify(t,-i),o=r.length-1;n.initSideSegments(r[o],r[o-1],Se.LEFT),n.addFirstSegment();for(var s=o-2;s>=0;s--)n.addNextSegment(r[s],!0)}else{var a=Ln.simplify(t,i),u=a.length-1;n.initSideSegments(a[0],a[1],Se.LEFT),n.addFirstSegment();for(var l=2;l<=u;l++)n.addNextSegment(a[l],!0)}n.addLastSegment()},Mn.prototype.getSegGen=function(t){return new Pn(this._precisionModel,this._bufParams,t)},Mn.prototype.interfaces_=function(){return[]},Mn.prototype.getClass=function(){return Mn},Mn.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),n=0;nr.getMaxY()||this.findStabbedSegments(t,i.getDirectedEdges(),e)}return e}if(3===arguments.length)if(T(arguments[2],xt)&&arguments[0]instanceof C&&arguments[1]instanceof ze)for(var o=arguments[0],s=arguments[1],a=arguments[2],u=s.getEdge().getCoordinates(),l=0;lthis._seg.p1.y&&this._seg.reverse();if(!(Math.max(this._seg.p0.x,this._seg.p1.x)this._seg.p1.y||at.computeOrientation(this._seg.p0,this._seg.p1,o)===at.RIGHT)){var c=s.getDepth(Se.LEFT);this._seg.p0.equals(u[l])||(c=s.getDepth(Se.RIGHT));var p=new Gn(this._seg,c);a.add(p)}}else if(T(arguments[2],xt)&&arguments[0]instanceof C&&T(arguments[1],xt))for(var h=arguments[0],f=arguments[1],g=arguments[2],d=f.iterator();d.hasNext();){var y=d.next();y.isForward()&&this.findStabbedSegments(h,y,g)}},An.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);if(0===e.size())return 0;return $e.min(e)._leftDepth},An.prototype.interfaces_=function(){return[]},An.prototype.getClass=function(){return An},Fn.DepthSegment.get=function(){return Gn},Object.defineProperties(An,Fn);var Gn=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new dn(t),this._leftDepth=e};Gn.prototype.compareTo=function(t){var e=t;if(this._upwardSeg.minX()>=e._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=e._upwardSeg.minX())return-1;var n=this._upwardSeg.orientationIndex(e._upwardSeg);return 0!==n?n:0!=(n=-1*e._upwardSeg.orientationIndex(this._upwardSeg))?n:this._upwardSeg.compareTo(e._upwardSeg)},Gn.prototype.compareX=function(t,e){var n=t.p0.compareTo(e.p0);return 0!==n?n:t.p1.compareTo(e.p1)},Gn.prototype.toString=function(){return this._upwardSeg.toString()},Gn.prototype.interfaces_=function(){return[E]},Gn.prototype.getClass=function(){return Gn};var qn=function(t,e,n){this.p0=t||null,this.p1=e||null,this.p2=n||null};qn.prototype.area=function(){return qn.area(this.p0,this.p1,this.p2)},qn.prototype.signedArea=function(){return qn.signedArea(this.p0,this.p1,this.p2)},qn.prototype.interpolateZ=function(t){if(null===t)throw new m("Supplied point is null.");return qn.interpolateZ(t,this.p0,this.p1,this.p2)},qn.prototype.longestSideLength=function(){return qn.longestSideLength(this.p0,this.p1,this.p2)},qn.prototype.isAcute=function(){return qn.isAcute(this.p0,this.p1,this.p2)},qn.prototype.circumcentre=function(){return qn.circumcentre(this.p0,this.p1,this.p2)},qn.prototype.area3D=function(){return qn.area3D(this.p0,this.p1,this.p2)},qn.prototype.centroid=function(){return qn.centroid(this.p0,this.p1,this.p2)},qn.prototype.inCentre=function(){return qn.inCentre(this.p0,this.p1,this.p2)},qn.prototype.interfaces_=function(){return[]},qn.prototype.getClass=function(){return qn},qn.area=function(t,e,n){return Math.abs(((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2)},qn.signedArea=function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2},qn.det=function(t,e,n,i){return t*i-e*n},qn.interpolateZ=function(t,e,n,i){var r=e.x,o=e.y,s=n.x-r,a=i.x-r,u=n.y-o,l=i.y-o,c=s*l-a*u,p=t.x-r,h=t.y-o,f=(l*p-a*h)/c,g=(-u*p+s*h)/c;return e.z+f*(n.z-e.z)+g*(i.z-e.z)},qn.longestSideLength=function(t,e,n){var i=t.distance(e),r=e.distance(n),o=n.distance(t),s=i;return r>s&&(s=r),o>s&&(s=o),s},qn.isAcute=function(t,e,n){return!!Tn.isAcute(t,e,n)&&(!!Tn.isAcute(e,n,t)&&!!Tn.isAcute(n,t,e))},qn.circumcentre=function(t,e,n){var i=n.x,r=n.y,o=t.x-i,s=t.y-r,a=e.x-i,u=e.y-r,l=2*qn.det(o,s,a,u),c=qn.det(s,o*o+s*s,u,a*a+u*u),p=qn.det(o,o*o+s*s,a,a*a+u*u);return new C(i-c/l,r+p/l)},qn.perpendicularBisector=function(t,e){var n=e.x-t.x,i=e.y-t.y,r=new k(t.x+n/2,t.y+i/2,1),o=new k(t.x-i+n/2,t.y+n+i/2,1);return new k(r,o)},qn.angleBisector=function(t,e,n){var i=e.distance(t),r=i/(i+e.distance(n)),o=n.x-t.x,s=n.y-t.y;return new C(t.x+r*o,t.y+r*s)},qn.area3D=function(t,e,n){var i=e.x-t.x,r=e.y-t.y,o=e.z-t.z,s=n.x-t.x,a=n.y-t.y,u=n.z-t.z,l=r*u-o*a,c=o*s-i*u,p=i*a-r*s,h=l*l+c*c+p*p,f=Math.sqrt(h)/2;return f},qn.centroid=function(t,e,n){var i=(t.x+e.x+n.x)/3,r=(t.y+e.y+n.y)/3;return new C(i,r)},qn.inCentre=function(t,e,n){var i=e.distance(n),r=t.distance(n),o=t.distance(e),s=i+r+o,a=(i*t.x+r*e.x+o*n.x)/s,u=(i*t.y+r*e.y+o*n.y)/s;return new C(a,u)};var Bn=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new Nt;var t=arguments[0],e=arguments[1],n=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=n};Bn.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,w.EXTERIOR,w.INTERIOR)},Bn.prototype.addPolygon=function(t){var e=this._distance,n=Se.LEFT;this._distance<0&&(e=-this._distance,n=Se.RIGHT);var i=t.getExteriorRing(),r=Lt.removeRepeatedPoints(i.getCoordinates());if(this._distance<0&&this.isErodedCompletely(i,this._distance))return null;if(this._distance<=0&&r.length<3)return null;this.addPolygonRing(r,e,n,w.EXTERIOR,w.INTERIOR);for(var o=0;o0&&this.isErodedCompletely(s,-this._distance)||this.addPolygonRing(a,e,Se.opposite(n),w.INTERIOR,w.EXTERIOR)}},Bn.prototype.isTriangleErodedCompletely=function(t,e){var n=new qn(t[0],t[1],t[2]),i=n.inCentre();return at.distancePointLine(i,n.p0,n.p1)=ee.MINIMUM_VALID_SIZE&&at.isCCW(t)&&(o=r,s=i,n=Se.opposite(n));var a=this._curveBuilder.getRingCurve(t,n,e);this.addCurve(a,o,s)},Bn.prototype.add=function(t){if(t.isEmpty())return null;t instanceof $t?this.addPolygon(t):t instanceof Kt?this.addLineString(t):t instanceof Qt?this.addPoint(t):t instanceof te?this.addCollection(t):t instanceof Xt?this.addCollection(t):t instanceof ne?this.addCollection(t):t instanceof zt&&this.addCollection(t)},Bn.prototype.isErodedCompletely=function(t,e){var n=t.getCoordinates();if(n.length<4)return e<0;if(4===n.length)return this.isTriangleErodedCompletely(n,e);var i=t.getEnvelopeInternal(),r=Math.min(i.getHeight(),i.getWidth());return e<0&&2*Math.abs(e)>r},Bn.prototype.addCollection=function(t){for(var e=0;e=this._max)throw new i;var t=this._parent.getGeometryN(this._index++);return t instanceof zt?(this._subcollectionIterator=new Un(t),this._subcollectionIterator.next()):t},Un.prototype.remove=function(){throw new Error(this.getClass().getName())},Un.prototype.hasNext=function(){if(this._atStart)return!0;if(null!==this._subcollectionIterator){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)},Un.prototype.interfaces_=function(){return[Et]},Un.prototype.getClass=function(){return Un},Un.isAtomic=function(t){return!(t instanceof zt)};var zn=function(){this._geom=null;var t=arguments[0];this._geom=t};zn.prototype.locate=function(t){return zn.locate(t,this._geom)},zn.prototype.interfaces_=function(){return[Vn]},zn.prototype.getClass=function(){return zn},zn.isPointInRing=function(t,e){return!!e.getEnvelopeInternal().intersects(t)&&at.isPointInRing(t,e.getCoordinates())},zn.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var n=e.getExteriorRing();if(!zn.isPointInRing(t,n))return!1;for(var i=0;i=0;n--){var i=this._edgeList.get(n),r=i.getSym();null===e&&(e=r),null!==t&&r.setNext(t),t=i}e.setNext(t)},e.prototype.computeDepths=function(){if(1===arguments.length){var t=arguments[0],e=this.findIndex(t),n=t.getDepth(Se.LEFT),i=t.getDepth(Se.RIGHT),r=this.computeDepths(e+1,this._edgeList.size(),n);if(this.computeDepths(0,e,r)!==i)throw new we("depth mismatch at "+t.getCoordinate())}else if(3===arguments.length){for(var o=arguments[0],s=arguments[1],a=arguments[2],u=o;u=0;r--){var o=this._resultAreaEdgeList.get(r),s=o.getSym();switch(null===e&&o.getEdgeRing()===t&&(e=o),i){case this._SCANNING_FOR_INCOMING:if(s.getEdgeRing()!==t)continue;n=s,i=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(o.getEdgeRing()!==t)continue;n.setNextMin(o),i=this._SCANNING_FOR_INCOMING}}i===this._LINKING_TO_OUTGOING&&(et.isTrue(null!==e,"found null for first outgoing dirEdge"),et.isTrue(e.getEdgeRing()===t,"unable to link last incoming dirEdge"),n.setNextMin(e))},e.prototype.getOutgoingDegree=function(){if(0===arguments.length){for(var t=0,e=this.iterator();e.hasNext();){e.next().isInResult()&&t++}return t}if(1===arguments.length){for(var n=arguments[0],i=0,r=this.iterator();r.hasNext();){r.next().getEdgeRing()===n&&i++}return i}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var t=w.NONE,e=this.iterator();e.hasNext();){var n=e.next(),i=n.getSym();if(!n.isLineEdge()){if(n.isInResult()){t=w.INTERIOR;break}if(i.isInResult()){t=w.EXTERIOR;break}}}if(t===w.NONE)return null;for(var r=t,o=this.iterator();o.hasNext();){var s=o.next(),a=s.getSym();s.isLineEdge()?s.getEdge().setCovered(r===w.INTERIOR):(s.isInResult()&&(r=w.EXTERIOR),a.isInResult()&&(r=w.INTERIOR))}},e.prototype.computeLabelling=function(e){t.prototype.computeLabelling.call(this,e),this._label=new Pe(w.NONE);for(var n=this.iterator();n.hasNext();)for(var i=n.next().getEdge().getLabel(),r=0;r<2;r++){var o=i.getLocation(r);o!==w.INTERIOR&&o!==w.BOUNDARY||this._label.setLocation(r,w.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Xn),kn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createNode=function(t){return new Ge(t,new Yn)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Xe),jn=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};jn.prototype.compareTo=function(t){var e=t;return jn.compareOriented(this._pts,this._orientation,e._pts,e._orientation)},jn.prototype.interfaces_=function(){return[E]},jn.prototype.getClass=function(){return jn},jn.orientation=function(t){return 1===Lt.increasingDirection(t)},jn.compareOriented=function(t,e,n,i){for(var r=e?1:-1,o=i?1:-1,s=e?t.length:-1,a=i?n.length:-1,u=e?0:t.length-1,l=i?0:n.length-1;;){var c=t[u].compareTo(n[l]);if(0!==c)return c;var p=(u+=r)===s,h=(l+=o)===a;if(p&&!h)return-1;if(!p&&h)return 1;if(p&&h)return 0}};var Hn=function(){this._edges=new Nt,this._ocaMap=new p};Hn.prototype.print=function(t){t.print("MULTILINESTRING ( ");for(var e=0;e0&&t.print(","),t.print("(");for(var i=n.getCoordinates(),r=0;r0&&t.print(","),t.print(i[r].x+" "+i[r].y);t.println(")")}t.print(") ")},Hn.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next())},Hn.prototype.findEdgeIndex=function(t){for(var e=0;e0||!e.coord.equals2D(i);r||n--;var o=new Array(n).fill(null),s=0;o[s++]=new C(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o[s++]=this.edge.pts[a];return r&&(o[s]=e.coord),new ni(o,new Pe(this.edge._label))},Qn.prototype.add=function(t,e,n){var i=new Jn(t,e,n),r=this._nodeMap.get(i);return null!==r?r:(this._nodeMap.put(i,i),i)},Qn.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();){if(e.next().coord.equals(t))return!0}return!1},Qn.prototype.interfaces_=function(){return[]},Qn.prototype.getClass=function(){return Qn};var Zn=function(){};Zn.prototype.getChainStartIndices=function(t){var e=0,n=new Nt;n.add(new M(e));do{var i=this.findChainEnd(t,e);n.add(new M(i)),e=i}while(en?e:n},$n.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return ee&&(i=1),this._depth[t][n]=i}}},ti.prototype.getDelta=function(t){return this._depth[t][Se.RIGHT]-this._depth[t][Se.LEFT]},ti.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?w.EXTERIOR:w.INTERIOR},ti.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},ti.prototype.add=function(){if(1===arguments.length)for(var t=arguments[0],e=0;e<2;e++)for(var n=1;n<3;n++){var i=t.getLocation(e,n);i!==w.EXTERIOR&&i!==w.INTERIOR||(this.isNull(e,n)?this._depth[e][n]=ti.depthAtLocation(i):this._depth[e][n]+=ti.depthAtLocation(i))}else if(3===arguments.length){var r=arguments[0],o=arguments[1];arguments[2]===w.INTERIOR&&this._depth[r][o]++}},ti.prototype.interfaces_=function(){return[]},ti.prototype.getClass=function(){return ti},ti.depthAtLocation=function(t){return t===w.EXTERIOR?0:t===w.INTERIOR?1:ti.NULL_VALUE},ei.NULL_VALUE.get=function(){return-1},Object.defineProperties(ti,ei);var ni=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new Qn(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new ti,this._depthDelta=0,1===arguments.length){var n=arguments[0];e.call(this,n,null)}else if(2===arguments.length){var i=arguments[0],r=arguments[1];this.pts=i,this._label=r}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDepth=function(){return this._depth},e.prototype.getCollapsedEdge=function(){var t=new Array(2).fill(null);t[0]=this.pts[0],t[1]=this.pts[1];return new e(t,Pe.toLineLabel(this._label))},e.prototype.isIsolated=function(){return this._isIsolated},e.prototype.getCoordinates=function(){return this.pts},e.prototype.setIsolated=function(t){this._isIsolated=t},e.prototype.setName=function(t){this._name=t},e.prototype.equals=function(t){if(!(t instanceof e))return!1;var n=t;if(this.pts.length!==n.pts.length)return!1;for(var i=!0,r=!0,o=this.pts.length,s=0;s0?this.pts[0]:null;if(1===arguments.length){var t=arguments[0];return this.pts[t]}},e.prototype.print=function(t){t.print("edge "+this._name+": "),t.print("LINESTRING (");for(var e=0;e0&&t.print(","),t.print(this.pts[e].x+" "+this.pts[e].y);t.print(") "+this._label+" "+this._depthDelta)},e.prototype.computeIM=function(t){e.updateIM(this._label,t)},e.prototype.isCollapsed=function(){return!!this._label.isArea()&&(3===this.pts.length&&!!this.pts[0].equals(this.pts[2]))},e.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},e.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},e.prototype.getDepthDelta=function(){return this._depthDelta},e.prototype.getNumPoints=function(){return this.pts.length},e.prototype.printReverse=function(t){t.print("edge "+this._name+": ");for(var e=this.pts.length-1;e>=0;e--)t.print(this.pts[e]+" ");t.println("")},e.prototype.getMonotoneChainEdge=function(){return null===this._mce&&(this._mce=new $n(this)),this._mce},e.prototype.getEnvelope=function(){if(null===this._env){this._env=new j;for(var t=0;t0&&t.append(","),t.append(this.pts[e].x+" "+this.pts[e].y);return t.append(") "+this._label+" "+this._depthDelta),t.toString()},e.prototype.isPointwiseEqual=function(t){if(this.pts.length!==t.pts.length)return!1;for(var e=0;ei||this._maxyo;if(s)return!1;var a=this.intersectsToleranceSquare(t,e);return et.isTrue(!(s&&a),"Found bad envelope test"),a},ai.prototype.initCorners=function(t){this._minx=t.x-.5,this._maxx=t.x+.5,this._miny=t.y-.5,this._maxy=t.y+.5,this._corner[0]=new C(this._maxx,this._maxy),this._corner[1]=new C(this._minx,this._maxy),this._corner[2]=new C(this._minx,this._miny),this._corner[3]=new C(this._maxx,this._miny)},ai.prototype.intersects=function(t,e){return 1===this._scaleFactor?this.intersectsScaled(t,e):(this.copyScaled(t,this._p0Scaled),this.copyScaled(e,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))},ai.prototype.scale=function(t){return Math.round(t*this._scaleFactor)},ai.prototype.getCoordinate=function(){return this._originalPt},ai.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)},ai.prototype.getSafeEnvelope=function(){if(null===this._safeEnv){var t=ai.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new j(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv},ai.prototype.intersectsPixelClosure=function(t,e){return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))},ai.prototype.intersectsToleranceSquare=function(t,e){var n=!1,i=!1;return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(i=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),!!this._li.isProper()||(!(!n||!i)||(!!t.equals(this._pt)||!!e.equals(this._pt))))))},ai.prototype.addSnappedNode=function(t,e){var n=t.getCoordinate(e),i=t.getCoordinate(e+1);return!!this.intersects(n,i)&&(t.addIntersection(this.getCoordinate(),e),!0)},ai.prototype.interfaces_=function(){return[]},ai.prototype.getClass=function(){return ai},ui.SAFE_ENV_EXPANSION_FACTOR.get=function(){return.75},Object.defineProperties(ai,ui);var li=function(){this.tempEnv1=new j,this.selectedSegment=new dn};li.prototype.select=function(){if(1===arguments.length);else if(2===arguments.length){var t=arguments[0],e=arguments[1];t.getLineSegment(e,this.selectedSegment),this.select(this.selectedSegment)}},li.prototype.interfaces_=function(){return[]},li.prototype.getClass=function(){return li};var ci=function(){this._index=null;var t=arguments[0];this._index=t},pi={HotPixelSnapAction:{configurable:!0}};ci.prototype.snap=function(){if(1===arguments.length){var t=arguments[0];return this.snap(t,null,-1)}if(3===arguments.length){var e=arguments[0],n=arguments[1],i=arguments[2],r=e.getSafeEnvelope(),o=new hi(e,n,i);return this._index.query(r,{interfaces_:function(){return[Ke]},visitItem:function(t){t.select(r,o)}}),o.isNodeAdded()}},ci.prototype.interfaces_=function(){return[]},ci.prototype.getClass=function(){return ci},pi.HotPixelSnapAction.get=function(){return hi},Object.defineProperties(ci,pi);var hi=function(t){function e(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var e=arguments[0],n=arguments[1],i=arguments[2];this._hotPixel=e,this._parentEdge=n,this._hotPixelVertexIndex=i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isNodeAdded=function(){return this._isNodeAdded},e.prototype.select=function(){if(2!==arguments.length)return t.prototype.select.apply(this,arguments);var e=arguments[0],n=arguments[1],i=e.getContext();if(null!==this._parentEdge&&i===this._parentEdge&&n===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(i,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(li),fi=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new Nt};fi.prototype.processIntersections=function(t,e,n,i){if(t===n&&e===i)return null;var r=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[i],a=n.getCoordinates()[i+1];if(this._li.computeIntersection(r,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var u=0;u=0;e--){try{t.bufferReducedPrecision(e)}catch(e){if(!(e instanceof we))throw e;t._saveException=e}if(null!==t._resultGeometry)return null}throw this._saveException}if(1===arguments.length){var n=arguments[0],i=di.precisionScaleFactor(this._argGeom,this._distance,n),r=new fe(i);this.bufferFixedPrecision(r)}},di.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),null!==this._resultGeometry)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===fe.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()},di.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)},di.prototype.bufferOriginalPrecision=function(){try{var t=new ii(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(t){if(!(t instanceof $))throw t;this._saveException=t}},di.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry},di.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)},di.prototype.interfaces_=function(){return[]},di.prototype.getClass=function(){return di},di.bufferOp=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return new di(t).getResultGeometry(e)}if(3===arguments.length){if(Number.isInteger(arguments[2])&&arguments[0]instanceof ct&&"number"==typeof arguments[1]){var n=arguments[0],i=arguments[1],r=arguments[2],o=new di(n);o.setQuadrantSegments(r);return o.getResultGeometry(i)}if(arguments[2]instanceof Cn&&arguments[0]instanceof ct&&"number"==typeof arguments[1]){var s=arguments[0],a=arguments[1],u=arguments[2];return new di(s,u).getResultGeometry(a)}}else if(4===arguments.length){var l=arguments[0],c=arguments[1],p=arguments[2],h=arguments[3],f=new di(l);f.setQuadrantSegments(p),f.setEndCapStyle(h);return f.getResultGeometry(c)}},di.precisionScaleFactor=function(t,e,n){var i=t.getEnvelopeInternal(),r=R.max(Math.abs(i.getMaxX()),Math.abs(i.getMaxY()),Math.abs(i.getMinX()),Math.abs(i.getMinY()))+2*(e>0?e:0),o=n-Math.trunc(Math.log(r)/Math.log(10)+1);return Math.pow(10,o)},yi.CAP_ROUND.get=function(){return Cn.CAP_ROUND},yi.CAP_BUTT.get=function(){return Cn.CAP_FLAT},yi.CAP_FLAT.get=function(){return Cn.CAP_FLAT},yi.CAP_SQUARE.get=function(){return Cn.CAP_SQUARE},yi.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(di,yi);var _i=function(){this._pt=[new C,new C],this._distance=v.NaN,this._isNull=!0};_i.prototype.getCoordinates=function(){return this._pt},_i.prototype.getCoordinate=function(t){return this._pt[t]},_i.prototype.setMinimum=function(){if(1===arguments.length){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var i=e.distance(n);ithis._distance&&this.initialize(e,n,i)}},_i.prototype.interfaces_=function(){return[]},_i.prototype.getClass=function(){return _i};var mi=function(){};mi.prototype.interfaces_=function(){return[]},mi.prototype.getClass=function(){return mi},mi.computeDistance=function(){if(arguments[2]instanceof _i&&arguments[0]instanceof Kt&&arguments[1]instanceof C)for(var t=arguments[0],e=arguments[1],n=arguments[2],i=t.getCoordinates(),r=new dn,o=0;o0||this._isIn?w.INTERIOR:w.EXTERIOR)},Si.prototype.interfaces_=function(){return[]},Si.prototype.getClass=function(){return Si};var Li=function t(){if(this._component=null,this._segIndex=null,this._pt=null,2===arguments.length){var e=arguments[0],n=arguments[1];t.call(this,e,t.INSIDE_AREA,n)}else if(3===arguments.length){var i=arguments[0],r=arguments[1],o=arguments[2];this._component=i,this._segIndex=r,this._pt=o}},bi={INSIDE_AREA:{configurable:!0}};Li.prototype.isInsideArea=function(){return this._segIndex===Li.INSIDE_AREA},Li.prototype.getCoordinate=function(){return this._pt},Li.prototype.getGeometryComponent=function(){return this._component},Li.prototype.getSegmentIndex=function(){return this._segIndex},Li.prototype.interfaces_=function(){return[]},Li.prototype.getClass=function(){return Li},bi.INSIDE_AREA.get=function(){return-1},Object.defineProperties(Li,bi);var wi=function(t){this._pts=t||null};wi.prototype.filter=function(t){t instanceof Qt&&this._pts.add(t)},wi.prototype.interfaces_=function(){return[Vt]},wi.prototype.getClass=function(){return wi},wi.getPoints=function(){if(1===arguments.length){var t=arguments[0];return t instanceof Qt?$e.singletonList(t):wi.getPoints(t,new Nt)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e instanceof Qt?n.add(e):e instanceof zt&&e.apply(new wi(n)),n}};var Oi=function(){this._locations=null;var t=arguments[0];this._locations=t};Oi.prototype.filter=function(t){(t instanceof Qt||t instanceof Kt||t instanceof $t)&&this._locations.add(new Li(t,0,t.getCoordinate()))},Oi.prototype.interfaces_=function(){return[Vt]},Oi.prototype.getClass=function(){return Oi},Oi.getLocations=function(t){var e=new Nt;return t.apply(new Oi(e)),e};var Ti=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Si,this._minDistanceLocation=null,this._minDistance=v.MAX_VALUE,2===arguments.length){var t=arguments[0],e=arguments[1];this._geom=[t,e],this._terminateDistance=0}else if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=i,this._terminateDistance=r}};Ti.prototype.computeContainmentDistance=function(){if(0===arguments.length){var t=new Array(2).fill(null);if(this.computeContainmentDistance(0,t),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1],i=1-e,r=Ni.getPolygons(this._geom[e]);if(r.size()>0){var o=Oi.getLocations(this._geom[i]);if(this.computeContainmentDistance(o,r,n),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[i]=n[0],this._minDistanceLocation[e]=n[1],null}}else if(3===arguments.length)if(arguments[2]instanceof Array&&T(arguments[0],xt)&&T(arguments[1],xt)){for(var s=arguments[0],a=arguments[1],u=arguments[2],l=0;lthis._minDistance)return null;for(var i=t.getCoordinates(),r=e.getCoordinate(),o=0;othis._minDistance)return null;for(var p=u.getCoordinates(),h=l.getCoordinates(),f=0;fthis._distance&&this.initialize(e,n,i)}},Ri.prototype.interfaces_=function(){return[]},Ri.prototype.getClass=function(){return Ri};var Pi=function(){};Pi.prototype.interfaces_=function(){return[]},Pi.prototype.getClass=function(){return Pi},Pi.computeDistance=function(){if(arguments[2]instanceof Ri&&arguments[0]instanceof Kt&&arguments[1]instanceof C)for(var t=arguments[0],e=arguments[1],n=arguments[2],i=new dn,r=t.getCoordinates(),o=0;o1||t<=0)throw new m("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t},Di.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)},Di.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},Di.prototype.computeOrientedDistance=function(t,e,n){var i=new Ai(e);if(t.apply(i),n.setMaximum(i.getMaxPointDistance()),this._densifyFrac>0){var r=new Fi(e,this._densifyFrac);t.apply(r),n.setMaximum(r.getMaxPointDistance())}},Di.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},Di.prototype.interfaces_=function(){return[]},Di.prototype.getClass=function(){return Di},Di.distance=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return new Di(t,e).distance()}if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2],o=new Di(n,i);return o.setDensifyFraction(r),o.distance()}},Mi.MaxPointDistanceFilter.get=function(){return Ai},Mi.MaxDensifiedByFractionDistanceFilter.get=function(){return Fi},Object.defineProperties(Di,Mi);var Ai=function(){this._maxPtDist=new Ri,this._minPtDist=new Ri,this._euclideanDist=new Pi,this._geom=null;var t=arguments[0];this._geom=t};Ai.prototype.filter=function(t){this._minPtDist.initialize(),Pi.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Ai.prototype.getMaxPointDistance=function(){return this._maxPtDist},Ai.prototype.interfaces_=function(){return[ft]},Ai.prototype.getClass=function(){return Ai};var Fi=function(){this._maxPtDist=new Ri,this._minPtDist=new Ri,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};Fi.prototype.filter=function(t,e){if(0===e)return null;for(var n=t.getCoordinate(e-1),i=t.getCoordinate(e),r=(i.x-n.x)/this._numSubSegs,o=(i.y-n.y)/this._numSubSegs,s=0;sn){this._isValid=!1;var r=i.getCoordinates();this._errorLocation=r[1],this._errorIndicator=t.getFactory().createLineString(r),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+Z.toLineString(r[0],r[1])+")"}},Gi.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=Gi.MAX_DISTANCE_DIFF_FRAC*t;return this._minValidDistance=t-e,this._maxValidDistance=t+e,!(!this._input.isEmpty()&&!this._result.isEmpty())||(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),Gi.VERBOSE&&Y.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},Gi.prototype.checkNegativeValid=function(){if(!(this._input instanceof $t||this._input instanceof ne||this._input instanceof zt))return null;var t=this.getPolygonLines(this._input);if(this.checkMinimumDistance(t,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(t,this._result,this._maxValidDistance)},Gi.prototype.getErrorIndicator=function(){return this._errorIndicator},Gi.prototype.checkMinimumDistance=function(t,e,n){var i=new Ti(t,e,n);if(this._minDistanceFound=i.distance(),this._minDistanceFound0&&t>e&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&t=2?null:this._distance>0?null:(this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),void this.report("ExpectedEmpty"))},Bi.prototype.report=function(t){if(!Bi.VERBOSE)return null;Y.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))},Bi.prototype.getErrorMessage=function(){return this._errorMsg},Bi.prototype.interfaces_=function(){return[]},Bi.prototype.getClass=function(){return Bi},Bi.isValidMsg=function(t,e,n){var i=new Bi(t,e,n);return i.isValid()?null:i.getErrorMessage()},Bi.isValid=function(t,e,n){return!!new Bi(t,e,n).isValid()},Vi.VERBOSE.get=function(){return!1},Vi.MAX_ENV_DIFF_FRAC.get=function(){return.012},Object.defineProperties(Bi,Vi);var Ui=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};Ui.prototype.getCoordinates=function(){return this._pts},Ui.prototype.size=function(){return this._pts.length},Ui.prototype.getCoordinate=function(t){return this._pts[t]},Ui.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Ui.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:pn.octant(this.getCoordinate(t),this.getCoordinate(t+1))},Ui.prototype.setData=function(t){this._data=t},Ui.prototype.getData=function(){return this._data},Ui.prototype.toString=function(){return Z.toLineString(new ue(this._pts))},Ui.prototype.interfaces_=function(){return[hn]},Ui.prototype.getClass=function(){return Ui};var zi=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new Nt,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};zi.prototype.getInteriorIntersection=function(){return this._interiorIntersection},zi.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t},zi.prototype.getIntersectionSegments=function(){return this._intSegments},zi.prototype.count=function(){return this._intersectionCount},zi.prototype.getIntersections=function(){return this._intersections},zi.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},zi.prototype.setKeepIntersections=function(t){this._keepIntersections=t},zi.prototype.processIntersections=function(t,e,n,i){if(!this._findAllIntersections&&this.hasIntersection())return null;if(t===n&&e===i)return null;if(this._isCheckEndSegmentsOnly){if(!(this.isEndSegment(t,e)||this.isEndSegment(n,i)))return null}var r=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[i],a=n.getCoordinates()[i+1];this._li.computeIntersection(r,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=r,this._intSegments[1]=o,this._intSegments[2]=s,this._intSegments[3]=a,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},zi.prototype.isEndSegment=function(t,e){return 0===e||e>=t.size()-2},zi.prototype.hasIntersection=function(){return null!==this._interiorIntersection},zi.prototype.isDone=function(){return!this._findAllIntersections&&null!==this._interiorIntersection},zi.prototype.interfaces_=function(){return[Wn]},zi.prototype.getClass=function(){return zi},zi.createAllIntersectionsFinder=function(t){var e=new zi(t);return e.setFindAllIntersections(!0),e},zi.createAnyIntersectionFinder=function(t){return new zi(t)},zi.createIntersectionCounter=function(t){var e=new zi(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var Xi=function(){this._li=new rt,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};Xi.prototype.execute=function(){if(null!==this._segInt)return null;this.checkInteriorIntersections()},Xi.prototype.getIntersections=function(){return this._segInt.getIntersections()},Xi.prototype.isValid=function(){return this.execute(),this._isValid},Xi.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},Xi.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new zi(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new xn;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},Xi.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new we(this.getErrorMessage(),this._segInt.getInteriorIntersection())},Xi.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+Z.toLineString(t[0],t[1])+" and "+Z.toLineString(t[2],t[3])},Xi.prototype.interfaces_=function(){return[]},Xi.prototype.getClass=function(){return Xi},Xi.computeIntersections=function(t){var e=new Xi(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var Yi=function t(){this._nv=null;var e=arguments[0];this._nv=new Xi(t.toSegmentStrings(e))};Yi.prototype.checkValid=function(){this._nv.checkValid()},Yi.prototype.interfaces_=function(){return[]},Yi.prototype.getClass=function(){return Yi},Yi.toSegmentStrings=function(t){for(var e=new Nt,n=t.iterator();n.hasNext();){var i=n.next();e.add(new Ui(i.getCoordinates(),i))}return e},Yi.checkValid=function(t){new Yi(t).checkValid()};var ki=function(t){this._mapOp=t};ki.prototype.map=function(t){for(var e=new Nt,n=0;n0&&i<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)},Wi.prototype.interfaces_=function(){return[]},Wi.prototype.getClass=function(){return Wi};var Ki=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new dn,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Kt&&"number"==typeof arguments[1]){var e=arguments[0],n=arguments[1];t.call(this,e.getCoordinates(),n)}else if(arguments[0]instanceof Array&&"number"==typeof arguments[1]){var i=arguments[0],r=arguments[1];this._srcPts=i,this._isClosed=t.isClosed(i),this._snapTolerance=r}};Ki.prototype.snapVertices=function(t,e){for(var n=this._isClosed?t.size()-1:t.size(),i=0;i=0&&t.add(o+1,new C(r),!1)}},Ki.prototype.findSegmentIndexToSnap=function(t,e){for(var n=v.MAX_VALUE,i=-1,r=0;re&&(e=i)}return e}if(2===arguments.length){var r=arguments[0],o=arguments[1];return Math.min(Ji.computeOverlaySnapTolerance(r),Ji.computeOverlaySnapTolerance(o))}},Ji.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal();return Math.min(e.getHeight(),e.getWidth())*Ji.SNAP_PRECISION_FACTOR},Ji.snapToSelf=function(t,e,n){return new Ji(t).snapToSelf(e,n)},Qi.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(Ji,Qi);var Zi=function(t){function e(e,n,i){t.call(this),this._snapTolerance=e||null,this._snapPts=n||null,this._isSelfSnap=void 0!==i&&i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapLine=function(t,e){var n=new Ki(t,this._snapTolerance);return n.setAllowSnappingToSourceVertices(this._isSelfSnap),n.snapTo(e)},e.prototype.transformCoordinates=function(t,e){var n=t.toCoordinateArray(),i=this.snapLine(n,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(i)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Wi),$i=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};$i.prototype.getCommon=function(){return v.longBitsToDouble(this._commonBits)},$i.prototype.add=function(t){var e=v.doubleToLongBits(t);if(this._isFirst)return this._commonBits=e,this._commonSignExp=$i.signExpBits(this._commonBits),this._isFirst=!1,null;if($i.signExpBits(e)!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=$i.numCommonMostSigMantissaBits(this._commonBits,e),this._commonBits=$i.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))},$i.prototype.toString=function(){if(1===arguments.length){var t=arguments[0],e=v.longBitsToDouble(t),n="0000000000000000000000000000000000000000000000000000000000000000"+v.toBinaryString(t),i=n.substring(n.length-64);return i.substring(0,1)+" "+i.substring(1,12)+"(exp) "+i.substring(12)+" [ "+e+" ]"}},$i.prototype.interfaces_=function(){return[]},$i.prototype.getClass=function(){return $i},$i.getBit=function(t,e){return 0!=(t&1<>52},$i.zeroLowerBits=function(t,e){return t&~((1<=0;i--){if($i.getBit(t,i)!==$i.getBit(e,i))return n;n++}return 52};var tr=function(){this._commonCoord=null,this._ccFilter=new nr},er={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};tr.prototype.addCommonBits=function(t){var e=new ir(this._commonCoord);t.apply(e),t.geometryChanged()},tr.prototype.removeCommonBits=function(t){if(0===this._commonCoord.x&&0===this._commonCoord.y)return t;var e=new C(this._commonCoord);e.x=-e.x,e.y=-e.y;var n=new ir(e);return t.apply(n),t.geometryChanged(),t},tr.prototype.getCommonCoordinate=function(){return this._commonCoord},tr.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},tr.prototype.interfaces_=function(){return[]},tr.prototype.getClass=function(){return tr},er.CommonCoordinateFilter.get=function(){return nr},er.Translater.get=function(){return ir},Object.defineProperties(tr,er);var nr=function(){this._commonBitsX=new $i,this._commonBitsY=new $i};nr.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)},nr.prototype.getCommonCoordinate=function(){return new C(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},nr.prototype.interfaces_=function(){return[ft]},nr.prototype.getClass=function(){return nr};var ir=function(){this.trans=null;var t=arguments[0];this.trans=t};ir.prototype.filter=function(t,e){var n=t.getOrdinate(e,0)+this.trans.x,i=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,n),t.setOrdinate(e,1,i)},ir.prototype.isDone=function(){return!1},ir.prototype.isGeometryChanged=function(){return!0},ir.prototype.interfaces_=function(){return[Ut]},ir.prototype.getClass=function(){return ir};var rr=function(t,e){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=t,this._geom[1]=e,this.computeSnapTolerance()};rr.prototype.selfSnap=function(t){return new Ji(t).snapTo(t,this._snapTolerance)},rr.prototype.removeCommonBits=function(t){this._cbr=new tr,this._cbr.add(t[0]),this._cbr.add(t[1]);var e=new Array(2).fill(null);return e[0]=this._cbr.removeCommonBits(t[0].copy()),e[1]=this._cbr.removeCommonBits(t[1].copy()),e},rr.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t},rr.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),n=Lr.overlayOp(e[0],e[1],t);return this.prepareResult(n)},rr.prototype.checkValid=function(t){t.isValid()||Y.out.println("Snapped geometry is invalid")},rr.prototype.computeSnapTolerance=function(){this._snapTolerance=Ji.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},rr.prototype.snap=function(t){var e=this.removeCommonBits(t);return Ji.snap(e[0],e[1],this._snapTolerance)},rr.prototype.interfaces_=function(){return[]},rr.prototype.getClass=function(){return rr},rr.overlayOp=function(t,e,n){return new rr(t,e).getResultGeometry(n)},rr.union=function(t,e){return rr.overlayOp(t,e,Lr.UNION)},rr.intersection=function(t,e){return rr.overlayOp(t,e,Lr.INTERSECTION)},rr.symDifference=function(t,e){return rr.overlayOp(t,e,Lr.SYMDIFFERENCE)},rr.difference=function(t,e){return rr.overlayOp(t,e,Lr.DIFFERENCE)};var or=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};or.prototype.getResultGeometry=function(t){var e=null,n=!1,i=null;try{e=Lr.overlayOp(this._geom[0],this._geom[1],t);n=!0}catch(t){if(!(t instanceof $))throw t;i=t}if(!n)try{e=rr.overlayOp(this._geom[0],this._geom[1],t)}catch(t){throw t instanceof $?i:t}return e},or.prototype.interfaces_=function(){return[]},or.prototype.getClass=function(){return or},or.overlayOp=function(t,e,n){return new or(t,e).getResultGeometry(n)},or.union=function(t,e){return or.overlayOp(t,e,Lr.UNION)},or.intersection=function(t,e){return or.overlayOp(t,e,Lr.INTERSECTION)},or.symDifference=function(t,e){return or.overlayOp(t,e,Lr.SYMDIFFERENCE)},or.difference=function(t,e){return or.overlayOp(t,e,Lr.DIFFERENCE)};var sr=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};sr.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)},sr.prototype.interfaces_=function(){return[]},sr.prototype.getClass=function(){return sr};var ar=function t(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,2===arguments.length){var e=arguments[0],n=arguments[1];this._eventType=t.DELETE,this._xValue=e,this._insertEvent=n}else if(3===arguments.length){var i=arguments[0],r=arguments[1],o=arguments[2];this._eventType=t.INSERT,this._label=i,this._xValue=r,this._obj=o}},ur={INSERT:{configurable:!0},DELETE:{configurable:!0}};ar.prototype.isDelete=function(){return this._eventType===ar.DELETE},ar.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t},ar.prototype.getObject=function(){return this._obj},ar.prototype.compareTo=function(t){var e=t;return this._xValuee._xValue?1:this._eventTypee._eventType?1:0},ar.prototype.getInsertEvent=function(){return this._insertEvent},ar.prototype.isInsert=function(){return this._eventType===ar.INSERT},ar.prototype.isSameLabel=function(t){return null!==this._label&&this._label===t._label},ar.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},ar.prototype.interfaces_=function(){return[E]},ar.prototype.getClass=function(){return ar},ur.INSERT.get=function(){return 1},ur.DELETE.get=function(){return 2},Object.defineProperties(ar,ur);var lr=function(){};lr.prototype.interfaces_=function(){return[]},lr.prototype.getClass=function(){return lr};var cr=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var t=arguments[0],e=arguments[1],n=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=n};cr.prototype.isTrivialIntersection=function(t,e,n,i){if(t===n&&1===this._li.getIntersectionNum()){if(cr.isAdjacentSegments(e,i))return!0;if(t.isClosed()){var r=t.getNumPoints()-1;if(0===e&&i===r||0===i&&e===r)return!0}}return!1},cr.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},cr.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t},cr.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},cr.prototype.isBoundaryPointInternal=function(t,e){for(var n=e.iterator();n.hasNext();){var i=n.next().getCoordinate();if(t.isIntersection(i))return!0}return!1},cr.prototype.hasProperIntersection=function(){return this._hasProper},cr.prototype.hasIntersection=function(){return this._hasIntersection},cr.prototype.isDone=function(){return this._isDone},cr.prototype.isBoundaryPoint=function(t,e){return null!==e&&(!!this.isBoundaryPointInternal(t,e[0])||!!this.isBoundaryPointInternal(t,e[1]))},cr.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e},cr.prototype.addIntersections=function(t,e,n,i){if(t===n&&e===i)return null;this.numTests++;var r=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[i],a=n.getCoordinates()[i+1];this._li.computeIntersection(r,o,s,a),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),n.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,n,i)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(t.addIntersections(this._li,e,0),n.addIntersections(this._li,i,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))},cr.prototype.interfaces_=function(){return[]},cr.prototype.getClass=function(){return cr},cr.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var pr=function(t){function e(){t.call(this),this.events=new Nt,this.nOverlaps=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvents=function(){$e.sort(this.events);for(var t=0;te||this._maxo?1:0},gr.prototype.interfaces_=function(){return[N]},gr.prototype.getClass=function(){return gr};var dr=function(t){function e(){t.call(this),this._item=null;var e=arguments[0],n=arguments[1],i=arguments[2];this._min=e,this._max=n,this._item=i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.query=function(t,e,n){if(!this.intersects(t,e))return null;n.visitItem(this._item)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(hr),yr=function(t){function e(){t.call(this),this._node1=null,this._node2=null;var e=arguments[0],n=arguments[1];this._node1=e,this._node2=n,this.buildExtent(this._node1,this._node2)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildExtent=function(t,e){this._min=Math.min(t._min,e._min),this._max=Math.max(t._max,e._max)},e.prototype.query=function(t,e,n){if(!this.intersects(t,e))return null;null!==this._node1&&this._node1.query(t,e,n),null!==this._node2&&this._node2.query(t,e,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(hr),_r=function(){this._leaves=new Nt,this._root=null,this._level=0};_r.prototype.buildTree=function(){$e.sort(this._leaves,new hr.NodeComparator);for(var t=this._leaves,e=null,n=new Nt;;){if(this.buildLevel(t,n),1===n.size())return n.get(0);e=t,t=n,n=e}},_r.prototype.insert=function(t,e,n){if(null!==this._root)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new dr(t,e,n))},_r.prototype.query=function(t,e,n){this.init(),this._root.query(t,e,n)},_r.prototype.buildRoot=function(){if(null!==this._root)return null;this._root=this.buildTree()},_r.prototype.printNode=function(t){Y.out.println(Z.toLineString(new C(t._min,this._level),new C(t._max,this._level)))},_r.prototype.init=function(){if(null!==this._root)return null;this.buildRoot()},_r.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var n=0;n=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,e[0]),this.insertBoundaryPoint(this._argIndex,e[e.length-1])},e.prototype.getInvalidPoint=function(){return this._invalidPoint},e.prototype.getBoundaryPoints=function(){for(var t=this.getBoundaryNodes(),e=new Array(t.size()).fill(null),n=0,i=t.iterator();i.hasNext();){var r=i.next();e[n++]=r.getCoordinate().copy()}return e},e.prototype.getBoundaryNodes=function(){return null===this._boundaryNodes&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},e.prototype.addSelfIntersectionNode=function(t,e,n){if(this.isBoundaryNode(t,e))return null;n===w.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(t,e):this.insertPoint(t,e,n)},e.prototype.addPolygonRing=function(t,e,n){if(t.isEmpty())return null;var i=Lt.removeRepeatedPoints(t.getCoordinates());if(i.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=i[0],null;var r=e,o=n;at.isCCW(i)&&(r=n,o=e);var s=new ni(i,new Pe(this._argIndex,w.BOUNDARY,r,o));this._lineEdgeMap.put(t,s),this.insertEdge(s),this.insertPoint(this._argIndex,i[0],w.BOUNDARY)},e.prototype.insertPoint=function(t,e,n){var i=this._nodes.addNode(e),r=i.getLabel();null===r?i._label=new Pe(t,n):r.setLocation(t,n)},e.prototype.createEdgeSetIntersector=function(){return new pr},e.prototype.addSelfIntersectionNodes=function(t){for(var e=this._edges.iterator();e.hasNext();)for(var n=e.next(),i=n.getLabel().getLocation(t),r=n.eiList.iterator();r.hasNext();){var o=r.next();this.addSelfIntersectionNode(t,o.coord,i)}},e.prototype.add=function(){if(1!==arguments.length)return t.prototype.add.apply(this,arguments);var e=arguments[0];if(e.isEmpty())return null;if(e instanceof ne&&(this._useBoundaryDeterminationRule=!1),e instanceof $t)this.addPolygon(e);else if(e instanceof Kt)this.addLineString(e);else if(e instanceof Qt)this.addPoint(e);else if(e instanceof te)this.addCollection(e);else if(e instanceof Xt)this.addCollection(e);else if(e instanceof ne)this.addCollection(e);else{if(!(e instanceof zt))throw new Error(e.getClass().getName());this.addCollection(e)}},e.prototype.addCollection=function(t){for(var e=0;e50?(null===this._areaPtLocator&&(this._areaPtLocator=new vr(this._parentGeom)),this._areaPtLocator.locate(t)):this._ptLocator.locate(t,this._parentGeom)},e.prototype.findEdge=function(){if(1===arguments.length){var e=arguments[0];return this._lineEdgeMap.get(e)}return t.prototype.findEdge.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.determineBoundary=function(t,e){return t.isInBoundary(e)?w.BOUNDARY:w.INTERIOR},e}(Ye),Cr=function(){if(this._li=new rt,this._resultPrecisionModel=null,this._arg=null,1===arguments.length){var t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new Nr(0,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1],i=gt.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(n.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(n.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new Nr(0,e,i),this._arg[1]=new Nr(1,n,i)}else if(3===arguments.length){var r=arguments[0],o=arguments[1],s=arguments[2];r.getPrecisionModel().compareTo(o.getPrecisionModel())>=0?this.setComputationPrecision(r.getPrecisionModel()):this.setComputationPrecision(o.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new Nr(0,r,s),this._arg[1]=new Nr(1,o,s)}};Cr.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()},Cr.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)},Cr.prototype.interfaces_=function(){return[]},Cr.prototype.getClass=function(){return Cr};var Sr=function(){};Sr.prototype.interfaces_=function(){return[]},Sr.prototype.getClass=function(){return Sr},Sr.map=function(){if(arguments[0]instanceof ct&&T(arguments[1],Sr.MapOp)){for(var t=arguments[0],e=arguments[1],n=new Nt,i=0;i=t.size()?null:t.get(e)},Dr.union=function(t){return new Dr(t).union()},Mr.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(Dr,Mr);var Ar=function(){};Ar.prototype.interfaces_=function(){return[]},Ar.prototype.getClass=function(){return Ar},Ar.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return Lr.createEmptyResult(Lr.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),or.overlayOp(t,e,Lr.UNION)},t.GeoJSONReader=Ne,t.GeoJSONWriter=Ce,t.OverlayOp=Lr,t.UnionOp=Ar,t.BufferOp=di,Object.defineProperty(t,"__esModule",{value:!0})}); - - -/***/ }), - -/***/ 41: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var hasPropertyDescriptors = __webpack_require__(592)(); - -var GetIntrinsic = __webpack_require__(453); - -var $defineProperty = hasPropertyDescriptors && GetIntrinsic('%Object.defineProperty%', true); -if ($defineProperty) { - try { - $defineProperty({}, 'a', { value: 1 }); - } catch (e) { - // IE 8 has a broken defineProperty - $defineProperty = false; - } -} - -var $SyntaxError = GetIntrinsic('%SyntaxError%'); -var $TypeError = GetIntrinsic('%TypeError%'); - -var gopd = __webpack_require__(5795); - -/** @type {(obj: Record, property: PropertyKey, value: unknown, nonEnumerable?: boolean | null, nonWritable?: boolean | null, nonConfigurable?: boolean | null, loose?: boolean) => void} */ -module.exports = function defineDataProperty( - obj, - property, - value -) { - if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) { - throw new $TypeError('`obj` must be an object or a function`'); - } - if (typeof property !== 'string' && typeof property !== 'symbol') { - throw new $TypeError('`property` must be a string or a symbol`'); - } - if (arguments.length > 3 && typeof arguments[3] !== 'boolean' && arguments[3] !== null) { - throw new $TypeError('`nonEnumerable`, if provided, must be a boolean or null'); - } - if (arguments.length > 4 && typeof arguments[4] !== 'boolean' && arguments[4] !== null) { - throw new $TypeError('`nonWritable`, if provided, must be a boolean or null'); - } - if (arguments.length > 5 && typeof arguments[5] !== 'boolean' && arguments[5] !== null) { - throw new $TypeError('`nonConfigurable`, if provided, must be a boolean or null'); - } - if (arguments.length > 6 && typeof arguments[6] !== 'boolean') { - throw new $TypeError('`loose`, if provided, must be a boolean'); - } - - var nonEnumerable = arguments.length > 3 ? arguments[3] : null; - var nonWritable = arguments.length > 4 ? arguments[4] : null; - var nonConfigurable = arguments.length > 5 ? arguments[5] : null; - var loose = arguments.length > 6 ? arguments[6] : false; - - /* @type {false | TypedPropertyDescriptor} */ - var desc = !!gopd && gopd(obj, property); - - if ($defineProperty) { - $defineProperty(obj, property, { - configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable, - enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable, - value: value, - writable: nonWritable === null && desc ? desc.writable : !nonWritable - }); - } else if (loose || (!nonEnumerable && !nonWritable && !nonConfigurable)) { - // must fall back to [[Set]], and was not explicitly asked to make non-enumerable, non-writable, or non-configurable - obj[property] = value; // eslint-disable-line no-param-reassign - } else { - throw new $SyntaxError('This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.'); - } -}; - - -/***/ }), - -/***/ 76: -/***/ ((module) => { - -"use strict"; - - -/** @type {import('./functionCall')} */ -module.exports = Function.prototype.call; - - -/***/ }), - -/***/ 301: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var helpers_1 = __webpack_require__(8967); -var invariant_1 = __webpack_require__(8506); -var spline_1 = __importDefault(__webpack_require__(9164)); -/** - * Takes a {@link LineString|line} and returns a curved version - * by applying a [Bezier spline](http://en.wikipedia.org/wiki/B%C3%A9zier_spline) - * algorithm. - * - * The bezier spline implementation is by [Leszek Rybicki](http://leszek.rybicki.cc/). - * - * @name bezierSpline - * @param {Feature} line input LineString - * @param {Object} [options={}] Optional parameters - * @param {Object} [options.properties={}] Translate properties to output - * @param {number} [options.resolution=10000] time in milliseconds between points - * @param {number} [options.sharpness=0.85] a measure of how curvy the path should be between splines - * @returns {Feature} curved line - * @example - * var line = turf.lineString([ - * [-76.091308, 18.427501], - * [-76.695556, 18.729501], - * [-76.552734, 19.40443], - * [-74.61914, 19.134789], - * [-73.652343, 20.07657], - * [-73.157958, 20.210656] - * ]); - * - * var curved = turf.bezierSpline(line); - * - * //addToMap - * var addToMap = [line, curved] - * curved.properties = { stroke: '#0F0' }; - */ -function bezier(line, options) { - if (options === void 0) { options = {}; } - // Optional params - var resolution = options.resolution || 10000; - var sharpness = options.sharpness || 0.85; - var coords = []; - var points = invariant_1.getGeom(line).coordinates.map(function (pt) { - return { x: pt[0], y: pt[1] }; - }); - var spline = new spline_1.default({ - duration: resolution, - points: points, - sharpness: sharpness, - }); - var pushCoord = function (time) { - var pos = spline.pos(time); - if (Math.floor(time / 100) % 2 === 0) { - coords.push([pos.x, pos.y]); - } - }; - for (var i = 0; i < spline.duration; i += 10) { - pushCoord(i); - } - pushCoord(spline.duration); - return helpers_1.lineString(coords, options.properties); -} -exports["default"] = bezier; - - -/***/ }), - -/***/ 347: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var distance_1 = __importDefault(__webpack_require__(9391)); -var helpers_1 = __webpack_require__(8967); -var meta_1 = __webpack_require__(8421); -var tin_1 = __importDefault(__webpack_require__(2141)); -var turf_dissolve_1 = __importDefault(__webpack_require__(8118)); -/** - * Takes a set of {@link Point|points} and returns a concave hull Polygon or MultiPolygon. - * Internally, this uses [turf-tin](https://github.com/Turfjs/turf-tin) to generate geometries. - * - * @name concave - * @param {FeatureCollection} points input points - * @param {Object} [options={}] Optional parameters - * @param {number} [options.maxEdge=Infinity] the length (in 'units') of an edge necessary for part of the - * hull to become concave. - * @param {string} [options.units='kilometers'] can be degrees, radians, miles, or kilometers - * @returns {Feature<(Polygon|MultiPolygon)>|null} a concave hull (null value is returned if unable to compute hull) - * @example - * var points = turf.featureCollection([ - * turf.point([-63.601226, 44.642643]), - * turf.point([-63.591442, 44.651436]), - * turf.point([-63.580799, 44.648749]), - * turf.point([-63.573589, 44.641788]), - * turf.point([-63.587665, 44.64533]), - * turf.point([-63.595218, 44.64765]) - * ]); - * var options = {units: 'miles', maxEdge: 1}; - * - * var hull = turf.concave(points, options); - * - * //addToMap - * var addToMap = [points, hull] - */ -function concave(points, options) { - if (options === void 0) { options = {}; } - var maxEdge = options.maxEdge || Infinity; - var cleaned = removeDuplicates(points); - var tinPolys = tin_1.default(cleaned); - // calculate length of all edges and area of all triangles - // and remove triangles that fail the max length test - tinPolys.features = tinPolys.features.filter(function (triangle) { - var pt1 = triangle.geometry.coordinates[0][0]; - var pt2 = triangle.geometry.coordinates[0][1]; - var pt3 = triangle.geometry.coordinates[0][2]; - var dist1 = distance_1.default(pt1, pt2, options); - var dist2 = distance_1.default(pt2, pt3, options); - var dist3 = distance_1.default(pt1, pt3, options); - return dist1 <= maxEdge && dist2 <= maxEdge && dist3 <= maxEdge; - }); - if (tinPolys.features.length < 1) { - return null; - } - // merge the adjacent triangles - var dissolved = turf_dissolve_1.default(tinPolys); - // geojson-dissolve always returns a MultiPolygon - if (dissolved.coordinates.length === 1) { - dissolved.coordinates = dissolved.coordinates[0]; - dissolved.type = "Polygon"; - } - return helpers_1.feature(dissolved); -} -/** - * Removes duplicated points in a collection returning a new collection - * - * @private - * @param {FeatureCollection} points to be cleaned - * @returns {FeatureCollection} cleaned set of points - */ -function removeDuplicates(points) { - var cleaned = []; - var existing = {}; - meta_1.featureEach(points, function (pt) { - if (!pt.geometry) { - return; - } - var key = pt.geometry.coordinates.join("-"); - if (!Object.prototype.hasOwnProperty.call(existing, key)) { - cleaned.push(pt); - existing[key] = true; - } - }); - return helpers_1.featureCollection(cleaned); -} -exports["default"] = concave; - - -/***/ }), - -/***/ 375: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var circle_1 = __importDefault(__webpack_require__(5764)); -var destination_1 = __importDefault(__webpack_require__(4202)); -var helpers_1 = __webpack_require__(8967); -/** - * Creates a circular arc, of a circle of the given radius and center point, between bearing1 and bearing2; - * 0 bearing is North of center point, positive clockwise. - * - * @name lineArc - * @param {Coord} center center point - * @param {number} radius radius of the circle - * @param {number} bearing1 angle, in decimal degrees, of the first radius of the arc - * @param {number} bearing2 angle, in decimal degrees, of the second radius of the arc - * @param {Object} [options={}] Optional parameters - * @param {number} [options.steps=64] number of steps - * @param {string} [options.units='kilometers'] miles, kilometers, degrees, or radians - * @returns {Feature} line arc - * @example - * var center = turf.point([-75, 40]); - * var radius = 5; - * var bearing1 = 25; - * var bearing2 = 47; - * - * var arc = turf.lineArc(center, radius, bearing1, bearing2); - * - * //addToMap - * var addToMap = [center, arc] - */ -function lineArc(center, radius, bearing1, bearing2, options) { - if (options === void 0) { options = {}; } - // default params - var steps = options.steps || 64; - var angle1 = convertAngleTo360(bearing1); - var angle2 = convertAngleTo360(bearing2); - var properties = !Array.isArray(center) && center.type === "Feature" - ? center.properties - : {}; - // handle angle parameters - if (angle1 === angle2) { - return helpers_1.lineString(circle_1.default(center, radius, options).geometry.coordinates[0], properties); - } - var arcStartDegree = angle1; - var arcEndDegree = angle1 < angle2 ? angle2 : angle2 + 360; - var alfa = arcStartDegree; - var coordinates = []; - var i = 0; - while (alfa < arcEndDegree) { - coordinates.push(destination_1.default(center, radius, alfa, options).geometry.coordinates); - i++; - alfa = arcStartDegree + (i * 360) / steps; - } - if (alfa > arcEndDegree) { - coordinates.push(destination_1.default(center, radius, arcEndDegree, options).geometry.coordinates); - } - return helpers_1.lineString(coordinates, properties); -} -exports["default"] = lineArc; -/** - * Takes any angle in degrees - * and returns a valid angle between 0-360 degrees - * - * @private - * @param {number} alfa angle between -180-180 degrees - * @returns {number} angle between 0-360 degrees - */ -function convertAngleTo360(alfa) { - var beta = alfa % 360; - if (beta < 0) { - beta += 360; - } - return beta; -} - - -/***/ }), - -/***/ 414: -/***/ ((module) => { - -"use strict"; - - -/** @type {import('./round')} */ -module.exports = Math.round; - - -/***/ }), - -/***/ 453: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var undefined; - -var $Object = __webpack_require__(9612); - -var $Error = __webpack_require__(9383); -var $EvalError = __webpack_require__(1237); -var $RangeError = __webpack_require__(9290); -var $ReferenceError = __webpack_require__(9538); -var $SyntaxError = __webpack_require__(8068); -var $TypeError = __webpack_require__(9675); -var $URIError = __webpack_require__(5345); - -var abs = __webpack_require__(1514); -var floor = __webpack_require__(8968); -var max = __webpack_require__(6188); -var min = __webpack_require__(8002); -var pow = __webpack_require__(5880); -var round = __webpack_require__(414); -var sign = __webpack_require__(3093); - -var $Function = Function; - -// eslint-disable-next-line consistent-return -var getEvalledConstructor = function (expressionSyntax) { - try { - return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')(); - } catch (e) {} -}; - -var $gOPD = __webpack_require__(5795); -var $defineProperty = __webpack_require__(655); - -var throwTypeError = function () { - throw new $TypeError(); -}; -var ThrowTypeError = $gOPD - ? (function () { - try { - // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties - arguments.callee; // IE 8 does not throw here - return throwTypeError; - } catch (calleeThrows) { - try { - // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '') - return $gOPD(arguments, 'callee').get; - } catch (gOPDthrows) { - return throwTypeError; - } - } - }()) - : throwTypeError; - -var hasSymbols = __webpack_require__(4039)(); - -var getProto = __webpack_require__(3628); -var $ObjectGPO = __webpack_require__(1064); -var $ReflectGPO = __webpack_require__(8648); - -var $apply = __webpack_require__(1002); -var $call = __webpack_require__(76); - -var needsEval = {}; - -var TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined : getProto(Uint8Array); - -var INTRINSICS = { - __proto__: null, - '%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError, - '%Array%': Array, - '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer, - '%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined, - '%AsyncFromSyncIteratorPrototype%': undefined, - '%AsyncFunction%': needsEval, - '%AsyncGenerator%': needsEval, - '%AsyncGeneratorFunction%': needsEval, - '%AsyncIteratorPrototype%': needsEval, - '%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics, - '%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt, - '%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined : BigInt64Array, - '%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined : BigUint64Array, - '%Boolean%': Boolean, - '%DataView%': typeof DataView === 'undefined' ? undefined : DataView, - '%Date%': Date, - '%decodeURI%': decodeURI, - '%decodeURIComponent%': decodeURIComponent, - '%encodeURI%': encodeURI, - '%encodeURIComponent%': encodeURIComponent, - '%Error%': $Error, - '%eval%': eval, // eslint-disable-line no-eval - '%EvalError%': $EvalError, - '%Float16Array%': typeof Float16Array === 'undefined' ? undefined : Float16Array, - '%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array, - '%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array, - '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry, - '%Function%': $Function, - '%GeneratorFunction%': needsEval, - '%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array, - '%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array, - '%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array, - '%isFinite%': isFinite, - '%isNaN%': isNaN, - '%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined, - '%JSON%': typeof JSON === 'object' ? JSON : undefined, - '%Map%': typeof Map === 'undefined' ? undefined : Map, - '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Map()[Symbol.iterator]()), - '%Math%': Math, - '%Number%': Number, - '%Object%': $Object, - '%Object.getOwnPropertyDescriptor%': $gOPD, - '%parseFloat%': parseFloat, - '%parseInt%': parseInt, - '%Promise%': typeof Promise === 'undefined' ? undefined : Promise, - '%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy, - '%RangeError%': $RangeError, - '%ReferenceError%': $ReferenceError, - '%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect, - '%RegExp%': RegExp, - '%Set%': typeof Set === 'undefined' ? undefined : Set, - '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Set()[Symbol.iterator]()), - '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer, - '%String%': String, - '%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined, - '%Symbol%': hasSymbols ? Symbol : undefined, - '%SyntaxError%': $SyntaxError, - '%ThrowTypeError%': ThrowTypeError, - '%TypedArray%': TypedArray, - '%TypeError%': $TypeError, - '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array, - '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray, - '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array, - '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array, - '%URIError%': $URIError, - '%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap, - '%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef, - '%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet, - - '%Function.prototype.call%': $call, - '%Function.prototype.apply%': $apply, - '%Object.defineProperty%': $defineProperty, - '%Object.getPrototypeOf%': $ObjectGPO, - '%Math.abs%': abs, - '%Math.floor%': floor, - '%Math.max%': max, - '%Math.min%': min, - '%Math.pow%': pow, - '%Math.round%': round, - '%Math.sign%': sign, - '%Reflect.getPrototypeOf%': $ReflectGPO -}; - -if (getProto) { - try { - null.error; // eslint-disable-line no-unused-expressions - } catch (e) { - // https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229 - var errorProto = getProto(getProto(e)); - INTRINSICS['%Error.prototype%'] = errorProto; - } -} - -var doEval = function doEval(name) { - var value; - if (name === '%AsyncFunction%') { - value = getEvalledConstructor('async function () {}'); - } else if (name === '%GeneratorFunction%') { - value = getEvalledConstructor('function* () {}'); - } else if (name === '%AsyncGeneratorFunction%') { - value = getEvalledConstructor('async function* () {}'); - } else if (name === '%AsyncGenerator%') { - var fn = doEval('%AsyncGeneratorFunction%'); - if (fn) { - value = fn.prototype; - } - } else if (name === '%AsyncIteratorPrototype%') { - var gen = doEval('%AsyncGenerator%'); - if (gen && getProto) { - value = getProto(gen.prototype); - } - } - - INTRINSICS[name] = value; - - return value; -}; - -var LEGACY_ALIASES = { - __proto__: null, - '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'], - '%ArrayPrototype%': ['Array', 'prototype'], - '%ArrayProto_entries%': ['Array', 'prototype', 'entries'], - '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'], - '%ArrayProto_keys%': ['Array', 'prototype', 'keys'], - '%ArrayProto_values%': ['Array', 'prototype', 'values'], - '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'], - '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'], - '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'], - '%BooleanPrototype%': ['Boolean', 'prototype'], - '%DataViewPrototype%': ['DataView', 'prototype'], - '%DatePrototype%': ['Date', 'prototype'], - '%ErrorPrototype%': ['Error', 'prototype'], - '%EvalErrorPrototype%': ['EvalError', 'prototype'], - '%Float32ArrayPrototype%': ['Float32Array', 'prototype'], - '%Float64ArrayPrototype%': ['Float64Array', 'prototype'], - '%FunctionPrototype%': ['Function', 'prototype'], - '%Generator%': ['GeneratorFunction', 'prototype'], - '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'], - '%Int8ArrayPrototype%': ['Int8Array', 'prototype'], - '%Int16ArrayPrototype%': ['Int16Array', 'prototype'], - '%Int32ArrayPrototype%': ['Int32Array', 'prototype'], - '%JSONParse%': ['JSON', 'parse'], - '%JSONStringify%': ['JSON', 'stringify'], - '%MapPrototype%': ['Map', 'prototype'], - '%NumberPrototype%': ['Number', 'prototype'], - '%ObjectPrototype%': ['Object', 'prototype'], - '%ObjProto_toString%': ['Object', 'prototype', 'toString'], - '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'], - '%PromisePrototype%': ['Promise', 'prototype'], - '%PromiseProto_then%': ['Promise', 'prototype', 'then'], - '%Promise_all%': ['Promise', 'all'], - '%Promise_reject%': ['Promise', 'reject'], - '%Promise_resolve%': ['Promise', 'resolve'], - '%RangeErrorPrototype%': ['RangeError', 'prototype'], - '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'], - '%RegExpPrototype%': ['RegExp', 'prototype'], - '%SetPrototype%': ['Set', 'prototype'], - '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'], - '%StringPrototype%': ['String', 'prototype'], - '%SymbolPrototype%': ['Symbol', 'prototype'], - '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'], - '%TypedArrayPrototype%': ['TypedArray', 'prototype'], - '%TypeErrorPrototype%': ['TypeError', 'prototype'], - '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'], - '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'], - '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'], - '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'], - '%URIErrorPrototype%': ['URIError', 'prototype'], - '%WeakMapPrototype%': ['WeakMap', 'prototype'], - '%WeakSetPrototype%': ['WeakSet', 'prototype'] -}; - -var bind = __webpack_require__(6743); -var hasOwn = __webpack_require__(9957); -var $concat = bind.call($call, Array.prototype.concat); -var $spliceApply = bind.call($apply, Array.prototype.splice); -var $replace = bind.call($call, String.prototype.replace); -var $strSlice = bind.call($call, String.prototype.slice); -var $exec = bind.call($call, RegExp.prototype.exec); - -/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */ -var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g; -var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */ -var stringToPath = function stringToPath(string) { - var first = $strSlice(string, 0, 1); - var last = $strSlice(string, -1); - if (first === '%' && last !== '%') { - throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`'); - } else if (last === '%' && first !== '%') { - throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`'); - } - var result = []; - $replace(string, rePropName, function (match, number, quote, subString) { - result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match; - }); - return result; -}; -/* end adaptation */ - -var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) { - var intrinsicName = name; - var alias; - if (hasOwn(LEGACY_ALIASES, intrinsicName)) { - alias = LEGACY_ALIASES[intrinsicName]; - intrinsicName = '%' + alias[0] + '%'; - } - - if (hasOwn(INTRINSICS, intrinsicName)) { - var value = INTRINSICS[intrinsicName]; - if (value === needsEval) { - value = doEval(intrinsicName); - } - if (typeof value === 'undefined' && !allowMissing) { - throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!'); - } - - return { - alias: alias, - name: intrinsicName, - value: value - }; - } - - throw new $SyntaxError('intrinsic ' + name + ' does not exist!'); -}; - -module.exports = function GetIntrinsic(name, allowMissing) { - if (typeof name !== 'string' || name.length === 0) { - throw new $TypeError('intrinsic name must be a non-empty string'); - } - if (arguments.length > 1 && typeof allowMissing !== 'boolean') { - throw new $TypeError('"allowMissing" argument must be a boolean'); - } - - if ($exec(/^%?[^%]*%?$/, name) === null) { - throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name'); - } - var parts = stringToPath(name); - var intrinsicBaseName = parts.length > 0 ? parts[0] : ''; - - var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing); - var intrinsicRealName = intrinsic.name; - var value = intrinsic.value; - var skipFurtherCaching = false; - - var alias = intrinsic.alias; - if (alias) { - intrinsicBaseName = alias[0]; - $spliceApply(parts, $concat([0, 1], alias)); - } - - for (var i = 1, isOwn = true; i < parts.length; i += 1) { - var part = parts[i]; - var first = $strSlice(part, 0, 1); - var last = $strSlice(part, -1); - if ( - ( - (first === '"' || first === "'" || first === '`') - || (last === '"' || last === "'" || last === '`') - ) - && first !== last - ) { - throw new $SyntaxError('property names with quotes must have matching quotes'); - } - if (part === 'constructor' || !isOwn) { - skipFurtherCaching = true; - } - - intrinsicBaseName += '.' + part; - intrinsicRealName = '%' + intrinsicBaseName + '%'; - - if (hasOwn(INTRINSICS, intrinsicRealName)) { - value = INTRINSICS[intrinsicRealName]; - } else if (value != null) { - if (!(part in value)) { - if (!allowMissing) { - throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.'); - } - return void undefined; - } - if ($gOPD && (i + 1) >= parts.length) { - var desc = $gOPD(value, part); - isOwn = !!desc; - - // By convention, when a data property is converted to an accessor - // property to emulate a data property that does not suffer from - // the override mistake, that accessor's getter is marked with - // an `originalValue` property. Here, when we detect this, we - // uphold the illusion by pretending to see that original data - // property, i.e., returning the value rather than the getter - // itself. - if (isOwn && 'get' in desc && !('originalValue' in desc.get)) { - value = desc.get; - } else { - value = value[part]; - } - } else { - isOwn = hasOwn(value, part); - value = value[part]; - } - - if (isOwn && !skipFurtherCaching) { - INTRINSICS[intrinsicRealName] = value; - } - } - } - return value; -}; - - -/***/ }), - -/***/ 487: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var bind = __webpack_require__(6743); -var GetIntrinsic = __webpack_require__(453); -var setFunctionLength = __webpack_require__(6897); - -var $TypeError = GetIntrinsic('%TypeError%'); -var $apply = GetIntrinsic('%Function.prototype.apply%'); -var $call = GetIntrinsic('%Function.prototype.call%'); -var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply); - -var $defineProperty = GetIntrinsic('%Object.defineProperty%', true); -var $max = GetIntrinsic('%Math.max%'); - -if ($defineProperty) { - try { - $defineProperty({}, 'a', { value: 1 }); - } catch (e) { - // IE 8 has a broken defineProperty - $defineProperty = null; - } -} - -module.exports = function callBind(originalFunction) { - if (typeof originalFunction !== 'function') { - throw new $TypeError('a function is required'); - } - var func = $reflectApply(bind, $call, arguments); - return setFunctionLength( - func, - 1 + $max(0, originalFunction.length - (arguments.length - 1)), - true - ); -}; - -var applyBind = function applyBind() { - return $reflectApply(bind, $apply, arguments); -}; - -if ($defineProperty) { - $defineProperty(module.exports, 'apply', { value: applyBind }); -} else { - module.exports.apply = applyBind; -} - - -/***/ }), - -/***/ 496: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.Configuration = exports.DEFAULT_IMAGE_FILTERS_CONFIG = exports.DEFAULT_FILTER_DISTANCE_CONFIG = exports.TARGET_MAX_N_CANVASES_PER_SUBTASK = exports.DEFAULT_N_ANNOS_PER_CANVAS = exports.AllowedToolboxItem = void 0; -var toolbox_1 = __webpack_require__(3045); -var submit_buttons_1 = __webpack_require__(8035); -var image_filters_1 = __webpack_require__(6840); -var utilities_1 = __webpack_require__(8286); -/* eslint-disable @stylistic/no-multi-spaces */ -var AllowedToolboxItem; -(function (AllowedToolboxItem) { - AllowedToolboxItem[AllowedToolboxItem["ModeSelect"] = 0] = "ModeSelect"; - AllowedToolboxItem[AllowedToolboxItem["ZoomPan"] = 1] = "ZoomPan"; - AllowedToolboxItem[AllowedToolboxItem["AnnotationResize"] = 2] = "AnnotationResize"; - AllowedToolboxItem[AllowedToolboxItem["AnnotationID"] = 3] = "AnnotationID"; - AllowedToolboxItem[AllowedToolboxItem["RecolorActive"] = 4] = "RecolorActive"; - AllowedToolboxItem[AllowedToolboxItem["ClassCounter"] = 5] = "ClassCounter"; - AllowedToolboxItem[AllowedToolboxItem["KeypointSlider"] = 6] = "KeypointSlider"; - AllowedToolboxItem[AllowedToolboxItem["SubmitButtons"] = 7] = "SubmitButtons"; - AllowedToolboxItem[AllowedToolboxItem["FilterDistance"] = 8] = "FilterDistance"; - AllowedToolboxItem[AllowedToolboxItem["Brush"] = 9] = "Brush"; - AllowedToolboxItem[AllowedToolboxItem["ImageFilters"] = 10] = "ImageFilters"; -})(AllowedToolboxItem || (exports.AllowedToolboxItem = AllowedToolboxItem = {})); -/* eslint-enable @stylistic/no-multi-spaces */ -exports.DEFAULT_N_ANNOS_PER_CANVAS = 100; -exports.TARGET_MAX_N_CANVASES_PER_SUBTASK = 8; -exports.DEFAULT_FILTER_DISTANCE_CONFIG = { - name: "Filter Distance From Row", - component_name: "filter-distance-from-row", - filter_min: 0, - filter_max: 400, - default_values: { closest_row: { distance: 40 } }, - step_value: 2, - multi_class_mode: false, - disable_multi_class_mode: false, - filter_on_load: true, - show_options: true, - show_overlay: false, - toggle_overlay_keybind: "p", - filter_during_polyline_move: true, -}; -exports.DEFAULT_IMAGE_FILTERS_CONFIG = { - default_values: { - brightness: 100, - contrast: 100, - hueRotate: 0, - invert: 0, - saturate: 100, - }, -}; -var Configuration = /** @class */ (function () { - function Configuration() { - var kwargs = []; - for (var _i = 0; _i < arguments.length; _i++) { - kwargs[_i] = arguments[_i]; - } - // Values useful for generating HTML for tool - this.container_id = "container"; - this.px_per_px = 1; - this.anno_scaling_mode = "fixed"; - this.initial_crop = null; - this.annbox_id = "annbox"; - this.imwrap_id = "imwrap"; - this.canvas_fid_pfx = "front-canvas"; - this.canvas_bid_pfx = "back-canvas"; - this.canvas_did = "demo-canvas"; - this.canvas_class = "easel"; - this.image_id_pfx = "ann_image"; - this.imgsz_class = "imgsz"; - this.toolbox_id = "toolbox"; - // Dimensions of various components of the tool - this.image_width = null; - this.image_height = null; - this.demo_width = 120; - this.demo_height = 40; - this.polygon_ender_size = 15; - this.edit_handle_size = 30; - this.brush_size = 60; - // Configuration for the annotation task itself - this.image_data = null; - this.allow_soft_id = false; - this.default_annotation_color = "#fa9d2a"; - this.username = "ULabelUser"; - this.initial_line_size = 4; - // ID Dialog config - this.cl_opacity = 0.4; - this.outer_diameter = 200; - this.inner_prop = 0.3; - // Behavior on special interactions - this.instructions_url = null; - this.submit_buttons = []; - // Passthrough - this.task_meta = {}; - this.annotation_meta = {}; - this.subtasks = null; - /** - * Map from AllowedToolboxItem enum to the class that implements it. - * The typing here uses a - * [abstract construct signature](https://www.typescriptlang.org/docs/handbook/2/classes.html#abstract-construct-signatures) - * to handle the different constructors for each toolbox item. - */ - this.toolbox_map = new Map([ - [AllowedToolboxItem.ModeSelect, toolbox_1.ModeSelectionToolboxItem], - [AllowedToolboxItem.ZoomPan, toolbox_1.ZoomPanToolboxItem], - [AllowedToolboxItem.AnnotationResize, toolbox_1.AnnotationResizeItem], - [AllowedToolboxItem.AnnotationID, toolbox_1.AnnotationIDToolboxItem], - [AllowedToolboxItem.RecolorActive, toolbox_1.RecolorActiveItem], - [AllowedToolboxItem.ClassCounter, toolbox_1.ClassCounterToolboxItem], - [AllowedToolboxItem.KeypointSlider, toolbox_1.KeypointSliderItem], - [AllowedToolboxItem.SubmitButtons, submit_buttons_1.SubmitButtons], - [AllowedToolboxItem.FilterDistance, toolbox_1.FilterPointDistanceFromRow], - [AllowedToolboxItem.Brush, toolbox_1.BrushToolboxItem], - [AllowedToolboxItem.ImageFilters, image_filters_1.ImageFiltersToolboxItem], - ]); - // Default toolbox order used when the user doesn't specify one - this.toolbox_order = [ - AllowedToolboxItem.ModeSelect, - AllowedToolboxItem.Brush, - AllowedToolboxItem.ImageFilters, - AllowedToolboxItem.ZoomPan, - AllowedToolboxItem.AnnotationResize, - AllowedToolboxItem.AnnotationID, - AllowedToolboxItem.RecolorActive, - AllowedToolboxItem.ClassCounter, - AllowedToolboxItem.KeypointSlider, - AllowedToolboxItem.SubmitButtons, - ]; - this.default_keybinds = { - annotation_size_small: "s", - annotation_size_large: "l", - annotation_size_plus: "=", - annotation_size_minus: "-", - annotation_vanish: "v", - }; - // Config for RecolorActiveItem - this.recolor_active_toolbox_item = { - gradient_turned_on: false, - }; - // Config for FilterDistanceToolboxItem - this.distance_filter_toolbox_item = exports.DEFAULT_FILTER_DISTANCE_CONFIG; - // Config for ImageFiltersToolboxItem - this.image_filters_toolbox_item = exports.DEFAULT_IMAGE_FILTERS_CONFIG; - this.change_zoom_keybind = "r"; - this.create_point_annotation_keybind = "c"; - this.default_annotation_size = 6; - this.delete_annotation_keybind = "d"; - this.filter_annotations_on_load = true; - this.switch_subtask_keybind = "z"; - this.toggle_annotation_mode_keybind = "u"; - this.create_bbox_on_initial_crop = "f"; - this.toggle_brush_mode_keybind = "g"; - this.toggle_erase_mode_keybind = "e"; - this.increase_brush_size_keybind = "]"; - this.decrease_brush_size_keybind = "["; - this.fly_to_next_annotation_keybind = "Tab"; - // null -> Shift+fly_to_next_annotation_keybind - this.fly_to_previous_annotation_keybind = null; - this.fly_to_max_zoom = 10; - this.n_annos_per_canvas = exports.DEFAULT_N_ANNOS_PER_CANVAS; - this.click_and_drag_poly_annotations = true; - this.allow_annotations_outside_image = true; - this.modify_config.apply(this, kwargs); - } - // TODO (joshua-dean): Can this any be narrowed? - // eslint-disable-next-line @typescript-eslint/no-explicit-any - Configuration.prototype.modify_config = function () { - var kwargs = []; - for (var _i = 0; _i < arguments.length; _i++) { - kwargs[_i] = arguments[_i]; - } - // Loop through every elements in kwargs - for (var idx = 0; idx < kwargs.length; idx++) { - // For every key: value pair, overwrite them/add them to the config - for (var key in kwargs[idx]) { - // If the value itself is an object, then loop through it and modify only the defined values - if ((0, utilities_1.is_object_and_not_array)(kwargs[idx][key]) && - (0, utilities_1.is_object_and_not_array)(this[key])) { - var inner_object = kwargs[idx][key]; - for (var inner_key in inner_object) { - this[key][inner_key] = inner_object[inner_key]; - } - } - else { - this[key] = kwargs[idx][key]; - } - } - } - }; - return Configuration; -}()); -exports.Configuration = Configuration; - - -/***/ }), - -/***/ 592: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var GetIntrinsic = __webpack_require__(453); - -var $defineProperty = GetIntrinsic('%Object.defineProperty%', true); - -var hasPropertyDescriptors = function hasPropertyDescriptors() { - if ($defineProperty) { - try { - $defineProperty({}, 'a', { value: 1 }); - return true; - } catch (e) { - // IE 8 has a broken defineProperty - return false; - } - } - return false; -}; - -hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() { - // node v0.6 has a bug where array lengths can be Set but not Defined - if (!hasPropertyDescriptors()) { - return null; - } - try { - return $defineProperty([], 'length', { value: 1 }).length !== 1; - } catch (e) { - // In Firefox 4-22, defining length on an array throws an exception. - return true; - } -}; - -module.exports = hasPropertyDescriptors; - - -/***/ }), - -/***/ 655: -/***/ ((module) => { - -"use strict"; - - -/** @type {import('.')} */ -var $defineProperty = Object.defineProperty || false; -if ($defineProperty) { - try { - $defineProperty({}, 'a', { value: 1 }); - } catch (e) { - // IE 8 has a broken defineProperty - $defineProperty = false; - } -} - -module.exports = $defineProperty; - - -/***/ }), - -/***/ 1002: -/***/ ((module) => { - -"use strict"; - - -/** @type {import('./functionApply')} */ -module.exports = Function.prototype.apply; - - -/***/ }), - -/***/ 1064: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var $Object = __webpack_require__(9612); - -/** @type {import('./Object.getPrototypeOf')} */ -module.exports = $Object.getPrototypeOf || null; - - -/***/ }), - -/***/ 1093: -/***/ ((module) => { - -"use strict"; - - -var toStr = Object.prototype.toString; - -module.exports = function isArguments(value) { - var str = toStr.call(value); - var isArgs = str === '[object Arguments]'; - if (!isArgs) { - isArgs = str !== '[object Array]' && - value !== null && - typeof value === 'object' && - typeof value.length === 'number' && - value.length >= 0 && - toStr.call(value.callee) === '[object Function]'; - } - return isArgs; -}; - - -/***/ }), - -/***/ 1101: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var meta_1 = __webpack_require__(8421); -var helpers_1 = __webpack_require__(8967); -var clone_1 = __importDefault(__webpack_require__(3711)); -/** - * Converts a WGS84 GeoJSON object into Mercator (EPSG:900913) projection - * - * @name toMercator - * @param {GeoJSON|Position} geojson WGS84 GeoJSON object - * @param {Object} [options] Optional parameters - * @param {boolean} [options.mutate=false] allows GeoJSON input to be mutated (significant performance increase if true) - * @returns {GeoJSON} Projected GeoJSON - * @example - * var pt = turf.point([-71,41]); - * var converted = turf.toMercator(pt); - * - * //addToMap - * var addToMap = [pt, converted]; - */ -function toMercator(geojson, options) { - if (options === void 0) { options = {}; } - return convert(geojson, "mercator", options); -} -exports.toMercator = toMercator; -/** - * Converts a Mercator (EPSG:900913) GeoJSON object into WGS84 projection - * - * @name toWgs84 - * @param {GeoJSON|Position} geojson Mercator GeoJSON object - * @param {Object} [options] Optional parameters - * @param {boolean} [options.mutate=false] allows GeoJSON input to be mutated (significant performance increase if true) - * @returns {GeoJSON} Projected GeoJSON - * @example - * var pt = turf.point([-7903683.846322424, 5012341.663847514]); - * var converted = turf.toWgs84(pt); - * - * //addToMap - * var addToMap = [pt, converted]; - */ -function toWgs84(geojson, options) { - if (options === void 0) { options = {}; } - return convert(geojson, "wgs84", options); -} -exports.toWgs84 = toWgs84; -/** - * Converts a GeoJSON coordinates to the defined `projection` - * - * @private - * @param {GeoJSON} geojson GeoJSON Feature or Geometry - * @param {string} projection defines the projection system to convert the coordinates to - * @param {Object} [options] Optional parameters - * @param {boolean} [options.mutate=false] allows GeoJSON input to be mutated (significant performance increase if true) - * @returns {GeoJSON} Converted GeoJSON - */ -function convert(geojson, projection, options) { - if (options === void 0) { options = {}; } - // Optional parameters - options = options || {}; - var mutate = options.mutate; - // Validation - if (!geojson) - throw new Error("geojson is required"); - // Handle Position - if (Array.isArray(geojson) && helpers_1.isNumber(geojson[0])) - geojson = - projection === "mercator" - ? convertToMercator(geojson) - : convertToWgs84(geojson); - // Handle GeoJSON - else { - // Handle possible data mutation - if (mutate !== true) - geojson = clone_1.default(geojson); - meta_1.coordEach(geojson, function (coord) { - var newCoord = projection === "mercator" - ? convertToMercator(coord) - : convertToWgs84(coord); - coord[0] = newCoord[0]; - coord[1] = newCoord[1]; - }); - } - return geojson; -} -/** - * Convert lon/lat values to 900913 x/y. - * (from https://github.com/mapbox/sphericalmercator) - * - * @private - * @param {Array} lonLat WGS84 point - * @returns {Array} Mercator [x, y] point - */ -function convertToMercator(lonLat) { - var D2R = Math.PI / 180, - // 900913 properties - A = 6378137.0, MAXEXTENT = 20037508.342789244; - // compensate longitudes passing the 180th meridian - // from https://github.com/proj4js/proj4js/blob/master/lib/common/adjust_lon.js - var adjusted = Math.abs(lonLat[0]) <= 180 ? lonLat[0] : lonLat[0] - sign(lonLat[0]) * 360; - var xy = [ - A * adjusted * D2R, - A * Math.log(Math.tan(Math.PI * 0.25 + 0.5 * lonLat[1] * D2R)), - ]; - // if xy value is beyond maxextent (e.g. poles), return maxextent - if (xy[0] > MAXEXTENT) - xy[0] = MAXEXTENT; - if (xy[0] < -MAXEXTENT) - xy[0] = -MAXEXTENT; - if (xy[1] > MAXEXTENT) - xy[1] = MAXEXTENT; - if (xy[1] < -MAXEXTENT) - xy[1] = -MAXEXTENT; - return xy; -} -/** - * Convert 900913 x/y values to lon/lat. - * (from https://github.com/mapbox/sphericalmercator) - * - * @private - * @param {Array} xy Mercator [x, y] point - * @returns {Array} WGS84 [lon, lat] point - */ -function convertToWgs84(xy) { - // 900913 properties. - var R2D = 180 / Math.PI; - var A = 6378137.0; - return [ - (xy[0] * R2D) / A, - (Math.PI * 0.5 - 2.0 * Math.atan(Math.exp(-xy[1] / A))) * R2D, - ]; -} -/** - * Returns the sign of the input, or zero - * - * @private - * @param {number} x input - * @returns {number} -1|0|1 output - */ -function sign(x) { - return x < 0 ? -1 : x > 0 ? 1 : 0; -} - - -/***/ }), - -/***/ 1111: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var cleanCoords = __webpack_require__(2086); -var clone = __webpack_require__(3711); -var meta = __webpack_require__(8421); -var helpers = __webpack_require__(8967); - -function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } - -var cleanCoords__default = /*#__PURE__*/_interopDefaultLegacy(cleanCoords); -var clone__default = /*#__PURE__*/_interopDefaultLegacy(clone); - -/* - (c) 2013, Vladimir Agafonkin - Simplify.js, a high-performance JS polyline simplification library - mourner.github.io/simplify-js -*/ - -// to suit your point format, run search/replace for '.x' and '.y'; -// for 3D version, see 3d branch (configurability would draw significant performance overhead) - -// square distance between 2 points -function getSqDist(p1, p2) { - var dx = p1.x - p2.x, - dy = p1.y - p2.y; - - return dx * dx + dy * dy; -} - -// square distance from a point to a segment -function getSqSegDist(p, p1, p2) { - var x = p1.x, - y = p1.y, - dx = p2.x - x, - dy = p2.y - y; - - if (dx !== 0 || dy !== 0) { - var t = ((p.x - x) * dx + (p.y - y) * dy) / (dx * dx + dy * dy); - - if (t > 1) { - x = p2.x; - y = p2.y; - } else if (t > 0) { - x += dx * t; - y += dy * t; - } - } - - dx = p.x - x; - dy = p.y - y; - - return dx * dx + dy * dy; -} -// rest of the code doesn't care about point format - -// basic distance-based simplification -function simplifyRadialDist(points, sqTolerance) { - var prevPoint = points[0], - newPoints = [prevPoint], - point; - - for (var i = 1, len = points.length; i < len; i++) { - point = points[i]; - - if (getSqDist(point, prevPoint) > sqTolerance) { - newPoints.push(point); - prevPoint = point; - } - } - - if (prevPoint !== point) newPoints.push(point); - - return newPoints; -} - -function simplifyDPStep(points, first, last, sqTolerance, simplified) { - var maxSqDist = sqTolerance, - index; - - for (var i = first + 1; i < last; i++) { - var sqDist = getSqSegDist(points[i], points[first], points[last]); - - if (sqDist > maxSqDist) { - index = i; - maxSqDist = sqDist; - } - } - - if (maxSqDist > sqTolerance) { - if (index - first > 1) - simplifyDPStep(points, first, index, sqTolerance, simplified); - simplified.push(points[index]); - if (last - index > 1) - simplifyDPStep(points, index, last, sqTolerance, simplified); - } -} - -// simplification using Ramer-Douglas-Peucker algorithm -function simplifyDouglasPeucker(points, sqTolerance) { - var last = points.length - 1; - - var simplified = [points[0]]; - simplifyDPStep(points, 0, last, sqTolerance, simplified); - simplified.push(points[last]); - - return simplified; -} - -// both algorithms combined for awesome performance -function simplify(points, tolerance, highestQuality) { - if (points.length <= 2) return points; - - var sqTolerance = tolerance !== undefined ? tolerance * tolerance : 1; - - points = highestQuality ? points : simplifyRadialDist(points, sqTolerance); - points = simplifyDouglasPeucker(points, sqTolerance); - - return points; -} - -/** - * Takes a {@link GeoJSON} object and returns a simplified version. Internally uses - * [simplify-js](http://mourner.github.io/simplify-js/) to perform simplification using the Ramer-Douglas-Peucker algorithm. - * - * @name simplify - * @param {GeoJSON} geojson object to be simplified - * @param {Object} [options={}] Optional parameters - * @param {number} [options.tolerance=1] simplification tolerance - * @param {boolean} [options.highQuality=false] whether or not to spend more time to create a higher-quality simplification with a different algorithm - * @param {boolean} [options.mutate=false] allows GeoJSON input to be mutated (significant performance increase if true) - * @returns {GeoJSON} a simplified GeoJSON - * @example - * var geojson = turf.polygon([[ - * [-70.603637, -33.399918], - * [-70.614624, -33.395332], - * [-70.639343, -33.392466], - * [-70.659942, -33.394759], - * [-70.683975, -33.404504], - * [-70.697021, -33.419406], - * [-70.701141, -33.434306], - * [-70.700454, -33.446339], - * [-70.694274, -33.458369], - * [-70.682601, -33.465816], - * [-70.668869, -33.472117], - * [-70.646209, -33.473835], - * [-70.624923, -33.472117], - * [-70.609817, -33.468107], - * [-70.595397, -33.458369], - * [-70.587158, -33.442901], - * [-70.587158, -33.426283], - * [-70.590591, -33.414248], - * [-70.594711, -33.406224], - * [-70.603637, -33.399918] - * ]]); - * var options = {tolerance: 0.01, highQuality: false}; - * var simplified = turf.simplify(geojson, options); - * - * //addToMap - * var addToMap = [geojson, simplified] - */ -function simplify$1(geojson, options) { - // Optional parameters - options = options || {}; - if (!helpers.isObject(options)) throw new Error("options is invalid"); - var tolerance = options.tolerance !== undefined ? options.tolerance : 1; - var highQuality = options.highQuality || false; - var mutate = options.mutate || false; - - if (!geojson) throw new Error("geojson is required"); - if (tolerance && tolerance < 0) throw new Error("invalid tolerance"); - - // Clone geojson to avoid side effects - if (mutate !== true) geojson = clone__default['default'](geojson); - - meta.geomEach(geojson, function (geom) { - simplifyGeom(geom, tolerance, highQuality); - }); - return geojson; -} - -/** - * Simplifies a feature's coordinates - * - * @private - * @param {Geometry} geometry to be simplified - * @param {number} [tolerance=1] simplification tolerance - * @param {boolean} [highQuality=false] whether or not to spend more time to create a higher-quality simplification with a different algorithm - * @returns {Geometry} output - */ -function simplifyGeom(geometry, tolerance, highQuality) { - var type = geometry.type; - - // "unsimplyfiable" geometry types - if (type === "Point" || type === "MultiPoint") return geometry; - - // Remove any extra coordinates - cleanCoords__default['default'](geometry, true); - - var coordinates = geometry.coordinates; - switch (type) { - case "LineString": - geometry["coordinates"] = simplifyLine( - coordinates, - tolerance, - highQuality - ); - break; - case "MultiLineString": - geometry["coordinates"] = coordinates.map(function (lines) { - return simplifyLine(lines, tolerance, highQuality); - }); - break; - case "Polygon": - geometry["coordinates"] = simplifyPolygon( - coordinates, - tolerance, - highQuality - ); - break; - case "MultiPolygon": - geometry["coordinates"] = coordinates.map(function (rings) { - return simplifyPolygon(rings, tolerance, highQuality); - }); - } - return geometry; -} - -/** - * Simplifies the coordinates of a LineString with simplify-js - * - * @private - * @param {Array} coordinates to be processed - * @param {number} tolerance simplification tolerance - * @param {boolean} highQuality whether or not to spend more time to create a higher-quality - * @returns {Array>} simplified coords - */ -function simplifyLine(coordinates, tolerance, highQuality) { - return simplify( - coordinates.map(function (coord) { - return { x: coord[0], y: coord[1], z: coord[2] }; - }), - tolerance, - highQuality - ).map(function (coords) { - return coords.z ? [coords.x, coords.y, coords.z] : [coords.x, coords.y]; - }); -} - -/** - * Simplifies the coordinates of a Polygon with simplify-js - * - * @private - * @param {Array} coordinates to be processed - * @param {number} tolerance simplification tolerance - * @param {boolean} highQuality whether or not to spend more time to create a higher-quality - * @returns {Array>>} simplified coords - */ -function simplifyPolygon(coordinates, tolerance, highQuality) { - return coordinates.map(function (ring) { - var pts = ring.map(function (coord) { - return { x: coord[0], y: coord[1] }; - }); - if (pts.length < 4) { - throw new Error("invalid polygon"); - } - var simpleRing = simplify(pts, tolerance, highQuality).map(function ( - coords - ) { - return [coords.x, coords.y]; - }); - //remove 1 percent of tolerance until enough points to make a triangle - while (!checkValidity(simpleRing)) { - tolerance -= tolerance * 0.01; - simpleRing = simplify(pts, tolerance, highQuality).map(function ( - coords - ) { - return [coords.x, coords.y]; - }); - } - if ( - simpleRing[simpleRing.length - 1][0] !== simpleRing[0][0] || - simpleRing[simpleRing.length - 1][1] !== simpleRing[0][1] - ) { - simpleRing.push(simpleRing[0]); - } - return simpleRing; - }); -} - -/** - * Returns true if ring has at least 3 coordinates and its first coordinate is the same as its last - * - * @private - * @param {Array} ring coordinates to be checked - * @returns {boolean} true if valid - */ -function checkValidity(ring) { - if (ring.length < 3) return false; - //if the last point is the same as the first, it's not a triangle - return !( - ring.length === 3 && - ring[2][0] === ring[0][0] && - ring[2][1] === ring[0][1] - ); -} - -module.exports = simplify$1; -module.exports["default"] = simplify$1; - - -/***/ }), - -/***/ 1137: -/***/ ((module) => { - -// ray-casting algorithm based on -// https://wrf.ecse.rpi.edu/Research/Short_Notes/pnpoly.html - -module.exports = function pointInPolygonNested (point, vs, start, end) { - var x = point[0], y = point[1]; - var inside = false; - if (start === undefined) start = 0; - if (end === undefined) end = vs.length; - var len = end - start; - for (var i = 0, j = len - 1; i < len; j = i++) { - var xi = vs[i+start][0], yi = vs[i+start][1]; - var xj = vs[j+start][0], yj = vs[j+start][1]; - var intersect = ((yi > y) !== (yj > y)) - && (x < (xj - xi) * (y - yi) / (yj - yi) + xi); - if (intersect) inside = !inside; - } - return inside; -}; - - -/***/ }), - -/***/ 1189: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var slice = Array.prototype.slice; -var isArgs = __webpack_require__(1093); - -var origKeys = Object.keys; -var keysShim = origKeys ? function keys(o) { return origKeys(o); } : __webpack_require__(8875); - -var originalKeys = Object.keys; - -keysShim.shim = function shimObjectKeys() { - if (Object.keys) { - var keysWorksWithArguments = (function () { - // Safari 5.0 bug - var args = Object.keys(arguments); - return args && args.length === arguments.length; - }(1, 2)); - if (!keysWorksWithArguments) { - Object.keys = function keys(object) { // eslint-disable-line func-name-matching - if (isArgs(object)) { - return originalKeys(slice.call(object)); - } - return originalKeys(object); - }; - } - } else { - Object.keys = keysShim; - } - return Object.keys || keysShim; -}; - -module.exports = keysShim; - - -/***/ }), - -/***/ 1207: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var helpers_1 = __webpack_require__(8967); -var meta_1 = __webpack_require__(8421); -var concaveman_1 = __importDefault(__webpack_require__(1582)); -/** - * Takes a {@link Feature} or a {@link FeatureCollection} and returns a convex hull {@link Polygon}. - * - * Internally this uses - * the [convex-hull](https://github.com/mikolalysenko/convex-hull) module that implements a - * [monotone chain hull](http://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Convex_hull/Monotone_chain). - * - * @name convex - * @param {GeoJSON} geojson input Feature or FeatureCollection - * @param {Object} [options={}] Optional parameters - * @param {number} [options.concavity=Infinity] 1 - thin shape. Infinity - convex hull. - * @param {Object} [options.properties={}] Translate Properties to Feature - * @returns {Feature} a convex hull - * @example - * var points = turf.featureCollection([ - * turf.point([10.195312, 43.755225]), - * turf.point([10.404052, 43.8424511]), - * turf.point([10.579833, 43.659924]), - * turf.point([10.360107, 43.516688]), - * turf.point([10.14038, 43.588348]), - * turf.point([10.195312, 43.755225]) - * ]); - * - * var hull = turf.convex(points); - * - * //addToMap - * var addToMap = [points, hull] - */ -function convex(geojson, options) { - if (options === void 0) { options = {}; } - // Default parameters - options.concavity = options.concavity || Infinity; - // Container - var points = []; - // Convert all points to flat 2D coordinate Array - meta_1.coordEach(geojson, function (coord) { - points.push([coord[0], coord[1]]); - }); - if (!points.length) { - return null; - } - var convexHull = concaveman_1.default(points, options.concavity); - // Convex hull should have at least 3 different vertices in order to create a valid polygon - if (convexHull.length > 3) { - return helpers_1.polygon([convexHull]); - } - return null; -} -exports["default"] = convex; - - -/***/ }), - -/***/ 1237: -/***/ ((module) => { - -"use strict"; - - -/** @type {import('./eval')} */ -module.exports = EvalError; - - -/***/ }), - -/***/ 1279: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var bbox = __webpack_require__(4383); -var area = __webpack_require__(7849); -var booleanPointInPolygon = __webpack_require__(2446); -var explode = __webpack_require__(3707); -var invariant = __webpack_require__(8506); -var helpers = __webpack_require__(8967); -var objectAssign = __webpack_require__(5228); -var meta = __webpack_require__(8421); - -function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } - -var bbox__default = /*#__PURE__*/_interopDefaultLegacy(bbox); -var area__default = /*#__PURE__*/_interopDefaultLegacy(area); -var booleanPointInPolygon__default = /*#__PURE__*/_interopDefaultLegacy(booleanPointInPolygon); -var explode__default = /*#__PURE__*/_interopDefaultLegacy(explode); -var objectAssign__default = /*#__PURE__*/_interopDefaultLegacy(objectAssign); - -/** - * Takes a {@link Point} grid and returns a correspondent matrix {Array>} - * of the 'property' values - * - * @name gridToMatrix - * @param {FeatureCollection} grid of points - * @param {Object} [options={}] Optional parameters - * @param {string} [options.zProperty='elevation'] the property name in `points` from which z-values will be pulled - * @param {boolean} [options.flip=false] returns the matrix upside-down - * @param {boolean} [options.flags=false] flags, adding a `matrixPosition` array field ([row, column]) to its properties, - * the grid points with coordinates on the matrix - * @returns {Array>} matrix of property values - * @example - * var extent = [-70.823364, -33.553984, -70.473175, -33.302986]; - * var cellSize = 3; - * var grid = turf.pointGrid(extent, cellSize); - * // add a random property to each point between 0 and 60 - * for (var i = 0; i < grid.features.length; i++) { - * grid.features[i].properties.elevation = (Math.random() * 60); - * } - * gridToMatrix(grid); - * //= [ - * [ 1, 13, 10, 9, 10, 13, 18], - * [34, 8, 5, 4, 5, 8, 13], - * [10, 5, 2, 1, 2, 5, 4], - * [ 0, 4, 56, 19, 1, 4, 9], - * [10, 5, 2, 1, 2, 5, 10], - * [57, 8, 5, 4, 5, 0, 57], - * [ 3, 13, 10, 9, 5, 13, 18], - * [18, 13, 10, 9, 78, 13, 18] - * ] - */ -function gridToMatrix(grid, options) { - // Optional parameters - options = options || {}; - if (!helpers.isObject(options)) throw new Error("options is invalid"); - var zProperty = options.zProperty || "elevation"; - var flip = options.flip; - var flags = options.flags; - - // validation - invariant.collectionOf(grid, "Point", "input must contain Points"); - - var pointsMatrix = sortPointsByLatLng(grid, flip); - - var matrix = []; - // create property matrix from sorted points - // looping order matters here - for (var r = 0; r < pointsMatrix.length; r++) { - var pointRow = pointsMatrix[r]; - var row = []; - for (var c = 0; c < pointRow.length; c++) { - var point = pointRow[c]; - // Check if zProperty exist - if (point.properties[zProperty]) row.push(point.properties[zProperty]); - else row.push(0); - // add flags - if (flags === true) point.properties.matrixPosition = [r, c]; - } - matrix.push(row); - } - - return matrix; -} - -/** - * Sorts points by latitude and longitude, creating a 2-dimensional array of points - * - * @private - * @param {FeatureCollection} points GeoJSON Point features - * @param {boolean} [flip=false] returns the matrix upside-down - * @returns {Array>} points ordered by latitude and longitude - */ -function sortPointsByLatLng(points, flip) { - var pointsByLatitude = {}; - - // divide points by rows with the same latitude - meta.featureEach(points, function (point) { - var lat = invariant.getCoords(point)[1]; - if (!pointsByLatitude[lat]) pointsByLatitude[lat] = []; - pointsByLatitude[lat].push(point); - }); - - // sort points (with the same latitude) by longitude - var orderedRowsByLatitude = Object.keys(pointsByLatitude).map(function (lat) { - var row = pointsByLatitude[lat]; - var rowOrderedByLongitude = row.sort(function (a, b) { - return invariant.getCoords(a)[0] - invariant.getCoords(b)[0]; - }); - return rowOrderedByLongitude; - }); - - // sort rows (of points with the same latitude) by latitude - var pointMatrix = orderedRowsByLatitude.sort(function (a, b) { - if (flip) return invariant.getCoords(a[0])[1] - invariant.getCoords(b[0])[1]; - else return invariant.getCoords(b[0])[1] - invariant.getCoords(a[0])[1]; - }); - - return pointMatrix; -} - -/*! - * @license GNU Affero General Public License. - * Copyright (c) 2015, 2015 Ronny Lorenz - * v. 1.2.0 - * https://github.com/RaumZeit/MarchingSquares.js - * - * MarchingSquaresJS is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * MarchingSquaresJS is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * As additional permission under GNU Affero General Public License version 3 - * section 7, third-party projects (personal or commercial) may distribute, - * include, or link against UNMODIFIED VERSIONS of MarchingSquaresJS without the - * requirement that said third-party project for that reason alone becomes - * subject to any requirement of the GNU Affero General Public License version 3. - * Any modifications to MarchingSquaresJS, however, must be shared with the public - * and made available. - * - * In summary this: - * - allows you to use MarchingSquaresJS at no cost - * - allows you to use MarchingSquaresJS for both personal and commercial purposes - * - allows you to distribute UNMODIFIED VERSIONS of MarchingSquaresJS under any - * license as long as this license notice is included - * - enables you to keep the source code of your program that uses MarchingSquaresJS - * undisclosed - * - forces you to share any modifications you have made to MarchingSquaresJS, - * e.g. bug-fixes - * - * You should have received a copy of the GNU Affero General Public License - * along with MarchingSquaresJS. If not, see . - */ -var defaultSettings = { - successCallback: null, - verbose: false, - polygons: false, -}; - -var settings = {}; - -/* - Compute isobands(s) of a scalar 2D field given a certain - threshold and a bandwidth by applying the Marching Squares - Algorithm. The function returns a list of path coordinates - either for individual polygons within each grid cell, or the - outline of connected polygons. -*/ -function isoBands(data, minV, bandwidth, options) { - /* process options */ - options = options ? options : {}; - - var optionKeys = Object.keys(defaultSettings); - - for (var i = 0; i < optionKeys.length; i++) { - var key = optionKeys[i]; - var val = options[key]; - val = - typeof val !== "undefined" && val !== null ? val : defaultSettings[key]; - - settings[key] = val; - } - - if (settings.verbose) - console.log( - "MarchingSquaresJS-isoBands: computing isobands for [" + - minV + - ":" + - (minV + bandwidth) + - "]" - ); - - var grid = computeBandGrid(data, minV, bandwidth); - - var ret; - if (settings.polygons) { - if (settings.verbose) - console.log( - "MarchingSquaresJS-isoBands: returning single polygons for each grid cell" - ); - ret = BandGrid2Areas(grid); - } else { - if (settings.verbose) - console.log( - "MarchingSquaresJS-isoBands: returning polygon paths for entire data grid" - ); - ret = BandGrid2AreaPaths(grid); - } - - if (typeof settings.successCallback === "function") - settings.successCallback(ret); - - return ret; -} - -/* - Thats all for the public interface, below follows the actual - implementation -*/ - -/* Some private variables */ -var Node0 = 64, - Node1 = 16, - Node2 = 4, - Node3 = 1; - -/* - The look-up tables for tracing back the contour path - of isoBands -*/ - -var isoBandNextXTL = []; -var isoBandNextYTL = []; -var isoBandNextOTL = []; - -var isoBandNextXTR = []; -var isoBandNextYTR = []; -var isoBandNextOTR = []; - -var isoBandNextXRT = []; -var isoBandNextYRT = []; -var isoBandNextORT = []; - -var isoBandNextXRB = []; -var isoBandNextYRB = []; -var isoBandNextORB = []; - -var isoBandNextXBL = []; -var isoBandNextYBL = []; -var isoBandNextOBL = []; - -var isoBandNextXBR = []; -var isoBandNextYBR = []; -var isoBandNextOBR = []; - -var isoBandNextXLT = []; -var isoBandNextYLT = []; -var isoBandNextOLT = []; - -var isoBandNextXLB = []; -var isoBandNextYLB = []; -var isoBandNextOLB = []; - -isoBandNextXRT[85] = isoBandNextXRB[85] = -1; -isoBandNextYRT[85] = isoBandNextYRB[85] = 0; -isoBandNextORT[85] = isoBandNextORB[85] = 1; -isoBandNextXLT[85] = isoBandNextXLB[85] = 1; -isoBandNextYLT[85] = isoBandNextYLB[85] = 0; -isoBandNextOLT[85] = isoBandNextOLB[85] = 1; - -isoBandNextXTL[85] = isoBandNextXTR[85] = 0; -isoBandNextYTL[85] = isoBandNextYTR[85] = -1; -isoBandNextOTL[85] = isoBandNextOBL[85] = 0; -isoBandNextXBR[85] = isoBandNextXBL[85] = 0; -isoBandNextYBR[85] = isoBandNextYBL[85] = 1; -isoBandNextOTR[85] = isoBandNextOBR[85] = 1; - -/* triangle cases */ -isoBandNextXLB[1] = isoBandNextXLB[169] = 0; -isoBandNextYLB[1] = isoBandNextYLB[169] = -1; -isoBandNextOLB[1] = isoBandNextOLB[169] = 0; -isoBandNextXBL[1] = isoBandNextXBL[169] = -1; -isoBandNextYBL[1] = isoBandNextYBL[169] = 0; -isoBandNextOBL[1] = isoBandNextOBL[169] = 0; - -isoBandNextXRB[4] = isoBandNextXRB[166] = 0; -isoBandNextYRB[4] = isoBandNextYRB[166] = -1; -isoBandNextORB[4] = isoBandNextORB[166] = 1; -isoBandNextXBR[4] = isoBandNextXBR[166] = 1; -isoBandNextYBR[4] = isoBandNextYBR[166] = 0; -isoBandNextOBR[4] = isoBandNextOBR[166] = 0; - -isoBandNextXRT[16] = isoBandNextXRT[154] = 0; -isoBandNextYRT[16] = isoBandNextYRT[154] = 1; -isoBandNextORT[16] = isoBandNextORT[154] = 1; -isoBandNextXTR[16] = isoBandNextXTR[154] = 1; -isoBandNextYTR[16] = isoBandNextYTR[154] = 0; -isoBandNextOTR[16] = isoBandNextOTR[154] = 1; - -isoBandNextXLT[64] = isoBandNextXLT[106] = 0; -isoBandNextYLT[64] = isoBandNextYLT[106] = 1; -isoBandNextOLT[64] = isoBandNextOLT[106] = 0; -isoBandNextXTL[64] = isoBandNextXTL[106] = -1; -isoBandNextYTL[64] = isoBandNextYTL[106] = 0; -isoBandNextOTL[64] = isoBandNextOTL[106] = 1; - -/* single trapezoid cases */ -isoBandNextXLT[2] = isoBandNextXLT[168] = 0; -isoBandNextYLT[2] = isoBandNextYLT[168] = -1; -isoBandNextOLT[2] = isoBandNextOLT[168] = 1; -isoBandNextXLB[2] = isoBandNextXLB[168] = 0; -isoBandNextYLB[2] = isoBandNextYLB[168] = -1; -isoBandNextOLB[2] = isoBandNextOLB[168] = 0; -isoBandNextXBL[2] = isoBandNextXBL[168] = -1; -isoBandNextYBL[2] = isoBandNextYBL[168] = 0; -isoBandNextOBL[2] = isoBandNextOBL[168] = 0; -isoBandNextXBR[2] = isoBandNextXBR[168] = -1; -isoBandNextYBR[2] = isoBandNextYBR[168] = 0; -isoBandNextOBR[2] = isoBandNextOBR[168] = 1; - -isoBandNextXRT[8] = isoBandNextXRT[162] = 0; -isoBandNextYRT[8] = isoBandNextYRT[162] = -1; -isoBandNextORT[8] = isoBandNextORT[162] = 0; -isoBandNextXRB[8] = isoBandNextXRB[162] = 0; -isoBandNextYRB[8] = isoBandNextYRB[162] = -1; -isoBandNextORB[8] = isoBandNextORB[162] = 1; -isoBandNextXBL[8] = isoBandNextXBL[162] = 1; -isoBandNextYBL[8] = isoBandNextYBL[162] = 0; -isoBandNextOBL[8] = isoBandNextOBL[162] = 1; -isoBandNextXBR[8] = isoBandNextXBR[162] = 1; -isoBandNextYBR[8] = isoBandNextYBR[162] = 0; -isoBandNextOBR[8] = isoBandNextOBR[162] = 0; - -isoBandNextXRT[32] = isoBandNextXRT[138] = 0; -isoBandNextYRT[32] = isoBandNextYRT[138] = 1; -isoBandNextORT[32] = isoBandNextORT[138] = 1; -isoBandNextXRB[32] = isoBandNextXRB[138] = 0; -isoBandNextYRB[32] = isoBandNextYRB[138] = 1; -isoBandNextORB[32] = isoBandNextORB[138] = 0; -isoBandNextXTL[32] = isoBandNextXTL[138] = 1; -isoBandNextYTL[32] = isoBandNextYTL[138] = 0; -isoBandNextOTL[32] = isoBandNextOTL[138] = 0; -isoBandNextXTR[32] = isoBandNextXTR[138] = 1; -isoBandNextYTR[32] = isoBandNextYTR[138] = 0; -isoBandNextOTR[32] = isoBandNextOTR[138] = 1; - -isoBandNextXLB[128] = isoBandNextXLB[42] = 0; -isoBandNextYLB[128] = isoBandNextYLB[42] = 1; -isoBandNextOLB[128] = isoBandNextOLB[42] = 1; -isoBandNextXLT[128] = isoBandNextXLT[42] = 0; -isoBandNextYLT[128] = isoBandNextYLT[42] = 1; -isoBandNextOLT[128] = isoBandNextOLT[42] = 0; -isoBandNextXTL[128] = isoBandNextXTL[42] = -1; -isoBandNextYTL[128] = isoBandNextYTL[42] = 0; -isoBandNextOTL[128] = isoBandNextOTL[42] = 1; -isoBandNextXTR[128] = isoBandNextXTR[42] = -1; -isoBandNextYTR[128] = isoBandNextYTR[42] = 0; -isoBandNextOTR[128] = isoBandNextOTR[42] = 0; - -/* single rectangle cases */ -isoBandNextXRB[5] = isoBandNextXRB[165] = -1; -isoBandNextYRB[5] = isoBandNextYRB[165] = 0; -isoBandNextORB[5] = isoBandNextORB[165] = 0; -isoBandNextXLB[5] = isoBandNextXLB[165] = 1; -isoBandNextYLB[5] = isoBandNextYLB[165] = 0; -isoBandNextOLB[5] = isoBandNextOLB[165] = 0; - -isoBandNextXBR[20] = isoBandNextXBR[150] = 0; -isoBandNextYBR[20] = isoBandNextYBR[150] = 1; -isoBandNextOBR[20] = isoBandNextOBR[150] = 1; -isoBandNextXTR[20] = isoBandNextXTR[150] = 0; -isoBandNextYTR[20] = isoBandNextYTR[150] = -1; -isoBandNextOTR[20] = isoBandNextOTR[150] = 1; - -isoBandNextXRT[80] = isoBandNextXRT[90] = -1; -isoBandNextYRT[80] = isoBandNextYRT[90] = 0; -isoBandNextORT[80] = isoBandNextORT[90] = 1; -isoBandNextXLT[80] = isoBandNextXLT[90] = 1; -isoBandNextYLT[80] = isoBandNextYLT[90] = 0; -isoBandNextOLT[80] = isoBandNextOLT[90] = 1; - -isoBandNextXBL[65] = isoBandNextXBL[105] = 0; -isoBandNextYBL[65] = isoBandNextYBL[105] = 1; -isoBandNextOBL[65] = isoBandNextOBL[105] = 0; -isoBandNextXTL[65] = isoBandNextXTL[105] = 0; -isoBandNextYTL[65] = isoBandNextYTL[105] = -1; -isoBandNextOTL[65] = isoBandNextOTL[105] = 0; - -isoBandNextXRT[160] = isoBandNextXRT[10] = -1; -isoBandNextYRT[160] = isoBandNextYRT[10] = 0; -isoBandNextORT[160] = isoBandNextORT[10] = 1; -isoBandNextXRB[160] = isoBandNextXRB[10] = -1; -isoBandNextYRB[160] = isoBandNextYRB[10] = 0; -isoBandNextORB[160] = isoBandNextORB[10] = 0; -isoBandNextXLB[160] = isoBandNextXLB[10] = 1; -isoBandNextYLB[160] = isoBandNextYLB[10] = 0; -isoBandNextOLB[160] = isoBandNextOLB[10] = 0; -isoBandNextXLT[160] = isoBandNextXLT[10] = 1; -isoBandNextYLT[160] = isoBandNextYLT[10] = 0; -isoBandNextOLT[160] = isoBandNextOLT[10] = 1; - -isoBandNextXBR[130] = isoBandNextXBR[40] = 0; -isoBandNextYBR[130] = isoBandNextYBR[40] = 1; -isoBandNextOBR[130] = isoBandNextOBR[40] = 1; -isoBandNextXBL[130] = isoBandNextXBL[40] = 0; -isoBandNextYBL[130] = isoBandNextYBL[40] = 1; -isoBandNextOBL[130] = isoBandNextOBL[40] = 0; -isoBandNextXTL[130] = isoBandNextXTL[40] = 0; -isoBandNextYTL[130] = isoBandNextYTL[40] = -1; -isoBandNextOTL[130] = isoBandNextOTL[40] = 0; -isoBandNextXTR[130] = isoBandNextXTR[40] = 0; -isoBandNextYTR[130] = isoBandNextYTR[40] = -1; -isoBandNextOTR[130] = isoBandNextOTR[40] = 1; - -/* single hexagon cases */ -isoBandNextXRB[37] = isoBandNextXRB[133] = 0; -isoBandNextYRB[37] = isoBandNextYRB[133] = 1; -isoBandNextORB[37] = isoBandNextORB[133] = 1; -isoBandNextXLB[37] = isoBandNextXLB[133] = 0; -isoBandNextYLB[37] = isoBandNextYLB[133] = 1; -isoBandNextOLB[37] = isoBandNextOLB[133] = 0; -isoBandNextXTL[37] = isoBandNextXTL[133] = -1; -isoBandNextYTL[37] = isoBandNextYTL[133] = 0; -isoBandNextOTL[37] = isoBandNextOTL[133] = 0; -isoBandNextXTR[37] = isoBandNextXTR[133] = 1; -isoBandNextYTR[37] = isoBandNextYTR[133] = 0; -isoBandNextOTR[37] = isoBandNextOTR[133] = 0; - -isoBandNextXBR[148] = isoBandNextXBR[22] = -1; -isoBandNextYBR[148] = isoBandNextYBR[22] = 0; -isoBandNextOBR[148] = isoBandNextOBR[22] = 0; -isoBandNextXLB[148] = isoBandNextXLB[22] = 0; -isoBandNextYLB[148] = isoBandNextYLB[22] = -1; -isoBandNextOLB[148] = isoBandNextOLB[22] = 1; -isoBandNextXLT[148] = isoBandNextXLT[22] = 0; -isoBandNextYLT[148] = isoBandNextYLT[22] = 1; -isoBandNextOLT[148] = isoBandNextOLT[22] = 1; -isoBandNextXTR[148] = isoBandNextXTR[22] = -1; -isoBandNextYTR[148] = isoBandNextYTR[22] = 0; -isoBandNextOTR[148] = isoBandNextOTR[22] = 1; - -isoBandNextXRT[82] = isoBandNextXRT[88] = 0; -isoBandNextYRT[82] = isoBandNextYRT[88] = -1; -isoBandNextORT[82] = isoBandNextORT[88] = 1; -isoBandNextXBR[82] = isoBandNextXBR[88] = 1; -isoBandNextYBR[82] = isoBandNextYBR[88] = 0; -isoBandNextOBR[82] = isoBandNextOBR[88] = 1; -isoBandNextXBL[82] = isoBandNextXBL[88] = -1; -isoBandNextYBL[82] = isoBandNextYBL[88] = 0; -isoBandNextOBL[82] = isoBandNextOBL[88] = 1; -isoBandNextXLT[82] = isoBandNextXLT[88] = 0; -isoBandNextYLT[82] = isoBandNextYLT[88] = -1; -isoBandNextOLT[82] = isoBandNextOLT[88] = 0; - -isoBandNextXRT[73] = isoBandNextXRT[97] = 0; -isoBandNextYRT[73] = isoBandNextYRT[97] = 1; -isoBandNextORT[73] = isoBandNextORT[97] = 0; -isoBandNextXRB[73] = isoBandNextXRB[97] = 0; -isoBandNextYRB[73] = isoBandNextYRB[97] = -1; -isoBandNextORB[73] = isoBandNextORB[97] = 0; -isoBandNextXBL[73] = isoBandNextXBL[97] = 1; -isoBandNextYBL[73] = isoBandNextYBL[97] = 0; -isoBandNextOBL[73] = isoBandNextOBL[97] = 0; -isoBandNextXTL[73] = isoBandNextXTL[97] = 1; -isoBandNextYTL[73] = isoBandNextYTL[97] = 0; -isoBandNextOTL[73] = isoBandNextOTL[97] = 1; - -isoBandNextXRT[145] = isoBandNextXRT[25] = 0; -isoBandNextYRT[145] = isoBandNextYRT[25] = -1; -isoBandNextORT[145] = isoBandNextORT[25] = 0; -isoBandNextXBL[145] = isoBandNextXBL[25] = 1; -isoBandNextYBL[145] = isoBandNextYBL[25] = 0; -isoBandNextOBL[145] = isoBandNextOBL[25] = 1; -isoBandNextXLB[145] = isoBandNextXLB[25] = 0; -isoBandNextYLB[145] = isoBandNextYLB[25] = 1; -isoBandNextOLB[145] = isoBandNextOLB[25] = 1; -isoBandNextXTR[145] = isoBandNextXTR[25] = -1; -isoBandNextYTR[145] = isoBandNextYTR[25] = 0; -isoBandNextOTR[145] = isoBandNextOTR[25] = 0; - -isoBandNextXRB[70] = isoBandNextXRB[100] = 0; -isoBandNextYRB[70] = isoBandNextYRB[100] = 1; -isoBandNextORB[70] = isoBandNextORB[100] = 0; -isoBandNextXBR[70] = isoBandNextXBR[100] = -1; -isoBandNextYBR[70] = isoBandNextYBR[100] = 0; -isoBandNextOBR[70] = isoBandNextOBR[100] = 1; -isoBandNextXLT[70] = isoBandNextXLT[100] = 0; -isoBandNextYLT[70] = isoBandNextYLT[100] = -1; -isoBandNextOLT[70] = isoBandNextOLT[100] = 1; -isoBandNextXTL[70] = isoBandNextXTL[100] = 1; -isoBandNextYTL[70] = isoBandNextYTL[100] = 0; -isoBandNextOTL[70] = isoBandNextOTL[100] = 0; - -/* single pentagon cases */ -isoBandNextXRB[101] = isoBandNextXRB[69] = 0; -isoBandNextYRB[101] = isoBandNextYRB[69] = 1; -isoBandNextORB[101] = isoBandNextORB[69] = 0; -isoBandNextXTL[101] = isoBandNextXTL[69] = 1; -isoBandNextYTL[101] = isoBandNextYTL[69] = 0; -isoBandNextOTL[101] = isoBandNextOTL[69] = 0; - -isoBandNextXLB[149] = isoBandNextXLB[21] = 0; -isoBandNextYLB[149] = isoBandNextYLB[21] = 1; -isoBandNextOLB[149] = isoBandNextOLB[21] = 1; -isoBandNextXTR[149] = isoBandNextXTR[21] = -1; -isoBandNextYTR[149] = isoBandNextYTR[21] = 0; -isoBandNextOTR[149] = isoBandNextOTR[21] = 0; - -isoBandNextXBR[86] = isoBandNextXBR[84] = -1; -isoBandNextYBR[86] = isoBandNextYBR[84] = 0; -isoBandNextOBR[86] = isoBandNextOBR[84] = 1; -isoBandNextXLT[86] = isoBandNextXLT[84] = 0; -isoBandNextYLT[86] = isoBandNextYLT[84] = -1; -isoBandNextOLT[86] = isoBandNextOLT[84] = 1; - -isoBandNextXRT[89] = isoBandNextXRT[81] = 0; -isoBandNextYRT[89] = isoBandNextYRT[81] = -1; -isoBandNextORT[89] = isoBandNextORT[81] = 0; -isoBandNextXBL[89] = isoBandNextXBL[81] = 1; -isoBandNextYBL[89] = isoBandNextYBL[81] = 0; -isoBandNextOBL[89] = isoBandNextOBL[81] = 1; - -isoBandNextXRT[96] = isoBandNextXRT[74] = 0; -isoBandNextYRT[96] = isoBandNextYRT[74] = 1; -isoBandNextORT[96] = isoBandNextORT[74] = 0; -isoBandNextXRB[96] = isoBandNextXRB[74] = -1; -isoBandNextYRB[96] = isoBandNextYRB[74] = 0; -isoBandNextORB[96] = isoBandNextORB[74] = 1; -isoBandNextXLT[96] = isoBandNextXLT[74] = 1; -isoBandNextYLT[96] = isoBandNextYLT[74] = 0; -isoBandNextOLT[96] = isoBandNextOLT[74] = 0; -isoBandNextXTL[96] = isoBandNextXTL[74] = 1; -isoBandNextYTL[96] = isoBandNextYTL[74] = 0; -isoBandNextOTL[96] = isoBandNextOTL[74] = 1; - -isoBandNextXRT[24] = isoBandNextXRT[146] = 0; -isoBandNextYRT[24] = isoBandNextYRT[146] = -1; -isoBandNextORT[24] = isoBandNextORT[146] = 1; -isoBandNextXBR[24] = isoBandNextXBR[146] = 1; -isoBandNextYBR[24] = isoBandNextYBR[146] = 0; -isoBandNextOBR[24] = isoBandNextOBR[146] = 1; -isoBandNextXBL[24] = isoBandNextXBL[146] = 0; -isoBandNextYBL[24] = isoBandNextYBL[146] = 1; -isoBandNextOBL[24] = isoBandNextOBL[146] = 1; -isoBandNextXTR[24] = isoBandNextXTR[146] = 0; -isoBandNextYTR[24] = isoBandNextYTR[146] = -1; -isoBandNextOTR[24] = isoBandNextOTR[146] = 0; - -isoBandNextXRB[6] = isoBandNextXRB[164] = -1; -isoBandNextYRB[6] = isoBandNextYRB[164] = 0; -isoBandNextORB[6] = isoBandNextORB[164] = 1; -isoBandNextXBR[6] = isoBandNextXBR[164] = -1; -isoBandNextYBR[6] = isoBandNextYBR[164] = 0; -isoBandNextOBR[6] = isoBandNextOBR[164] = 0; -isoBandNextXLB[6] = isoBandNextXLB[164] = 0; -isoBandNextYLB[6] = isoBandNextYLB[164] = -1; -isoBandNextOLB[6] = isoBandNextOLB[164] = 1; -isoBandNextXLT[6] = isoBandNextXLT[164] = 1; -isoBandNextYLT[6] = isoBandNextYLT[164] = 0; -isoBandNextOLT[6] = isoBandNextOLT[164] = 0; - -isoBandNextXBL[129] = isoBandNextXBL[41] = 0; -isoBandNextYBL[129] = isoBandNextYBL[41] = 1; -isoBandNextOBL[129] = isoBandNextOBL[41] = 1; -isoBandNextXLB[129] = isoBandNextXLB[41] = 0; -isoBandNextYLB[129] = isoBandNextYLB[41] = 1; -isoBandNextOLB[129] = isoBandNextOLB[41] = 0; -isoBandNextXTL[129] = isoBandNextXTL[41] = -1; -isoBandNextYTL[129] = isoBandNextYTL[41] = 0; -isoBandNextOTL[129] = isoBandNextOTL[41] = 0; -isoBandNextXTR[129] = isoBandNextXTR[41] = 0; -isoBandNextYTR[129] = isoBandNextYTR[41] = -1; -isoBandNextOTR[129] = isoBandNextOTR[41] = 0; - -isoBandNextXBR[66] = isoBandNextXBR[104] = 0; -isoBandNextYBR[66] = isoBandNextYBR[104] = 1; -isoBandNextOBR[66] = isoBandNextOBR[104] = 0; -isoBandNextXBL[66] = isoBandNextXBL[104] = -1; -isoBandNextYBL[66] = isoBandNextYBL[104] = 0; -isoBandNextOBL[66] = isoBandNextOBL[104] = 1; -isoBandNextXLT[66] = isoBandNextXLT[104] = 0; -isoBandNextYLT[66] = isoBandNextYLT[104] = -1; -isoBandNextOLT[66] = isoBandNextOLT[104] = 0; -isoBandNextXTL[66] = isoBandNextXTL[104] = 0; -isoBandNextYTL[66] = isoBandNextYTL[104] = -1; -isoBandNextOTL[66] = isoBandNextOTL[104] = 1; - -isoBandNextXRT[144] = isoBandNextXRT[26] = -1; -isoBandNextYRT[144] = isoBandNextYRT[26] = 0; -isoBandNextORT[144] = isoBandNextORT[26] = 0; -isoBandNextXLB[144] = isoBandNextXLB[26] = 1; -isoBandNextYLB[144] = isoBandNextYLB[26] = 0; -isoBandNextOLB[144] = isoBandNextOLB[26] = 1; -isoBandNextXLT[144] = isoBandNextXLT[26] = 0; -isoBandNextYLT[144] = isoBandNextYLT[26] = 1; -isoBandNextOLT[144] = isoBandNextOLT[26] = 1; -isoBandNextXTR[144] = isoBandNextXTR[26] = -1; -isoBandNextYTR[144] = isoBandNextYTR[26] = 0; -isoBandNextOTR[144] = isoBandNextOTR[26] = 1; - -isoBandNextXRB[36] = isoBandNextXRB[134] = 0; -isoBandNextYRB[36] = isoBandNextYRB[134] = 1; -isoBandNextORB[36] = isoBandNextORB[134] = 1; -isoBandNextXBR[36] = isoBandNextXBR[134] = 0; -isoBandNextYBR[36] = isoBandNextYBR[134] = 1; -isoBandNextOBR[36] = isoBandNextOBR[134] = 0; -isoBandNextXTL[36] = isoBandNextXTL[134] = 0; -isoBandNextYTL[36] = isoBandNextYTL[134] = -1; -isoBandNextOTL[36] = isoBandNextOTL[134] = 1; -isoBandNextXTR[36] = isoBandNextXTR[134] = 1; -isoBandNextYTR[36] = isoBandNextYTR[134] = 0; -isoBandNextOTR[36] = isoBandNextOTR[134] = 0; - -isoBandNextXRT[9] = isoBandNextXRT[161] = -1; -isoBandNextYRT[9] = isoBandNextYRT[161] = 0; -isoBandNextORT[9] = isoBandNextORT[161] = 0; -isoBandNextXRB[9] = isoBandNextXRB[161] = 0; -isoBandNextYRB[9] = isoBandNextYRB[161] = -1; -isoBandNextORB[9] = isoBandNextORB[161] = 0; -isoBandNextXBL[9] = isoBandNextXBL[161] = 1; -isoBandNextYBL[9] = isoBandNextYBL[161] = 0; -isoBandNextOBL[9] = isoBandNextOBL[161] = 0; -isoBandNextXLB[9] = isoBandNextXLB[161] = 1; -isoBandNextYLB[9] = isoBandNextYLB[161] = 0; -isoBandNextOLB[9] = isoBandNextOLB[161] = 1; - -/* 8-sided cases */ -isoBandNextXRT[136] = 0; -isoBandNextYRT[136] = 1; -isoBandNextORT[136] = 1; -isoBandNextXRB[136] = 0; -isoBandNextYRB[136] = 1; -isoBandNextORB[136] = 0; -isoBandNextXBR[136] = -1; -isoBandNextYBR[136] = 0; -isoBandNextOBR[136] = 1; -isoBandNextXBL[136] = -1; -isoBandNextYBL[136] = 0; -isoBandNextOBL[136] = 0; -isoBandNextXLB[136] = 0; -isoBandNextYLB[136] = -1; -isoBandNextOLB[136] = 0; -isoBandNextXLT[136] = 0; -isoBandNextYLT[136] = -1; -isoBandNextOLT[136] = 1; -isoBandNextXTL[136] = 1; -isoBandNextYTL[136] = 0; -isoBandNextOTL[136] = 0; -isoBandNextXTR[136] = 1; -isoBandNextYTR[136] = 0; -isoBandNextOTR[136] = 1; - -isoBandNextXRT[34] = 0; -isoBandNextYRT[34] = -1; -isoBandNextORT[34] = 0; -isoBandNextXRB[34] = 0; -isoBandNextYRB[34] = -1; -isoBandNextORB[34] = 1; -isoBandNextXBR[34] = 1; -isoBandNextYBR[34] = 0; -isoBandNextOBR[34] = 0; -isoBandNextXBL[34] = 1; -isoBandNextYBL[34] = 0; -isoBandNextOBL[34] = 1; -isoBandNextXLB[34] = 0; -isoBandNextYLB[34] = 1; -isoBandNextOLB[34] = 1; -isoBandNextXLT[34] = 0; -isoBandNextYLT[34] = 1; -isoBandNextOLT[34] = 0; -isoBandNextXTL[34] = -1; -isoBandNextYTL[34] = 0; -isoBandNextOTL[34] = 1; -isoBandNextXTR[34] = -1; -isoBandNextYTR[34] = 0; -isoBandNextOTR[34] = 0; - -isoBandNextXRT[35] = 0; -isoBandNextYRT[35] = 1; -isoBandNextORT[35] = 1; -isoBandNextXRB[35] = 0; -isoBandNextYRB[35] = -1; -isoBandNextORB[35] = 1; -isoBandNextXBR[35] = 1; -isoBandNextYBR[35] = 0; -isoBandNextOBR[35] = 0; -isoBandNextXBL[35] = -1; -isoBandNextYBL[35] = 0; -isoBandNextOBL[35] = 0; -isoBandNextXLB[35] = 0; -isoBandNextYLB[35] = -1; -isoBandNextOLB[35] = 0; -isoBandNextXLT[35] = 0; -isoBandNextYLT[35] = 1; -isoBandNextOLT[35] = 0; -isoBandNextXTL[35] = -1; -isoBandNextYTL[35] = 0; -isoBandNextOTL[35] = 1; -isoBandNextXTR[35] = 1; -isoBandNextYTR[35] = 0; -isoBandNextOTR[35] = 1; - -/* 6-sided cases */ -isoBandNextXRT[153] = 0; -isoBandNextYRT[153] = 1; -isoBandNextORT[153] = 1; -isoBandNextXBL[153] = -1; -isoBandNextYBL[153] = 0; -isoBandNextOBL[153] = 0; -isoBandNextXLB[153] = 0; -isoBandNextYLB[153] = -1; -isoBandNextOLB[153] = 0; -isoBandNextXTR[153] = 1; -isoBandNextYTR[153] = 0; -isoBandNextOTR[153] = 1; - -isoBandNextXRB[102] = 0; -isoBandNextYRB[102] = -1; -isoBandNextORB[102] = 1; -isoBandNextXBR[102] = 1; -isoBandNextYBR[102] = 0; -isoBandNextOBR[102] = 0; -isoBandNextXLT[102] = 0; -isoBandNextYLT[102] = 1; -isoBandNextOLT[102] = 0; -isoBandNextXTL[102] = -1; -isoBandNextYTL[102] = 0; -isoBandNextOTL[102] = 1; - -isoBandNextXRT[155] = 0; -isoBandNextYRT[155] = -1; -isoBandNextORT[155] = 0; -isoBandNextXBL[155] = 1; -isoBandNextYBL[155] = 0; -isoBandNextOBL[155] = 1; -isoBandNextXLB[155] = 0; -isoBandNextYLB[155] = 1; -isoBandNextOLB[155] = 1; -isoBandNextXTR[155] = -1; -isoBandNextYTR[155] = 0; -isoBandNextOTR[155] = 0; - -isoBandNextXRB[103] = 0; -isoBandNextYRB[103] = 1; -isoBandNextORB[103] = 0; -isoBandNextXBR[103] = -1; -isoBandNextYBR[103] = 0; -isoBandNextOBR[103] = 1; -isoBandNextXLT[103] = 0; -isoBandNextYLT[103] = -1; -isoBandNextOLT[103] = 1; -isoBandNextXTL[103] = 1; -isoBandNextYTL[103] = 0; -isoBandNextOTL[103] = 0; - -/* 7-sided cases */ -isoBandNextXRT[152] = 0; -isoBandNextYRT[152] = 1; -isoBandNextORT[152] = 1; -isoBandNextXBR[152] = -1; -isoBandNextYBR[152] = 0; -isoBandNextOBR[152] = 1; -isoBandNextXBL[152] = -1; -isoBandNextYBL[152] = 0; -isoBandNextOBL[152] = 0; -isoBandNextXLB[152] = 0; -isoBandNextYLB[152] = -1; -isoBandNextOLB[152] = 0; -isoBandNextXLT[152] = 0; -isoBandNextYLT[152] = -1; -isoBandNextOLT[152] = 1; -isoBandNextXTR[152] = 1; -isoBandNextYTR[152] = 0; -isoBandNextOTR[152] = 1; - -isoBandNextXRT[156] = 0; -isoBandNextYRT[156] = -1; -isoBandNextORT[156] = 1; -isoBandNextXBR[156] = 1; -isoBandNextYBR[156] = 0; -isoBandNextOBR[156] = 1; -isoBandNextXBL[156] = -1; -isoBandNextYBL[156] = 0; -isoBandNextOBL[156] = 0; -isoBandNextXLB[156] = 0; -isoBandNextYLB[156] = -1; -isoBandNextOLB[156] = 0; -isoBandNextXLT[156] = 0; -isoBandNextYLT[156] = 1; -isoBandNextOLT[156] = 1; -isoBandNextXTR[156] = -1; -isoBandNextYTR[156] = 0; -isoBandNextOTR[156] = 1; - -isoBandNextXRT[137] = 0; -isoBandNextYRT[137] = 1; -isoBandNextORT[137] = 1; -isoBandNextXRB[137] = 0; -isoBandNextYRB[137] = 1; -isoBandNextORB[137] = 0; -isoBandNextXBL[137] = -1; -isoBandNextYBL[137] = 0; -isoBandNextOBL[137] = 0; -isoBandNextXLB[137] = 0; -isoBandNextYLB[137] = -1; -isoBandNextOLB[137] = 0; -isoBandNextXTL[137] = 1; -isoBandNextYTL[137] = 0; -isoBandNextOTL[137] = 0; -isoBandNextXTR[137] = 1; -isoBandNextYTR[137] = 0; -isoBandNextOTR[137] = 1; - -isoBandNextXRT[139] = 0; -isoBandNextYRT[139] = 1; -isoBandNextORT[139] = 1; -isoBandNextXRB[139] = 0; -isoBandNextYRB[139] = -1; -isoBandNextORB[139] = 0; -isoBandNextXBL[139] = 1; -isoBandNextYBL[139] = 0; -isoBandNextOBL[139] = 0; -isoBandNextXLB[139] = 0; -isoBandNextYLB[139] = 1; -isoBandNextOLB[139] = 0; -isoBandNextXTL[139] = -1; -isoBandNextYTL[139] = 0; -isoBandNextOTL[139] = 0; -isoBandNextXTR[139] = 1; -isoBandNextYTR[139] = 0; -isoBandNextOTR[139] = 1; - -isoBandNextXRT[98] = 0; -isoBandNextYRT[98] = -1; -isoBandNextORT[98] = 0; -isoBandNextXRB[98] = 0; -isoBandNextYRB[98] = -1; -isoBandNextORB[98] = 1; -isoBandNextXBR[98] = 1; -isoBandNextYBR[98] = 0; -isoBandNextOBR[98] = 0; -isoBandNextXBL[98] = 1; -isoBandNextYBL[98] = 0; -isoBandNextOBL[98] = 1; -isoBandNextXLT[98] = 0; -isoBandNextYLT[98] = 1; -isoBandNextOLT[98] = 0; -isoBandNextXTL[98] = -1; -isoBandNextYTL[98] = 0; -isoBandNextOTL[98] = 1; - -isoBandNextXRT[99] = 0; -isoBandNextYRT[99] = 1; -isoBandNextORT[99] = 0; -isoBandNextXRB[99] = 0; -isoBandNextYRB[99] = -1; -isoBandNextORB[99] = 1; -isoBandNextXBR[99] = 1; -isoBandNextYBR[99] = 0; -isoBandNextOBR[99] = 0; -isoBandNextXBL[99] = -1; -isoBandNextYBL[99] = 0; -isoBandNextOBL[99] = 1; -isoBandNextXLT[99] = 0; -isoBandNextYLT[99] = -1; -isoBandNextOLT[99] = 0; -isoBandNextXTL[99] = 1; -isoBandNextYTL[99] = 0; -isoBandNextOTL[99] = 1; - -isoBandNextXRB[38] = 0; -isoBandNextYRB[38] = -1; -isoBandNextORB[38] = 1; -isoBandNextXBR[38] = 1; -isoBandNextYBR[38] = 0; -isoBandNextOBR[38] = 0; -isoBandNextXLB[38] = 0; -isoBandNextYLB[38] = 1; -isoBandNextOLB[38] = 1; -isoBandNextXLT[38] = 0; -isoBandNextYLT[38] = 1; -isoBandNextOLT[38] = 0; -isoBandNextXTL[38] = -1; -isoBandNextYTL[38] = 0; -isoBandNextOTL[38] = 1; -isoBandNextXTR[38] = -1; -isoBandNextYTR[38] = 0; -isoBandNextOTR[38] = 0; - -isoBandNextXRB[39] = 0; -isoBandNextYRB[39] = 1; -isoBandNextORB[39] = 1; -isoBandNextXBR[39] = -1; -isoBandNextYBR[39] = 0; -isoBandNextOBR[39] = 0; -isoBandNextXLB[39] = 0; -isoBandNextYLB[39] = -1; -isoBandNextOLB[39] = 1; -isoBandNextXLT[39] = 0; -isoBandNextYLT[39] = 1; -isoBandNextOLT[39] = 0; -isoBandNextXTL[39] = -1; -isoBandNextYTL[39] = 0; -isoBandNextOTL[39] = 1; -isoBandNextXTR[39] = 1; -isoBandNextYTR[39] = 0; -isoBandNextOTR[39] = 0; - -/* - Define helper functions for the polygon_table - */ - -/* triangle cases */ -var p00 = function (cell) { - return [ - [cell.bottomleft, 0], - [0, 0], - [0, cell.leftbottom], - ]; -}; -var p01 = function (cell) { - return [ - [1, cell.rightbottom], - [1, 0], - [cell.bottomright, 0], - ]; -}; -var p02 = function (cell) { - return [ - [cell.topright, 1], - [1, 1], - [1, cell.righttop], - ]; -}; -var p03 = function (cell) { - return [ - [0, cell.lefttop], - [0, 1], - [cell.topleft, 1], - ]; -}; -/* trapezoid cases */ -var p04 = function (cell) { - return [ - [cell.bottomright, 0], - [cell.bottomleft, 0], - [0, cell.leftbottom], - [0, cell.lefttop], - ]; -}; -var p05 = function (cell) { - return [ - [cell.bottomright, 0], - [cell.bottomleft, 0], - [1, cell.righttop], - [1, cell.rightbottom], - ]; -}; -var p06 = function (cell) { - return [ - [1, cell.righttop], - [1, cell.rightbottom], - [cell.topleft, 1], - [cell.topright, 1], - ]; -}; -var p07 = function (cell) { - return [ - [0, cell.leftbottom], - [0, cell.lefttop], - [cell.topleft, 1], - [cell.topright, 1], - ]; -}; -/* rectangle cases */ -var p08 = function (cell) { - return [ - [0, 0], - [0, cell.leftbottom], - [1, cell.rightbottom], - [1, 0], - ]; -}; -var p09 = function (cell) { - return [ - [1, 0], - [cell.bottomright, 0], - [cell.topright, 1], - [1, 1], - ]; -}; -var p10 = function (cell) { - return [ - [1, 1], - [1, cell.righttop], - [0, cell.lefttop], - [0, 1], - ]; -}; -var p11 = function (cell) { - return [ - [cell.bottomleft, 0], - [0, 0], - [0, 1], - [cell.topleft, 1], - ]; -}; -var p12 = function (cell) { - return [ - [1, cell.righttop], - [1, cell.rightbottom], - [0, cell.leftbottom], - [0, cell.lefttop], - ]; -}; -var p13 = function (cell) { - return [ - [cell.topleft, 1], - [cell.topright, 1], - [cell.bottomright, 0], - [cell.bottomleft, 0], - ]; -}; -/* square case */ -var p14 = function () { - return [ - [0, 0], - [0, 1], - [1, 1], - [1, 0], - ]; -}; -/* pentagon cases */ -var p15 = function (cell) { - return [ - [1, cell.rightbottom], - [1, 0], - [0, 0], - [0, 1], - [cell.topleft, 1], - ]; -}; -/* 1211 || 1011 */ -var p16 = function (cell) { - return [ - [cell.topright, 1], - [1, 1], - [1, 0], - [0, 0], - [0, cell.leftbottom], - ]; -}; -/* 2111 || 0111 */ -var p17 = function (cell) { - return [ - [1, 0], - [cell.bottomright, 0], - [0, cell.lefttop], - [0, 1], - [1, 1], - ]; -}; -/* 1112 || 1110 */ -var p18 = function (cell) { - return [ - [1, 1], - [1, cell.righttop], - [cell.bottomleft, 0], - [0, 0], - [0, 1], - ]; -}; -/* 1121 || 1101 */ -var p19 = function (cell) { - return [ - [1, cell.righttop], - [1, cell.rightbottom], - [0, cell.lefttop], - [0, 1], - [cell.topleft, 1], - ]; -}; -/* 1200 || 1022 */ -var p20 = function (cell) { - return [ - [1, 1], - [1, cell.righttop], - [cell.bottomright, 0], - [cell.bottomleft, 0], - [cell.topright, 1], - ]; -}; -/* 0120 || 2102 */ -var p21 = function (cell) { - return [ - [1, cell.rightbottom], - [1, 0], - [cell.bottomright, 0], - [0, cell.leftbottom], - [0, cell.lefttop], - ]; -}; -/* 0012 || 2210 */ -var p22 = function (cell) { - return [ - [cell.topright, 1], - [cell.bottomleft, 0], - [0, 0], - [0, cell.leftbottom], - [cell.topleft, 1], - ]; -}; -/* 2001 || 0221 */ -var p23 = function (cell) { - return [ - [cell.bottomright, 0], - [cell.bottomleft, 0], - [0, cell.lefttop], - [0, 1], - [cell.topleft, 1], - ]; -}; -/* 1002 || 1220 */ -var p24 = function (cell) { - return [ - [1, 1], - [1, cell.righttop], - [0, cell.leftbottom], - [0, cell.lefttop], - [cell.topright, 1], - ]; -}; -/* 2100 || 0122 */ -var p25 = function (cell) { - return [ - [1, cell.rightbottom], - [1, 0], - [cell.bottomright, 0], - [cell.topleft, 1], - [cell.topright, 1], - ]; -}; -/* 0210 || 2012 */ -var p26 = function (cell) { - return [ - [1, cell.righttop], - [1, cell.rightbottom], - [cell.bottomleft, 0], - [0, 0], - [0, cell.leftbottom], - ]; -}; -/* 0021 || 2201 */ -/*hexagon cases */ -var p27 = function (cell) { - return [ - [1, cell.rightbottom], - [1, 0], - [0, 0], - [0, cell.leftbottom], - [cell.topleft, 1], - [cell.topright, 1], - ]; -}; -/* 0211 || 2011 */ -var p28 = function (cell) { - return [ - [1, 1], - [1, 0], - [cell.bottomright, 0], - [0, cell.leftbottom], - [0, cell.lefttop], - [cell.topright, 1], - ]; -}; -/* 2110 || 0112 */ -var p29 = function (cell) { - return [ - [1, 1], - [1, cell.righttop], - [cell.bottomright, 0], - [cell.bottomleft, 0], - [0, cell.lefttop], - [0, 1], - ]; -}; -/* 1102 || 1120 */ -var p30 = function (cell) { - return [ - [1, cell.righttop], - [1, cell.rightbottom], - [cell.bottomleft, 0], - [0, 0], - [0, 1], - [cell.topleft, 1], - ]; -}; -/* 1021 || 1201 */ -var p31 = function (cell) { - return [ - [1, 1], - [1, cell.righttop], - [cell.bottomleft, 0], - [0, 0], - [0, cell.leftbottom], - [cell.topright, 1], - ]; -}; -/* 2101 || 0121 */ -var p32 = function (cell) { - return [ - [1, cell.rightbottom], - [1, 0], - [cell.bottomright, 0], - [0, cell.lefttop], - [0, 1], - [cell.topleft, 1], - ]; -}; -/* 1012 || 1210 */ -/* 8-sided cases */ -var p33 = function (cell) { - return [ - [1, cell.righttop], - [1, cell.rightbottom], - [cell.bottomright, 0], - [cell.bottomleft, 0], - [0, cell.leftbottom], - [0, cell.lefttop], - [cell.topleft, 1], - [cell.topright, 1], - ]; -}; -/* flipped == 1 state for 0202 and 2020 */ -/* 6-sided cases */ -var p34 = function (cell) { - return [ - [1, 1], - [1, cell.righttop], - [cell.bottomleft, 0], - [0, 0], - [0, cell.leftbottom], - [cell.topright, 1], - ]; -}; -/* 0101 with flipped == 1 || 2121 with flipped == 1 */ -var p35 = function (cell) { - return [ - [1, cell.rightbottom], - [1, 0], - [cell.bottomright, 0], - [0, cell.lefttop], - [0, 1], - [cell.topleft, 1], - ]; -}; -/* 1010 with flipped == 1 || 1212 with flipped == 1 */ -/* 7-sided cases */ -var p36 = function (cell) { - return [ - [1, 1], - [1, cell.righttop], - [cell.bottomright, 0], - [cell.bottomleft, 0], - [0, cell.leftbottom], - [0, cell.lefttop], - [cell.topright, 1], - ]; -}; -/* 2120 with flipped == 1 || 0102 with flipped == 1 */ -var p37 = function (cell) { - return [ - [1, cell.righttop], - [1, cell.rightbottom], - [cell.bottomleft, 0], - [0, 0], - [0, cell.leftbottom], - [cell.topleft, 1], - [cell.topright, 1], - ]; -}; -/* 2021 with flipped == 1 || 0201 with flipped == 1 */ -var p38 = function (cell) { - return [ - [1, cell.righttop], - [1, cell.rightbottom], - [cell.bottomright, 0], - [cell.bottomleft, 0], - [0, cell.lefttop], - [0, 1], - [cell.topleft, 1], - ]; -}; -/* 1202 with flipped == 1 || 1020 with flipped == 1 */ -var p39 = function (cell) { - return [ - [1, cell.rightbottom], - [1, 0], - [cell.bottomright, 0], - [0, cell.leftbottom], - [0, cell.lefttop], - [cell.topleft, 1], - [cell.topright, 1], - ]; -}; -/* 0212 with flipped == 1 || 2010 with flipped == 1 */ - -/* - The lookup tables for edge number given the polygon - is entered at a specific location -*/ - -var isoBandEdgeRT = []; -var isoBandEdgeRB = []; -var isoBandEdgeBR = []; -var isoBandEdgeBL = []; -var isoBandEdgeLB = []; -var isoBandEdgeLT = []; -var isoBandEdgeTL = []; -var isoBandEdgeTR = []; - -/* triangle cases */ -isoBandEdgeBL[1] = isoBandEdgeLB[1] = 18; -isoBandEdgeBL[169] = isoBandEdgeLB[169] = 18; -isoBandEdgeBR[4] = isoBandEdgeRB[4] = 12; -isoBandEdgeBR[166] = isoBandEdgeRB[166] = 12; -isoBandEdgeRT[16] = isoBandEdgeTR[16] = 4; -isoBandEdgeRT[154] = isoBandEdgeTR[154] = 4; -isoBandEdgeLT[64] = isoBandEdgeTL[64] = 22; -isoBandEdgeLT[106] = isoBandEdgeTL[106] = 22; - -/* trapezoid cases */ -isoBandEdgeBR[2] = isoBandEdgeLT[2] = 17; -isoBandEdgeBL[2] = isoBandEdgeLB[2] = 18; -isoBandEdgeBR[168] = isoBandEdgeLT[168] = 17; -isoBandEdgeBL[168] = isoBandEdgeLB[168] = 18; -isoBandEdgeRT[8] = isoBandEdgeBL[8] = 9; -isoBandEdgeRB[8] = isoBandEdgeBR[8] = 12; -isoBandEdgeRT[162] = isoBandEdgeBL[162] = 9; -isoBandEdgeRB[162] = isoBandEdgeBR[162] = 12; -isoBandEdgeRT[32] = isoBandEdgeTR[32] = 4; -isoBandEdgeRB[32] = isoBandEdgeTL[32] = 1; -isoBandEdgeRT[138] = isoBandEdgeTR[138] = 4; -isoBandEdgeRB[138] = isoBandEdgeTL[138] = 1; -isoBandEdgeLB[128] = isoBandEdgeTR[128] = 21; -isoBandEdgeLT[128] = isoBandEdgeTL[128] = 22; -isoBandEdgeLB[42] = isoBandEdgeTR[42] = 21; -isoBandEdgeLT[42] = isoBandEdgeTL[42] = 22; - -/* rectangle cases */ -isoBandEdgeRB[5] = isoBandEdgeLB[5] = 14; -isoBandEdgeRB[165] = isoBandEdgeLB[165] = 14; -isoBandEdgeBR[20] = isoBandEdgeTR[20] = 6; -isoBandEdgeBR[150] = isoBandEdgeTR[150] = 6; -isoBandEdgeRT[80] = isoBandEdgeLT[80] = 11; -isoBandEdgeRT[90] = isoBandEdgeLT[90] = 11; -isoBandEdgeBL[65] = isoBandEdgeTL[65] = 3; -isoBandEdgeBL[105] = isoBandEdgeTL[105] = 3; -isoBandEdgeRT[160] = isoBandEdgeLT[160] = 11; -isoBandEdgeRB[160] = isoBandEdgeLB[160] = 14; -isoBandEdgeRT[10] = isoBandEdgeLT[10] = 11; -isoBandEdgeRB[10] = isoBandEdgeLB[10] = 14; -isoBandEdgeBR[130] = isoBandEdgeTR[130] = 6; -isoBandEdgeBL[130] = isoBandEdgeTL[130] = 3; -isoBandEdgeBR[40] = isoBandEdgeTR[40] = 6; -isoBandEdgeBL[40] = isoBandEdgeTL[40] = 3; - -/* pentagon cases */ -isoBandEdgeRB[101] = isoBandEdgeTL[101] = 1; -isoBandEdgeRB[69] = isoBandEdgeTL[69] = 1; -isoBandEdgeLB[149] = isoBandEdgeTR[149] = 21; -isoBandEdgeLB[21] = isoBandEdgeTR[21] = 21; -isoBandEdgeBR[86] = isoBandEdgeLT[86] = 17; -isoBandEdgeBR[84] = isoBandEdgeLT[84] = 17; -isoBandEdgeRT[89] = isoBandEdgeBL[89] = 9; -isoBandEdgeRT[81] = isoBandEdgeBL[81] = 9; -isoBandEdgeRT[96] = isoBandEdgeTL[96] = 0; -isoBandEdgeRB[96] = isoBandEdgeLT[96] = 15; -isoBandEdgeRT[74] = isoBandEdgeTL[74] = 0; -isoBandEdgeRB[74] = isoBandEdgeLT[74] = 15; -isoBandEdgeRT[24] = isoBandEdgeBR[24] = 8; -isoBandEdgeBL[24] = isoBandEdgeTR[24] = 7; -isoBandEdgeRT[146] = isoBandEdgeBR[146] = 8; -isoBandEdgeBL[146] = isoBandEdgeTR[146] = 7; -isoBandEdgeRB[6] = isoBandEdgeLT[6] = 15; -isoBandEdgeBR[6] = isoBandEdgeLB[6] = 16; -isoBandEdgeRB[164] = isoBandEdgeLT[164] = 15; -isoBandEdgeBR[164] = isoBandEdgeLB[164] = 16; -isoBandEdgeBL[129] = isoBandEdgeTR[129] = 7; -isoBandEdgeLB[129] = isoBandEdgeTL[129] = 20; -isoBandEdgeBL[41] = isoBandEdgeTR[41] = 7; -isoBandEdgeLB[41] = isoBandEdgeTL[41] = 20; -isoBandEdgeBR[66] = isoBandEdgeTL[66] = 2; -isoBandEdgeBL[66] = isoBandEdgeLT[66] = 19; -isoBandEdgeBR[104] = isoBandEdgeTL[104] = 2; -isoBandEdgeBL[104] = isoBandEdgeLT[104] = 19; -isoBandEdgeRT[144] = isoBandEdgeLB[144] = 10; -isoBandEdgeLT[144] = isoBandEdgeTR[144] = 23; -isoBandEdgeRT[26] = isoBandEdgeLB[26] = 10; -isoBandEdgeLT[26] = isoBandEdgeTR[26] = 23; -isoBandEdgeRB[36] = isoBandEdgeTR[36] = 5; -isoBandEdgeBR[36] = isoBandEdgeTL[36] = 2; -isoBandEdgeRB[134] = isoBandEdgeTR[134] = 5; -isoBandEdgeBR[134] = isoBandEdgeTL[134] = 2; -isoBandEdgeRT[9] = isoBandEdgeLB[9] = 10; -isoBandEdgeRB[9] = isoBandEdgeBL[9] = 13; -isoBandEdgeRT[161] = isoBandEdgeLB[161] = 10; -isoBandEdgeRB[161] = isoBandEdgeBL[161] = 13; - -/* hexagon cases */ -isoBandEdgeRB[37] = isoBandEdgeTR[37] = 5; -isoBandEdgeLB[37] = isoBandEdgeTL[37] = 20; -isoBandEdgeRB[133] = isoBandEdgeTR[133] = 5; -isoBandEdgeLB[133] = isoBandEdgeTL[133] = 20; -isoBandEdgeBR[148] = isoBandEdgeLB[148] = 16; -isoBandEdgeLT[148] = isoBandEdgeTR[148] = 23; -isoBandEdgeBR[22] = isoBandEdgeLB[22] = 16; -isoBandEdgeLT[22] = isoBandEdgeTR[22] = 23; -isoBandEdgeRT[82] = isoBandEdgeBR[82] = 8; -isoBandEdgeBL[82] = isoBandEdgeLT[82] = 19; -isoBandEdgeRT[88] = isoBandEdgeBR[88] = 8; -isoBandEdgeBL[88] = isoBandEdgeLT[88] = 19; -isoBandEdgeRT[73] = isoBandEdgeTL[73] = 0; -isoBandEdgeRB[73] = isoBandEdgeBL[73] = 13; -isoBandEdgeRT[97] = isoBandEdgeTL[97] = 0; -isoBandEdgeRB[97] = isoBandEdgeBL[97] = 13; -isoBandEdgeRT[145] = isoBandEdgeBL[145] = 9; -isoBandEdgeLB[145] = isoBandEdgeTR[145] = 21; -isoBandEdgeRT[25] = isoBandEdgeBL[25] = 9; -isoBandEdgeLB[25] = isoBandEdgeTR[25] = 21; -isoBandEdgeRB[70] = isoBandEdgeTL[70] = 1; -isoBandEdgeBR[70] = isoBandEdgeLT[70] = 17; -isoBandEdgeRB[100] = isoBandEdgeTL[100] = 1; -isoBandEdgeBR[100] = isoBandEdgeLT[100] = 17; - -/* 8-sided cases */ -isoBandEdgeRT[34] = isoBandEdgeBL[34] = 9; -isoBandEdgeRB[34] = isoBandEdgeBR[34] = 12; -isoBandEdgeLB[34] = isoBandEdgeTR[34] = 21; -isoBandEdgeLT[34] = isoBandEdgeTL[34] = 22; -isoBandEdgeRT[136] = isoBandEdgeTR[136] = 4; -isoBandEdgeRB[136] = isoBandEdgeTL[136] = 1; -isoBandEdgeBR[136] = isoBandEdgeLT[136] = 17; -isoBandEdgeBL[136] = isoBandEdgeLB[136] = 18; -isoBandEdgeRT[35] = isoBandEdgeTR[35] = 4; -isoBandEdgeRB[35] = isoBandEdgeBR[35] = 12; -isoBandEdgeBL[35] = isoBandEdgeLB[35] = 18; -isoBandEdgeLT[35] = isoBandEdgeTL[35] = 22; - -/* 6-sided cases */ -isoBandEdgeRT[153] = isoBandEdgeTR[153] = 4; -isoBandEdgeBL[153] = isoBandEdgeLB[153] = 18; -isoBandEdgeRB[102] = isoBandEdgeBR[102] = 12; -isoBandEdgeLT[102] = isoBandEdgeTL[102] = 22; -isoBandEdgeRT[155] = isoBandEdgeBL[155] = 9; -isoBandEdgeLB[155] = isoBandEdgeTR[155] = 23; -isoBandEdgeRB[103] = isoBandEdgeTL[103] = 1; -isoBandEdgeBR[103] = isoBandEdgeLT[103] = 17; - -/* 7-sided cases */ -isoBandEdgeRT[152] = isoBandEdgeTR[152] = 4; -isoBandEdgeBR[152] = isoBandEdgeLT[152] = 17; -isoBandEdgeBL[152] = isoBandEdgeLB[152] = 18; -isoBandEdgeRT[156] = isoBandEdgeBR[156] = 8; -isoBandEdgeBL[156] = isoBandEdgeLB[156] = 18; -isoBandEdgeLT[156] = isoBandEdgeTR[156] = 23; -isoBandEdgeRT[137] = isoBandEdgeTR[137] = 4; -isoBandEdgeRB[137] = isoBandEdgeTL[137] = 1; -isoBandEdgeBL[137] = isoBandEdgeLB[137] = 18; -isoBandEdgeRT[139] = isoBandEdgeTR[139] = 4; -isoBandEdgeRB[139] = isoBandEdgeBL[139] = 13; -isoBandEdgeLB[139] = isoBandEdgeTL[139] = 20; -isoBandEdgeRT[98] = isoBandEdgeBL[98] = 9; -isoBandEdgeRB[98] = isoBandEdgeBR[98] = 12; -isoBandEdgeLT[98] = isoBandEdgeTL[98] = 22; -isoBandEdgeRT[99] = isoBandEdgeTL[99] = 0; -isoBandEdgeRB[99] = isoBandEdgeBR[99] = 12; -isoBandEdgeBL[99] = isoBandEdgeLT[99] = 19; -isoBandEdgeRB[38] = isoBandEdgeBR[38] = 12; -isoBandEdgeLB[38] = isoBandEdgeTR[38] = 21; -isoBandEdgeLT[38] = isoBandEdgeTL[38] = 22; -isoBandEdgeRB[39] = isoBandEdgeTR[39] = 5; -isoBandEdgeBR[39] = isoBandEdgeLB[39] = 16; -isoBandEdgeLT[39] = isoBandEdgeTL[39] = 22; - -/* - The lookup tables for all different polygons that - may appear within a grid cell -*/ - -var polygon_table = []; - -/* triangle cases */ -polygon_table[1] = polygon_table[169] = p00; /* 2221 || 0001 */ -polygon_table[4] = polygon_table[166] = p01; /* 2212 || 0010 */ -polygon_table[16] = polygon_table[154] = p02; /* 2122 || 0100 */ -polygon_table[64] = polygon_table[106] = p03; /* 1222 || 1000 */ - -/* trapezoid cases */ -polygon_table[168] = polygon_table[2] = p04; /* 2220 || 0002 */ -polygon_table[162] = polygon_table[8] = p05; /* 2202 || 0020 */ -polygon_table[138] = polygon_table[32] = p06; /* 2022 || 0200 */ -polygon_table[42] = polygon_table[128] = p07; /* 0222 || 2000 */ - -/* rectangle cases */ -polygon_table[5] = polygon_table[165] = p08; /* 0011 || 2211 */ -polygon_table[20] = polygon_table[150] = p09; /* 0110 || 2112 */ -polygon_table[80] = polygon_table[90] = p10; /* 1100 || 1122 */ -polygon_table[65] = polygon_table[105] = p11; /* 1001 || 1221 */ -polygon_table[160] = polygon_table[10] = p12; /* 2200 || 0022 */ -polygon_table[130] = polygon_table[40] = p13; /* 2002 || 0220 */ - -/* square case */ -polygon_table[85] = p14; /* 1111 */ - -/* pentagon cases */ -polygon_table[101] = polygon_table[69] = p15; /* 1211 || 1011 */ -polygon_table[149] = polygon_table[21] = p16; /* 2111 || 0111 */ -polygon_table[86] = polygon_table[84] = p17; /* 1112 || 1110 */ -polygon_table[89] = polygon_table[81] = p18; /* 1121 || 1101 */ -polygon_table[96] = polygon_table[74] = p19; /* 1200 || 1022 */ -polygon_table[24] = polygon_table[146] = p20; /* 0120 || 2102 */ -polygon_table[6] = polygon_table[164] = p21; /* 0012 || 2210 */ -polygon_table[129] = polygon_table[41] = p22; /* 2001 || 0221 */ -polygon_table[66] = polygon_table[104] = p23; /* 1002 || 1220 */ -polygon_table[144] = polygon_table[26] = p24; /* 2100 || 0122 */ -polygon_table[36] = polygon_table[134] = p25; /* 0210 || 2012 */ -polygon_table[9] = polygon_table[161] = p26; /* 0021 || 2201 */ - -/* hexagon cases */ -polygon_table[37] = polygon_table[133] = p27; /* 0211 || 2011 */ -polygon_table[148] = polygon_table[22] = p28; /* 2110 || 0112 */ -polygon_table[82] = polygon_table[88] = p29; /* 1102 || 1120 */ -polygon_table[73] = polygon_table[97] = p30; /* 1021 || 1201 */ -polygon_table[145] = polygon_table[25] = p31; /* 2101 || 0121 */ -polygon_table[70] = polygon_table[100] = p32; /* 1012 || 1210 */ - -/* 8-sided cases */ -polygon_table[34] = function (c) { - return [p07(c), p05(c)]; -}; /* 0202 || 2020 with flipped == 0 */ -polygon_table[35] = p33; /* flipped == 1 state for 0202 and 2020 */ -polygon_table[136] = function (c) { - return [p06(c), p04(c)]; -}; /* 2020 || 0202 with flipped == 0 */ - -/* 6-sided cases */ -polygon_table[153] = function (c) { - return [p02(c), p00(c)]; -}; /* 0101 with flipped == 0 || 2121 with flipped == 2 */ -polygon_table[102] = function (c) { - return [p01(c), p03(c)]; -}; /* 1010 with flipped == 0 || 1212 with flipped == 2 */ -polygon_table[155] = p34; /* 0101 with flipped == 1 || 2121 with flipped == 1 */ -polygon_table[103] = p35; /* 1010 with flipped == 1 || 1212 with flipped == 1 */ - -/* 7-sided cases */ -polygon_table[152] = function (c) { - return [p02(c), p04(c)]; -}; /* 2120 with flipped == 2 || 0102 with flipped == 0 */ -polygon_table[156] = p36; /* 2120 with flipped == 1 || 0102 with flipped == 1 */ -polygon_table[137] = function (c) { - return [p06(c), p00(c)]; -}; /* 2021 with flipped == 2 || 0201 with flipped == 0 */ -polygon_table[139] = p37; /* 2021 with flipped == 1 || 0201 with flipped == 1 */ -polygon_table[98] = function (c) { - return [p05(c), p03(c)]; -}; /* 1202 with flipped == 2 || 1020 with flipped == 0 */ -polygon_table[99] = p38; /* 1202 with flipped == 1 || 1020 with flipped == 1 */ -polygon_table[38] = function (c) { - return [p01(c), p07(c)]; -}; /* 0212 with flipped == 2 || 2010 with flipped == 0 */ -polygon_table[39] = p39; /* 0212 with flipped == 1 || 2010 with flipped == 1 */ - -/* -#################################### -Some small helper functions -#################################### -*/ - -/* assume that x1 == 1 && x0 == 0 */ -function interpolateX(y, y0, y1) { - return (y - y0) / (y1 - y0); -} - -function isArray(myArray) { - return myArray.constructor.toString().indexOf("Array") > -1; -} - -/* -#################################### -Below is the actual Marching Squares implementation -#################################### -*/ - -function computeBandGrid(data, minV, bandwidth) { - var rows = data.length - 1; - var cols = data[0].length - 1; - var BandGrid = { rows: rows, cols: cols, cells: [] }; - - var maxV = minV + Math.abs(bandwidth); - - for (var j = 0; j < rows; ++j) { - BandGrid.cells[j] = []; - for (var i = 0; i < cols; ++i) { - /* compose the 4-trit corner representation */ - var cval = 0; - - var tl = data[j + 1][i]; - var tr = data[j + 1][i + 1]; - var br = data[j][i + 1]; - var bl = data[j][i]; - - if (isNaN(tl) || isNaN(tr) || isNaN(br) || isNaN(bl)) { - continue; - } - - cval |= tl < minV ? 0 : tl > maxV ? 128 : 64; - cval |= tr < minV ? 0 : tr > maxV ? 32 : 16; - cval |= br < minV ? 0 : br > maxV ? 8 : 4; - cval |= bl < minV ? 0 : bl > maxV ? 2 : 1; - - var cval_real = +cval; - - /* resolve ambiguity via averaging */ - var flipped = 0; - if ( - cval === 17 /* 0101 */ || - cval === 18 /* 0102 */ || - cval === 33 /* 0201 */ || - cval === 34 /* 0202 */ || - cval === 38 /* 0212 */ || - cval === 68 /* 1010 */ || - cval === 72 /* 1020 */ || - cval === 98 /* 1202 */ || - cval === 102 /* 1212 */ || - cval === 132 /* 2010 */ || - cval === 136 /* 2020 */ || - cval === 137 /* 2021 */ || - cval === 152 /* 2120 */ || - cval === 153 /* 2121 */ - ) { - var average = (tl + tr + br + bl) / 4; - /* set flipped state */ - flipped = average > maxV ? 2 : average < minV ? 0 : 1; - - /* adjust cval for flipped cases */ - - /* 8-sided cases */ - if (cval === 34) { - if (flipped === 1) { - cval = 35; - } else if (flipped === 0) { - cval = 136; - } - } else if (cval === 136) { - if (flipped === 1) { - cval = 35; - flipped = 4; - } else if (flipped === 0) { - cval = 34; - } - } else if (cval === 17) { - /* 6-sided polygon cases */ - if (flipped === 1) { - cval = 155; - flipped = 4; - } else if (flipped === 0) { - cval = 153; - } - } else if (cval === 68) { - if (flipped === 1) { - cval = 103; - flipped = 4; - } else if (flipped === 0) { - cval = 102; - } - } else if (cval === 153) { - if (flipped === 1) cval = 155; - } else if (cval === 102) { - if (flipped === 1) cval = 103; - } else if (cval === 152) { - /* 7-sided polygon cases */ - if (flipped < 2) { - cval = 156; - flipped = 1; - } - } else if (cval === 137) { - if (flipped < 2) { - cval = 139; - flipped = 1; - } - } else if (cval === 98) { - if (flipped < 2) { - cval = 99; - flipped = 1; - } - } else if (cval === 38) { - if (flipped < 2) { - cval = 39; - flipped = 1; - } - } else if (cval === 18) { - if (flipped > 0) { - cval = 156; - flipped = 4; - } else { - cval = 152; - } - } else if (cval === 33) { - if (flipped > 0) { - cval = 139; - flipped = 4; - } else { - cval = 137; - } - } else if (cval === 72) { - if (flipped > 0) { - cval = 99; - flipped = 4; - } else { - cval = 98; - } - } else if (cval === 132) { - if (flipped > 0) { - cval = 39; - flipped = 4; - } else { - cval = 38; - } - } - } - - /* add cell to BandGrid if it contains at least one polygon-side */ - if (cval != 0 && cval != 170) { - var topleft, - topright, - bottomleft, - bottomright, - righttop, - rightbottom, - lefttop, - leftbottom; - - topleft = topright = bottomleft = bottomright = righttop = rightbottom = lefttop = leftbottom = 0.5; - - var edges = []; - - /* do interpolation here */ - /* 1st Triangles */ - if (cval === 1) { - /* 0001 */ - bottomleft = 1 - interpolateX(minV, br, bl); - leftbottom = 1 - interpolateX(minV, tl, bl); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 169) { - /* 2221 */ - bottomleft = interpolateX(maxV, bl, br); - leftbottom = interpolateX(maxV, bl, tl); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 4) { - /* 0010 */ - rightbottom = 1 - interpolateX(minV, tr, br); - bottomright = interpolateX(minV, bl, br); - edges.push(isoBandEdgeRB[cval]); - } else if (cval === 166) { - /* 2212 */ - rightbottom = interpolateX(maxV, br, tr); - bottomright = 1 - interpolateX(maxV, br, bl); - edges.push(isoBandEdgeRB[cval]); - } else if (cval === 16) { - /* 0100 */ - righttop = interpolateX(minV, br, tr); - topright = interpolateX(minV, tl, tr); - edges.push(isoBandEdgeRT[cval]); - } else if (cval === 154) { - /* 2122 */ - righttop = 1 - interpolateX(maxV, tr, br); - topright = 1 - interpolateX(maxV, tr, tl); - edges.push(isoBandEdgeRT[cval]); - } else if (cval === 64) { - /* 1000 */ - lefttop = interpolateX(minV, bl, tl); - topleft = 1 - interpolateX(minV, tr, tl); - edges.push(isoBandEdgeLT[cval]); - } else if (cval === 106) { - /* 1222 */ - lefttop = 1 - interpolateX(maxV, tl, bl); - topleft = interpolateX(maxV, tl, tr); - edges.push(isoBandEdgeLT[cval]); - } else if (cval === 168) { - /* 2nd Trapezoids */ - /* 2220 */ - bottomright = interpolateX(maxV, bl, br); - bottomleft = interpolateX(minV, bl, br); - leftbottom = interpolateX(minV, bl, tl); - lefttop = interpolateX(maxV, bl, tl); - edges.push(isoBandEdgeBR[cval]); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 2) { - /* 0002 */ - bottomright = 1 - interpolateX(minV, br, bl); - bottomleft = 1 - interpolateX(maxV, br, bl); - leftbottom = 1 - interpolateX(maxV, tl, bl); - lefttop = 1 - interpolateX(minV, tl, bl); - edges.push(isoBandEdgeBR[cval]); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 162) { - /* 2202 */ - righttop = interpolateX(maxV, br, tr); - rightbottom = interpolateX(minV, br, tr); - bottomright = 1 - interpolateX(minV, br, bl); - bottomleft = 1 - interpolateX(maxV, br, bl); - edges.push(isoBandEdgeBR[cval]); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 8) { - /* 0020 */ - righttop = 1 - interpolateX(minV, tr, br); - rightbottom = 1 - interpolateX(maxV, tr, br); - bottomright = interpolateX(maxV, bl, br); - bottomleft = interpolateX(minV, bl, br); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeRB[cval]); - } else if (cval === 138) { - /* 2022 */ - righttop = 1 - interpolateX(minV, tr, br); - rightbottom = 1 - interpolateX(maxV, tr, br); - topleft = 1 - interpolateX(maxV, tr, tl); - topright = 1 - interpolateX(minV, tr, tl); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeRB[cval]); - } else if (cval === 32) { - /* 0200 */ - righttop = interpolateX(maxV, br, tr); - rightbottom = interpolateX(minV, br, tr); - topleft = interpolateX(minV, tl, tr); - topright = interpolateX(maxV, tl, tr); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeRB[cval]); - } else if (cval === 42) { - /* 0222 */ - leftbottom = 1 - interpolateX(maxV, tl, bl); - lefttop = 1 - interpolateX(minV, tl, bl); - topleft = interpolateX(minV, tl, tr); - topright = interpolateX(maxV, tl, tr); - edges.push(isoBandEdgeLB[cval]); - edges.push(isoBandEdgeLT[cval]); - } else if (cval === 128) { - /* 2000 */ - leftbottom = interpolateX(minV, bl, tl); - lefttop = interpolateX(maxV, bl, tl); - topleft = 1 - interpolateX(maxV, tr, tl); - topright = 1 - interpolateX(minV, tr, tl); - edges.push(isoBandEdgeLB[cval]); - edges.push(isoBandEdgeLT[cval]); - } - - /* 3rd rectangle cases */ - if (cval === 5) { - /* 0011 */ - rightbottom = 1 - interpolateX(minV, tr, br); - leftbottom = 1 - interpolateX(minV, tl, bl); - edges.push(isoBandEdgeRB[cval]); - } else if (cval === 165) { - /* 2211 */ - rightbottom = interpolateX(maxV, br, tr); - leftbottom = interpolateX(maxV, bl, tl); - edges.push(isoBandEdgeRB[cval]); - } else if (cval === 20) { - /* 0110 */ - bottomright = interpolateX(minV, bl, br); - topright = interpolateX(minV, tl, tr); - edges.push(isoBandEdgeBR[cval]); - } else if (cval === 150) { - /* 2112 */ - bottomright = 1 - interpolateX(maxV, br, bl); - topright = 1 - interpolateX(maxV, tr, tl); - edges.push(isoBandEdgeBR[cval]); - } else if (cval === 80) { - /* 1100 */ - righttop = interpolateX(minV, br, tr); - lefttop = interpolateX(minV, bl, tl); - edges.push(isoBandEdgeRT[cval]); - } else if (cval === 90) { - /* 1122 */ - righttop = 1 - interpolateX(maxV, tr, br); - lefttop = 1 - interpolateX(maxV, tl, bl); - edges.push(isoBandEdgeRT[cval]); - } else if (cval === 65) { - /* 1001 */ - bottomleft = 1 - interpolateX(minV, br, bl); - topleft = 1 - interpolateX(minV, tr, tl); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 105) { - /* 1221 */ - bottomleft = interpolateX(maxV, bl, br); - topleft = interpolateX(maxV, tl, tr); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 160) { - /* 2200 */ - righttop = interpolateX(maxV, br, tr); - rightbottom = interpolateX(minV, br, tr); - leftbottom = interpolateX(minV, bl, tl); - lefttop = interpolateX(maxV, bl, tl); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeRB[cval]); - } else if (cval === 10) { - /* 0022 */ - righttop = 1 - interpolateX(minV, tr, br); - rightbottom = 1 - interpolateX(maxV, tr, br); - leftbottom = 1 - interpolateX(maxV, tl, bl); - lefttop = 1 - interpolateX(minV, tl, bl); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeRB[cval]); - } else if (cval === 130) { - /* 2002 */ - bottomright = 1 - interpolateX(minV, br, bl); - bottomleft = 1 - interpolateX(maxV, br, bl); - topleft = 1 - interpolateX(maxV, tr, tl); - topright = 1 - interpolateX(minV, tr, tl); - edges.push(isoBandEdgeBR[cval]); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 40) { - /* 0220 */ - bottomright = interpolateX(maxV, bl, br); - bottomleft = interpolateX(minV, bl, br); - topleft = interpolateX(minV, tl, tr); - topright = interpolateX(maxV, tl, tr); - edges.push(isoBandEdgeBR[cval]); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 101) { - /* 4th single pentagon cases */ - /* 1211 */ - rightbottom = interpolateX(maxV, br, tr); - topleft = interpolateX(maxV, tl, tr); - edges.push(isoBandEdgeRB[cval]); - } else if (cval === 69) { - /* 1011 */ - rightbottom = 1 - interpolateX(minV, tr, br); - topleft = 1 - interpolateX(minV, tr, tl); - edges.push(isoBandEdgeRB[cval]); - } else if (cval === 149) { - /* 2111 */ - leftbottom = interpolateX(maxV, bl, tl); - topright = 1 - interpolateX(maxV, tr, tl); - edges.push(isoBandEdgeLB[cval]); - } else if (cval === 21) { - /* 0111 */ - leftbottom = 1 - interpolateX(minV, tl, bl); - topright = interpolateX(minV, tl, tr); - edges.push(isoBandEdgeLB[cval]); - } else if (cval === 86) { - /* 1112 */ - bottomright = 1 - interpolateX(maxV, br, bl); - lefttop = 1 - interpolateX(maxV, tl, bl); - edges.push(isoBandEdgeBR[cval]); - } else if (cval === 84) { - /* 1110 */ - bottomright = interpolateX(minV, bl, br); - lefttop = interpolateX(minV, bl, tl); - edges.push(isoBandEdgeBR[cval]); - } else if (cval === 89) { - /* 1121 */ - righttop = 1 - interpolateX(maxV, tr, br); - bottomleft = interpolateX(maxV, bl, br); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 81) { - /* 1101 */ - righttop = interpolateX(minV, br, tr); - bottomleft = 1 - interpolateX(minV, br, bl); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 96) { - /* 1200 */ - righttop = interpolateX(maxV, br, tr); - rightbottom = interpolateX(minV, br, tr); - lefttop = interpolateX(minV, bl, tl); - topleft = interpolateX(maxV, tl, tr); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeRB[cval]); - } else if (cval === 74) { - /* 1022 */ - righttop = 1 - interpolateX(minV, tr, br); - rightbottom = 1 - interpolateX(maxV, tr, br); - lefttop = 1 - interpolateX(maxV, tl, bl); - topleft = 1 - interpolateX(minV, tr, tl); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeRB[cval]); - } else if (cval === 24) { - /* 0120 */ - righttop = 1 - interpolateX(maxV, tr, br); - bottomright = interpolateX(maxV, bl, br); - bottomleft = interpolateX(minV, bl, br); - topright = interpolateX(minV, tl, tr); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 146) { - /* 2102 */ - righttop = interpolateX(minV, br, tr); - bottomright = 1 - interpolateX(minV, br, bl); - bottomleft = 1 - interpolateX(maxV, br, bl); - topright = 1 - interpolateX(maxV, tr, tl); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 6) { - /* 0012 */ - rightbottom = 1 - interpolateX(minV, tr, br); - bottomright = 1 - interpolateX(maxV, br, bl); - leftbottom = 1 - interpolateX(maxV, tl, bl); - lefttop = 1 - interpolateX(minV, tl, bl); - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeBR[cval]); - } else if (cval === 164) { - /* 2210 */ - rightbottom = interpolateX(maxV, br, tr); - bottomright = interpolateX(minV, bl, br); - leftbottom = interpolateX(minV, bl, tl); - lefttop = interpolateX(maxV, bl, tl); - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeBR[cval]); - } else if (cval === 129) { - /* 2001 */ - bottomleft = 1 - interpolateX(minV, br, bl); - leftbottom = interpolateX(maxV, bl, tl); - topleft = 1 - interpolateX(maxV, tr, tl); - topright = 1 - interpolateX(minV, tr, tl); - edges.push(isoBandEdgeBL[cval]); - edges.push(isoBandEdgeLB[cval]); - } else if (cval === 41) { - /* 0221 */ - bottomleft = interpolateX(maxV, bl, br); - leftbottom = 1 - interpolateX(minV, tl, bl); - topleft = interpolateX(minV, tl, tr); - topright = interpolateX(maxV, tl, tr); - edges.push(isoBandEdgeBL[cval]); - edges.push(isoBandEdgeLB[cval]); - } else if (cval === 66) { - /* 1002 */ - bottomright = 1 - interpolateX(minV, br, bl); - bottomleft = 1 - interpolateX(maxV, br, bl); - lefttop = 1 - interpolateX(maxV, tl, bl); - topleft = 1 - interpolateX(minV, tr, tl); - edges.push(isoBandEdgeBR[cval]); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 104) { - /* 1220 */ - bottomright = interpolateX(maxV, bl, br); - bottomleft = interpolateX(minV, bl, br); - lefttop = interpolateX(minV, bl, tl); - topleft = interpolateX(maxV, tl, tr); - edges.push(isoBandEdgeBL[cval]); - edges.push(isoBandEdgeTL[cval]); - } else if (cval === 144) { - /* 2100 */ - righttop = interpolateX(minV, br, tr); - leftbottom = interpolateX(minV, bl, tl); - lefttop = interpolateX(maxV, bl, tl); - topright = 1 - interpolateX(maxV, tr, tl); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeLT[cval]); - } else if (cval === 26) { - /* 0122 */ - righttop = 1 - interpolateX(maxV, tr, br); - leftbottom = 1 - interpolateX(maxV, tl, bl); - lefttop = 1 - interpolateX(minV, tl, bl); - topright = interpolateX(minV, tl, tr); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeLT[cval]); - } else if (cval === 36) { - /* 0210 */ - rightbottom = interpolateX(maxV, br, tr); - bottomright = interpolateX(minV, bl, br); - topleft = interpolateX(minV, tl, tr); - topright = interpolateX(maxV, tl, tr); - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeBR[cval]); - } else if (cval === 134) { - /* 2012 */ - rightbottom = 1 - interpolateX(minV, tr, br); - bottomright = 1 - interpolateX(maxV, br, bl); - topleft = 1 - interpolateX(maxV, tr, tl); - topright = 1 - interpolateX(minV, tr, tl); - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeBR[cval]); - } else if (cval === 9) { - /* 0021 */ - righttop = 1 - interpolateX(minV, tr, br); - rightbottom = 1 - interpolateX(maxV, tr, br); - bottomleft = interpolateX(maxV, bl, br); - leftbottom = 1 - interpolateX(minV, tl, bl); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeRB[cval]); - } else if (cval === 161) { - /* 2201 */ - righttop = interpolateX(maxV, br, tr); - rightbottom = interpolateX(minV, br, tr); - bottomleft = 1 - interpolateX(minV, br, bl); - leftbottom = interpolateX(maxV, bl, tl); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeRB[cval]); - } else if (cval === 37) { - /* 5th single hexagon cases */ - /* 0211 */ - rightbottom = interpolateX(maxV, br, tr); - leftbottom = 1 - interpolateX(minV, tl, bl); - topleft = interpolateX(minV, tl, tr); - topright = interpolateX(maxV, tl, tr); - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeLB[cval]); - } else if (cval === 133) { - /* 2011 */ - rightbottom = 1 - interpolateX(minV, tr, br); - leftbottom = interpolateX(maxV, bl, tl); - topleft = 1 - interpolateX(maxV, tr, tl); - topright = 1 - interpolateX(minV, tr, tl); - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeLB[cval]); - } else if (cval === 148) { - /* 2110 */ - bottomright = interpolateX(minV, bl, br); - leftbottom = interpolateX(minV, bl, tl); - lefttop = interpolateX(maxV, bl, tl); - topright = 1 - interpolateX(maxV, tr, tl); - edges.push(isoBandEdgeBR[cval]); - edges.push(isoBandEdgeLT[cval]); - } else if (cval === 22) { - /* 0112 */ - bottomright = 1 - interpolateX(maxV, br, bl); - leftbottom = 1 - interpolateX(maxV, tl, bl); - lefttop = 1 - interpolateX(minV, tl, bl); - topright = interpolateX(minV, tl, tr); - edges.push(isoBandEdgeBR[cval]); - edges.push(isoBandEdgeLT[cval]); - } else if (cval === 82) { - /* 1102 */ - righttop = interpolateX(minV, br, tr); - bottomright = 1 - interpolateX(minV, br, bl); - bottomleft = 1 - interpolateX(maxV, br, bl); - lefttop = 1 - interpolateX(maxV, tl, bl); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 88) { - /* 1120 */ - righttop = 1 - interpolateX(maxV, tr, br); - bottomright = interpolateX(maxV, bl, br); - bottomleft = interpolateX(minV, bl, br); - lefttop = interpolateX(minV, bl, tl); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 73) { - /* 1021 */ - righttop = 1 - interpolateX(minV, tr, br); - rightbottom = 1 - interpolateX(maxV, tr, br); - bottomleft = interpolateX(maxV, bl, br); - topleft = 1 - interpolateX(minV, tr, tl); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeRB[cval]); - } else if (cval === 97) { - /* 1201 */ - righttop = interpolateX(maxV, br, tr); - rightbottom = interpolateX(minV, br, tr); - bottomleft = 1 - interpolateX(minV, br, bl); - topleft = interpolateX(maxV, tl, tr); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeRB[cval]); - } else if (cval === 145) { - /* 2101 */ - righttop = interpolateX(minV, br, tr); - bottomleft = 1 - interpolateX(minV, br, bl); - leftbottom = interpolateX(maxV, bl, tl); - topright = 1 - interpolateX(maxV, tr, tl); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeLB[cval]); - } else if (cval === 25) { - /* 0121 */ - righttop = 1 - interpolateX(maxV, tr, br); - bottomleft = interpolateX(maxV, bl, br); - leftbottom = 1 - interpolateX(minV, tl, bl); - topright = interpolateX(minV, tl, tr); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeLB[cval]); - } else if (cval === 70) { - /* 1012 */ - rightbottom = 1 - interpolateX(minV, tr, br); - bottomright = 1 - interpolateX(maxV, br, bl); - lefttop = 1 - interpolateX(maxV, tl, bl); - topleft = 1 - interpolateX(minV, tr, tl); - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeBR[cval]); - } else if (cval === 100) { - /* 1210 */ - rightbottom = interpolateX(maxV, br, tr); - bottomright = interpolateX(minV, bl, br); - lefttop = interpolateX(minV, bl, tl); - topleft = interpolateX(maxV, tl, tr); - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeBR[cval]); - } else if (cval === 34) { - /* 8-sided cases */ - /* 0202 || 2020 with flipped == 0 */ - if (flipped === 0) { - righttop = 1 - interpolateX(minV, tr, br); - rightbottom = 1 - interpolateX(maxV, tr, br); - bottomright = interpolateX(maxV, bl, br); - bottomleft = interpolateX(minV, bl, br); - leftbottom = interpolateX(minV, bl, tl); - lefttop = interpolateX(maxV, bl, tl); - topleft = 1 - interpolateX(maxV, tr, tl); - topright = 1 - interpolateX(minV, tr, tl); - } else { - righttop = interpolateX(maxV, br, tr); - rightbottom = interpolateX(minV, br, tr); - bottomright = 1 - interpolateX(minV, br, bl); - bottomleft = 1 - interpolateX(maxV, br, bl); - leftbottom = 1 - interpolateX(maxV, tl, bl); - lefttop = 1 - interpolateX(minV, tl, bl); - topleft = interpolateX(minV, tl, tr); - topright = interpolateX(maxV, tl, tr); - } - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeLB[cval]); - edges.push(isoBandEdgeLT[cval]); - } else if (cval === 35) { - /* flipped == 1 state for 0202, and 2020 with flipped == 4*/ - if (flipped === 4) { - righttop = 1 - interpolateX(minV, tr, br); - rightbottom = 1 - interpolateX(maxV, tr, br); - bottomright = interpolateX(maxV, bl, br); - bottomleft = interpolateX(minV, bl, br); - leftbottom = interpolateX(minV, bl, tl); - lefttop = interpolateX(maxV, bl, tl); - topleft = 1 - interpolateX(maxV, tr, tl); - topright = 1 - interpolateX(minV, tr, tl); - } else { - righttop = interpolateX(maxV, br, tr); - rightbottom = interpolateX(minV, br, tr); - bottomright = 1 - interpolateX(minV, br, bl); - bottomleft = 1 - interpolateX(maxV, br, bl); - leftbottom = 1 - interpolateX(maxV, tl, bl); - lefttop = 1 - interpolateX(minV, tl, bl); - topleft = interpolateX(minV, tl, tr); - topright = interpolateX(maxV, tl, tr); - } - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeBL[cval]); - edges.push(isoBandEdgeLT[cval]); - } else if (cval === 136) { - /* 2020 || 0202 with flipped == 0 */ - if (flipped === 0) { - righttop = interpolateX(maxV, br, tr); - rightbottom = interpolateX(minV, br, tr); - bottomright = 1 - interpolateX(minV, br, bl); - bottomleft = 1 - interpolateX(maxV, br, bl); - leftbottom = 1 - interpolateX(maxV, tl, bl); - lefttop = 1 - interpolateX(minV, tl, bl); - topleft = interpolateX(minV, tl, tr); - topright = interpolateX(maxV, tl, tr); - } else { - righttop = 1 - interpolateX(minV, tr, br); - rightbottom = 1 - interpolateX(maxV, tr, br); - bottomright = interpolateX(maxV, bl, br); - bottomleft = interpolateX(minV, bl, br); - leftbottom = interpolateX(minV, bl, tl); - lefttop = interpolateX(maxV, bl, tl); - topleft = 1 - interpolateX(maxV, tr, tl); - topright = 1 - interpolateX(minV, tr, tl); - } - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeLB[cval]); - edges.push(isoBandEdgeLT[cval]); - } else if (cval === 153) { - /* 6-sided polygon cases */ - /* 0101 with flipped == 0 || 2121 with flipped == 2 */ - if (flipped === 0) { - righttop = interpolateX(minV, br, tr); - bottomleft = 1 - interpolateX(minV, br, bl); - leftbottom = 1 - interpolateX(minV, tl, bl); - topright = interpolateX(minV, tl, tr); - } else { - righttop = 1 - interpolateX(maxV, tr, br); - bottomleft = interpolateX(maxV, bl, br); - leftbottom = interpolateX(maxV, bl, tl); - topright = 1 - interpolateX(maxV, tr, tl); - } - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 102) { - /* 1010 with flipped == 0 || 1212 with flipped == 2 */ - if (flipped === 0) { - rightbottom = 1 - interpolateX(minV, tr, br); - bottomright = interpolateX(minV, bl, br); - lefttop = interpolateX(minV, bl, tl); - topleft = 1 - interpolateX(minV, tr, tl); - } else { - rightbottom = interpolateX(maxV, br, tr); - bottomright = 1 - interpolateX(maxV, br, bl); - lefttop = 1 - interpolateX(maxV, tl, bl); - topleft = interpolateX(maxV, tl, tr); - } - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeLT[cval]); - } else if (cval === 155) { - /* 0101 with flipped == 4 || 2121 with flipped == 1 */ - if (flipped === 4) { - righttop = interpolateX(minV, br, tr); - bottomleft = 1 - interpolateX(minV, br, bl); - leftbottom = 1 - interpolateX(minV, tl, bl); - topright = interpolateX(minV, tl, tr); - } else { - righttop = 1 - interpolateX(maxV, tr, br); - bottomleft = interpolateX(maxV, bl, br); - leftbottom = interpolateX(maxV, bl, tl); - topright = 1 - interpolateX(maxV, tr, tl); - } - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeLB[cval]); - } else if (cval === 103) { - /* 1010 with flipped == 4 || 1212 with flipped == 1 */ - if (flipped === 4) { - rightbottom = 1 - interpolateX(minV, tr, br); - bottomright = interpolateX(minV, bl, br); - lefttop = interpolateX(minV, bl, tl); - topleft = 1 - interpolateX(minV, tr, tl); - } else { - rightbottom = interpolateX(maxV, br, tr); - bottomright = 1 - interpolateX(maxV, br, bl); - lefttop = 1 - interpolateX(maxV, tl, bl); - topleft = interpolateX(maxV, tl, tr); - } - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeBR[cval]); - } else if (cval === 152) { - /* 7-sided polygon cases */ - /* 2120 with flipped == 2 || 0102 with flipped == 0 */ - if (flipped === 0) { - righttop = interpolateX(minV, br, tr); - bottomright = 1 - interpolateX(minV, br, bl); - bottomleft = 1 - interpolateX(maxV, br, bl); - leftbottom = 1 - interpolateX(maxV, tl, bl); - lefttop = 1 - interpolateX(minV, tl, bl); - topright = interpolateX(minV, tl, tr); - } else { - righttop = 1 - interpolateX(maxV, tr, br); - bottomright = interpolateX(maxV, bl, br); - bottomleft = interpolateX(minV, bl, br); - leftbottom = interpolateX(minV, bl, tl); - lefttop = interpolateX(maxV, bl, tl); - topright = 1 - interpolateX(maxV, tr, tl); - } - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeBR[cval]); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 156) { - /* 2120 with flipped == 1 || 0102 with flipped == 4 */ - if (flipped === 4) { - righttop = interpolateX(minV, br, tr); - bottomright = 1 - interpolateX(minV, br, bl); - bottomleft = 1 - interpolateX(maxV, br, bl); - leftbottom = 1 - interpolateX(maxV, tl, bl); - lefttop = 1 - interpolateX(minV, tl, bl); - topright = interpolateX(minV, tl, tr); - } else { - righttop = 1 - interpolateX(maxV, tr, br); - bottomright = interpolateX(maxV, bl, br); - bottomleft = interpolateX(minV, bl, br); - leftbottom = interpolateX(minV, bl, tl); - lefttop = interpolateX(maxV, bl, tl); - topright = 1 - interpolateX(maxV, tr, tl); - } - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeBL[cval]); - edges.push(isoBandEdgeLT[cval]); - } else if (cval === 137) { - /* 2021 with flipped == 2 || 0201 with flipped == 0 */ - if (flipped === 0) { - righttop = interpolateX(maxV, br, tr); - rightbottom = interpolateX(minV, br, tr); - bottomleft = 1 - interpolateX(minV, br, bl); - leftbottom = 1 - interpolateX(minV, tl, bl); - topleft = interpolateX(minV, tl, tr); - topright = interpolateX(maxV, tl, tr); - } else { - righttop = 1 - interpolateX(minV, tr, br); - rightbottom = 1 - interpolateX(maxV, tr, br); - bottomleft = interpolateX(maxV, bl, br); - leftbottom = interpolateX(maxV, bl, tl); - topleft = 1 - interpolateX(maxV, tr, tl); - topright = 1 - interpolateX(minV, tr, tl); - } - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 139) { - /* 2021 with flipped == 1 || 0201 with flipped == 4 */ - if (flipped === 4) { - righttop = interpolateX(maxV, br, tr); - rightbottom = interpolateX(minV, br, tr); - bottomleft = 1 - interpolateX(minV, br, bl); - leftbottom = 1 - interpolateX(minV, tl, bl); - topleft = interpolateX(minV, tl, tr); - topright = interpolateX(maxV, tl, tr); - } else { - righttop = 1 - interpolateX(minV, tr, br); - rightbottom = 1 - interpolateX(maxV, tr, br); - bottomleft = interpolateX(maxV, bl, br); - leftbottom = interpolateX(maxV, bl, tl); - topleft = 1 - interpolateX(maxV, tr, tl); - topright = 1 - interpolateX(minV, tr, tl); - } - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeLB[cval]); - } else if (cval === 98) { - /* 1202 with flipped == 2 || 1020 with flipped == 0 */ - if (flipped === 0) { - righttop = 1 - interpolateX(minV, tr, br); - rightbottom = 1 - interpolateX(maxV, tr, br); - bottomright = interpolateX(maxV, bl, br); - bottomleft = interpolateX(minV, bl, br); - lefttop = interpolateX(minV, bl, tl); - topleft = 1 - interpolateX(minV, tr, tl); - } else { - righttop = interpolateX(maxV, br, tr); - rightbottom = interpolateX(minV, br, tr); - bottomright = 1 - interpolateX(minV, br, bl); - bottomleft = 1 - interpolateX(maxV, br, bl); - lefttop = 1 - interpolateX(maxV, tl, bl); - topleft = interpolateX(maxV, tl, tr); - } - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeLT[cval]); - } else if (cval === 99) { - /* 1202 with flipped == 1 || 1020 with flipped == 4 */ - if (flipped === 4) { - righttop = 1 - interpolateX(minV, tr, br); - rightbottom = 1 - interpolateX(maxV, tr, br); - bottomright = interpolateX(maxV, bl, br); - bottomleft = interpolateX(minV, bl, br); - lefttop = interpolateX(minV, bl, tl); - topleft = 1 - interpolateX(minV, tr, tl); - } else { - righttop = interpolateX(maxV, br, tr); - rightbottom = interpolateX(minV, br, tr); - bottomright = 1 - interpolateX(minV, br, bl); - bottomleft = 1 - interpolateX(maxV, br, bl); - lefttop = 1 - interpolateX(maxV, tl, bl); - topleft = interpolateX(maxV, tl, tr); - } - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 38) { - /* 0212 with flipped == 2 || 2010 with flipped == 0 */ - if (flipped === 0) { - rightbottom = 1 - interpolateX(minV, tr, br); - bottomright = interpolateX(minV, bl, br); - leftbottom = interpolateX(minV, bl, tl); - lefttop = interpolateX(maxV, bl, tl); - topleft = 1 - interpolateX(maxV, tr, tl); - topright = 1 - interpolateX(minV, tr, tl); - } else { - rightbottom = interpolateX(maxV, br, tr); - bottomright = 1 - interpolateX(maxV, br, bl); - leftbottom = 1 - interpolateX(maxV, tl, bl); - lefttop = 1 - interpolateX(minV, tl, bl); - topleft = interpolateX(minV, tl, tr); - topright = interpolateX(maxV, tl, tr); - } - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeLB[cval]); - edges.push(isoBandEdgeLT[cval]); - } else if (cval === 39) { - /* 0212 with flipped == 1 || 2010 with flipped == 4 */ - if (flipped === 4) { - rightbottom = 1 - interpolateX(minV, tr, br); - bottomright = interpolateX(minV, bl, br); - leftbottom = interpolateX(minV, bl, tl); - lefttop = interpolateX(maxV, bl, tl); - topleft = 1 - interpolateX(maxV, tr, tl); - topright = 1 - interpolateX(minV, tr, tl); - } else { - rightbottom = interpolateX(maxV, br, tr); - bottomright = 1 - interpolateX(maxV, br, bl); - leftbottom = 1 - interpolateX(maxV, tl, bl); - lefttop = 1 - interpolateX(minV, tl, bl); - topleft = interpolateX(minV, tl, tr); - topright = interpolateX(maxV, tl, tr); - } - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeBR[cval]); - edges.push(isoBandEdgeLT[cval]); - } else if (cval === 85) { - righttop = 1; - rightbottom = 0; - bottomright = 1; - bottomleft = 0; - leftbottom = 0; - lefttop = 1; - topleft = 0; - topright = 1; - } - - if ( - topleft < 0 || - topleft > 1 || - topright < 0 || - topright > 1 || - righttop < 0 || - righttop > 1 || - bottomright < 0 || - bottomright > 1 || - leftbottom < 0 || - leftbottom > 1 || - lefttop < 0 || - lefttop > 1 - ) { - console.log( - "MarchingSquaresJS-isoBands: " + - cval + - " " + - cval_real + - " " + - tl + - "," + - tr + - "," + - br + - "," + - bl + - " " + - flipped + - " " + - topleft + - " " + - topright + - " " + - righttop + - " " + - rightbottom + - " " + - bottomright + - " " + - bottomleft + - " " + - leftbottom + - " " + - lefttop - ); - } - - BandGrid.cells[j][i] = { - cval: cval, - cval_real: cval_real, - flipped: flipped, - topleft: topleft, - topright: topright, - righttop: righttop, - rightbottom: rightbottom, - bottomright: bottomright, - bottomleft: bottomleft, - leftbottom: leftbottom, - lefttop: lefttop, - edges: edges, - }; - } - } - } - - return BandGrid; -} - -function BandGrid2AreaPaths(grid) { - var areas = []; - var rows = grid.rows; - var cols = grid.cols; - var currentPolygon = []; - - for (var j = 0; j < rows; j++) { - for (var i = 0; i < cols; i++) { - if ( - typeof grid.cells[j][i] !== "undefined" && - grid.cells[j][i].edges.length > 0 - ) { - /* trace back polygon path starting from this cell */ - - var cell = grid.cells[j][i]; - - /* get start coordinates */ - - var prev = getStartXY(cell), - next = null, - p = i, - q = j; - - if (prev !== null) { - currentPolygon.push([prev.p[0] + p, prev.p[1] + q]); - //console.log(cell); - //console.log("coords: " + (prev.p[0] + p) + " " + (prev.p[1] + q)); - } - - do { - //console.log(p + "," + q); - //console.log(grid.cells[q][p]); - //console.log(grid.cells[q][p].edges); - //console.log("from : " + prev.x + " " + prev.y + " " + prev.o); - - next = getExitXY(grid.cells[q][p], prev.x, prev.y, prev.o); - if (next !== null) { - //console.log("coords: " + (next.p[0] + p) + " " + (next.p[1] + q)); - currentPolygon.push([next.p[0] + p, next.p[1] + q]); - p += next.x; - q += next.y; - prev = next; - } else { - //console.log("getExitXY() returned null!"); - break; - } - //console.log("to : " + next.x + " " + next.y + " " + next.o); - /* special case, where we've reached the grid boundaries */ - if ( - q < 0 || - q >= rows || - p < 0 || - p >= cols || - typeof grid.cells[q][p] === "undefined" - ) { - /* to create a closed path, we need to trace our way - arround the missing data, until we find an entry - point again - */ - - /* set back coordinates of current cell */ - p -= next.x; - q -= next.y; - - //console.log("reached boundary at " + p + " " + q); - - var missing = traceOutOfGridPath( - grid, - p, - q, - next.x, - next.y, - next.o - ); - if (missing !== null) { - missing.path.forEach(function (pp) { - //console.log("coords: " + (pp[0]) + " " + (pp[1])); - currentPolygon.push(pp); - }); - p = missing.i; - q = missing.j; - prev = missing; - } else { - break; - } - //console.log(grid.cells[q][p]); - } - } while ( - typeof grid.cells[q][p] !== "undefined" && - grid.cells[q][p].edges.length > 0 - ); - - areas.push(currentPolygon); - //console.log("next polygon"); - //console.log(currentPolygon); - currentPolygon = []; - if (grid.cells[j][i].edges.length > 0) i--; - } - } - } - return areas; -} - -function traceOutOfGridPath(grid, i, j, d_x, d_y, d_o) { - var cell = grid.cells[j][i]; - var cval = cell.cval_real; - var p = i + d_x, - q = j + d_y; - var path = []; - var closed = false; - - while (!closed) { - //console.log("processing cell " + p + "," + q + " " + d_x + " " + d_y + " " + d_o); - if ( - typeof grid.cells[q] === "undefined" || - typeof grid.cells[q][p] === "undefined" - ) { - //console.log("which is undefined"); - /* we can't move on, so we have to change direction to proceed further */ - - /* go back to previous cell */ - q -= d_y; - p -= d_x; - cell = grid.cells[q][p]; - cval = cell.cval_real; - - /* check where we've left defined cells of the grid... */ - if (d_y === -1) { - /* we came from top */ - if (d_o === 0) { - /* exit left */ - if (cval & Node3) { - /* lower left node is within range, so we move left */ - path.push([p, q]); - d_x = -1; - d_y = 0; - d_o = 0; - } else if (cval & Node2) { - /* lower right node is within range, so we move right */ - path.push([p + 1, q]); - d_x = 1; - d_y = 0; - d_o = 0; - } else { - /* close the path */ - path.push([p + cell.bottomright, q]); - d_x = 0; - d_y = 1; - d_o = 1; - closed = true; - break; - } - } else if (cval & Node3) { - path.push([p, q]); - d_x = -1; - d_y = 0; - d_o = 0; - } else if (cval & Node2) { - path.push([p + cell.bottomright, q]); - d_x = 0; - d_y = 1; - d_o = 1; - closed = true; - break; - } else { - path.push([p + cell.bottomleft, q]); - d_x = 0; - d_y = 1; - d_o = 0; - closed = true; - break; - } - } else if (d_y === 1) { - /* we came from bottom */ - //console.log("we came from bottom and hit a non-existing cell " + (p + d_x) + "," + (q + d_y) + "!"); - if (d_o === 0) { - /* exit left */ - if (cval & Node1) { - /* top right node is within range, so we move right */ - path.push([p + 1, q + 1]); - d_x = 1; - d_y = 0; - d_o = 1; - } else if (!(cval & Node0)) { - /* found entry within same cell */ - path.push([p + cell.topright, q + 1]); - d_x = 0; - d_y = -1; - d_o = 1; - closed = true; - //console.log("found entry from bottom at " + p + "," + q); - break; - } else { - path.push([p + cell.topleft, q + 1]); - d_x = 0; - d_y = -1; - d_o = 0; - closed = true; - break; - } - } else if (cval & Node1) { - path.push([p + 1, q + 1]); - d_x = 1; - d_y = 0; - d_o = 1; - } else { - /* move right */ - path.push([p + 1, q + 1]); - d_x = 1; - d_y = 0; - d_o = 1; - //console.log("wtf"); - //break; - } - } else if (d_x === -1) { - /* we came from right */ - //console.log("we came from right and hit a non-existing cell at " + (p + d_x) + "," + (q + d_y) + "!"); - if (d_o === 0) { - //console.log("continue at bottom"); - if (cval & Node0) { - path.push([p, q + 1]); - d_x = 0; - d_y = 1; - d_o = 0; - //console.log("moving upwards to " + (p + d_x) + "," + (q + d_y) + "!"); - } else if (!(cval & Node3)) { - /* there has to be an entry into the regular grid again! */ - //console.log("exiting top"); - path.push([p, q + cell.lefttop]); - d_x = 1; - d_y = 0; - d_o = 1; - closed = true; - break; - } else { - //console.log("exiting bottom"); - path.push([p, q + cell.leftbottom]); - d_x = 1; - d_y = 0; - d_o = 0; - closed = true; - break; - } - } else { - //console.log("continue at top"); - if (cval & Node0) { - path.push([p, q + 1]); - d_x = 0; - d_y = 1; - d_o = 0; - //console.log("moving upwards to " + (p + d_x) + "," + (q + d_y) + "!"); - } else { - /* */ - console.log("MarchingSquaresJS-isoBands: wtf"); - break; - } - } - } else if (d_x === 1) { - /* we came from left */ - //console.log("we came from left and hit a non-existing cell " + (p + d_x) + "," + (q + d_y) + "!"); - if (d_o === 0) { - /* exit bottom */ - if (cval & Node2) { - path.push([p + 1, q]); - d_x = 0; - d_y = -1; - d_o = 1; - } else { - path.push([p + 1, q + cell.rightbottom]); - d_x = -1; - d_y = 0; - d_o = 0; - closed = true; - break; - } - } else { - /* exit top */ - if (cval & Node2) { - path.push([p + 1, q]); - d_x = 0; - d_y = -1; - d_o = 1; - } else if (!(cval & Node1)) { - path.push([p + 1, q + cell.rightbottom]); - d_x = -1; - d_y = 0; - d_o = 0; - closed = true; - break; - } else { - path.push([p + 1, q + cell.righttop]); - d_x = -1; - d_y = 0; - d_o = 1; - break; - } - } - } else { - /* we came from the same cell */ - console.log("MarchingSquaresJS-isoBands: we came from nowhere!"); - break; - } - } else { - /* try to find an entry into the regular grid again! */ - cell = grid.cells[q][p]; - cval = cell.cval_real; - //console.log("which is defined"); - - if (d_x === -1) { - if (d_o === 0) { - /* try to go downwards */ - if ( - typeof grid.cells[q - 1] !== "undefined" && - typeof grid.cells[q - 1][p] !== "undefined" - ) { - d_x = 0; - d_y = -1; - d_o = 1; - } else if (cval & Node3) { - /* proceed searching in x-direction */ - //console.log("proceeding in x-direction!"); - path.push([p, q]); - } else { - /* we must have found an entry into the regular grid */ - path.push([p + cell.bottomright, q]); - d_x = 0; - d_y = 1; - d_o = 1; - closed = true; - //console.log("found entry from bottom at " + p + "," + q); - break; - } - } else if (cval & Node0) { - /* proceed searchin in x-direction */ - console.log("MarchingSquaresJS-isoBands: proceeding in x-direction!"); - } else { - /* we must have found an entry into the regular grid */ - console.log( - "MarchingSquaresJS-isoBands: found entry from top at " + p + "," + q - ); - break; - } - } else if (d_x === 1) { - if (d_o === 0) { - console.log("MarchingSquaresJS-isoBands: wtf"); - break; - } else { - /* try to go upwards */ - if ( - typeof grid.cells[q + 1] !== "undefined" && - typeof grid.cells[q + 1][p] !== "undefined" - ) { - d_x = 0; - d_y = 1; - d_o = 0; - } else if (cval & Node1) { - path.push([p + 1, q + 1]); - d_x = 1; - d_y = 0; - d_o = 1; - } else { - /* found an entry point into regular grid! */ - path.push([p + cell.topleft, q + 1]); - d_x = 0; - d_y = -1; - d_o = 0; - closed = true; - //console.log("found entry from bottom at " + p + "," + q); - break; - } - } - } else if (d_y === -1) { - if (d_o === 1) { - /* try to go right */ - if (typeof grid.cells[q][p + 1] !== "undefined") { - d_x = 1; - d_y = 0; - d_o = 1; - } else if (cval & Node2) { - path.push([p + 1, q]); - d_x = 0; - d_y = -1; - d_o = 1; - } else { - /* found entry into regular grid! */ - path.push([p + 1, q + cell.righttop]); - d_x = -1; - d_y = 0; - d_o = 1; - closed = true; - //console.log("found entry from top at " + p + "," + q); - break; - } - } else { - console.log("MarchingSquaresJS-isoBands: wtf"); - break; - } - } else if (d_y === 1) { - if (d_o === 0) { - //console.log("we came from bottom left and proceed to the left"); - /* try to go left */ - if (typeof grid.cells[q][p - 1] !== "undefined") { - d_x = -1; - d_y = 0; - d_o = 0; - } else if (cval & Node0) { - path.push([p, q + 1]); - d_x = 0; - d_y = 1; - d_o = 0; - } else { - /* found an entry point into regular grid! */ - path.push([p, q + cell.leftbottom]); - d_x = 1; - d_y = 0; - d_o = 0; - closed = true; - //console.log("found entry from bottom at " + p + "," + q); - break; - } - } else { - //console.log("we came from bottom right and proceed to the right"); - console.log("MarchingSquaresJS-isoBands: wtf"); - break; - } - } else { - console.log("MarchingSquaresJS-isoBands: where did we came from???"); - break; - } - } - - p += d_x; - q += d_y; - //console.log("going on to " + p + "," + q + " via " + d_x + " " + d_y + " " + d_o); - - if (p === i && q === j) { - /* bail out, once we've closed a circle path */ - break; - } - } - - //console.log("exit with " + p + "," + q + " " + d_x + " " + d_y + " " + d_o); - return { path: path, i: p, j: q, x: d_x, y: d_y, o: d_o }; -} - -function deleteEdge(cell, edgeIdx) { - delete cell.edges[edgeIdx]; - for (var k = edgeIdx + 1; k < cell.edges.length; k++) { - cell.edges[k - 1] = cell.edges[k]; - } - cell.edges.pop(); -} - -function getStartXY(cell) { - if (cell.edges.length > 0) { - var e = cell.edges[cell.edges.length - 1]; - //console.log("starting with edge " + e); - var cval = cell.cval_real; - switch (e) { - case 0: - if (cval & Node1) { - /* node 1 within range */ - return { p: [1, cell.righttop], x: -1, y: 0, o: 1 }; - } else { - /* node 1 below or above threshold */ - return { p: [cell.topleft, 1], x: 0, y: -1, o: 0 }; - } - case 1: - if (cval & Node2) { - return { p: [cell.topleft, 1], x: 0, y: -1, o: 0 }; - } else { - return { p: [1, cell.rightbottom], x: -1, y: 0, o: 0 }; - } - case 2: - if (cval & Node2) { - return { p: [cell.bottomright, 0], x: 0, y: 1, o: 1 }; - } else { - return { p: [cell.topleft, 1], x: 0, y: -1, o: 0 }; - } - case 3: - if (cval & Node3) { - return { p: [cell.topleft, 1], x: 0, y: -1, o: 0 }; - } else { - return { p: [cell.bottomleft, 0], x: 0, y: 1, o: 0 }; - } - case 4: - if (cval & Node1) { - return { p: [1, cell.righttop], x: -1, y: 0, o: 1 }; - } else { - return { p: [cell.topright, 1], x: 0, y: -1, o: 1 }; - } - case 5: - if (cval & Node2) { - return { p: [cell.topright, 1], x: 0, y: -1, o: 1 }; - } else { - return { p: [1, cell.rightbottom], x: -1, y: 0, o: 0 }; - } - case 6: - if (cval & Node2) { - return { p: [cell.bottomright, 0], x: 0, y: 1, o: 1 }; - } else { - return { p: [cell.topright, 1], x: 0, y: -1, o: 1 }; - } - case 7: - if (cval & Node3) { - return { p: [cell.topright, 1], x: 0, y: -1, o: 1 }; - } else { - return { p: [cell.bottomleft, 0], x: 0, y: 1, o: 0 }; - } - case 8: - if (cval & Node2) { - return { p: [cell.bottomright, 0], x: 0, y: 1, o: 1 }; - } else { - return { p: [1, cell.righttop], x: -1, y: 0, o: 1 }; - } - case 9: - if (cval & Node3) { - return { p: [1, cell.righttop], x: -1, y: 0, o: 1 }; - } else { - return { p: [cell.bottomleft, 0], x: 0, y: 1, o: 0 }; - } - case 10: - if (cval & Node3) { - return { p: [0, cell.leftbottom], x: 1, y: 0, o: 0 }; - } else { - return { p: [1, cell.righttop], x: -1, y: 0, o: 1 }; - } - case 11: - if (cval & Node0) { - return { p: [1, cell.righttop], x: -1, y: 0, o: 1 }; - } else { - return { p: [0, cell.lefttop], x: 1, y: 0, o: 1 }; - } - case 12: - if (cval & Node2) { - return { p: [cell.bottomright, 0], x: 0, y: 1, o: 1 }; - } else { - return { p: [1, cell.rightbottom], x: -1, y: 0, o: 0 }; - } - case 13: - if (cval & Node3) { - return { p: [1, cell.rightbottom], x: -1, y: 0, o: 0 }; - } else { - return { p: [cell.bottomleft, 0], x: 0, y: 1, o: 0 }; - } - case 14: - if (cval & Node3) { - return { p: [0, cell.leftbottom], x: 1, y: 0, o: 0 }; - } else { - return { p: [1, cell.rightbottom], x: -1, y: 0, o: 0 }; - } - case 15: - if (cval & Node0) { - return { p: [1, cell.rightbottom], x: -1, y: 0, o: 0 }; - } else { - return { p: [0, cell.lefttop], x: 1, y: 0, o: 1 }; - } - case 16: - if (cval & Node2) { - return { p: [cell.bottomright, 0], x: 0, y: 1, o: 1 }; - } else { - return { p: [0, cell.leftbottom], x: 1, y: 0, o: 0 }; - } - case 17: - if (cval & Node0) { - return { p: [cell.bottomright, 0], x: 0, y: 1, o: 1 }; - } else { - return { p: [0, cell.lefttop], x: 1, y: 0, o: 1 }; - } - case 18: - if (cval & Node3) { - return { p: [0, cell.leftbottom], x: 1, y: 0, o: 0 }; - } else { - return { p: [cell.bottomleft, 0], x: 0, y: 1, o: 0 }; - } - case 19: - if (cval & Node0) { - return { p: [cell.bottomleft, 0], x: 0, y: 1, o: 0 }; - } else { - return { p: [0, cell.lefttop], x: 1, y: 0, o: 1 }; - } - case 20: - if (cval & Node0) { - return { p: [cell.topleft, 1], x: 0, y: -1, o: 0 }; - } else { - return { p: [0, cell.leftbottom], x: 1, y: 0, o: 0 }; - } - case 21: - if (cval & Node1) { - return { p: [0, cell.leftbottom], x: 1, y: 0, o: 0 }; - } else { - return { p: [cell.topright, 1], x: 0, y: -1, o: 1 }; - } - case 22: - if (cval & Node0) { - return { p: [cell.topleft, 1], x: 0, y: -1, o: 0 }; - } else { - return { p: [0, cell.lefttop], x: 1, y: 0, o: 1 }; - } - case 23: - if (cval & Node1) { - return { p: [0, cell.lefttop], x: 1, y: 0, o: 1 }; - } else { - return { p: [cell.topright, 1], x: 0, y: -1, o: 1 }; - } - default: - console.log("MarchingSquaresJS-isoBands: edge index out of range!"); - console.log(cell); - break; - } - } - - return null; -} - -function getExitXY(cell, x, y, o) { - var e, - id_x, - d_x, - d_y, - cval = cell.cval; - var d_o; - - switch (x) { - case -1: - switch (o) { - case 0: - e = isoBandEdgeRB[cval]; - d_x = isoBandNextXRB[cval]; - d_y = isoBandNextYRB[cval]; - d_o = isoBandNextORB[cval]; - break; - default: - e = isoBandEdgeRT[cval]; - d_x = isoBandNextXRT[cval]; - d_y = isoBandNextYRT[cval]; - d_o = isoBandNextORT[cval]; - break; - } - break; - case 1: - switch (o) { - case 0: - e = isoBandEdgeLB[cval]; - d_x = isoBandNextXLB[cval]; - d_y = isoBandNextYLB[cval]; - d_o = isoBandNextOLB[cval]; - break; - default: - e = isoBandEdgeLT[cval]; - d_x = isoBandNextXLT[cval]; - d_y = isoBandNextYLT[cval]; - d_o = isoBandNextOLT[cval]; - break; - } - break; - default: - switch (y) { - case -1: - switch (o) { - case 0: - e = isoBandEdgeTL[cval]; - d_x = isoBandNextXTL[cval]; - d_y = isoBandNextYTL[cval]; - d_o = isoBandNextOTL[cval]; - break; - default: - e = isoBandEdgeTR[cval]; - d_x = isoBandNextXTR[cval]; - d_y = isoBandNextYTR[cval]; - d_o = isoBandNextOTR[cval]; - break; - } - break; - case 1: - switch (o) { - case 0: - e = isoBandEdgeBL[cval]; - d_x = isoBandNextXBL[cval]; - d_y = isoBandNextYBL[cval]; - d_o = isoBandNextOBL[cval]; - break; - default: - e = isoBandEdgeBR[cval]; - d_x = isoBandNextXBR[cval]; - d_y = isoBandNextYBR[cval]; - d_o = isoBandNextOBR[cval]; - break; - } - break; - } - break; - } - - id_x = cell.edges.indexOf(e); - if (typeof cell.edges[id_x] !== "undefined") { - deleteEdge(cell, id_x); - } else { - //console.log("wrong edges..."); - //console.log(x + " " + y + " " + o); - //console.log(cell); - return null; - } - - cval = cell.cval_real; - - switch (e) { - case 0: - if (cval & Node1) { - /* node 1 within range */ - x = cell.topleft; - y = 1; - } else { - /* node 1 below or above threshold */ - x = 1; - y = cell.righttop; - } - break; - case 1: - if (cval & Node2) { - x = 1; - y = cell.rightbottom; - } else { - x = cell.topleft; - y = 1; - } - break; - case 2: - if (cval & Node2) { - x = cell.topleft; - y = 1; - } else { - x = cell.bottomright; - y = 0; - } - break; - case 3: - if (cval & Node3) { - x = cell.bottomleft; - y = 0; - } else { - x = cell.topleft; - y = 1; - } - break; - case 4: - if (cval & Node1) { - x = cell.topright; - y = 1; - } else { - x = 1; - y = cell.righttop; - } - break; - case 5: - if (cval & Node2) { - x = 1; - y = cell.rightbottom; - } else { - x = cell.topright; - y = 1; - } - break; - case 6: - if (cval & Node2) { - x = cell.topright; - y = 1; - } else { - x = cell.bottomright; - y = 0; - } - break; - case 7: - if (cval & Node3) { - x = cell.bottomleft; - y = 0; - } else { - x = cell.topright; - y = 1; - } - break; - case 8: - if (cval & Node2) { - x = 1; - y = cell.righttop; - } else { - x = cell.bottomright; - y = 0; - } - break; - case 9: - if (cval & Node3) { - x = cell.bottomleft; - y = 0; - } else { - x = 1; - y = cell.righttop; - } - break; - case 10: - if (cval & Node3) { - x = 1; - y = cell.righttop; - } else { - x = 0; - y = cell.leftbottom; - } - break; - case 11: - if (cval & Node0) { - x = 0; - y = cell.lefttop; - } else { - x = 1; - y = cell.righttop; - } - break; - case 12: - if (cval & Node2) { - x = 1; - y = cell.rightbottom; - } else { - x = cell.bottomright; - y = 0; - } - break; - case 13: - if (cval & Node3) { - x = cell.bottomleft; - y = 0; - } else { - x = 1; - y = cell.rightbottom; - } - break; - case 14: - if (cval & Node3) { - x = 1; - y = cell.rightbottom; - } else { - x = 0; - y = cell.leftbottom; - } - break; - case 15: - if (cval & Node0) { - x = 0; - y = cell.lefttop; - } else { - x = 1; - y = cell.rightbottom; - } - break; - case 16: - if (cval & Node2) { - x = 0; - y = cell.leftbottom; - } else { - x = cell.bottomright; - y = 0; - } - break; - case 17: - if (cval & Node0) { - x = 0; - y = cell.lefttop; - } else { - x = cell.bottomright; - y = 0; - } - break; - case 18: - if (cval & Node3) { - x = cell.bottomleft; - y = 0; - } else { - x = 0; - y = cell.leftbottom; - } - break; - case 19: - if (cval & Node0) { - x = 0; - y = cell.lefttop; - } else { - x = cell.bottomleft; - y = 0; - } - break; - case 20: - if (cval & Node0) { - x = 0; - y = cell.leftbottom; - } else { - x = cell.topleft; - y = 1; - } - break; - case 21: - if (cval & Node1) { - x = cell.topright; - y = 1; - } else { - x = 0; - y = cell.leftbottom; - } - break; - case 22: - if (cval & Node0) { - x = 0; - y = cell.lefttop; - } else { - x = cell.topleft; - y = 1; - } - break; - case 23: - if (cval & Node1) { - x = cell.topright; - y = 1; - } else { - x = 0; - y = cell.lefttop; - } - break; - default: - console.log("MarchingSquaresJS-isoBands: edge index out of range!"); - console.log(cell); - return null; - } - - if ( - typeof x === "undefined" || - typeof y === "undefined" || - typeof d_x === "undefined" || - typeof d_y === "undefined" || - typeof d_o === "undefined" - ) { - console.log("MarchingSquaresJS-isoBands: undefined value!"); - console.log(cell); - console.log(x + " " + y + " " + d_x + " " + d_y + " " + d_o); - } - return { p: [x, y], x: d_x, y: d_y, o: d_o }; -} - -function BandGrid2Areas(grid) { - var areas = []; - var area_idx = 0; - - grid.cells.forEach(function (g, j) { - g.forEach(function (gg, i) { - if (typeof gg !== "undefined") { - var a = polygon_table[gg.cval](gg); - if (typeof a === "object" && isArray(a)) { - if (typeof a[0] === "object" && isArray(a[0])) { - if (typeof a[0][0] === "object" && isArray(a[0][0])) { - a.forEach(function (aa) { - aa.forEach(function (aaa) { - aaa[0] += i; - aaa[1] += j; - }); - areas[area_idx++] = aa; - }); - } else { - a.forEach(function (aa) { - aa[0] += i; - aa[1] += j; - }); - areas[area_idx++] = a; - } - } else { - console.log( - "MarchingSquaresJS-isoBands: bandcell polygon with malformed coordinates" - ); - } - } else { - console.log( - "MarchingSquaresJS-isoBands: bandcell polygon with null coordinates" - ); - } - } - }); - }); - - return areas; -} - -/** - * Takes a square or rectangular grid {@link FeatureCollection} of {@link Point} features with z-values and an array of - * value breaks and generates filled contour isobands. - * - * @name isobands - * @param {FeatureCollection} pointGrid input points - must be square or rectangular - * @param {Array} breaks where to draw contours - * @param {Object} [options={}] options on output - * @param {string} [options.zProperty='elevation'] the property name in `points` from which z-values will be pulled - * @param {Object} [options.commonProperties={}] GeoJSON properties passed to ALL isobands - * @param {Array} [options.breaksProperties=[]] GeoJSON properties passed, in order, to the correspondent isoband (order defined by breaks) - * @returns {FeatureCollection} a FeatureCollection of {@link MultiPolygon} features representing isobands - */ -function isobands(pointGrid, breaks, options) { - // Optional parameters - options = options || {}; - if (!helpers.isObject(options)) throw new Error("options is invalid"); - var zProperty = options.zProperty || "elevation"; - var commonProperties = options.commonProperties || {}; - var breaksProperties = options.breaksProperties || []; - - // Validation - invariant.collectionOf(pointGrid, "Point", "Input must contain Points"); - if (!breaks) throw new Error("breaks is required"); - if (!Array.isArray(breaks)) throw new Error("breaks is not an Array"); - if (!helpers.isObject(commonProperties)) - throw new Error("commonProperties is not an Object"); - if (!Array.isArray(breaksProperties)) - throw new Error("breaksProperties is not an Array"); - - // Isoband methods - var matrix = gridToMatrix(pointGrid, { zProperty: zProperty, flip: true }); - var contours = createContourLines(matrix, breaks, zProperty); - contours = rescaleContours(contours, matrix, pointGrid); - - var multipolygons = contours.map(function (contour, index) { - if (breaksProperties[index] && !helpers.isObject(breaksProperties[index])) { - throw new Error("Each mappedProperty is required to be an Object"); - } - // collect all properties - var contourProperties = objectAssign__default['default']( - {}, - commonProperties, - breaksProperties[index] - ); - contourProperties[zProperty] = contour[zProperty]; - var multiP = helpers.multiPolygon(contour.groupedRings, contourProperties); - return multiP; - }); - - return helpers.featureCollection(multipolygons); -} - -/** - * Creates the contours lines (featuresCollection of polygon features) from the 2D data grid - * - * Marchingsquares process the grid data as a 3D representation of a function on a 2D plane, therefore it - * assumes the points (x-y coordinates) are one 'unit' distance. The result of the IsoBands function needs to be - * rescaled, with turfjs, to the original area and proportions on the map - * - * @private - * @param {Array>} matrix Grid Data - * @param {Array} breaks Breaks - * @param {string} [property='elevation'] Property - * @returns {Array} contours - */ -function createContourLines(matrix, breaks, property) { - var contours = []; - for (var i = 1; i < breaks.length; i++) { - var lowerBand = +breaks[i - 1]; // make sure the breaks value is a number - var upperBand = +breaks[i]; - - var isobandsCoords = isoBands(matrix, lowerBand, upperBand - lowerBand); - // as per GeoJson rules for creating a Polygon, make sure the first element - // in the array of LinearRings represents the exterior ring (i.e. biggest area), - // and any subsequent elements represent interior rings (i.e. smaller area); - // this avoids rendering issues of the MultiPolygons on the map - var nestedRings = orderByArea(isobandsCoords); - var groupedRings = groupNestedRings(nestedRings); - var obj = {}; - obj["groupedRings"] = groupedRings; - obj[property] = lowerBand + "-" + upperBand; - contours.push(obj); - } - return contours; -} - -/** - * Transform isobands of 2D grid to polygons for the map - * - * @private - * @param {Array} contours Contours - * @param {Array>} matrix Grid Data - * @param {Object} points Points by Latitude - * @returns {Array} contours - */ -function rescaleContours(contours, matrix, points) { - // get dimensions (on the map) of the original grid - var gridBbox = bbox__default['default'](points); // [ minX, minY, maxX, maxY ] - var originalWidth = gridBbox[2] - gridBbox[0]; - var originalHeigth = gridBbox[3] - gridBbox[1]; - - // get origin, which is the first point of the last row on the rectangular data on the map - var x0 = gridBbox[0]; - var y0 = gridBbox[1]; - // get number of cells per side - var matrixWidth = matrix[0].length - 1; - var matrixHeight = matrix.length - 1; - // calculate the scaling factor between matrix and rectangular grid on the map - var scaleX = originalWidth / matrixWidth; - var scaleY = originalHeigth / matrixHeight; - - var resize = function (point) { - point[0] = point[0] * scaleX + x0; - point[1] = point[1] * scaleY + y0; - }; - - // resize and shift each point/line of the isobands - contours.forEach(function (contour) { - contour.groupedRings.forEach(function (lineRingSet) { - lineRingSet.forEach(function (lineRing) { - lineRing.forEach(resize); - }); - }); - }); - return contours; -} - -/* utility functions */ - -/** - * Returns an array of coordinates (of LinearRings) in descending order by area - * - * @private - * @param {Array} ringsCoords array of closed LineString - * @returns {Array} array of the input LineString ordered by area - */ -function orderByArea(ringsCoords) { - var ringsWithArea = []; - var areas = []; - ringsCoords.forEach(function (coords) { - // var poly = polygon([points]); - var ringArea = area__default['default'](helpers.polygon([coords])); - // create an array of areas value - areas.push(ringArea); - // associate each lineRing with its area - ringsWithArea.push({ ring: coords, area: ringArea }); - }); - areas.sort(function (a, b) { - // bigger --> smaller - return b - a; - }); - // create a new array of linearRings coordinates ordered by their area - var orderedByArea = []; - areas.forEach(function (area) { - for (var lr = 0; lr < ringsWithArea.length; lr++) { - if (ringsWithArea[lr].area === area) { - orderedByArea.push(ringsWithArea[lr].ring); - ringsWithArea.splice(lr, 1); - break; - } - } - }); - return orderedByArea; -} - -/** - * Returns an array of arrays of coordinates, each representing - * a set of (coordinates of) nested LinearRings, - * i.e. the first ring contains all the others - * - * @private - * @param {Array} orderedLinearRings array of coordinates (of LinearRings) in descending order by area - * @returns {Array} Array of coordinates of nested LinearRings - */ -function groupNestedRings(orderedLinearRings) { - // create a list of the (coordinates of) LinearRings - var lrList = orderedLinearRings.map(function (lr) { - return { lrCoordinates: lr, grouped: false }; - }); - var groupedLinearRingsCoords = []; - while (!allGrouped(lrList)) { - for (var i = 0; i < lrList.length; i++) { - if (!lrList[i].grouped) { - // create new group starting with the larger not already grouped ring - var group = []; - group.push(lrList[i].lrCoordinates); - lrList[i].grouped = true; - var outerMostPoly = helpers.polygon([lrList[i].lrCoordinates]); - // group all the rings contained by the outermost ring - for (var j = i + 1; j < lrList.length; j++) { - if (!lrList[j].grouped) { - var lrPoly = helpers.polygon([lrList[j].lrCoordinates]); - if (isInside(lrPoly, outerMostPoly)) { - group.push(lrList[j].lrCoordinates); - lrList[j].grouped = true; - } - } - } - // insert the new group - groupedLinearRingsCoords.push(group); - } - } - } - return groupedLinearRingsCoords; -} - -/** - * @private - * @param {Polygon} testPolygon polygon of interest - * @param {Polygon} targetPolygon polygon you want to compare with - * @returns {boolean} true if test-Polygon is inside target-Polygon - */ -function isInside(testPolygon, targetPolygon) { - var points = explode__default['default'](testPolygon); - for (var i = 0; i < points.features.length; i++) { - if (!booleanPointInPolygon__default['default'](points.features[i], targetPolygon)) { - return false; - } - } - return true; -} - -/** - * @private - * @param {Array} list list of objects which might contain the 'group' attribute - * @returns {boolean} true if all the objects in the list are marked as grouped - */ -function allGrouped(list) { - for (var i = 0; i < list.length; i++) { - if (list[i].grouped === false) { - return false; - } - } - return true; -} - -module.exports = isobands; -module.exports["default"] = isobands; - - -/***/ }), - -/***/ 1283: -/***/ ((module) => { - -/** - * PriorityQueue - * Elements in this queue are sorted according to their value - * - * @author Lukasz Krawczyk - * @copyright MIT - */ - -/** - * PriorityQueue class construcotr - * @constructor - * - * @example - * queue: [1,2,3,4] - * priorities: [4,1,2,3] - * > result = [1,4,2,3] - * - * @param {Array} elements - * @param {Array} priorities - * @param {string} sorting - asc / desc - * @returns {PriorityQueue} - */ -function PriorityQueue(elements, priorities, sorting) { - /** @type {Array} */ - this._queue = []; - /** @type {Array} */ - this._priorities = []; - /** @type {string} */ - this._sorting = 'desc'; - - this._init(elements, priorities, sorting); -}; - -/** - * Insert element - * - * @param {Object} ele - * @param {Object} priority - * @returns {undefined} - * @access public - */ -PriorityQueue.prototype.insert = function(ele, priority) { - var indexToInsert = this._queue.length; - var index = indexToInsert; - - while (index--) { - var priority2 = this._priorities[index]; - if (this._sorting === 'desc') { - if (priority > priority2) { - indexToInsert = index; - } - } else { - if (priority < priority2) { - indexToInsert = index; - } - } - } - - this._insertAt(ele, priority, indexToInsert); -}; - -/** - * Remove element - * - * @param {Object} ele - * @returns {undefined} - * @access public - */ -PriorityQueue.prototype.remove = function(ele) { - var index = this._queue.length; - - while (index--) { - var ele2 = this._queue[index]; - if (ele === ele2) { - this._queue.splice(index, 1); - this._priorities.splice(index, 1); - break; - } - } -}; - -/** - * For each loop wrapper - * - * @param {function} func - * @returs {undefined} - * @access public - */ -PriorityQueue.prototype.forEach = function(func) { - this._queue.forEach(func); -}; - -/** - * @returns {Array} - * @access public - */ -PriorityQueue.prototype.getElements = function() { - return this._queue; -}; - -/** - * @param {number} index - * @returns {Object} - * @access public - */ -PriorityQueue.prototype.getElementPriority = function(index) { - return this._priorities[index]; -}; - -/** - * @returns {Array} - * @access public - */ -PriorityQueue.prototype.getPriorities = function() { - return this._priorities; -}; - -/** - * @returns {Array} - * @access public - */ -PriorityQueue.prototype.getElementsWithPriorities = function() { - var result = []; - - for (var i = 0, l = this._queue.length; i < l; i++) { - result.push([this._queue[i], this._priorities[i]]); - } - - return result; -}; - -/** - * Set object properties - * - * @param {Array} elements - * @param {Array} priorities - * @returns {undefined} - * @access protected - */ -PriorityQueue.prototype._init = function(elements, priorities, sorting) { - - if (elements && priorities) { - this._queue = []; - this._priorities = []; - - if (elements.length !== priorities.length) { - throw new Error('Arrays must have the same length'); - } - - for (var i = 0; i < elements.length; i++) { - this.insert(elements[i], priorities[i]); - } - } - - if (sorting) { - this._sorting = sorting; - } -}; - -/** - * Insert element at given position - * - * @param {Object} ele - * @param {number} index - * @returns {undefined} - * @access protected - */ -PriorityQueue.prototype._insertAt = function(ele, priority, index) { - if (this._queue.length === index) { - this._queue.push(ele); - this._priorities.push(priority); - } else { - this._queue.splice(index, 0, ele); - this._priorities.splice(index, 0, priority); - } -}; - -if ( true && module.exports) { - module.exports = PriorityQueue; -} - - -/***/ }), - -/***/ 1288: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -var helpers_1 = __webpack_require__(8967); -var invariant_1 = __webpack_require__(8506); -// http://en.wikipedia.org/wiki/Haversine_formula -// http://www.movable-type.co.uk/scripts/latlong.html -/** - * Takes two {@link Point|points} and finds the geographic bearing between them, - * i.e. the angle measured in degrees from the north line (0 degrees) - * - * @name bearing - * @param {Coord} start starting Point - * @param {Coord} end ending Point - * @param {Object} [options={}] Optional parameters - * @param {boolean} [options.final=false] calculates the final bearing if true - * @returns {number} bearing in decimal degrees, between -180 and 180 degrees (positive clockwise) - * @example - * var point1 = turf.point([-75.343, 39.984]); - * var point2 = turf.point([-75.534, 39.123]); - * - * var bearing = turf.bearing(point1, point2); - * - * //addToMap - * var addToMap = [point1, point2] - * point1.properties['marker-color'] = '#f00' - * point2.properties['marker-color'] = '#0f0' - * point1.properties.bearing = bearing - */ -function bearing(start, end, options) { - if (options === void 0) { options = {}; } - // Reverse calculation - if (options.final === true) { - return calculateFinalBearing(start, end); - } - var coordinates1 = invariant_1.getCoord(start); - var coordinates2 = invariant_1.getCoord(end); - var lon1 = helpers_1.degreesToRadians(coordinates1[0]); - var lon2 = helpers_1.degreesToRadians(coordinates2[0]); - var lat1 = helpers_1.degreesToRadians(coordinates1[1]); - var lat2 = helpers_1.degreesToRadians(coordinates2[1]); - var a = Math.sin(lon2 - lon1) * Math.cos(lat2); - var b = Math.cos(lat1) * Math.sin(lat2) - - Math.sin(lat1) * Math.cos(lat2) * Math.cos(lon2 - lon1); - return helpers_1.radiansToDegrees(Math.atan2(a, b)); -} -exports["default"] = bearing; -/** - * Calculates Final Bearing - * - * @private - * @param {Coord} start starting Point - * @param {Coord} end ending Point - * @returns {number} bearing - */ -function calculateFinalBearing(start, end) { - // Swap start & end - var bear = bearing(end, start); - bear = (bear + 180) % 360; - return bear; -} - - -/***/ }), - -/***/ 1323: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var boolean_point_in_polygon_1 = __importDefault(__webpack_require__(2446)); -var line_intersect_1 = __importDefault(__webpack_require__(3154)); -var meta_1 = __webpack_require__(8421); -var polygon_to_line_1 = __importDefault(__webpack_require__(4527)); -/** - * Boolean-disjoint returns (TRUE) if the intersection of the two geometries is an empty set. - * - * @name booleanDisjoint - * @param {Geometry|Feature} feature1 GeoJSON Feature or Geometry - * @param {Geometry|Feature} feature2 GeoJSON Feature or Geometry - * @returns {boolean} true/false - * @example - * var point = turf.point([2, 2]); - * var line = turf.lineString([[1, 1], [1, 2], [1, 3], [1, 4]]); - * - * turf.booleanDisjoint(line, point); - * //=true - */ -function booleanDisjoint(feature1, feature2) { - var bool = true; - meta_1.flattenEach(feature1, function (flatten1) { - meta_1.flattenEach(feature2, function (flatten2) { - if (bool === false) { - return false; - } - bool = disjoint(flatten1.geometry, flatten2.geometry); - }); - }); - return bool; -} -/** - * Disjoint operation for simple Geometries (Point/LineString/Polygon) - * - * @private - * @param {Geometry} geom1 GeoJSON Geometry - * @param {Geometry} geom2 GeoJSON Geometry - * @returns {boolean} true/false - */ -function disjoint(geom1, geom2) { - switch (geom1.type) { - case "Point": - switch (geom2.type) { - case "Point": - return !compareCoords(geom1.coordinates, geom2.coordinates); - case "LineString": - return !isPointOnLine(geom2, geom1); - case "Polygon": - return !boolean_point_in_polygon_1.default(geom1, geom2); - } - /* istanbul ignore next */ - break; - case "LineString": - switch (geom2.type) { - case "Point": - return !isPointOnLine(geom1, geom2); - case "LineString": - return !isLineOnLine(geom1, geom2); - case "Polygon": - return !isLineInPoly(geom2, geom1); - } - /* istanbul ignore next */ - break; - case "Polygon": - switch (geom2.type) { - case "Point": - return !boolean_point_in_polygon_1.default(geom2, geom1); - case "LineString": - return !isLineInPoly(geom1, geom2); - case "Polygon": - return !isPolyInPoly(geom2, geom1); - } - } - return false; -} -// http://stackoverflow.com/a/11908158/1979085 -function isPointOnLine(lineString, pt) { - for (var i = 0; i < lineString.coordinates.length - 1; i++) { - if (isPointOnLineSegment(lineString.coordinates[i], lineString.coordinates[i + 1], pt.coordinates)) { - return true; - } - } - return false; -} -function isLineOnLine(lineString1, lineString2) { - var doLinesIntersect = line_intersect_1.default(lineString1, lineString2); - if (doLinesIntersect.features.length > 0) { - return true; - } - return false; -} -function isLineInPoly(polygon, lineString) { - for (var _i = 0, _a = lineString.coordinates; _i < _a.length; _i++) { - var coord = _a[_i]; - if (boolean_point_in_polygon_1.default(coord, polygon)) { - return true; - } - } - var doLinesIntersect = line_intersect_1.default(lineString, polygon_to_line_1.default(polygon)); - if (doLinesIntersect.features.length > 0) { - return true; - } - return false; -} -/** - * Is Polygon (geom1) in Polygon (geom2) - * Only takes into account outer rings - * See http://stackoverflow.com/a/4833823/1979085 - * - * @private - * @param {Geometry|Feature} feature1 Polygon1 - * @param {Geometry|Feature} feature2 Polygon2 - * @returns {boolean} true/false - */ -function isPolyInPoly(feature1, feature2) { - for (var _i = 0, _a = feature1.coordinates[0]; _i < _a.length; _i++) { - var coord1 = _a[_i]; - if (boolean_point_in_polygon_1.default(coord1, feature2)) { - return true; - } - } - for (var _b = 0, _c = feature2.coordinates[0]; _b < _c.length; _b++) { - var coord2 = _c[_b]; - if (boolean_point_in_polygon_1.default(coord2, feature1)) { - return true; - } - } - var doLinesIntersect = line_intersect_1.default(polygon_to_line_1.default(feature1), polygon_to_line_1.default(feature2)); - if (doLinesIntersect.features.length > 0) { - return true; - } - return false; -} -function isPointOnLineSegment(lineSegmentStart, lineSegmentEnd, pt) { - var dxc = pt[0] - lineSegmentStart[0]; - var dyc = pt[1] - lineSegmentStart[1]; - var dxl = lineSegmentEnd[0] - lineSegmentStart[0]; - var dyl = lineSegmentEnd[1] - lineSegmentStart[1]; - var cross = dxc * dyl - dyc * dxl; - if (cross !== 0) { - return false; - } - if (Math.abs(dxl) >= Math.abs(dyl)) { - if (dxl > 0) { - return lineSegmentStart[0] <= pt[0] && pt[0] <= lineSegmentEnd[0]; - } - else { - return lineSegmentEnd[0] <= pt[0] && pt[0] <= lineSegmentStart[0]; - } - } - else if (dyl > 0) { - return lineSegmentStart[1] <= pt[1] && pt[1] <= lineSegmentEnd[1]; - } - else { - return lineSegmentEnd[1] <= pt[1] && pt[1] <= lineSegmentStart[1]; - } -} -/** - * compareCoords - * - * @private - * @param {Position} pair1 point [x,y] - * @param {Position} pair2 point [x,y] - * @returns {boolean} true/false if coord pairs match - */ -function compareCoords(pair1, pair2) { - return pair1[0] === pair2[0] && pair1[1] === pair2[1]; -} -exports["default"] = booleanDisjoint; - - -/***/ }), - -/***/ 1333: -/***/ ((module) => { - -"use strict"; - - -/** @type {import('./shams')} */ -/* eslint complexity: [2, 18], max-statements: [2, 33] */ -module.exports = function hasSymbols() { - if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; } - if (typeof Symbol.iterator === 'symbol') { return true; } - - /** @type {{ [k in symbol]?: unknown }} */ - var obj = {}; - var sym = Symbol('test'); - var symObj = Object(sym); - if (typeof sym === 'string') { return false; } - - if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; } - if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; } - - // temp disabled per https://github.com/ljharb/object.assign/issues/17 - // if (sym instanceof Symbol) { return false; } - // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4 - // if (!(symObj instanceof Symbol)) { return false; } - - // if (typeof Symbol.prototype.toString !== 'function') { return false; } - // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; } - - var symVal = 42; - obj[sym] = symVal; - for (var _ in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop - if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; } - - if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; } - - var syms = Object.getOwnPropertySymbols(obj); - if (syms.length !== 1 || syms[0] !== sym) { return false; } - - if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; } - - if (typeof Object.getOwnPropertyDescriptor === 'function') { - // eslint-disable-next-line no-extra-parens - var descriptor = /** @type {PropertyDescriptor} */ (Object.getOwnPropertyDescriptor(obj, sym)); - if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; } - } - - return true; -}; - - -/***/ }), - -/***/ 1353: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; -var __webpack_unused_export__; - -__webpack_unused_export__ = ({ value: true }); -exports.h3 = record_action; -exports.k8 = record_finish; -exports.DS = record_finish_edit; -exports.WH = record_finish_move; -exports.tN = undo; -exports.ZS = redo; -__webpack_unused_export__ = redo_action; -// Import ULabel from ../src/index - TypeScript will find ../src/index.d.ts for types -// and resolve to ../src/index.js at runtime after compilation -var index_1 = __webpack_require__(7105); -var configuration_1 = __webpack_require__(496); -var annotation_operators_1 = __webpack_require__(2571); -var annotation_1 = __webpack_require__(5573); -var error_logging_1 = __webpack_require__(5638); -// ================= Record Actions ================= -/** - * Record an action in the action stream to allow undo/redo functionality. - * Also trigger any listeners associated with the action. - * - * @param ulabel ULabel instance - * @param raw_action action to record - * @param is_redo whether ulabel action is a redo or not - * @param add_to_action_stream whether to add the action to the action stream - */ -function record_action(ulabel, raw_action, is_redo, add_to_action_stream) { - if (is_redo === void 0) { is_redo = false; } - if (add_to_action_stream === void 0) { add_to_action_stream = true; } - ulabel.set_saved(false); - var current_subtask = ulabel.get_current_subtask(); - var annotation = current_subtask.annotations.access[raw_action.annotation_id]; - // After a new action, you can no longer redo old actions - if (add_to_action_stream && !is_redo) { - current_subtask.actions.undone_stack = []; - } - // Stringify the undo/redo payloads - var act_type = raw_action.act_type; - var action = { - act_type: act_type, - annotation_id: raw_action.annotation_id, - frame: raw_action.frame, - undo_payload: JSON.stringify(raw_action.undo_payload), - redo_payload: JSON.stringify(raw_action.redo_payload), - prev_timestamp: (annotation === null || annotation === void 0 ? void 0 : annotation.last_edited_at) || null, - prev_user: (annotation === null || annotation === void 0 ? void 0 : annotation.last_edited_by) || "unknown", - }; - // Add to stream - if (add_to_action_stream) { - current_subtask.actions.stream.push(action); - // For some redo actions the annotation may no longer exist - if (annotation !== undefined) { - // Update annotation edit info - annotation.last_edited_at = index_1.ULabel.get_time(); - annotation.last_edited_by = ulabel.config.username; - } - } - // Trigger any listeners for the action - trigger_action_listeners(ulabel, action, false, is_redo); -} -; -/** - * Finish an action in the action stream. - * - * @param ulabel ULabel instance - * @param active_id ID of the active annotation - */ -function record_finish(ulabel, active_id) { - // Set up constants for convenience - var current_subtask = ulabel.get_current_subtask(); - var action = current_subtask.actions.stream.pop(); - // Parse and complete the redo payload - var redo_payload = JSON.parse(action.redo_payload); - redo_payload.init_spatial = current_subtask.annotations.access[active_id].spatial_payload; - redo_payload.finished = true; - action.redo_payload = JSON.stringify(redo_payload); - // Add the completed action back to the stream - current_subtask.actions.stream.push(action); -} -/** - * Finish an edit action in the action stream. - * - * @param ulabel ULabel instance - * @param active_id ID of the active annotation - */ -function record_finish_edit(ulabel, active_id) { - // Set up constants for convenience - var current_subtask = ulabel.get_current_subtask(); - var stream = current_subtask.actions.stream; - // Iterate backwards through the action stream to find the source "begin_edit" action - var action = null; - for (var i = stream.length - 1; i >= 0; i--) { - if (stream[i].act_type === "begin_edit" && stream[i].annotation_id === active_id) { - action = stream[i]; - break; - } - } - // If no action was found, log an error and return - if (action === null) { - (0, error_logging_1.log_message)("No \"begin_edit\" action found for annotation ID: ".concat(active_id), error_logging_1.LogLevel.ERROR, true); - return; - } - // Parse and complete the redo payload - var redo_payload = JSON.parse(action.redo_payload); - redo_payload.annotation = current_subtask.annotations.access[active_id]; - redo_payload.finished = true; - action.redo_payload = JSON.stringify(redo_payload); - // Record action without adding to the action stream - // The "begin_edit" action in the action stream is what is used to - // undo/redo the edit - record_action(ulabel, { - act_type: "finish_edit", - annotation_id: active_id, - frame: ulabel.state.current_frame, - undo_payload: {}, - redo_payload: {}, - }, false, false); -} -/** - * Finish a move action in the action stream. - * - * @param ulabel ULabel instance - * @param diffX x-axis translation - * @param diffY y-axis translation - * @param diffZ z-axis translation - * @param move_not_allowed whether the move is not allowed (used when allow_annotations_outside_image = false) - */ -function record_finish_move(ulabel, diffX, diffY, diffZ, move_not_allowed) { - if (diffZ === void 0) { diffZ = 0; } - if (move_not_allowed === void 0) { move_not_allowed = false; } - // Set up constants for convenience - var current_subtask = ulabel.get_current_subtask(); - var action = current_subtask.actions.stream.pop(); - // Parse and complete the redo/undo payloads - var redo_payload = JSON.parse(action.redo_payload); - var undo_payload = JSON.parse(action.undo_payload); - redo_payload.diffX = diffX; - redo_payload.diffY = diffY; - redo_payload.diffZ = diffZ; - undo_payload.diffX = -diffX; - undo_payload.diffY = -diffY; - undo_payload.diffZ = -diffZ; - redo_payload.finished = true; - redo_payload.move_not_allowed = move_not_allowed; - action.redo_payload = JSON.stringify(redo_payload); - action.undo_payload = JSON.stringify(undo_payload); - // Add the completed action back to the stream - current_subtask.actions.stream.push(action); - // Record action without adding to the action stream - // The "begin_move" action in the action stream is what is used to - // undo/redo the move - record_action(ulabel, { - act_type: "finish_move", - annotation_id: action.annotation_id, - frame: ulabel.state.current_frame, - undo_payload: {}, - redo_payload: {}, - }, false, false); -} -; -/** - * Finish an action in the action stream. - * - * @param ulabel ULabel instance - * @param action Action to finish - */ -function finish_action(ulabel, action) { - switch (action.act_type) { - case "begin_annotation": - case "begin_edit": - case "begin_move": - ulabel.end_drag(ulabel.state.last_move); - break; - default: - break; - } -} -// ================= Action Listeners ================= -function trigger_action_listeners(ulabel, action, is_undo, is_redo) { - if (is_undo === void 0) { is_undo = false; } - if (is_redo === void 0) { is_redo = false; } - var action_map = { - begin_annotation: { - action: on_start_annotation_spatial_modification, - undo: on_annotation_deletion, - }, - create_nonspatial_annotation: { - action: on_start_annotation_spatial_modification, - undo: on_annotation_deletion, - }, - continue_edit: { - action: on_in_progress_annotation_spatial_modification, - }, - continue_move: { - action: on_in_progress_annotation_spatial_modification, - }, - continue_brush: { - action: on_in_progress_annotation_spatial_modification, - }, - continue_annotation: { - action: on_in_progress_annotation_spatial_modification, - }, - create_annotation: { - action: on_finish_annotation_spatial_modification, - undo: on_annotation_deletion, - }, - finish_modify_annotation: { - action: on_finish_annotation_spatial_modification, - undo: on_finish_annotation_spatial_modification, - }, - finish_edit: { - action: on_finish_annotation_spatial_modification, - }, - finish_move: { - action: on_finish_annotation_spatial_modification, - }, - finish_annotation: { - action: on_finish_annotation_spatial_modification, - undo: on_finish_annotation_spatial_modification, - }, - cancel_annotation: { - action: on_finish_annotation_spatial_modification, - undo: on_annotation_revert, - }, - delete_annotation: { - action: on_annotation_deletion, - undo: on_finish_annotation_spatial_modification, - }, - assign_annotation_id: { - action: on_annotation_id_change, - undo: on_annotation_id_change, - }, - begin_edit: { - undo: on_finish_annotation_spatial_modification, - redo: on_finish_annotation_spatial_modification, - }, - begin_move: { - undo: on_finish_annotation_spatial_modification, - redo: on_finish_annotation_spatial_modification, - }, - start_complex_polygon: { - undo: on_finish_annotation_spatial_modification, - }, - merge_polygon_complex_layer: { - undo: on_annotation_revert, - }, - simplify_polygon_complex_layer: { - undo: on_annotation_revert, - }, - begin_brush: { - undo: on_annotation_revert, - }, - delete_annotations_in_polygon: { - // No listener for this action. - // It handles the re-rendering of the affected annotations itself. - }, - }; - // Call the appropriate listener - if (action.act_type in action_map) { - if ((!is_undo && !is_redo && "action" in action_map[action.act_type]) || - // For actions without a specific "redo" listener, call the "action" listener instead - (is_redo && !("redo" in action_map[action.act_type]) && "action" in action_map[action.act_type])) { - action_map[action.act_type].action(ulabel, action); - } - else if (is_undo && "undo" in action_map[action.act_type]) { - action_map[action.act_type].undo(ulabel, action, is_undo); - } - else if (is_redo && "redo" in action_map[action.act_type]) { - action_map[action.act_type].redo(ulabel, action); - } - } -} -/** - * Triggered when an annotation is started. - * - * @param ulabel ULabel instance - * @param action ULabelAction instance - * @param is_undo whether the action is an undo action - */ -function on_start_annotation_spatial_modification(ulabel, action, -// eslint-disable-next-line @typescript-eslint/no-unused-vars -is_undo) { - if (is_undo === void 0) { is_undo = false; } - // Draw new annotation - ulabel.draw_annotation_from_id(action.annotation_id); -} -/** - * For modes like edit, move, brush, etc, in-progress changes need to be rendered. - * - * @param ulabel ULabel instance - * @param action ULabelAction instance - * @param is_undo whether the action is an undo action - */ -function on_in_progress_annotation_spatial_modification(ulabel, action, -// eslint-disable-next-line @typescript-eslint/no-unused-vars -is_undo) { - var _a; - if (is_undo === void 0) { is_undo = false; } - var subtask_key = ulabel.get_current_subtask_key(); - var current_subtask = ulabel.subtasks[subtask_key]; - var offset = ((_a = current_subtask.state.move_candidate) === null || _a === void 0 ? void 0 : _a.offset) || { - id: action.annotation_id, - diffX: 0, - diffY: 0, - diffZ: 0, - }; - // Update the toolbox filter distance - ulabel.update_filter_distance_during_polyline_move(action.annotation_id, true, false, offset); - // Update the annotation rendering - ulabel.rebuild_containing_box(action.annotation_id, false, subtask_key); - ulabel.redraw_annotation(action.annotation_id, subtask_key, offset); - // Update dialogs - ulabel.suggest_edits(); -} -/** - * Triggered when an annotation is modified. - * - * @param ulabel ULabel instance - * @param action Action that was completed - * @param is_undo whether the action is an undo - * @param is_redo whether the action is a redo - */ -function on_finish_annotation_spatial_modification(ulabel, action, -// eslint-disable-next-line @typescript-eslint/no-unused-vars -is_undo) { - if (is_undo === void 0) { is_undo = false; } - // Update annotation rendering - ulabel.rebuild_containing_box(action.annotation_id); - ulabel.redraw_annotation(action.annotation_id); - // Update dialogs - ulabel.suggest_edits(null, null, true); - // Update the toolbox - ulabel.update_filter_distance(action.annotation_id); - ulabel.toolbox.redraw_update_items(ulabel); - // Ensure there are no lingering enders - ulabel.destroy_polygon_ender(action.annotation_id); -} -/** - * Triggered when an annotation is deleted. - * - * @param ulabel ULabel instance - * @param action ULabelAction instance - * @param is_undo Whether the action is an undo - */ -function on_annotation_deletion(ulabel, action, -// eslint-disable-next-line @typescript-eslint/no-unused-vars -is_undo) { - var _a; - if (is_undo === void 0) { is_undo = false; } - // Sometimes the annotation is just deprecated, and sometimes it is fully deleted - // Check if it still exists, because if so we need to redraw - var current_subtask = ulabel.get_current_subtask(); - var annotations = current_subtask.annotations.access; - if (action.annotation_id in annotations) { - var spatial_type = (_a = annotations[action.annotation_id]) === null || _a === void 0 ? void 0 : _a.spatial_type; - if (annotation_1.NONSPATIAL_MODES.includes(spatial_type)) { - // Render the change - ulabel.clear_nonspatial_annotation(action.annotation_id); - } - else { - ulabel.redraw_annotation(action.annotation_id); - // Force filter points if necessary - if (annotations[action.annotation_id].spatial_type === "polyline") { - ulabel.update_filter_distance(action.annotation_id, false, true); - } - } - } - // Ensure there are no lingering enders - ulabel.destroy_polygon_ender(action.annotation_id); - // Update dialogs - ulabel.suggest_edits(null, null, true); - // Update the toolbox - ulabel.toolbox.redraw_update_items(ulabel); -} -/** - * Triggered when an annotation ID is changed. - * - * @param ulabel ULabel instance - * @param action ULabelAction instance - * @param is_undo Whether the action is an undo action - */ -function on_annotation_id_change(ulabel, action, is_undo) { - if (is_undo === void 0) { is_undo = false; } - // Update the annotation rendering - ulabel.redraw_annotation(action.annotation_id); - ulabel.recolor_active_polygon_ender(); - ulabel.recolor_brush_circle(); - // Update dialogs - if (!is_undo) { - // Hide the large ID dialog after the user has made a selection - ulabel.hide_id_dialog(); - } - ulabel.suggest_edits(null, null, true); - // Determine if we need to update the filter distance - // If the filter_distance_toolbox_item exists, - // Check if the FilterDistance ToolboxItem is in this ULabel instance - if (ulabel.config.toolbox_order.includes(configuration_1.AllowedToolboxItem.FilterDistance)) { - var spatial_type = ulabel.get_current_subtask().annotations.access[action.annotation_id].spatial_type; - if (spatial_type === "polyline") { - // Get the toolbox item - var filter_distance_toolbox_item = ulabel.toolbox.items.find(function (item) { return item.get_toolbox_item_type() === "FilterDistance"; }); - // filter annotations if in multi_class_mode - if (filter_distance_toolbox_item === null || filter_distance_toolbox_item === void 0 ? void 0 : filter_distance_toolbox_item.multi_class_mode) { - (0, annotation_operators_1.filter_points_distance_from_line)(ulabel, true); - } - } - } - // Update toolbox - ulabel.toolbox.redraw_update_items(ulabel); -} -/** - * Triggered when an annotation is fully reverted as part of an undo action. - * - * @param ulabel ULabel instance - * @param action ULabelAction instance - * @param is_undo whether the action is an undo action - */ -function on_annotation_revert(ulabel, action, -// eslint-disable-next-line @typescript-eslint/no-unused-vars -is_undo) { - if (is_undo === void 0) { is_undo = false; } - // Redraw the annotation - ulabel.redraw_annotation(action.annotation_id); -} -// ================= Undo / Redo ================= -/** - * Undo the last action in the action stream. - * - * @param ulabel ULabel instance - * @param is_internal_undo whether ulabel undo is triggered by an internal action - */ -function undo(ulabel, is_internal_undo) { - if (is_internal_undo === void 0) { is_internal_undo = false; } - // Create constants for convenience - var current_subtask = ulabel.get_current_subtask(); - var action_stream = current_subtask.actions.stream; - var undone_stack = current_subtask.actions.undone_stack; - // If the action_steam is empty, then there are no actions to undo - if (action_stream.length === 0) - return; - if (!current_subtask.state.idd_thumbnail) { - ulabel.hide_id_dialog(); - } - var undo_candidate = action_stream.pop(); - // Finish action if it is marked as unfinished - if (JSON.parse(undo_candidate.redo_payload).finished === false) { - // Push action back to the stream, finish, then pop it again - // TODO: better way of doing this? - action_stream.push(undo_candidate); - finish_action(ulabel, undo_candidate); - undo_candidate = action_stream.pop(); - } - // Set internal undo status - undo_candidate.is_internal_undo = is_internal_undo; - undone_stack.push(undo_candidate); - undo_action(ulabel, undo_candidate); - // Trigger any listeners for the action - trigger_action_listeners(ulabel, undo_candidate, true); -} -/** - * Redo the last undone action. - * - * @param ulabel ULabel instance - */ -function redo(ulabel) { - // Create constants for convenience - var current_subtask = ulabel.get_current_subtask(); - var undone_stack = current_subtask.actions.undone_stack; - // If the action_steam is empty, then there are no actions to redo - if (undone_stack.length === 0) - return; - // Redo the action - var redo_candidate = undone_stack.pop(); - redo_action(ulabel, redo_candidate); -} -/** - * Call the appropriate undo function for the given action type. - * - * @param ulabel ULabel instance - * @param action Action to undo - */ -function undo_action(ulabel, action) { - ulabel.update_frame(null, action.frame); - var undo_payload = JSON.parse(action.undo_payload); - var annotations = ulabel.get_current_subtask().annotations.access; - // For some actions like delete_annotations_in_polygon, the annotation may no longer exist - if (action.annotation_id in annotations) { - var annotation = annotations[action.annotation_id]; - // Revert the annotation's last edited info - annotation.last_edited_at = action.prev_timestamp; - annotation.last_edited_by = action.prev_user; - } - switch (action.act_type) { - case "begin_annotation": - ulabel.begin_annotation__undo(action.annotation_id); - break; - case "continue_annotation": - ulabel.continue_annotation__undo(action.annotation_id); - break; - case "finish_annotation": - ulabel.finish_annotation__undo(action.annotation_id); - break; - case "begin_edit": - ulabel.begin_edit__undo(action.annotation_id, undo_payload); - break; - case "begin_move": - ulabel.begin_move__undo(action.annotation_id, undo_payload); - break; - case "delete_annotation": - ulabel.delete_annotation__undo(action.annotation_id); - break; - case "cancel_annotation": - ulabel.cancel_annotation__undo(action.annotation_id, undo_payload); - break; - case "assign_annotation_id": - ulabel.assign_annotation_id__undo(action.annotation_id, undo_payload); - break; - case "create_annotation": - ulabel.create_annotation__undo(action.annotation_id); - break; - case "create_nonspatial_annotation": - ulabel.create_nonspatial_annotation__undo(action.annotation_id); - break; - case "start_complex_polygon": - ulabel.start_complex_polygon__undo(action.annotation_id); - break; - case "merge_polygon_complex_layer": - ulabel.merge_polygon_complex_layer__undo(action.annotation_id, undo_payload); - // If the undo was triggered by the user, they - // expect ctrl+z to undo the previous action as well - if (!action.is_internal_undo) { - undo(ulabel); - } - break; - case "simplify_polygon_complex_layer": - ulabel.simplify_polygon_complex_layer__undo(action.annotation_id, undo_payload); - // If the undo was triggered by the user, they - // expect ctrl+z to undo the previous action as well - if (!action.is_internal_undo) { - undo(ulabel); - } - break; - case "delete_annotations_in_polygon": - ulabel.delete_annotations_in_polygon__undo(undo_payload); - break; - case "begin_brush": - ulabel.begin_brush__undo(action.annotation_id, undo_payload); - break; - case "finish_modify_annotation": - ulabel.finish_modify_annotation__undo(action.annotation_id, undo_payload); - break; - default: - (0, error_logging_1.log_message)("Action type not recognized for undo: ".concat(action.act_type), error_logging_1.LogLevel.WARNING); - break; - } -} -/** - * Call the appropriate redo function for the given action type. - * - * @param ulabel ULabel instance - * @param action Action to redo - */ -function redo_action(ulabel, action) { - ulabel.update_frame(null, action.frame); - var redo_payload = JSON.parse(action.redo_payload); - switch (action.act_type) { - case "begin_annotation": - ulabel.begin_annotation(null, action.annotation_id, redo_payload); - break; - case "continue_annotation": - ulabel.continue_annotation(null, null, action.annotation_id, redo_payload); - break; - case "finish_annotation": - ulabel.finish_annotation__redo(action.annotation_id); - break; - case "begin_edit": - ulabel.begin_edit__redo(action.annotation_id, redo_payload); - break; - case "begin_move": - ulabel.begin_move__redo(action.annotation_id, redo_payload); - break; - case "delete_annotation": - ulabel.delete_annotation__redo(action.annotation_id); - break; - case "cancel_annotation": - ulabel.cancel_annotation(action.annotation_id); - break; - case "assign_annotation_id": - ulabel.assign_annotation_id(action.annotation_id, redo_payload); - break; - case "create_annotation": - ulabel.create_annotation__redo(action.annotation_id, redo_payload); - break; - case "create_nonspatial_annotation": - ulabel.create_nonspatial_annotation(action.annotation_id, redo_payload); - break; - case "start_complex_polygon": - ulabel.start_complex_polygon(action.annotation_id); - break; - case "merge_polygon_complex_layer": - ulabel.merge_polygon_complex_layer(action.annotation_id, redo_payload.layer_idx, false, true); - break; - case "simplify_polygon_complex_layer": - ulabel.simplify_polygon_complex_layer(action.annotation_id, redo_payload.active_idx, true); - // Since this is an internal operation, user expects redo of the next action - ulabel.redo(); - break; - case "delete_annotations_in_polygon": - ulabel.delete_annotations_in_polygon(action.annotation_id, redo_payload); - break; - case "finish_modify_annotation": - ulabel.finish_modify_annotation__redo(action.annotation_id, redo_payload); - break; - default: - (0, error_logging_1.log_message)("Action type not recognized for redo: ".concat(action.act_type), error_logging_1.LogLevel.WARNING); - break; - } -} - - -/***/ }), - -/***/ 1356: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var helpers = __webpack_require__(8967); -var invariant = __webpack_require__(8506); -var d3voronoi = __webpack_require__(3227); - -/** - * @private - * @param {Array>} coords representing a polygon - * @returns {Feature} polygon - */ -function coordsToPolygon(coords) { - coords = coords.slice(); - coords.push(coords[0]); - return helpers.polygon([coords]); -} - -/** - * Takes a FeatureCollection of points, and a bounding box, and returns a FeatureCollection - * of Voronoi polygons. - * - * The Voronoi algorithim used comes from the d3-voronoi package. - * - * @name voronoi - * @param {FeatureCollection} points to find the Voronoi polygons around. - * @param {Object} [options={}] Optional parameters - * @param {number[]} [options.bbox=[-180, -85, 180, -85]] clipping rectangle, in [minX, minY, maxX, MaxY] order. - * @returns {FeatureCollection} a set of polygons, one per input point. - * @example - * var options = { - * bbox: [-70, 40, -60, 60] - * }; - * var points = turf.randomPoint(100, options); - * var voronoiPolygons = turf.voronoi(points, options); - * - * //addToMap - * var addToMap = [voronoiPolygons, points]; - */ -function voronoi(points, options) { - // Optional params - options = options || {}; - if (!helpers.isObject(options)) throw new Error("options is invalid"); - var bbox = options.bbox || [-180, -85, 180, 85]; - - // Input Validation - if (!points) throw new Error("points is required"); - if (!Array.isArray(bbox)) throw new Error("bbox is invalid"); - invariant.collectionOf(points, "Point", "points"); - - // Main - return helpers.featureCollection( - d3voronoi.voronoi() - .x(function (feature) { - return feature.geometry.coordinates[0]; - }) - .y(function (feature) { - return feature.geometry.coordinates[1]; - }) - .extent([ - [bbox[0], bbox[1]], - [bbox[2], bbox[3]], - ]) - .polygons(points.features) - .map(coordsToPolygon) - ); -} - -module.exports = voronoi; -module.exports["default"] = voronoi; - - -/***/ }), - -/***/ 1424: -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ ULABEL_VERSION: () => (/* binding */ ULABEL_VERSION) -/* harmony export */ }); -const ULABEL_VERSION = "0.20.0"; - - -/***/ }), - -/***/ 1476: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var pointInPolygonFlat = __webpack_require__(3841) -var pointInPolygonNested = __webpack_require__(1137) - -module.exports = function pointInPolygon (point, vs, start, end) { - if (vs.length > 0 && Array.isArray(vs[0])) { - return pointInPolygonNested(point, vs, start, end); - } else { - return pointInPolygonFlat(point, vs, start, end); - } -} -module.exports.nested = pointInPolygonNested -module.exports.flat = pointInPolygonFlat - - -/***/ }), - -/***/ 1484: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var bbox_1 = __importDefault(__webpack_require__(4383)); -var boolean_point_in_polygon_1 = __importDefault(__webpack_require__(2446)); -var rbush_1 = __importDefault(__webpack_require__(2903)); -/** - * Merges a specified property from a FeatureCollection of points into a - * FeatureCollection of polygons. Given an `inProperty` on points and an `outProperty` - * for polygons, this finds every point that lies within each polygon, collects the - * `inProperty` values from those points, and adds them as an array to `outProperty` - * on the polygon. - * - * @name collect - * @param {FeatureCollection} polygons polygons with values on which to aggregate - * @param {FeatureCollection} points points to be aggregated - * @param {string} inProperty property to be nested from - * @param {string} outProperty property to be nested into - * @returns {FeatureCollection} polygons with properties listed based on `outField` - * @example - * var poly1 = turf.polygon([[[0,0],[10,0],[10,10],[0,10],[0,0]]]); - * var poly2 = turf.polygon([[[10,0],[20,10],[20,20],[20,0],[10,0]]]); - * var polyFC = turf.featureCollection([poly1, poly2]); - * var pt1 = turf.point([5,5], {population: 200}); - * var pt2 = turf.point([1,3], {population: 600}); - * var pt3 = turf.point([14,2], {population: 100}); - * var pt4 = turf.point([13,1], {population: 200}); - * var pt5 = turf.point([19,7], {population: 300}); - * var pointFC = turf.featureCollection([pt1, pt2, pt3, pt4, pt5]); - * var collected = turf.collect(polyFC, pointFC, 'population', 'values'); - * var values = collected.features[0].properties.values - * //=values => [200, 600] - * - * //addToMap - * var addToMap = [pointFC, collected] - */ -function collect(polygons, points, inProperty, outProperty) { - var rtree = rbush_1.default(6); - var treeItems = points.features.map(function (item) { - var _a; - return { - minX: item.geometry.coordinates[0], - minY: item.geometry.coordinates[1], - maxX: item.geometry.coordinates[0], - maxY: item.geometry.coordinates[1], - property: (_a = item.properties) === null || _a === void 0 ? void 0 : _a[inProperty], - }; - }); - rtree.load(treeItems); - polygons.features.forEach(function (poly) { - if (!poly.properties) { - poly.properties = {}; - } - var bbox = bbox_1.default(poly); - var potentialPoints = rtree.search({ - minX: bbox[0], - minY: bbox[1], - maxX: bbox[2], - maxY: bbox[3], - }); - var values = []; - potentialPoints.forEach(function (pt) { - if (boolean_point_in_polygon_1.default([pt.minX, pt.minY], poly)) { - values.push(pt.property); - } - }); - poly.properties[outProperty] = values; - }); - return polygons; -} -exports["default"] = collect; - - -/***/ }), - -/***/ 1514: -/***/ ((module) => { - -"use strict"; - - -/** @type {import('./abs')} */ -module.exports = Math.abs; - - -/***/ }), - -/***/ 1582: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var RBush = __webpack_require__(5341); -var Queue = __webpack_require__(4262); -var pointInPolygon = __webpack_require__(1476); -var orient = (__webpack_require__(3467).orient2d); - -// Fix for require issue in webpack https://github.com/mapbox/concaveman/issues/18 -if (Queue.default) { - Queue = Queue.default; -} - -module.exports = concaveman; -module.exports["default"] = concaveman; - -function concaveman(points, concavity, lengthThreshold) { - // a relative measure of concavity; higher value means simpler hull - concavity = Math.max(0, concavity === undefined ? 2 : concavity); - - // when a segment goes below this length threshold, it won't be drilled down further - lengthThreshold = lengthThreshold || 0; - - // start with a convex hull of the points - var hull = fastConvexHull(points); - - // index the points with an R-tree - var tree = new RBush(16); - tree.toBBox = function (a) { - return { - minX: a[0], - minY: a[1], - maxX: a[0], - maxY: a[1] - }; - }; - tree.compareMinX = function (a, b) { return a[0] - b[0]; }; - tree.compareMinY = function (a, b) { return a[1] - b[1]; }; - - tree.load(points); - - // turn the convex hull into a linked list and populate the initial edge queue with the nodes - var queue = []; - for (var i = 0, last; i < hull.length; i++) { - var p = hull[i]; - tree.remove(p); - last = insertNode(p, last); - queue.push(last); - } - - // index the segments with an R-tree (for intersection checks) - var segTree = new RBush(16); - for (i = 0; i < queue.length; i++) segTree.insert(updateBBox(queue[i])); - - var sqConcavity = concavity * concavity; - var sqLenThreshold = lengthThreshold * lengthThreshold; - - // process edges one by one - while (queue.length) { - var node = queue.shift(); - var a = node.p; - var b = node.next.p; - - // skip the edge if it's already short enough - var sqLen = getSqDist(a, b); - if (sqLen < sqLenThreshold) continue; - - var maxSqLen = sqLen / sqConcavity; - - // find the best connection point for the current edge to flex inward to - p = findCandidate(tree, node.prev.p, a, b, node.next.next.p, maxSqLen, segTree); - - // if we found a connection and it satisfies our concavity measure - if (p && Math.min(getSqDist(p, a), getSqDist(p, b)) <= maxSqLen) { - // connect the edge endpoints through this point and add 2 new edges to the queue - queue.push(node); - queue.push(insertNode(p, node)); - - // update point and segment indexes - tree.remove(p); - segTree.remove(node); - segTree.insert(updateBBox(node)); - segTree.insert(updateBBox(node.next)); - } - } - - // convert the resulting hull linked list to an array of points - node = last; - var concave = []; - do { - concave.push(node.p); - node = node.next; - } while (node !== last); - - concave.push(node.p); - - return concave; -} - -function findCandidate(tree, a, b, c, d, maxDist, segTree) { - var queue = new Queue([], compareDist); - var node = tree.data; - - // search through the point R-tree with a depth-first search using a priority queue - // in the order of distance to the edge (b, c) - while (node) { - for (var i = 0; i < node.children.length; i++) { - var child = node.children[i]; - - var dist = node.leaf ? sqSegDist(child, b, c) : sqSegBoxDist(b, c, child); - if (dist > maxDist) continue; // skip the node if it's farther than we ever need - - queue.push({ - node: child, - dist: dist - }); - } - - while (queue.length && !queue.peek().node.children) { - var item = queue.pop(); - var p = item.node; - - // skip all points that are as close to adjacent edges (a,b) and (c,d), - // and points that would introduce self-intersections when connected - var d0 = sqSegDist(p, a, b); - var d1 = sqSegDist(p, c, d); - if (item.dist < d0 && item.dist < d1 && - noIntersections(b, p, segTree) && - noIntersections(c, p, segTree)) return p; - } - - node = queue.pop(); - if (node) node = node.node; - } - - return null; -} - -function compareDist(a, b) { - return a.dist - b.dist; -} - -// square distance from a segment bounding box to the given one -function sqSegBoxDist(a, b, bbox) { - if (inside(a, bbox) || inside(b, bbox)) return 0; - var d1 = sqSegSegDist(a[0], a[1], b[0], b[1], bbox.minX, bbox.minY, bbox.maxX, bbox.minY); - if (d1 === 0) return 0; - var d2 = sqSegSegDist(a[0], a[1], b[0], b[1], bbox.minX, bbox.minY, bbox.minX, bbox.maxY); - if (d2 === 0) return 0; - var d3 = sqSegSegDist(a[0], a[1], b[0], b[1], bbox.maxX, bbox.minY, bbox.maxX, bbox.maxY); - if (d3 === 0) return 0; - var d4 = sqSegSegDist(a[0], a[1], b[0], b[1], bbox.minX, bbox.maxY, bbox.maxX, bbox.maxY); - if (d4 === 0) return 0; - return Math.min(d1, d2, d3, d4); -} - -function inside(a, bbox) { - return a[0] >= bbox.minX && - a[0] <= bbox.maxX && - a[1] >= bbox.minY && - a[1] <= bbox.maxY; -} - -// check if the edge (a,b) doesn't intersect any other edges -function noIntersections(a, b, segTree) { - var minX = Math.min(a[0], b[0]); - var minY = Math.min(a[1], b[1]); - var maxX = Math.max(a[0], b[0]); - var maxY = Math.max(a[1], b[1]); - - var edges = segTree.search({minX: minX, minY: minY, maxX: maxX, maxY: maxY}); - for (var i = 0; i < edges.length; i++) { - if (intersects(edges[i].p, edges[i].next.p, a, b)) return false; - } - return true; -} - -function cross(p1, p2, p3) { - return orient(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1]); -} - -// check if the edges (p1,q1) and (p2,q2) intersect -function intersects(p1, q1, p2, q2) { - return p1 !== q2 && q1 !== p2 && - cross(p1, q1, p2) > 0 !== cross(p1, q1, q2) > 0 && - cross(p2, q2, p1) > 0 !== cross(p2, q2, q1) > 0; -} - -// update the bounding box of a node's edge -function updateBBox(node) { - var p1 = node.p; - var p2 = node.next.p; - node.minX = Math.min(p1[0], p2[0]); - node.minY = Math.min(p1[1], p2[1]); - node.maxX = Math.max(p1[0], p2[0]); - node.maxY = Math.max(p1[1], p2[1]); - return node; -} - -// speed up convex hull by filtering out points inside quadrilateral formed by 4 extreme points -function fastConvexHull(points) { - var left = points[0]; - var top = points[0]; - var right = points[0]; - var bottom = points[0]; - - // find the leftmost, rightmost, topmost and bottommost points - for (var i = 0; i < points.length; i++) { - var p = points[i]; - if (p[0] < left[0]) left = p; - if (p[0] > right[0]) right = p; - if (p[1] < top[1]) top = p; - if (p[1] > bottom[1]) bottom = p; - } - - // filter out points that are inside the resulting quadrilateral - var cull = [left, top, right, bottom]; - var filtered = cull.slice(); - for (i = 0; i < points.length; i++) { - if (!pointInPolygon(points[i], cull)) filtered.push(points[i]); - } - - // get convex hull around the filtered points - return convexHull(filtered); -} - -// create a new node in a doubly linked list -function insertNode(p, prev) { - var node = { - p: p, - prev: null, - next: null, - minX: 0, - minY: 0, - maxX: 0, - maxY: 0 - }; - - if (!prev) { - node.prev = node; - node.next = node; - - } else { - node.next = prev.next; - node.prev = prev; - prev.next.prev = node; - prev.next = node; - } - return node; -} - -// square distance between 2 points -function getSqDist(p1, p2) { - - var dx = p1[0] - p2[0], - dy = p1[1] - p2[1]; - - return dx * dx + dy * dy; -} - -// square distance from a point to a segment -function sqSegDist(p, p1, p2) { - - var x = p1[0], - y = p1[1], - dx = p2[0] - x, - dy = p2[1] - y; - - if (dx !== 0 || dy !== 0) { - - var t = ((p[0] - x) * dx + (p[1] - y) * dy) / (dx * dx + dy * dy); - - if (t > 1) { - x = p2[0]; - y = p2[1]; - - } else if (t > 0) { - x += dx * t; - y += dy * t; - } - } - - dx = p[0] - x; - dy = p[1] - y; - - return dx * dx + dy * dy; -} - -// segment to segment distance, ported from http://geomalgorithms.com/a07-_distance.html by Dan Sunday -function sqSegSegDist(x0, y0, x1, y1, x2, y2, x3, y3) { - var ux = x1 - x0; - var uy = y1 - y0; - var vx = x3 - x2; - var vy = y3 - y2; - var wx = x0 - x2; - var wy = y0 - y2; - var a = ux * ux + uy * uy; - var b = ux * vx + uy * vy; - var c = vx * vx + vy * vy; - var d = ux * wx + uy * wy; - var e = vx * wx + vy * wy; - var D = a * c - b * b; - - var sc, sN, tc, tN; - var sD = D; - var tD = D; - - if (D === 0) { - sN = 0; - sD = 1; - tN = e; - tD = c; - } else { - sN = b * e - c * d; - tN = a * e - b * d; - if (sN < 0) { - sN = 0; - tN = e; - tD = c; - } else if (sN > sD) { - sN = sD; - tN = e + b; - tD = c; - } - } - - if (tN < 0.0) { - tN = 0.0; - if (-d < 0.0) sN = 0.0; - else if (-d > a) sN = sD; - else { - sN = -d; - sD = a; - } - } else if (tN > tD) { - tN = tD; - if ((-d + b) < 0.0) sN = 0; - else if (-d + b > a) sN = sD; - else { - sN = -d + b; - sD = a; - } - } - - sc = sN === 0 ? 0 : sN / sD; - tc = tN === 0 ? 0 : tN / tD; - - var cx = (1 - sc) * x0 + sc * x1; - var cy = (1 - sc) * y0 + sc * y1; - var cx2 = (1 - tc) * x2 + tc * x3; - var cy2 = (1 - tc) * y2 + tc * y3; - var dx = cx2 - cx; - var dy = cy2 - cy; - - return dx * dx + dy * dy; -} - -function compareByX(a, b) { - return a[0] === b[0] ? a[1] - b[1] : a[0] - b[0]; -} - -function convexHull(points) { - points.sort(compareByX); - - var lower = []; - for (var i = 0; i < points.length; i++) { - while (lower.length >= 2 && cross(lower[lower.length - 2], lower[lower.length - 1], points[i]) <= 0) { - lower.pop(); - } - lower.push(points[i]); - } - - var upper = []; - for (var ii = points.length - 1; ii >= 0; ii--) { - while (upper.length >= 2 && cross(upper[upper.length - 2], upper[upper.length - 1], points[ii]) <= 0) { - upper.pop(); - } - upper.push(points[ii]); - } - - upper.pop(); - lower.pop(); - return lower.concat(upper); -} - - -/***/ }), - -/***/ 1589: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var define = __webpack_require__(8452); -var callBind = __webpack_require__(487); - -var implementation = __webpack_require__(7675); -var getPolyfill = __webpack_require__(5330); -var shim = __webpack_require__(3984); - -var flagsBound = callBind(getPolyfill()); - -define(flagsBound, { - getPolyfill: getPolyfill, - implementation: implementation, - shim: shim -}); - -module.exports = flagsBound; - - -/***/ }), - -/***/ 1715: -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -// ESM COMPAT FLAG -__webpack_require__.r(__webpack_exports__); - -// EXPORTS -__webpack_require__.d(__webpack_exports__, { - geoAlbers: () => (/* reexport */ albers), - geoAlbersUsa: () => (/* reexport */ albersUsa), - geoArea: () => (/* reexport */ src_area), - geoAzimuthalEqualArea: () => (/* reexport */ azimuthalEqualArea), - geoAzimuthalEqualAreaRaw: () => (/* reexport */ azimuthalEqualAreaRaw), - geoAzimuthalEquidistant: () => (/* reexport */ azimuthalEquidistant), - geoAzimuthalEquidistantRaw: () => (/* reexport */ azimuthalEquidistantRaw), - geoBounds: () => (/* reexport */ bounds), - geoCentroid: () => (/* reexport */ centroid), - geoCircle: () => (/* reexport */ circle), - geoClipExtent: () => (/* reexport */ clip_extent), - geoConicConformal: () => (/* reexport */ conicConformal), - geoConicConformalRaw: () => (/* reexport */ conicConformalRaw), - geoConicEqualArea: () => (/* reexport */ conicEqualArea), - geoConicEqualAreaRaw: () => (/* reexport */ conicEqualAreaRaw), - geoConicEquidistant: () => (/* reexport */ conicEquidistant), - geoConicEquidistantRaw: () => (/* reexport */ conicEquidistantRaw), - geoContains: () => (/* reexport */ contains), - geoDistance: () => (/* reexport */ distance), - geoEquirectangular: () => (/* reexport */ equirectangular), - geoEquirectangularRaw: () => (/* reexport */ equirectangularRaw), - geoGnomonic: () => (/* reexport */ gnomonic), - geoGnomonicRaw: () => (/* reexport */ gnomonicRaw), - geoGraticule: () => (/* reexport */ graticule), - geoGraticule10: () => (/* reexport */ graticule10), - geoIdentity: () => (/* reexport */ projection_identity), - geoInterpolate: () => (/* reexport */ interpolate), - geoLength: () => (/* reexport */ src_length), - geoMercator: () => (/* reexport */ mercator), - geoMercatorRaw: () => (/* reexport */ mercatorRaw), - geoNaturalEarth1: () => (/* reexport */ naturalEarth1), - geoNaturalEarth1Raw: () => (/* reexport */ naturalEarth1Raw), - geoOrthographic: () => (/* reexport */ orthographic), - geoOrthographicRaw: () => (/* reexport */ orthographicRaw), - geoPath: () => (/* reexport */ path), - geoProjection: () => (/* reexport */ projection), - geoProjectionMutator: () => (/* reexport */ projectionMutator), - geoRotation: () => (/* reexport */ rotation), - geoStereographic: () => (/* reexport */ stereographic), - geoStereographicRaw: () => (/* reexport */ stereographicRaw), - geoStream: () => (/* reexport */ stream), - geoTransform: () => (/* reexport */ transform), - geoTransverseMercator: () => (/* reexport */ transverseMercator), - geoTransverseMercatorRaw: () => (/* reexport */ transverseMercatorRaw) -}); - -;// ./node_modules/d3-geo/src/adder.js -// Adds floating point numbers with twice the normal precision. -// Reference: J. R. Shewchuk, Adaptive Precision Floating-Point Arithmetic and -// Fast Robust Geometric Predicates, Discrete & Computational Geometry 18(3) -// 305–363 (1997). -// Code adapted from GeographicLib by Charles F. F. Karney, -// http://geographiclib.sourceforge.net/ - -/* harmony default export */ function adder() { - return new Adder; -} - -function Adder() { - this.reset(); -} - -Adder.prototype = { - constructor: Adder, - reset: function() { - this.s = // rounded value - this.t = 0; // exact error - }, - add: function(y) { - add(temp, y, this.t); - add(this, temp.s, this.s); - if (this.s) this.t += temp.t; - else this.s = temp.t; - }, - valueOf: function() { - return this.s; - } -}; - -var temp = new Adder; - -function add(adder, a, b) { - var x = adder.s = a + b, - bv = x - a, - av = x - bv; - adder.t = (a - av) + (b - bv); -} - -;// ./node_modules/d3-geo/src/math.js -var epsilon = 1e-6; -var epsilon2 = 1e-12; -var pi = Math.PI; -var halfPi = pi / 2; -var quarterPi = pi / 4; -var tau = pi * 2; - -var degrees = 180 / pi; -var radians = pi / 180; - -var abs = Math.abs; -var atan = Math.atan; -var atan2 = Math.atan2; -var cos = Math.cos; -var ceil = Math.ceil; -var exp = Math.exp; -var floor = Math.floor; -var log = Math.log; -var pow = Math.pow; -var sin = Math.sin; -var sign = Math.sign || function(x) { return x > 0 ? 1 : x < 0 ? -1 : 0; }; -var sqrt = Math.sqrt; -var tan = Math.tan; - -function acos(x) { - return x > 1 ? 0 : x < -1 ? pi : Math.acos(x); -} - -function asin(x) { - return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x); -} - -function haversin(x) { - return (x = sin(x / 2)) * x; -} - -;// ./node_modules/d3-geo/src/noop.js -function noop() {} - -;// ./node_modules/d3-geo/src/stream.js -function streamGeometry(geometry, stream) { - if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) { - streamGeometryType[geometry.type](geometry, stream); - } -} - -var streamObjectType = { - Feature: function(object, stream) { - streamGeometry(object.geometry, stream); - }, - FeatureCollection: function(object, stream) { - var features = object.features, i = -1, n = features.length; - while (++i < n) streamGeometry(features[i].geometry, stream); - } -}; - -var streamGeometryType = { - Sphere: function(object, stream) { - stream.sphere(); - }, - Point: function(object, stream) { - object = object.coordinates; - stream.point(object[0], object[1], object[2]); - }, - MultiPoint: function(object, stream) { - var coordinates = object.coordinates, i = -1, n = coordinates.length; - while (++i < n) object = coordinates[i], stream.point(object[0], object[1], object[2]); - }, - LineString: function(object, stream) { - streamLine(object.coordinates, stream, 0); - }, - MultiLineString: function(object, stream) { - var coordinates = object.coordinates, i = -1, n = coordinates.length; - while (++i < n) streamLine(coordinates[i], stream, 0); - }, - Polygon: function(object, stream) { - streamPolygon(object.coordinates, stream); - }, - MultiPolygon: function(object, stream) { - var coordinates = object.coordinates, i = -1, n = coordinates.length; - while (++i < n) streamPolygon(coordinates[i], stream); - }, - GeometryCollection: function(object, stream) { - var geometries = object.geometries, i = -1, n = geometries.length; - while (++i < n) streamGeometry(geometries[i], stream); - } -}; - -function streamLine(coordinates, stream, closed) { - var i = -1, n = coordinates.length - closed, coordinate; - stream.lineStart(); - while (++i < n) coordinate = coordinates[i], stream.point(coordinate[0], coordinate[1], coordinate[2]); - stream.lineEnd(); -} - -function streamPolygon(coordinates, stream) { - var i = -1, n = coordinates.length; - stream.polygonStart(); - while (++i < n) streamLine(coordinates[i], stream, 1); - stream.polygonEnd(); -} - -/* harmony default export */ function stream(object, stream) { - if (object && streamObjectType.hasOwnProperty(object.type)) { - streamObjectType[object.type](object, stream); - } else { - streamGeometry(object, stream); - } -} - -;// ./node_modules/d3-geo/src/area.js - - - - - -var areaRingSum = adder(); - -var areaSum = adder(), - lambda00, - phi00, - lambda0, - cosPhi0, - sinPhi0; - -var areaStream = { - point: noop, - lineStart: noop, - lineEnd: noop, - polygonStart: function() { - areaRingSum.reset(); - areaStream.lineStart = areaRingStart; - areaStream.lineEnd = areaRingEnd; - }, - polygonEnd: function() { - var areaRing = +areaRingSum; - areaSum.add(areaRing < 0 ? tau + areaRing : areaRing); - this.lineStart = this.lineEnd = this.point = noop; - }, - sphere: function() { - areaSum.add(tau); - } -}; - -function areaRingStart() { - areaStream.point = areaPointFirst; -} - -function areaRingEnd() { - areaPoint(lambda00, phi00); -} - -function areaPointFirst(lambda, phi) { - areaStream.point = areaPoint; - lambda00 = lambda, phi00 = phi; - lambda *= radians, phi *= radians; - lambda0 = lambda, cosPhi0 = cos(phi = phi / 2 + quarterPi), sinPhi0 = sin(phi); -} - -function areaPoint(lambda, phi) { - lambda *= radians, phi *= radians; - phi = phi / 2 + quarterPi; // half the angular distance from south pole - - // Spherical excess E for a spherical triangle with vertices: south pole, - // previous point, current point. Uses a formula derived from Cagnoli’s - // theorem. See Todhunter, Spherical Trig. (1871), Sec. 103, Eq. (2). - var dLambda = lambda - lambda0, - sdLambda = dLambda >= 0 ? 1 : -1, - adLambda = sdLambda * dLambda, - cosPhi = cos(phi), - sinPhi = sin(phi), - k = sinPhi0 * sinPhi, - u = cosPhi0 * cosPhi + k * cos(adLambda), - v = k * sdLambda * sin(adLambda); - areaRingSum.add(atan2(v, u)); - - // Advance the previous points. - lambda0 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi; -} - -/* harmony default export */ function src_area(object) { - areaSum.reset(); - stream(object, areaStream); - return areaSum * 2; -} - -;// ./node_modules/d3-geo/src/cartesian.js - - -function spherical(cartesian) { - return [atan2(cartesian[1], cartesian[0]), asin(cartesian[2])]; -} - -function cartesian(spherical) { - var lambda = spherical[0], phi = spherical[1], cosPhi = cos(phi); - return [cosPhi * cos(lambda), cosPhi * sin(lambda), sin(phi)]; -} - -function cartesianDot(a, b) { - return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; -} - -function cartesianCross(a, b) { - return [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]]; -} - -// TODO return a -function cartesianAddInPlace(a, b) { - a[0] += b[0], a[1] += b[1], a[2] += b[2]; -} - -function cartesianScale(vector, k) { - return [vector[0] * k, vector[1] * k, vector[2] * k]; -} - -// TODO return d -function cartesianNormalizeInPlace(d) { - var l = sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]); - d[0] /= l, d[1] /= l, d[2] /= l; -} - -;// ./node_modules/d3-geo/src/bounds.js - - - - - - -var bounds_lambda0, phi0, lambda1, phi1, // bounds - lambda2, // previous lambda-coordinate - bounds_lambda00, bounds_phi00, // first point - p0, // previous 3D point - deltaSum = adder(), - ranges, - bounds_range; - -var boundsStream = { - point: boundsPoint, - lineStart: boundsLineStart, - lineEnd: boundsLineEnd, - polygonStart: function() { - boundsStream.point = boundsRingPoint; - boundsStream.lineStart = boundsRingStart; - boundsStream.lineEnd = boundsRingEnd; - deltaSum.reset(); - areaStream.polygonStart(); - }, - polygonEnd: function() { - areaStream.polygonEnd(); - boundsStream.point = boundsPoint; - boundsStream.lineStart = boundsLineStart; - boundsStream.lineEnd = boundsLineEnd; - if (areaRingSum < 0) bounds_lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90); - else if (deltaSum > epsilon) phi1 = 90; - else if (deltaSum < -epsilon) phi0 = -90; - bounds_range[0] = bounds_lambda0, bounds_range[1] = lambda1; - } -}; - -function boundsPoint(lambda, phi) { - ranges.push(bounds_range = [bounds_lambda0 = lambda, lambda1 = lambda]); - if (phi < phi0) phi0 = phi; - if (phi > phi1) phi1 = phi; -} - -function linePoint(lambda, phi) { - var p = cartesian([lambda * radians, phi * radians]); - if (p0) { - var normal = cartesianCross(p0, p), - equatorial = [normal[1], -normal[0], 0], - inflection = cartesianCross(equatorial, normal); - cartesianNormalizeInPlace(inflection); - inflection = spherical(inflection); - var delta = lambda - lambda2, - sign = delta > 0 ? 1 : -1, - lambdai = inflection[0] * degrees * sign, - phii, - antimeridian = abs(delta) > 180; - if (antimeridian ^ (sign * lambda2 < lambdai && lambdai < sign * lambda)) { - phii = inflection[1] * degrees; - if (phii > phi1) phi1 = phii; - } else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign * lambda2 < lambdai && lambdai < sign * lambda)) { - phii = -inflection[1] * degrees; - if (phii < phi0) phi0 = phii; - } else { - if (phi < phi0) phi0 = phi; - if (phi > phi1) phi1 = phi; - } - if (antimeridian) { - if (lambda < lambda2) { - if (angle(bounds_lambda0, lambda) > angle(bounds_lambda0, lambda1)) lambda1 = lambda; - } else { - if (angle(lambda, lambda1) > angle(bounds_lambda0, lambda1)) bounds_lambda0 = lambda; - } - } else { - if (lambda1 >= bounds_lambda0) { - if (lambda < bounds_lambda0) bounds_lambda0 = lambda; - if (lambda > lambda1) lambda1 = lambda; - } else { - if (lambda > lambda2) { - if (angle(bounds_lambda0, lambda) > angle(bounds_lambda0, lambda1)) lambda1 = lambda; - } else { - if (angle(lambda, lambda1) > angle(bounds_lambda0, lambda1)) bounds_lambda0 = lambda; - } - } - } - } else { - ranges.push(bounds_range = [bounds_lambda0 = lambda, lambda1 = lambda]); - } - if (phi < phi0) phi0 = phi; - if (phi > phi1) phi1 = phi; - p0 = p, lambda2 = lambda; -} - -function boundsLineStart() { - boundsStream.point = linePoint; -} - -function boundsLineEnd() { - bounds_range[0] = bounds_lambda0, bounds_range[1] = lambda1; - boundsStream.point = boundsPoint; - p0 = null; -} - -function boundsRingPoint(lambda, phi) { - if (p0) { - var delta = lambda - lambda2; - deltaSum.add(abs(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta); - } else { - bounds_lambda00 = lambda, bounds_phi00 = phi; - } - areaStream.point(lambda, phi); - linePoint(lambda, phi); -} - -function boundsRingStart() { - areaStream.lineStart(); -} - -function boundsRingEnd() { - boundsRingPoint(bounds_lambda00, bounds_phi00); - areaStream.lineEnd(); - if (abs(deltaSum) > epsilon) bounds_lambda0 = -(lambda1 = 180); - bounds_range[0] = bounds_lambda0, bounds_range[1] = lambda1; - p0 = null; -} - -// Finds the left-right distance between two longitudes. -// This is almost the same as (lambda1 - lambda0 + 360°) % 360°, except that we want -// the distance between ±180° to be 360°. -function angle(lambda0, lambda1) { - return (lambda1 -= lambda0) < 0 ? lambda1 + 360 : lambda1; -} - -function rangeCompare(a, b) { - return a[0] - b[0]; -} - -function rangeContains(range, x) { - return range[0] <= range[1] ? range[0] <= x && x <= range[1] : x < range[0] || range[1] < x; -} - -/* harmony default export */ function bounds(feature) { - var i, n, a, b, merged, deltaMax, delta; - - phi1 = lambda1 = -(bounds_lambda0 = phi0 = Infinity); - ranges = []; - stream(feature, boundsStream); - - // First, sort ranges by their minimum longitudes. - if (n = ranges.length) { - ranges.sort(rangeCompare); - - // Then, merge any ranges that overlap. - for (i = 1, a = ranges[0], merged = [a]; i < n; ++i) { - b = ranges[i]; - if (rangeContains(a, b[0]) || rangeContains(a, b[1])) { - if (angle(a[0], b[1]) > angle(a[0], a[1])) a[1] = b[1]; - if (angle(b[0], a[1]) > angle(a[0], a[1])) a[0] = b[0]; - } else { - merged.push(a = b); - } - } - - // Finally, find the largest gap between the merged ranges. - // The final bounding box will be the inverse of this gap. - for (deltaMax = -Infinity, n = merged.length - 1, i = 0, a = merged[n]; i <= n; a = b, ++i) { - b = merged[i]; - if ((delta = angle(a[1], b[0])) > deltaMax) deltaMax = delta, bounds_lambda0 = b[0], lambda1 = a[1]; - } - } - - ranges = bounds_range = null; - - return bounds_lambda0 === Infinity || phi0 === Infinity - ? [[NaN, NaN], [NaN, NaN]] - : [[bounds_lambda0, phi0], [lambda1, phi1]]; -} - -;// ./node_modules/d3-geo/src/centroid.js - - - - -var W0, W1, - X0, Y0, Z0, - X1, Y1, Z1, - X2, Y2, Z2, - centroid_lambda00, centroid_phi00, // first point - x0, y0, z0; // previous point - -var centroidStream = { - sphere: noop, - point: centroidPoint, - lineStart: centroidLineStart, - lineEnd: centroidLineEnd, - polygonStart: function() { - centroidStream.lineStart = centroidRingStart; - centroidStream.lineEnd = centroidRingEnd; - }, - polygonEnd: function() { - centroidStream.lineStart = centroidLineStart; - centroidStream.lineEnd = centroidLineEnd; - } -}; - -// Arithmetic mean of Cartesian vectors. -function centroidPoint(lambda, phi) { - lambda *= radians, phi *= radians; - var cosPhi = cos(phi); - centroidPointCartesian(cosPhi * cos(lambda), cosPhi * sin(lambda), sin(phi)); -} - -function centroidPointCartesian(x, y, z) { - ++W0; - X0 += (x - X0) / W0; - Y0 += (y - Y0) / W0; - Z0 += (z - Z0) / W0; -} - -function centroidLineStart() { - centroidStream.point = centroidLinePointFirst; -} - -function centroidLinePointFirst(lambda, phi) { - lambda *= radians, phi *= radians; - var cosPhi = cos(phi); - x0 = cosPhi * cos(lambda); - y0 = cosPhi * sin(lambda); - z0 = sin(phi); - centroidStream.point = centroidLinePoint; - centroidPointCartesian(x0, y0, z0); -} - -function centroidLinePoint(lambda, phi) { - lambda *= radians, phi *= radians; - var cosPhi = cos(phi), - x = cosPhi * cos(lambda), - y = cosPhi * sin(lambda), - z = sin(phi), - w = atan2(sqrt((w = y0 * z - z0 * y) * w + (w = z0 * x - x0 * z) * w + (w = x0 * y - y0 * x) * w), x0 * x + y0 * y + z0 * z); - W1 += w; - X1 += w * (x0 + (x0 = x)); - Y1 += w * (y0 + (y0 = y)); - Z1 += w * (z0 + (z0 = z)); - centroidPointCartesian(x0, y0, z0); -} - -function centroidLineEnd() { - centroidStream.point = centroidPoint; -} - -// See J. E. Brock, The Inertia Tensor for a Spherical Triangle, -// J. Applied Mechanics 42, 239 (1975). -function centroidRingStart() { - centroidStream.point = centroidRingPointFirst; -} - -function centroidRingEnd() { - centroidRingPoint(centroid_lambda00, centroid_phi00); - centroidStream.point = centroidPoint; -} - -function centroidRingPointFirst(lambda, phi) { - centroid_lambda00 = lambda, centroid_phi00 = phi; - lambda *= radians, phi *= radians; - centroidStream.point = centroidRingPoint; - var cosPhi = cos(phi); - x0 = cosPhi * cos(lambda); - y0 = cosPhi * sin(lambda); - z0 = sin(phi); - centroidPointCartesian(x0, y0, z0); -} - -function centroidRingPoint(lambda, phi) { - lambda *= radians, phi *= radians; - var cosPhi = cos(phi), - x = cosPhi * cos(lambda), - y = cosPhi * sin(lambda), - z = sin(phi), - cx = y0 * z - z0 * y, - cy = z0 * x - x0 * z, - cz = x0 * y - y0 * x, - m = sqrt(cx * cx + cy * cy + cz * cz), - w = asin(m), // line weight = angle - v = m && -w / m; // area weight multiplier - X2 += v * cx; - Y2 += v * cy; - Z2 += v * cz; - W1 += w; - X1 += w * (x0 + (x0 = x)); - Y1 += w * (y0 + (y0 = y)); - Z1 += w * (z0 + (z0 = z)); - centroidPointCartesian(x0, y0, z0); -} - -/* harmony default export */ function centroid(object) { - W0 = W1 = - X0 = Y0 = Z0 = - X1 = Y1 = Z1 = - X2 = Y2 = Z2 = 0; - stream(object, centroidStream); - - var x = X2, - y = Y2, - z = Z2, - m = x * x + y * y + z * z; - - // If the area-weighted ccentroid is undefined, fall back to length-weighted ccentroid. - if (m < epsilon2) { - x = X1, y = Y1, z = Z1; - // If the feature has zero length, fall back to arithmetic mean of point vectors. - if (W1 < epsilon) x = X0, y = Y0, z = Z0; - m = x * x + y * y + z * z; - // If the feature still has an undefined ccentroid, then return. - if (m < epsilon2) return [NaN, NaN]; - } - - return [atan2(y, x) * degrees, asin(z / sqrt(m)) * degrees]; -} - -;// ./node_modules/d3-geo/src/constant.js -/* harmony default export */ function src_constant(x) { - return function() { - return x; - }; -} - -;// ./node_modules/d3-geo/src/compose.js -/* harmony default export */ function compose(a, b) { - - function compose(x, y) { - return x = a(x, y), b(x[0], x[1]); - } - - if (a.invert && b.invert) compose.invert = function(x, y) { - return x = b.invert(x, y), x && a.invert(x[0], x[1]); - }; - - return compose; -} - -;// ./node_modules/d3-geo/src/rotation.js - - - -function rotationIdentity(lambda, phi) { - return [lambda > pi ? lambda - tau : lambda < -pi ? lambda + tau : lambda, phi]; -} - -rotationIdentity.invert = rotationIdentity; - -function rotateRadians(deltaLambda, deltaPhi, deltaGamma) { - return (deltaLambda %= tau) ? (deltaPhi || deltaGamma ? compose(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) - : rotationLambda(deltaLambda)) - : (deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) - : rotationIdentity); -} - -function forwardRotationLambda(deltaLambda) { - return function(lambda, phi) { - return lambda += deltaLambda, [lambda > pi ? lambda - tau : lambda < -pi ? lambda + tau : lambda, phi]; - }; -} - -function rotationLambda(deltaLambda) { - var rotation = forwardRotationLambda(deltaLambda); - rotation.invert = forwardRotationLambda(-deltaLambda); - return rotation; -} - -function rotationPhiGamma(deltaPhi, deltaGamma) { - var cosDeltaPhi = cos(deltaPhi), - sinDeltaPhi = sin(deltaPhi), - cosDeltaGamma = cos(deltaGamma), - sinDeltaGamma = sin(deltaGamma); - - function rotation(lambda, phi) { - var cosPhi = cos(phi), - x = cos(lambda) * cosPhi, - y = sin(lambda) * cosPhi, - z = sin(phi), - k = z * cosDeltaPhi + x * sinDeltaPhi; - return [ - atan2(y * cosDeltaGamma - k * sinDeltaGamma, x * cosDeltaPhi - z * sinDeltaPhi), - asin(k * cosDeltaGamma + y * sinDeltaGamma) - ]; - } - - rotation.invert = function(lambda, phi) { - var cosPhi = cos(phi), - x = cos(lambda) * cosPhi, - y = sin(lambda) * cosPhi, - z = sin(phi), - k = z * cosDeltaGamma - y * sinDeltaGamma; - return [ - atan2(y * cosDeltaGamma + z * sinDeltaGamma, x * cosDeltaPhi + k * sinDeltaPhi), - asin(k * cosDeltaPhi - x * sinDeltaPhi) - ]; - }; - - return rotation; -} - -/* harmony default export */ function rotation(rotate) { - rotate = rotateRadians(rotate[0] * radians, rotate[1] * radians, rotate.length > 2 ? rotate[2] * radians : 0); - - function forward(coordinates) { - coordinates = rotate(coordinates[0] * radians, coordinates[1] * radians); - return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates; - } - - forward.invert = function(coordinates) { - coordinates = rotate.invert(coordinates[0] * radians, coordinates[1] * radians); - return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates; - }; - - return forward; -} - -;// ./node_modules/d3-geo/src/circle.js - - - - - -// Generates a circle centered at [0°, 0°], with a given radius and precision. -function circleStream(stream, radius, delta, direction, t0, t1) { - if (!delta) return; - var cosRadius = cos(radius), - sinRadius = sin(radius), - step = direction * delta; - if (t0 == null) { - t0 = radius + direction * tau; - t1 = radius - step / 2; - } else { - t0 = circleRadius(cosRadius, t0); - t1 = circleRadius(cosRadius, t1); - if (direction > 0 ? t0 < t1 : t0 > t1) t0 += direction * tau; - } - for (var point, t = t0; direction > 0 ? t > t1 : t < t1; t -= step) { - point = spherical([cosRadius, -sinRadius * cos(t), -sinRadius * sin(t)]); - stream.point(point[0], point[1]); - } -} - -// Returns the signed angle of a cartesian point relative to [cosRadius, 0, 0]. -function circleRadius(cosRadius, point) { - point = cartesian(point), point[0] -= cosRadius; - cartesianNormalizeInPlace(point); - var radius = acos(-point[1]); - return ((-point[2] < 0 ? -radius : radius) + tau - epsilon) % tau; -} - -/* harmony default export */ function circle() { - var center = src_constant([0, 0]), - radius = src_constant(90), - precision = src_constant(6), - ring, - rotate, - stream = {point: point}; - - function point(x, y) { - ring.push(x = rotate(x, y)); - x[0] *= degrees, x[1] *= degrees; - } - - function circle() { - var c = center.apply(this, arguments), - r = radius.apply(this, arguments) * radians, - p = precision.apply(this, arguments) * radians; - ring = []; - rotate = rotateRadians(-c[0] * radians, -c[1] * radians, 0).invert; - circleStream(stream, r, p, 1); - c = {type: "Polygon", coordinates: [ring]}; - ring = rotate = null; - return c; - } - - circle.center = function(_) { - return arguments.length ? (center = typeof _ === "function" ? _ : src_constant([+_[0], +_[1]]), circle) : center; - }; - - circle.radius = function(_) { - return arguments.length ? (radius = typeof _ === "function" ? _ : src_constant(+_), circle) : radius; - }; - - circle.precision = function(_) { - return arguments.length ? (precision = typeof _ === "function" ? _ : src_constant(+_), circle) : precision; - }; - - return circle; -} - -;// ./node_modules/d3-geo/src/clip/buffer.js - - -/* harmony default export */ function buffer() { - var lines = [], - line; - return { - point: function(x, y) { - line.push([x, y]); - }, - lineStart: function() { - lines.push(line = []); - }, - lineEnd: noop, - rejoin: function() { - if (lines.length > 1) lines.push(lines.pop().concat(lines.shift())); - }, - result: function() { - var result = lines; - lines = []; - line = null; - return result; - } - }; -} - -;// ./node_modules/d3-geo/src/clip/line.js -/* harmony default export */ function line(a, b, x0, y0, x1, y1) { - var ax = a[0], - ay = a[1], - bx = b[0], - by = b[1], - t0 = 0, - t1 = 1, - dx = bx - ax, - dy = by - ay, - r; - - r = x0 - ax; - if (!dx && r > 0) return; - r /= dx; - if (dx < 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } else if (dx > 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } - - r = x1 - ax; - if (!dx && r < 0) return; - r /= dx; - if (dx < 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } else if (dx > 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } - - r = y0 - ay; - if (!dy && r > 0) return; - r /= dy; - if (dy < 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } else if (dy > 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } - - r = y1 - ay; - if (!dy && r < 0) return; - r /= dy; - if (dy < 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } else if (dy > 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } - - if (t0 > 0) a[0] = ax + t0 * dx, a[1] = ay + t0 * dy; - if (t1 < 1) b[0] = ax + t1 * dx, b[1] = ay + t1 * dy; - return true; -} - -;// ./node_modules/d3-geo/src/pointEqual.js - - -/* harmony default export */ function pointEqual(a, b) { - return abs(a[0] - b[0]) < epsilon && abs(a[1] - b[1]) < epsilon; -} - -;// ./node_modules/d3-geo/src/clip/polygon.js - - -function Intersection(point, points, other, entry) { - this.x = point; - this.z = points; - this.o = other; // another intersection - this.e = entry; // is an entry? - this.v = false; // visited - this.n = this.p = null; // next & previous -} - -// A generalized polygon clipping algorithm: given a polygon that has been cut -// into its visible line segments, and rejoins the segments by interpolating -// along the clip edge. -/* harmony default export */ function clip_polygon(segments, compareIntersection, startInside, interpolate, stream) { - var subject = [], - clip = [], - i, - n; - - segments.forEach(function(segment) { - if ((n = segment.length - 1) <= 0) return; - var n, p0 = segment[0], p1 = segment[n], x; - - // If the first and last points of a segment are coincident, then treat as a - // closed ring. TODO if all rings are closed, then the winding order of the - // exterior ring should be checked. - if (pointEqual(p0, p1)) { - stream.lineStart(); - for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]); - stream.lineEnd(); - return; - } - - subject.push(x = new Intersection(p0, segment, null, true)); - clip.push(x.o = new Intersection(p0, null, x, false)); - subject.push(x = new Intersection(p1, segment, null, false)); - clip.push(x.o = new Intersection(p1, null, x, true)); - }); - - if (!subject.length) return; - - clip.sort(compareIntersection); - polygon_link(subject); - polygon_link(clip); - - for (i = 0, n = clip.length; i < n; ++i) { - clip[i].e = startInside = !startInside; - } - - var start = subject[0], - points, - point; - - while (1) { - // Find first unvisited intersection. - var current = start, - isSubject = true; - while (current.v) if ((current = current.n) === start) return; - points = current.z; - stream.lineStart(); - do { - current.v = current.o.v = true; - if (current.e) { - if (isSubject) { - for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]); - } else { - interpolate(current.x, current.n.x, 1, stream); - } - current = current.n; - } else { - if (isSubject) { - points = current.p.z; - for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]); - } else { - interpolate(current.x, current.p.x, -1, stream); - } - current = current.p; - } - current = current.o; - points = current.z; - isSubject = !isSubject; - } while (!current.v); - stream.lineEnd(); - } -} - -function polygon_link(array) { - if (!(n = array.length)) return; - var n, - i = 0, - a = array[0], - b; - while (++i < n) { - a.n = b = array[i]; - b.p = a; - a = b; - } - a.n = b = array[0]; - b.p = a; -} - -;// ./node_modules/d3-array/src/ascending.js -/* harmony default export */ function src_ascending(a, b) { - return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; -} - -;// ./node_modules/d3-array/src/bisector.js - - -/* harmony default export */ function bisector(compare) { - if (compare.length === 1) compare = ascendingComparator(compare); - return { - left: function(a, x, lo, hi) { - if (lo == null) lo = 0; - if (hi == null) hi = a.length; - while (lo < hi) { - var mid = lo + hi >>> 1; - if (compare(a[mid], x) < 0) lo = mid + 1; - else hi = mid; - } - return lo; - }, - right: function(a, x, lo, hi) { - if (lo == null) lo = 0; - if (hi == null) hi = a.length; - while (lo < hi) { - var mid = lo + hi >>> 1; - if (compare(a[mid], x) > 0) hi = mid; - else lo = mid + 1; - } - return lo; - } - }; -} - -function ascendingComparator(f) { - return function(d, x) { - return src_ascending(f(d), x); - }; -} - -;// ./node_modules/d3-array/src/bisect.js - - - -var ascendingBisect = bisector(src_ascending); -var bisectRight = ascendingBisect.right; -var bisectLeft = ascendingBisect.left; -/* harmony default export */ const src_bisect = ((/* unused pure expression or super */ null && (bisectRight))); - -;// ./node_modules/d3-array/src/array.js -var array = Array.prototype; - -var array_slice = array.slice; -var array_map = array.map; - -;// ./node_modules/d3-array/src/ticks.js -var e10 = Math.sqrt(50), - e5 = Math.sqrt(10), - e2 = Math.sqrt(2); - -/* harmony default export */ function ticks(start, stop, count) { - var reverse, - i = -1, - n, - ticks, - step; - - stop = +stop, start = +start, count = +count; - if (start === stop && count > 0) return [start]; - if (reverse = stop < start) n = start, start = stop, stop = n; - if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return []; - - if (step > 0) { - start = Math.ceil(start / step); - stop = Math.floor(stop / step); - ticks = new Array(n = Math.ceil(stop - start + 1)); - while (++i < n) ticks[i] = (start + i) * step; - } else { - start = Math.floor(start * step); - stop = Math.ceil(stop * step); - ticks = new Array(n = Math.ceil(start - stop + 1)); - while (++i < n) ticks[i] = (start - i) / step; - } - - if (reverse) ticks.reverse(); - - return ticks; -} - -function tickIncrement(start, stop, count) { - var step = (stop - start) / Math.max(0, count), - power = Math.floor(Math.log(step) / Math.LN10), - error = step / Math.pow(10, power); - return power >= 0 - ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power) - : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1); -} - -function ticks_tickStep(start, stop, count) { - var step0 = Math.abs(stop - start) / Math.max(0, count), - step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), - error = step0 / step1; - if (error >= e10) step1 *= 10; - else if (error >= e5) step1 *= 5; - else if (error >= e2) step1 *= 2; - return stop < start ? -step1 : step1; -} - -;// ./node_modules/d3-array/src/histogram.js - - - - - - - - - -/* harmony default export */ function histogram() { - var value = identity, - domain = extent, - threshold = sturges; - - function histogram(data) { - var i, - n = data.length, - x, - values = new Array(n); - - for (i = 0; i < n; ++i) { - values[i] = value(data[i], i, data); - } - - var xz = domain(values), - x0 = xz[0], - x1 = xz[1], - tz = threshold(values, x0, x1); - - // Convert number of thresholds into uniform thresholds. - if (!Array.isArray(tz)) { - tz = tickStep(x0, x1, tz); - tz = range(Math.ceil(x0 / tz) * tz, x1, tz); // exclusive - } - - // Remove any thresholds outside the domain. - var m = tz.length; - while (tz[0] <= x0) tz.shift(), --m; - while (tz[m - 1] > x1) tz.pop(), --m; - - var bins = new Array(m + 1), - bin; - - // Initialize bins. - for (i = 0; i <= m; ++i) { - bin = bins[i] = []; - bin.x0 = i > 0 ? tz[i - 1] : x0; - bin.x1 = i < m ? tz[i] : x1; - } - - // Assign data to bins by value, ignoring any outside the domain. - for (i = 0; i < n; ++i) { - x = values[i]; - if (x0 <= x && x <= x1) { - bins[bisect(tz, x, 0, m)].push(data[i]); - } - } - - return bins; - } - - histogram.value = function(_) { - return arguments.length ? (value = typeof _ === "function" ? _ : constant(_), histogram) : value; - }; - - histogram.domain = function(_) { - return arguments.length ? (domain = typeof _ === "function" ? _ : constant([_[0], _[1]]), histogram) : domain; - }; - - histogram.thresholds = function(_) { - return arguments.length ? (threshold = typeof _ === "function" ? _ : Array.isArray(_) ? constant(slice.call(_)) : constant(_), histogram) : threshold; - }; - - return histogram; -} - -;// ./node_modules/d3-array/src/threshold/freedmanDiaconis.js - - - - - -/* harmony default export */ function freedmanDiaconis(values, min, max) { - values = map.call(values, number).sort(ascending); - return Math.ceil((max - min) / (2 * (quantile(values, 0.75) - quantile(values, 0.25)) * Math.pow(values.length, -1 / 3))); -} - -;// ./node_modules/d3-array/src/merge.js -/* harmony default export */ function merge(arrays) { - var n = arrays.length, - m, - i = -1, - j = 0, - merged, - array; - - while (++i < n) j += arrays[i].length; - merged = new Array(j); - - while (--n >= 0) { - array = arrays[n]; - m = array.length; - while (--m >= 0) { - merged[--j] = array[m]; - } - } - - return merged; -} - -;// ./node_modules/d3-array/src/range.js -/* harmony default export */ function src_range(start, stop, step) { - start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step; - - var i = -1, - n = Math.max(0, Math.ceil((stop - start) / step)) | 0, - range = new Array(n); - - while (++i < n) { - range[i] = start + i * step; - } - - return range; -} - -;// ./node_modules/d3-array/src/index.js - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;// ./node_modules/d3-geo/src/clip/extent.js - - - - - - -var clipMax = 1e9, clipMin = -clipMax; - -// TODO Use d3-polygon’s polygonContains here for the ring check? -// TODO Eliminate duplicate buffering in clipBuffer and polygon.push? - -function clipExtent(x0, y0, x1, y1) { - - function visible(x, y) { - return x0 <= x && x <= x1 && y0 <= y && y <= y1; - } - - function interpolate(from, to, direction, stream) { - var a = 0, a1 = 0; - if (from == null - || (a = corner(from, direction)) !== (a1 = corner(to, direction)) - || comparePoint(from, to) < 0 ^ direction > 0) { - do stream.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0); - while ((a = (a + direction + 4) % 4) !== a1); - } else { - stream.point(to[0], to[1]); - } - } - - function corner(p, direction) { - return abs(p[0] - x0) < epsilon ? direction > 0 ? 0 : 3 - : abs(p[0] - x1) < epsilon ? direction > 0 ? 2 : 1 - : abs(p[1] - y0) < epsilon ? direction > 0 ? 1 : 0 - : direction > 0 ? 3 : 2; // abs(p[1] - y1) < epsilon - } - - function compareIntersection(a, b) { - return comparePoint(a.x, b.x); - } - - function comparePoint(a, b) { - var ca = corner(a, 1), - cb = corner(b, 1); - return ca !== cb ? ca - cb - : ca === 0 ? b[1] - a[1] - : ca === 1 ? a[0] - b[0] - : ca === 2 ? a[1] - b[1] - : b[0] - a[0]; - } - - return function(stream) { - var activeStream = stream, - bufferStream = buffer(), - segments, - polygon, - ring, - x__, y__, v__, // first point - x_, y_, v_, // previous point - first, - clean; - - var clipStream = { - point: point, - lineStart: lineStart, - lineEnd: lineEnd, - polygonStart: polygonStart, - polygonEnd: polygonEnd - }; - - function point(x, y) { - if (visible(x, y)) activeStream.point(x, y); - } - - function polygonInside() { - var winding = 0; - - for (var i = 0, n = polygon.length; i < n; ++i) { - for (var ring = polygon[i], j = 1, m = ring.length, point = ring[0], a0, a1, b0 = point[0], b1 = point[1]; j < m; ++j) { - a0 = b0, a1 = b1, point = ring[j], b0 = point[0], b1 = point[1]; - if (a1 <= y1) { if (b1 > y1 && (b0 - a0) * (y1 - a1) > (b1 - a1) * (x0 - a0)) ++winding; } - else { if (b1 <= y1 && (b0 - a0) * (y1 - a1) < (b1 - a1) * (x0 - a0)) --winding; } - } - } - - return winding; - } - - // Buffer geometry within a polygon and then clip it en masse. - function polygonStart() { - activeStream = bufferStream, segments = [], polygon = [], clean = true; - } - - function polygonEnd() { - var startInside = polygonInside(), - cleanInside = clean && startInside, - visible = (segments = merge(segments)).length; - if (cleanInside || visible) { - stream.polygonStart(); - if (cleanInside) { - stream.lineStart(); - interpolate(null, null, 1, stream); - stream.lineEnd(); - } - if (visible) { - clip_polygon(segments, compareIntersection, startInside, interpolate, stream); - } - stream.polygonEnd(); - } - activeStream = stream, segments = polygon = ring = null; - } - - function lineStart() { - clipStream.point = linePoint; - if (polygon) polygon.push(ring = []); - first = true; - v_ = false; - x_ = y_ = NaN; - } - - // TODO rather than special-case polygons, simply handle them separately. - // Ideally, coincident intersection points should be jittered to avoid - // clipping issues. - function lineEnd() { - if (segments) { - linePoint(x__, y__); - if (v__ && v_) bufferStream.rejoin(); - segments.push(bufferStream.result()); - } - clipStream.point = point; - if (v_) activeStream.lineEnd(); - } - - function linePoint(x, y) { - var v = visible(x, y); - if (polygon) ring.push([x, y]); - if (first) { - x__ = x, y__ = y, v__ = v; - first = false; - if (v) { - activeStream.lineStart(); - activeStream.point(x, y); - } - } else { - if (v && v_) activeStream.point(x, y); - else { - var a = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))], - b = [x = Math.max(clipMin, Math.min(clipMax, x)), y = Math.max(clipMin, Math.min(clipMax, y))]; - if (line(a, b, x0, y0, x1, y1)) { - if (!v_) { - activeStream.lineStart(); - activeStream.point(a[0], a[1]); - } - activeStream.point(b[0], b[1]); - if (!v) activeStream.lineEnd(); - clean = false; - } else if (v) { - activeStream.lineStart(); - activeStream.point(x, y); - clean = false; - } - } - } - x_ = x, y_ = y, v_ = v; - } - - return clipStream; - }; -} - -/* harmony default export */ function clip_extent() { - var x0 = 0, - y0 = 0, - x1 = 960, - y1 = 500, - cache, - cacheStream, - clip; - - return clip = { - stream: function(stream) { - return cache && cacheStream === stream ? cache : cache = clipExtent(x0, y0, x1, y1)(cacheStream = stream); - }, - extent: function(_) { - return arguments.length ? (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1], cache = cacheStream = null, clip) : [[x0, y0], [x1, y1]]; - } - }; -} - -;// ./node_modules/d3-geo/src/polygonContains.js - - - - -var sum = adder(); - -/* harmony default export */ function polygonContains(polygon, point) { - var lambda = point[0], - phi = point[1], - normal = [sin(lambda), -cos(lambda), 0], - angle = 0, - winding = 0; - - sum.reset(); - - for (var i = 0, n = polygon.length; i < n; ++i) { - if (!(m = (ring = polygon[i]).length)) continue; - var ring, - m, - point0 = ring[m - 1], - lambda0 = point0[0], - phi0 = point0[1] / 2 + quarterPi, - sinPhi0 = sin(phi0), - cosPhi0 = cos(phi0); - - for (var j = 0; j < m; ++j, lambda0 = lambda1, sinPhi0 = sinPhi1, cosPhi0 = cosPhi1, point0 = point1) { - var point1 = ring[j], - lambda1 = point1[0], - phi1 = point1[1] / 2 + quarterPi, - sinPhi1 = sin(phi1), - cosPhi1 = cos(phi1), - delta = lambda1 - lambda0, - sign = delta >= 0 ? 1 : -1, - absDelta = sign * delta, - antimeridian = absDelta > pi, - k = sinPhi0 * sinPhi1; - - sum.add(atan2(k * sign * sin(absDelta), cosPhi0 * cosPhi1 + k * cos(absDelta))); - angle += antimeridian ? delta + sign * tau : delta; - - // Are the longitudes either side of the point’s meridian (lambda), - // and are the latitudes smaller than the parallel (phi)? - if (antimeridian ^ lambda0 >= lambda ^ lambda1 >= lambda) { - var arc = cartesianCross(cartesian(point0), cartesian(point1)); - cartesianNormalizeInPlace(arc); - var intersection = cartesianCross(normal, arc); - cartesianNormalizeInPlace(intersection); - var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin(intersection[2]); - if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) { - winding += antimeridian ^ delta >= 0 ? 1 : -1; - } - } - } - } - - // First, determine whether the South pole is inside or outside: - // - // It is inside if: - // * the polygon winds around it in a clockwise direction. - // * the polygon does not (cumulatively) wind around it, but has a negative - // (counter-clockwise) area. - // - // Second, count the (signed) number of times a segment crosses a lambda - // from the point to the South pole. If it is zero, then the point is the - // same side as the South pole. - - return (angle < -epsilon || angle < epsilon && sum < -epsilon) ^ (winding & 1); -} - -;// ./node_modules/d3-geo/src/length.js - - - - - -var lengthSum = adder(), - length_lambda0, - length_sinPhi0, - length_cosPhi0; - -var lengthStream = { - sphere: noop, - point: noop, - lineStart: lengthLineStart, - lineEnd: noop, - polygonStart: noop, - polygonEnd: noop -}; - -function lengthLineStart() { - lengthStream.point = lengthPointFirst; - lengthStream.lineEnd = lengthLineEnd; -} - -function lengthLineEnd() { - lengthStream.point = lengthStream.lineEnd = noop; -} - -function lengthPointFirst(lambda, phi) { - lambda *= radians, phi *= radians; - length_lambda0 = lambda, length_sinPhi0 = sin(phi), length_cosPhi0 = cos(phi); - lengthStream.point = lengthPoint; -} - -function lengthPoint(lambda, phi) { - lambda *= radians, phi *= radians; - var sinPhi = sin(phi), - cosPhi = cos(phi), - delta = abs(lambda - length_lambda0), - cosDelta = cos(delta), - sinDelta = sin(delta), - x = cosPhi * sinDelta, - y = length_cosPhi0 * sinPhi - length_sinPhi0 * cosPhi * cosDelta, - z = length_sinPhi0 * sinPhi + length_cosPhi0 * cosPhi * cosDelta; - lengthSum.add(atan2(sqrt(x * x + y * y), z)); - length_lambda0 = lambda, length_sinPhi0 = sinPhi, length_cosPhi0 = cosPhi; -} - -/* harmony default export */ function src_length(object) { - lengthSum.reset(); - stream(object, lengthStream); - return +lengthSum; -} - -;// ./node_modules/d3-geo/src/distance.js - - -var coordinates = [null, null], - object = {type: "LineString", coordinates: coordinates}; - -/* harmony default export */ function distance(a, b) { - coordinates[0] = a; - coordinates[1] = b; - return src_length(object); -} - -;// ./node_modules/d3-geo/src/contains.js - - - - -var containsObjectType = { - Feature: function(object, point) { - return containsGeometry(object.geometry, point); - }, - FeatureCollection: function(object, point) { - var features = object.features, i = -1, n = features.length; - while (++i < n) if (containsGeometry(features[i].geometry, point)) return true; - return false; - } -}; - -var containsGeometryType = { - Sphere: function() { - return true; - }, - Point: function(object, point) { - return containsPoint(object.coordinates, point); - }, - MultiPoint: function(object, point) { - var coordinates = object.coordinates, i = -1, n = coordinates.length; - while (++i < n) if (containsPoint(coordinates[i], point)) return true; - return false; - }, - LineString: function(object, point) { - return containsLine(object.coordinates, point); - }, - MultiLineString: function(object, point) { - var coordinates = object.coordinates, i = -1, n = coordinates.length; - while (++i < n) if (containsLine(coordinates[i], point)) return true; - return false; - }, - Polygon: function(object, point) { - return containsPolygon(object.coordinates, point); - }, - MultiPolygon: function(object, point) { - var coordinates = object.coordinates, i = -1, n = coordinates.length; - while (++i < n) if (containsPolygon(coordinates[i], point)) return true; - return false; - }, - GeometryCollection: function(object, point) { - var geometries = object.geometries, i = -1, n = geometries.length; - while (++i < n) if (containsGeometry(geometries[i], point)) return true; - return false; - } -}; - -function containsGeometry(geometry, point) { - return geometry && containsGeometryType.hasOwnProperty(geometry.type) - ? containsGeometryType[geometry.type](geometry, point) - : false; -} - -function containsPoint(coordinates, point) { - return distance(coordinates, point) === 0; -} - -function containsLine(coordinates, point) { - var ab = distance(coordinates[0], coordinates[1]), - ao = distance(coordinates[0], point), - ob = distance(point, coordinates[1]); - return ao + ob <= ab + epsilon; -} - -function containsPolygon(coordinates, point) { - return !!polygonContains(coordinates.map(ringRadians), pointRadians(point)); -} - -function ringRadians(ring) { - return ring = ring.map(pointRadians), ring.pop(), ring; -} - -function pointRadians(point) { - return [point[0] * radians, point[1] * radians]; -} - -/* harmony default export */ function contains(object, point) { - return (object && containsObjectType.hasOwnProperty(object.type) - ? containsObjectType[object.type] - : containsGeometry)(object, point); -} - -;// ./node_modules/d3-geo/src/graticule.js - - - -function graticuleX(y0, y1, dy) { - var y = src_range(y0, y1 - epsilon, dy).concat(y1); - return function(x) { return y.map(function(y) { return [x, y]; }); }; -} - -function graticuleY(x0, x1, dx) { - var x = src_range(x0, x1 - epsilon, dx).concat(x1); - return function(y) { return x.map(function(x) { return [x, y]; }); }; -} - -function graticule() { - var x1, x0, X1, X0, - y1, y0, Y1, Y0, - dx = 10, dy = dx, DX = 90, DY = 360, - x, y, X, Y, - precision = 2.5; - - function graticule() { - return {type: "MultiLineString", coordinates: lines()}; - } - - function lines() { - return src_range(ceil(X0 / DX) * DX, X1, DX).map(X) - .concat(src_range(ceil(Y0 / DY) * DY, Y1, DY).map(Y)) - .concat(src_range(ceil(x0 / dx) * dx, x1, dx).filter(function(x) { return abs(x % DX) > epsilon; }).map(x)) - .concat(src_range(ceil(y0 / dy) * dy, y1, dy).filter(function(y) { return abs(y % DY) > epsilon; }).map(y)); - } - - graticule.lines = function() { - return lines().map(function(coordinates) { return {type: "LineString", coordinates: coordinates}; }); - }; - - graticule.outline = function() { - return { - type: "Polygon", - coordinates: [ - X(X0).concat( - Y(Y1).slice(1), - X(X1).reverse().slice(1), - Y(Y0).reverse().slice(1)) - ] - }; - }; - - graticule.extent = function(_) { - if (!arguments.length) return graticule.extentMinor(); - return graticule.extentMajor(_).extentMinor(_); - }; - - graticule.extentMajor = function(_) { - if (!arguments.length) return [[X0, Y0], [X1, Y1]]; - X0 = +_[0][0], X1 = +_[1][0]; - Y0 = +_[0][1], Y1 = +_[1][1]; - if (X0 > X1) _ = X0, X0 = X1, X1 = _; - if (Y0 > Y1) _ = Y0, Y0 = Y1, Y1 = _; - return graticule.precision(precision); - }; - - graticule.extentMinor = function(_) { - if (!arguments.length) return [[x0, y0], [x1, y1]]; - x0 = +_[0][0], x1 = +_[1][0]; - y0 = +_[0][1], y1 = +_[1][1]; - if (x0 > x1) _ = x0, x0 = x1, x1 = _; - if (y0 > y1) _ = y0, y0 = y1, y1 = _; - return graticule.precision(precision); - }; - - graticule.step = function(_) { - if (!arguments.length) return graticule.stepMinor(); - return graticule.stepMajor(_).stepMinor(_); - }; - - graticule.stepMajor = function(_) { - if (!arguments.length) return [DX, DY]; - DX = +_[0], DY = +_[1]; - return graticule; - }; - - graticule.stepMinor = function(_) { - if (!arguments.length) return [dx, dy]; - dx = +_[0], dy = +_[1]; - return graticule; - }; - - graticule.precision = function(_) { - if (!arguments.length) return precision; - precision = +_; - x = graticuleX(y0, y1, 90); - y = graticuleY(x0, x1, precision); - X = graticuleX(Y0, Y1, 90); - Y = graticuleY(X0, X1, precision); - return graticule; - }; - - return graticule - .extentMajor([[-180, -90 + epsilon], [180, 90 - epsilon]]) - .extentMinor([[-180, -80 - epsilon], [180, 80 + epsilon]]); -} - -function graticule10() { - return graticule()(); -} - -;// ./node_modules/d3-geo/src/interpolate.js - - -/* harmony default export */ function interpolate(a, b) { - var x0 = a[0] * radians, - y0 = a[1] * radians, - x1 = b[0] * radians, - y1 = b[1] * radians, - cy0 = cos(y0), - sy0 = sin(y0), - cy1 = cos(y1), - sy1 = sin(y1), - kx0 = cy0 * cos(x0), - ky0 = cy0 * sin(x0), - kx1 = cy1 * cos(x1), - ky1 = cy1 * sin(x1), - d = 2 * asin(sqrt(haversin(y1 - y0) + cy0 * cy1 * haversin(x1 - x0))), - k = sin(d); - - var interpolate = d ? function(t) { - var B = sin(t *= d) / k, - A = sin(d - t) / k, - x = A * kx0 + B * kx1, - y = A * ky0 + B * ky1, - z = A * sy0 + B * sy1; - return [ - atan2(y, x) * degrees, - atan2(z, sqrt(x * x + y * y)) * degrees - ]; - } : function() { - return [x0 * degrees, y0 * degrees]; - }; - - interpolate.distance = d; - - return interpolate; -} - -;// ./node_modules/d3-geo/src/identity.js -/* harmony default export */ function src_identity(x) { - return x; -} - -;// ./node_modules/d3-geo/src/path/area.js - - - - -var area_areaSum = adder(), - area_areaRingSum = adder(), - x00, - y00, - area_x0, - area_y0; - -var area_areaStream = { - point: noop, - lineStart: noop, - lineEnd: noop, - polygonStart: function() { - area_areaStream.lineStart = area_areaRingStart; - area_areaStream.lineEnd = area_areaRingEnd; - }, - polygonEnd: function() { - area_areaStream.lineStart = area_areaStream.lineEnd = area_areaStream.point = noop; - area_areaSum.add(abs(area_areaRingSum)); - area_areaRingSum.reset(); - }, - result: function() { - var area = area_areaSum / 2; - area_areaSum.reset(); - return area; - } -}; - -function area_areaRingStart() { - area_areaStream.point = area_areaPointFirst; -} - -function area_areaPointFirst(x, y) { - area_areaStream.point = area_areaPoint; - x00 = area_x0 = x, y00 = area_y0 = y; -} - -function area_areaPoint(x, y) { - area_areaRingSum.add(area_y0 * x - area_x0 * y); - area_x0 = x, area_y0 = y; -} - -function area_areaRingEnd() { - area_areaPoint(x00, y00); -} - -/* harmony default export */ const path_area = (area_areaStream); - -;// ./node_modules/d3-geo/src/path/bounds.js - - -var bounds_x0 = Infinity, - bounds_y0 = bounds_x0, - x1 = -bounds_x0, - y1 = x1; - -var bounds_boundsStream = { - point: bounds_boundsPoint, - lineStart: noop, - lineEnd: noop, - polygonStart: noop, - polygonEnd: noop, - result: function() { - var bounds = [[bounds_x0, bounds_y0], [x1, y1]]; - x1 = y1 = -(bounds_y0 = bounds_x0 = Infinity); - return bounds; - } -}; - -function bounds_boundsPoint(x, y) { - if (x < bounds_x0) bounds_x0 = x; - if (x > x1) x1 = x; - if (y < bounds_y0) bounds_y0 = y; - if (y > y1) y1 = y; -} - -/* harmony default export */ const path_bounds = (bounds_boundsStream); - -;// ./node_modules/d3-geo/src/path/centroid.js - - -// TODO Enforce positive area for exterior, negative area for interior? - -var centroid_X0 = 0, - centroid_Y0 = 0, - centroid_Z0 = 0, - centroid_X1 = 0, - centroid_Y1 = 0, - centroid_Z1 = 0, - centroid_X2 = 0, - centroid_Y2 = 0, - centroid_Z2 = 0, - centroid_x00, - centroid_y00, - centroid_x0, - centroid_y0; - -var centroid_centroidStream = { - point: centroid_centroidPoint, - lineStart: centroid_centroidLineStart, - lineEnd: centroid_centroidLineEnd, - polygonStart: function() { - centroid_centroidStream.lineStart = centroid_centroidRingStart; - centroid_centroidStream.lineEnd = centroid_centroidRingEnd; - }, - polygonEnd: function() { - centroid_centroidStream.point = centroid_centroidPoint; - centroid_centroidStream.lineStart = centroid_centroidLineStart; - centroid_centroidStream.lineEnd = centroid_centroidLineEnd; - }, - result: function() { - var centroid = centroid_Z2 ? [centroid_X2 / centroid_Z2, centroid_Y2 / centroid_Z2] - : centroid_Z1 ? [centroid_X1 / centroid_Z1, centroid_Y1 / centroid_Z1] - : centroid_Z0 ? [centroid_X0 / centroid_Z0, centroid_Y0 / centroid_Z0] - : [NaN, NaN]; - centroid_X0 = centroid_Y0 = centroid_Z0 = - centroid_X1 = centroid_Y1 = centroid_Z1 = - centroid_X2 = centroid_Y2 = centroid_Z2 = 0; - return centroid; - } -}; - -function centroid_centroidPoint(x, y) { - centroid_X0 += x; - centroid_Y0 += y; - ++centroid_Z0; -} - -function centroid_centroidLineStart() { - centroid_centroidStream.point = centroidPointFirstLine; -} - -function centroidPointFirstLine(x, y) { - centroid_centroidStream.point = centroidPointLine; - centroid_centroidPoint(centroid_x0 = x, centroid_y0 = y); -} - -function centroidPointLine(x, y) { - var dx = x - centroid_x0, dy = y - centroid_y0, z = sqrt(dx * dx + dy * dy); - centroid_X1 += z * (centroid_x0 + x) / 2; - centroid_Y1 += z * (centroid_y0 + y) / 2; - centroid_Z1 += z; - centroid_centroidPoint(centroid_x0 = x, centroid_y0 = y); -} - -function centroid_centroidLineEnd() { - centroid_centroidStream.point = centroid_centroidPoint; -} - -function centroid_centroidRingStart() { - centroid_centroidStream.point = centroidPointFirstRing; -} - -function centroid_centroidRingEnd() { - centroidPointRing(centroid_x00, centroid_y00); -} - -function centroidPointFirstRing(x, y) { - centroid_centroidStream.point = centroidPointRing; - centroid_centroidPoint(centroid_x00 = centroid_x0 = x, centroid_y00 = centroid_y0 = y); -} - -function centroidPointRing(x, y) { - var dx = x - centroid_x0, - dy = y - centroid_y0, - z = sqrt(dx * dx + dy * dy); - - centroid_X1 += z * (centroid_x0 + x) / 2; - centroid_Y1 += z * (centroid_y0 + y) / 2; - centroid_Z1 += z; - - z = centroid_y0 * x - centroid_x0 * y; - centroid_X2 += z * (centroid_x0 + x); - centroid_Y2 += z * (centroid_y0 + y); - centroid_Z2 += z * 3; - centroid_centroidPoint(centroid_x0 = x, centroid_y0 = y); -} - -/* harmony default export */ const path_centroid = (centroid_centroidStream); - -;// ./node_modules/d3-geo/src/path/context.js - - - -function PathContext(context) { - this._context = context; -} - -PathContext.prototype = { - _radius: 4.5, - pointRadius: function(_) { - return this._radius = _, this; - }, - polygonStart: function() { - this._line = 0; - }, - polygonEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._point = 0; - }, - lineEnd: function() { - if (this._line === 0) this._context.closePath(); - this._point = NaN; - }, - point: function(x, y) { - switch (this._point) { - case 0: { - this._context.moveTo(x, y); - this._point = 1; - break; - } - case 1: { - this._context.lineTo(x, y); - break; - } - default: { - this._context.moveTo(x + this._radius, y); - this._context.arc(x, y, this._radius, 0, tau); - break; - } - } - }, - result: noop -}; - -;// ./node_modules/d3-geo/src/path/measure.js - - - - -var measure_lengthSum = adder(), - lengthRing, - measure_x00, - measure_y00, - measure_x0, - measure_y0; - -var measure_lengthStream = { - point: noop, - lineStart: function() { - measure_lengthStream.point = measure_lengthPointFirst; - }, - lineEnd: function() { - if (lengthRing) measure_lengthPoint(measure_x00, measure_y00); - measure_lengthStream.point = noop; - }, - polygonStart: function() { - lengthRing = true; - }, - polygonEnd: function() { - lengthRing = null; - }, - result: function() { - var length = +measure_lengthSum; - measure_lengthSum.reset(); - return length; - } -}; - -function measure_lengthPointFirst(x, y) { - measure_lengthStream.point = measure_lengthPoint; - measure_x00 = measure_x0 = x, measure_y00 = measure_y0 = y; -} - -function measure_lengthPoint(x, y) { - measure_x0 -= x, measure_y0 -= y; - measure_lengthSum.add(sqrt(measure_x0 * measure_x0 + measure_y0 * measure_y0)); - measure_x0 = x, measure_y0 = y; -} - -/* harmony default export */ const measure = (measure_lengthStream); - -;// ./node_modules/d3-geo/src/path/string.js -function PathString() { - this._string = []; -} - -PathString.prototype = { - _radius: 4.5, - _circle: string_circle(4.5), - pointRadius: function(_) { - if ((_ = +_) !== this._radius) this._radius = _, this._circle = null; - return this; - }, - polygonStart: function() { - this._line = 0; - }, - polygonEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._point = 0; - }, - lineEnd: function() { - if (this._line === 0) this._string.push("Z"); - this._point = NaN; - }, - point: function(x, y) { - switch (this._point) { - case 0: { - this._string.push("M", x, ",", y); - this._point = 1; - break; - } - case 1: { - this._string.push("L", x, ",", y); - break; - } - default: { - if (this._circle == null) this._circle = string_circle(this._radius); - this._string.push("M", x, ",", y, this._circle); - break; - } - } - }, - result: function() { - if (this._string.length) { - var result = this._string.join(""); - this._string = []; - return result; - } else { - return null; - } - } -}; - -function string_circle(radius) { - return "m0," + radius - + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius - + "a" + radius + "," + radius + " 0 1,1 0," + 2 * radius - + "z"; -} - -;// ./node_modules/d3-geo/src/path/index.js - - - - - - - - - -/* harmony default export */ function path(projection, context) { - var pointRadius = 4.5, - projectionStream, - contextStream; - - function path(object) { - if (object) { - if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments)); - stream(object, projectionStream(contextStream)); - } - return contextStream.result(); - } - - path.area = function(object) { - stream(object, projectionStream(path_area)); - return path_area.result(); - }; - - path.measure = function(object) { - stream(object, projectionStream(measure)); - return measure.result(); - }; - - path.bounds = function(object) { - stream(object, projectionStream(path_bounds)); - return path_bounds.result(); - }; - - path.centroid = function(object) { - stream(object, projectionStream(path_centroid)); - return path_centroid.result(); - }; - - path.projection = function(_) { - return arguments.length ? (projectionStream = _ == null ? (projection = null, src_identity) : (projection = _).stream, path) : projection; - }; - - path.context = function(_) { - if (!arguments.length) return context; - contextStream = _ == null ? (context = null, new PathString) : new PathContext(context = _); - if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius); - return path; - }; - - path.pointRadius = function(_) { - if (!arguments.length) return pointRadius; - pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_); - return path; - }; - - return path.projection(projection).context(context); -} - -;// ./node_modules/d3-geo/src/clip/index.js - - - - - - -/* harmony default export */ function clip(pointVisible, clipLine, interpolate, start) { - return function(rotate, sink) { - var line = clipLine(sink), - rotatedStart = rotate.invert(start[0], start[1]), - ringBuffer = buffer(), - ringSink = clipLine(ringBuffer), - polygonStarted = false, - polygon, - segments, - ring; - - var clip = { - point: point, - lineStart: lineStart, - lineEnd: lineEnd, - polygonStart: function() { - clip.point = pointRing; - clip.lineStart = ringStart; - clip.lineEnd = ringEnd; - segments = []; - polygon = []; - }, - polygonEnd: function() { - clip.point = point; - clip.lineStart = lineStart; - clip.lineEnd = lineEnd; - segments = merge(segments); - var startInside = polygonContains(polygon, rotatedStart); - if (segments.length) { - if (!polygonStarted) sink.polygonStart(), polygonStarted = true; - clip_polygon(segments, compareIntersection, startInside, interpolate, sink); - } else if (startInside) { - if (!polygonStarted) sink.polygonStart(), polygonStarted = true; - sink.lineStart(); - interpolate(null, null, 1, sink); - sink.lineEnd(); - } - if (polygonStarted) sink.polygonEnd(), polygonStarted = false; - segments = polygon = null; - }, - sphere: function() { - sink.polygonStart(); - sink.lineStart(); - interpolate(null, null, 1, sink); - sink.lineEnd(); - sink.polygonEnd(); - } - }; - - function point(lambda, phi) { - var point = rotate(lambda, phi); - if (pointVisible(lambda = point[0], phi = point[1])) sink.point(lambda, phi); - } - - function pointLine(lambda, phi) { - var point = rotate(lambda, phi); - line.point(point[0], point[1]); - } - - function lineStart() { - clip.point = pointLine; - line.lineStart(); - } - - function lineEnd() { - clip.point = point; - line.lineEnd(); - } - - function pointRing(lambda, phi) { - ring.push([lambda, phi]); - var point = rotate(lambda, phi); - ringSink.point(point[0], point[1]); - } - - function ringStart() { - ringSink.lineStart(); - ring = []; - } - - function ringEnd() { - pointRing(ring[0][0], ring[0][1]); - ringSink.lineEnd(); - - var clean = ringSink.clean(), - ringSegments = ringBuffer.result(), - i, n = ringSegments.length, m, - segment, - point; - - ring.pop(); - polygon.push(ring); - ring = null; - - if (!n) return; - - // No intersections. - if (clean & 1) { - segment = ringSegments[0]; - if ((m = segment.length - 1) > 0) { - if (!polygonStarted) sink.polygonStart(), polygonStarted = true; - sink.lineStart(); - for (i = 0; i < m; ++i) sink.point((point = segment[i])[0], point[1]); - sink.lineEnd(); - } - return; - } - - // Rejoin connected segments. - // TODO reuse ringBuffer.rejoin()? - if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift())); - - segments.push(ringSegments.filter(validSegment)); - } - - return clip; - }; -} - -function validSegment(segment) { - return segment.length > 1; -} - -// Intersections are sorted along the clip edge. For both antimeridian cutting -// and circle clipping, the same comparison is used. -function compareIntersection(a, b) { - return ((a = a.x)[0] < 0 ? a[1] - halfPi - epsilon : halfPi - a[1]) - - ((b = b.x)[0] < 0 ? b[1] - halfPi - epsilon : halfPi - b[1]); -} - -;// ./node_modules/d3-geo/src/clip/antimeridian.js - - - -/* harmony default export */ const antimeridian = (clip( - function() { return true; }, - clipAntimeridianLine, - clipAntimeridianInterpolate, - [-pi, -halfPi] -)); - -// Takes a line and cuts into visible segments. Return values: 0 - there were -// intersections or the line was empty; 1 - no intersections; 2 - there were -// intersections, and the first and last segments should be rejoined. -function clipAntimeridianLine(stream) { - var lambda0 = NaN, - phi0 = NaN, - sign0 = NaN, - clean; // no intersections - - return { - lineStart: function() { - stream.lineStart(); - clean = 1; - }, - point: function(lambda1, phi1) { - var sign1 = lambda1 > 0 ? pi : -pi, - delta = abs(lambda1 - lambda0); - if (abs(delta - pi) < epsilon) { // line crosses a pole - stream.point(lambda0, phi0 = (phi0 + phi1) / 2 > 0 ? halfPi : -halfPi); - stream.point(sign0, phi0); - stream.lineEnd(); - stream.lineStart(); - stream.point(sign1, phi0); - stream.point(lambda1, phi0); - clean = 0; - } else if (sign0 !== sign1 && delta >= pi) { // line crosses antimeridian - if (abs(lambda0 - sign0) < epsilon) lambda0 -= sign0 * epsilon; // handle degeneracies - if (abs(lambda1 - sign1) < epsilon) lambda1 -= sign1 * epsilon; - phi0 = clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1); - stream.point(sign0, phi0); - stream.lineEnd(); - stream.lineStart(); - stream.point(sign1, phi0); - clean = 0; - } - stream.point(lambda0 = lambda1, phi0 = phi1); - sign0 = sign1; - }, - lineEnd: function() { - stream.lineEnd(); - lambda0 = phi0 = NaN; - }, - clean: function() { - return 2 - clean; // if intersections, rejoin first and last segments - } - }; -} - -function clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1) { - var cosPhi0, - cosPhi1, - sinLambda0Lambda1 = sin(lambda0 - lambda1); - return abs(sinLambda0Lambda1) > epsilon - ? atan((sin(phi0) * (cosPhi1 = cos(phi1)) * sin(lambda1) - - sin(phi1) * (cosPhi0 = cos(phi0)) * sin(lambda0)) - / (cosPhi0 * cosPhi1 * sinLambda0Lambda1)) - : (phi0 + phi1) / 2; -} - -function clipAntimeridianInterpolate(from, to, direction, stream) { - var phi; - if (from == null) { - phi = direction * halfPi; - stream.point(-pi, phi); - stream.point(0, phi); - stream.point(pi, phi); - stream.point(pi, 0); - stream.point(pi, -phi); - stream.point(0, -phi); - stream.point(-pi, -phi); - stream.point(-pi, 0); - stream.point(-pi, phi); - } else if (abs(from[0] - to[0]) > epsilon) { - var lambda = from[0] < to[0] ? pi : -pi; - phi = direction * lambda / 2; - stream.point(-lambda, phi); - stream.point(0, phi); - stream.point(lambda, phi); - } else { - stream.point(to[0], to[1]); - } -} - -;// ./node_modules/d3-geo/src/clip/circle.js - - - - - - -/* harmony default export */ function clip_circle(radius, delta) { - var cr = cos(radius), - smallRadius = cr > 0, - notHemisphere = abs(cr) > epsilon; // TODO optimise for this common case - - function interpolate(from, to, direction, stream) { - circleStream(stream, radius, delta, direction, from, to); - } - - function visible(lambda, phi) { - return cos(lambda) * cos(phi) > cr; - } - - // Takes a line and cuts into visible segments. Return values used for polygon - // clipping: 0 - there were intersections or the line was empty; 1 - no - // intersections 2 - there were intersections, and the first and last segments - // should be rejoined. - function clipLine(stream) { - var point0, // previous point - c0, // code for previous point - v0, // visibility of previous point - v00, // visibility of first point - clean; // no intersections - return { - lineStart: function() { - v00 = v0 = false; - clean = 1; - }, - point: function(lambda, phi) { - var point1 = [lambda, phi], - point2, - v = visible(lambda, phi), - c = smallRadius - ? v ? 0 : code(lambda, phi) - : v ? code(lambda + (lambda < 0 ? pi : -pi), phi) : 0; - if (!point0 && (v00 = v0 = v)) stream.lineStart(); - // Handle degeneracies. - // TODO ignore if not clipping polygons. - if (v !== v0) { - point2 = intersect(point0, point1); - if (!point2 || pointEqual(point0, point2) || pointEqual(point1, point2)) { - point1[0] += epsilon; - point1[1] += epsilon; - v = visible(point1[0], point1[1]); - } - } - if (v !== v0) { - clean = 0; - if (v) { - // outside going in - stream.lineStart(); - point2 = intersect(point1, point0); - stream.point(point2[0], point2[1]); - } else { - // inside going out - point2 = intersect(point0, point1); - stream.point(point2[0], point2[1]); - stream.lineEnd(); - } - point0 = point2; - } else if (notHemisphere && point0 && smallRadius ^ v) { - var t; - // If the codes for two points are different, or are both zero, - // and there this segment intersects with the small circle. - if (!(c & c0) && (t = intersect(point1, point0, true))) { - clean = 0; - if (smallRadius) { - stream.lineStart(); - stream.point(t[0][0], t[0][1]); - stream.point(t[1][0], t[1][1]); - stream.lineEnd(); - } else { - stream.point(t[1][0], t[1][1]); - stream.lineEnd(); - stream.lineStart(); - stream.point(t[0][0], t[0][1]); - } - } - } - if (v && (!point0 || !pointEqual(point0, point1))) { - stream.point(point1[0], point1[1]); - } - point0 = point1, v0 = v, c0 = c; - }, - lineEnd: function() { - if (v0) stream.lineEnd(); - point0 = null; - }, - // Rejoin first and last segments if there were intersections and the first - // and last points were visible. - clean: function() { - return clean | ((v00 && v0) << 1); - } - }; - } - - // Intersects the great circle between a and b with the clip circle. - function intersect(a, b, two) { - var pa = cartesian(a), - pb = cartesian(b); - - // We have two planes, n1.p = d1 and n2.p = d2. - // Find intersection line p(t) = c1 n1 + c2 n2 + t (n1 ⨯ n2). - var n1 = [1, 0, 0], // normal - n2 = cartesianCross(pa, pb), - n2n2 = cartesianDot(n2, n2), - n1n2 = n2[0], // cartesianDot(n1, n2), - determinant = n2n2 - n1n2 * n1n2; - - // Two polar points. - if (!determinant) return !two && a; - - var c1 = cr * n2n2 / determinant, - c2 = -cr * n1n2 / determinant, - n1xn2 = cartesianCross(n1, n2), - A = cartesianScale(n1, c1), - B = cartesianScale(n2, c2); - cartesianAddInPlace(A, B); - - // Solve |p(t)|^2 = 1. - var u = n1xn2, - w = cartesianDot(A, u), - uu = cartesianDot(u, u), - t2 = w * w - uu * (cartesianDot(A, A) - 1); - - if (t2 < 0) return; - - var t = sqrt(t2), - q = cartesianScale(u, (-w - t) / uu); - cartesianAddInPlace(q, A); - q = spherical(q); - - if (!two) return q; - - // Two intersection points. - var lambda0 = a[0], - lambda1 = b[0], - phi0 = a[1], - phi1 = b[1], - z; - - if (lambda1 < lambda0) z = lambda0, lambda0 = lambda1, lambda1 = z; - - var delta = lambda1 - lambda0, - polar = abs(delta - pi) < epsilon, - meridian = polar || delta < epsilon; - - if (!polar && phi1 < phi0) z = phi0, phi0 = phi1, phi1 = z; - - // Check that the first point is between a and b. - if (meridian - ? polar - ? phi0 + phi1 > 0 ^ q[1] < (abs(q[0] - lambda0) < epsilon ? phi0 : phi1) - : phi0 <= q[1] && q[1] <= phi1 - : delta > pi ^ (lambda0 <= q[0] && q[0] <= lambda1)) { - var q1 = cartesianScale(u, (-w + t) / uu); - cartesianAddInPlace(q1, A); - return [q, spherical(q1)]; - } - } - - // Generates a 4-bit vector representing the location of a point relative to - // the small circle's bounding box. - function code(lambda, phi) { - var r = smallRadius ? radius : pi - radius, - code = 0; - if (lambda < -r) code |= 1; // left - else if (lambda > r) code |= 2; // right - if (phi < -r) code |= 4; // below - else if (phi > r) code |= 8; // above - return code; - } - - return clip(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-pi, radius - pi]); -} - -;// ./node_modules/d3-geo/src/transform.js -/* harmony default export */ function transform(methods) { - return { - stream: transformer(methods) - }; -} - -function transformer(methods) { - return function(stream) { - var s = new TransformStream; - for (var key in methods) s[key] = methods[key]; - s.stream = stream; - return s; - }; -} - -function TransformStream() {} - -TransformStream.prototype = { - constructor: TransformStream, - point: function(x, y) { this.stream.point(x, y); }, - sphere: function() { this.stream.sphere(); }, - lineStart: function() { this.stream.lineStart(); }, - lineEnd: function() { this.stream.lineEnd(); }, - polygonStart: function() { this.stream.polygonStart(); }, - polygonEnd: function() { this.stream.polygonEnd(); } -}; - -;// ./node_modules/d3-geo/src/projection/fit.js - - - -function fitExtent(projection, extent, object) { - var w = extent[1][0] - extent[0][0], - h = extent[1][1] - extent[0][1], - clip = projection.clipExtent && projection.clipExtent(); - - projection - .scale(150) - .translate([0, 0]); - - if (clip != null) projection.clipExtent(null); - - stream(object, projection.stream(path_bounds)); - - var b = path_bounds.result(), - k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])), - x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2, - y = +extent[0][1] + (h - k * (b[1][1] + b[0][1])) / 2; - - if (clip != null) projection.clipExtent(clip); - - return projection - .scale(k * 150) - .translate([x, y]); -} - -function fitSize(projection, size, object) { - return fitExtent(projection, [[0, 0], size], object); -} - -;// ./node_modules/d3-geo/src/projection/resample.js - - - - -var maxDepth = 16, // maximum depth of subdivision - cosMinDistance = cos(30 * radians); // cos(minimum angular distance) - -/* harmony default export */ function resample(project, delta2) { - return +delta2 ? resample_resample(project, delta2) : resampleNone(project); -} - -function resampleNone(project) { - return transformer({ - point: function(x, y) { - x = project(x, y); - this.stream.point(x[0], x[1]); - } - }); -} - -function resample_resample(project, delta2) { - - function resampleLineTo(x0, y0, lambda0, a0, b0, c0, x1, y1, lambda1, a1, b1, c1, depth, stream) { - var dx = x1 - x0, - dy = y1 - y0, - d2 = dx * dx + dy * dy; - if (d2 > 4 * delta2 && depth--) { - var a = a0 + a1, - b = b0 + b1, - c = c0 + c1, - m = sqrt(a * a + b * b + c * c), - phi2 = asin(c /= m), - lambda2 = abs(abs(c) - 1) < epsilon || abs(lambda0 - lambda1) < epsilon ? (lambda0 + lambda1) / 2 : atan2(b, a), - p = project(lambda2, phi2), - x2 = p[0], - y2 = p[1], - dx2 = x2 - x0, - dy2 = y2 - y0, - dz = dy * dx2 - dx * dy2; - if (dz * dz / d2 > delta2 // perpendicular projected distance - || abs((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 // midpoint close to an end - || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) { // angular distance - resampleLineTo(x0, y0, lambda0, a0, b0, c0, x2, y2, lambda2, a /= m, b /= m, c, depth, stream); - stream.point(x2, y2); - resampleLineTo(x2, y2, lambda2, a, b, c, x1, y1, lambda1, a1, b1, c1, depth, stream); - } - } - } - return function(stream) { - var lambda00, x00, y00, a00, b00, c00, // first point - lambda0, x0, y0, a0, b0, c0; // previous point - - var resampleStream = { - point: point, - lineStart: lineStart, - lineEnd: lineEnd, - polygonStart: function() { stream.polygonStart(); resampleStream.lineStart = ringStart; }, - polygonEnd: function() { stream.polygonEnd(); resampleStream.lineStart = lineStart; } - }; - - function point(x, y) { - x = project(x, y); - stream.point(x[0], x[1]); - } - - function lineStart() { - x0 = NaN; - resampleStream.point = linePoint; - stream.lineStart(); - } - - function linePoint(lambda, phi) { - var c = cartesian([lambda, phi]), p = project(lambda, phi); - resampleLineTo(x0, y0, lambda0, a0, b0, c0, x0 = p[0], y0 = p[1], lambda0 = lambda, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream); - stream.point(x0, y0); - } - - function lineEnd() { - resampleStream.point = point; - stream.lineEnd(); - } - - function ringStart() { - lineStart(); - resampleStream.point = ringPoint; - resampleStream.lineEnd = ringEnd; - } - - function ringPoint(lambda, phi) { - linePoint(lambda00 = lambda, phi), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0; - resampleStream.point = linePoint; - } - - function ringEnd() { - resampleLineTo(x0, y0, lambda0, a0, b0, c0, x00, y00, lambda00, a00, b00, c00, maxDepth, stream); - resampleStream.lineEnd = lineEnd; - lineEnd(); - } - - return resampleStream; - }; -} - -;// ./node_modules/d3-geo/src/projection/index.js - - - - - - - - - - - -var transformRadians = transformer({ - point: function(x, y) { - this.stream.point(x * radians, y * radians); - } -}); - -function projection(project) { - return projectionMutator(function() { return project; })(); -} - -function projectionMutator(projectAt) { - var project, - k = 150, // scale - x = 480, y = 250, // translate - dx, dy, lambda = 0, phi = 0, // center - deltaLambda = 0, deltaPhi = 0, deltaGamma = 0, rotate, projectRotate, // rotate - theta = null, preclip = antimeridian, // clip angle - x0 = null, y0, x1, y1, postclip = src_identity, // clip extent - delta2 = 0.5, projectResample = resample(projectTransform, delta2), // precision - cache, - cacheStream; - - function projection(point) { - point = projectRotate(point[0] * radians, point[1] * radians); - return [point[0] * k + dx, dy - point[1] * k]; - } - - function invert(point) { - point = projectRotate.invert((point[0] - dx) / k, (dy - point[1]) / k); - return point && [point[0] * degrees, point[1] * degrees]; - } - - function projectTransform(x, y) { - return x = project(x, y), [x[0] * k + dx, dy - x[1] * k]; - } - - projection.stream = function(stream) { - return cache && cacheStream === stream ? cache : cache = transformRadians(preclip(rotate, projectResample(postclip(cacheStream = stream)))); - }; - - projection.clipAngle = function(_) { - return arguments.length ? (preclip = +_ ? clip_circle(theta = _ * radians, 6 * radians) : (theta = null, antimeridian), reset()) : theta * degrees; - }; - - projection.clipExtent = function(_) { - return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, src_identity) : clipExtent(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]]; - }; - - projection.scale = function(_) { - return arguments.length ? (k = +_, recenter()) : k; - }; - - projection.translate = function(_) { - return arguments.length ? (x = +_[0], y = +_[1], recenter()) : [x, y]; - }; - - projection.center = function(_) { - return arguments.length ? (lambda = _[0] % 360 * radians, phi = _[1] % 360 * radians, recenter()) : [lambda * degrees, phi * degrees]; - }; - - projection.rotate = function(_) { - return arguments.length ? (deltaLambda = _[0] % 360 * radians, deltaPhi = _[1] % 360 * radians, deltaGamma = _.length > 2 ? _[2] % 360 * radians : 0, recenter()) : [deltaLambda * degrees, deltaPhi * degrees, deltaGamma * degrees]; - }; - - projection.precision = function(_) { - return arguments.length ? (projectResample = resample(projectTransform, delta2 = _ * _), reset()) : sqrt(delta2); - }; - - projection.fitExtent = function(extent, object) { - return fitExtent(projection, extent, object); - }; - - projection.fitSize = function(size, object) { - return fitSize(projection, size, object); - }; - - function recenter() { - projectRotate = compose(rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma), project); - var center = project(lambda, phi); - dx = x - center[0] * k; - dy = y + center[1] * k; - return reset(); - } - - function reset() { - cache = cacheStream = null; - return projection; - } - - return function() { - project = projectAt.apply(this, arguments); - projection.invert = project.invert && invert; - return recenter(); - }; -} - -;// ./node_modules/d3-geo/src/projection/conic.js - - - -function conicProjection(projectAt) { - var phi0 = 0, - phi1 = pi / 3, - m = projectionMutator(projectAt), - p = m(phi0, phi1); - - p.parallels = function(_) { - return arguments.length ? m(phi0 = _[0] * radians, phi1 = _[1] * radians) : [phi0 * degrees, phi1 * degrees]; - }; - - return p; -} - -;// ./node_modules/d3-geo/src/projection/cylindricalEqualArea.js - - -function cylindricalEqualAreaRaw(phi0) { - var cosPhi0 = cos(phi0); - - function forward(lambda, phi) { - return [lambda * cosPhi0, sin(phi) / cosPhi0]; - } - - forward.invert = function(x, y) { - return [x / cosPhi0, asin(y * cosPhi0)]; - }; - - return forward; -} - -;// ./node_modules/d3-geo/src/projection/conicEqualArea.js - - - - -function conicEqualAreaRaw(y0, y1) { - var sy0 = sin(y0), n = (sy0 + sin(y1)) / 2; - - // Are the parallels symmetrical around the Equator? - if (abs(n) < epsilon) return cylindricalEqualAreaRaw(y0); - - var c = 1 + sy0 * (2 * n - sy0), r0 = sqrt(c) / n; - - function project(x, y) { - var r = sqrt(c - 2 * n * sin(y)) / n; - return [r * sin(x *= n), r0 - r * cos(x)]; - } - - project.invert = function(x, y) { - var r0y = r0 - y; - return [atan2(x, abs(r0y)) / n * sign(r0y), asin((c - (x * x + r0y * r0y) * n * n) / (2 * n))]; - }; - - return project; -} - -/* harmony default export */ function conicEqualArea() { - return conicProjection(conicEqualAreaRaw) - .scale(155.424) - .center([0, 33.6442]); -} - -;// ./node_modules/d3-geo/src/projection/albers.js - - -/* harmony default export */ function albers() { - return conicEqualArea() - .parallels([29.5, 45.5]) - .scale(1070) - .translate([480, 250]) - .rotate([96, 0]) - .center([-0.6, 38.7]); -} - -;// ./node_modules/d3-geo/src/projection/albersUsa.js - - - - - -// The projections must have mutually exclusive clip regions on the sphere, -// as this will avoid emitting interleaving lines and polygons. -function multiplex(streams) { - var n = streams.length; - return { - point: function(x, y) { var i = -1; while (++i < n) streams[i].point(x, y); }, - sphere: function() { var i = -1; while (++i < n) streams[i].sphere(); }, - lineStart: function() { var i = -1; while (++i < n) streams[i].lineStart(); }, - lineEnd: function() { var i = -1; while (++i < n) streams[i].lineEnd(); }, - polygonStart: function() { var i = -1; while (++i < n) streams[i].polygonStart(); }, - polygonEnd: function() { var i = -1; while (++i < n) streams[i].polygonEnd(); } - }; -} - -// A composite projection for the United States, configured by default for -// 960×500. The projection also works quite well at 960×600 if you change the -// scale to 1285 and adjust the translate accordingly. The set of standard -// parallels for each region comes from USGS, which is published here: -// http://egsc.usgs.gov/isb/pubs/MapProjections/projections.html#albers -/* harmony default export */ function albersUsa() { - var cache, - cacheStream, - lower48 = albers(), lower48Point, - alaska = conicEqualArea().rotate([154, 0]).center([-2, 58.5]).parallels([55, 65]), alaskaPoint, // EPSG:3338 - hawaii = conicEqualArea().rotate([157, 0]).center([-3, 19.9]).parallels([8, 18]), hawaiiPoint, // ESRI:102007 - point, pointStream = {point: function(x, y) { point = [x, y]; }}; - - function albersUsa(coordinates) { - var x = coordinates[0], y = coordinates[1]; - return point = null, - (lower48Point.point(x, y), point) - || (alaskaPoint.point(x, y), point) - || (hawaiiPoint.point(x, y), point); - } - - albersUsa.invert = function(coordinates) { - var k = lower48.scale(), - t = lower48.translate(), - x = (coordinates[0] - t[0]) / k, - y = (coordinates[1] - t[1]) / k; - return (y >= 0.120 && y < 0.234 && x >= -0.425 && x < -0.214 ? alaska - : y >= 0.166 && y < 0.234 && x >= -0.214 && x < -0.115 ? hawaii - : lower48).invert(coordinates); - }; - - albersUsa.stream = function(stream) { - return cache && cacheStream === stream ? cache : cache = multiplex([lower48.stream(cacheStream = stream), alaska.stream(stream), hawaii.stream(stream)]); - }; - - albersUsa.precision = function(_) { - if (!arguments.length) return lower48.precision(); - lower48.precision(_), alaska.precision(_), hawaii.precision(_); - return reset(); - }; - - albersUsa.scale = function(_) { - if (!arguments.length) return lower48.scale(); - lower48.scale(_), alaska.scale(_ * 0.35), hawaii.scale(_); - return albersUsa.translate(lower48.translate()); - }; - - albersUsa.translate = function(_) { - if (!arguments.length) return lower48.translate(); - var k = lower48.scale(), x = +_[0], y = +_[1]; - - lower48Point = lower48 - .translate(_) - .clipExtent([[x - 0.455 * k, y - 0.238 * k], [x + 0.455 * k, y + 0.238 * k]]) - .stream(pointStream); - - alaskaPoint = alaska - .translate([x - 0.307 * k, y + 0.201 * k]) - .clipExtent([[x - 0.425 * k + epsilon, y + 0.120 * k + epsilon], [x - 0.214 * k - epsilon, y + 0.234 * k - epsilon]]) - .stream(pointStream); - - hawaiiPoint = hawaii - .translate([x - 0.205 * k, y + 0.212 * k]) - .clipExtent([[x - 0.214 * k + epsilon, y + 0.166 * k + epsilon], [x - 0.115 * k - epsilon, y + 0.234 * k - epsilon]]) - .stream(pointStream); - - return reset(); - }; - - albersUsa.fitExtent = function(extent, object) { - return fitExtent(albersUsa, extent, object); - }; - - albersUsa.fitSize = function(size, object) { - return fitSize(albersUsa, size, object); - }; - - function reset() { - cache = cacheStream = null; - return albersUsa; - } - - return albersUsa.scale(1070); -} - -;// ./node_modules/d3-geo/src/projection/azimuthal.js - - -function azimuthalRaw(scale) { - return function(x, y) { - var cx = cos(x), - cy = cos(y), - k = scale(cx * cy); - return [ - k * cy * sin(x), - k * sin(y) - ]; - } -} - -function azimuthalInvert(angle) { - return function(x, y) { - var z = sqrt(x * x + y * y), - c = angle(z), - sc = sin(c), - cc = cos(c); - return [ - atan2(x * sc, z * cc), - asin(z && y * sc / z) - ]; - } -} - -;// ./node_modules/d3-geo/src/projection/azimuthalEqualArea.js - - - - -var azimuthalEqualAreaRaw = azimuthalRaw(function(cxcy) { - return sqrt(2 / (1 + cxcy)); -}); - -azimuthalEqualAreaRaw.invert = azimuthalInvert(function(z) { - return 2 * asin(z / 2); -}); - -/* harmony default export */ function azimuthalEqualArea() { - return projection(azimuthalEqualAreaRaw) - .scale(124.75) - .clipAngle(180 - 1e-3); -} - -;// ./node_modules/d3-geo/src/projection/azimuthalEquidistant.js - - - - -var azimuthalEquidistantRaw = azimuthalRaw(function(c) { - return (c = acos(c)) && c / sin(c); -}); - -azimuthalEquidistantRaw.invert = azimuthalInvert(function(z) { - return z; -}); - -/* harmony default export */ function azimuthalEquidistant() { - return projection(azimuthalEquidistantRaw) - .scale(79.4188) - .clipAngle(180 - 1e-3); -} - -;// ./node_modules/d3-geo/src/projection/mercator.js - - - - -function mercatorRaw(lambda, phi) { - return [lambda, log(tan((halfPi + phi) / 2))]; -} - -mercatorRaw.invert = function(x, y) { - return [x, 2 * atan(exp(y)) - halfPi]; -}; - -/* harmony default export */ function mercator() { - return mercatorProjection(mercatorRaw) - .scale(961 / tau); -} - -function mercatorProjection(project) { - var m = projection(project), - center = m.center, - scale = m.scale, - translate = m.translate, - clipExtent = m.clipExtent, - x0 = null, y0, x1, y1; // clip extent - - m.scale = function(_) { - return arguments.length ? (scale(_), reclip()) : scale(); - }; - - m.translate = function(_) { - return arguments.length ? (translate(_), reclip()) : translate(); - }; - - m.center = function(_) { - return arguments.length ? (center(_), reclip()) : center(); - }; - - m.clipExtent = function(_) { - return arguments.length ? ((_ == null ? x0 = y0 = x1 = y1 = null : (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1])), reclip()) : x0 == null ? null : [[x0, y0], [x1, y1]]; - }; - - function reclip() { - var k = pi * scale(), - t = m(rotation(m.rotate()).invert([0, 0])); - return clipExtent(x0 == null - ? [[t[0] - k, t[1] - k], [t[0] + k, t[1] + k]] : project === mercatorRaw - ? [[Math.max(t[0] - k, x0), y0], [Math.min(t[0] + k, x1), y1]] - : [[x0, Math.max(t[1] - k, y0)], [x1, Math.min(t[1] + k, y1)]]); - } - - return reclip(); -} - -;// ./node_modules/d3-geo/src/projection/conicConformal.js - - - - -function tany(y) { - return tan((halfPi + y) / 2); -} - -function conicConformalRaw(y0, y1) { - var cy0 = cos(y0), - n = y0 === y1 ? sin(y0) : log(cy0 / cos(y1)) / log(tany(y1) / tany(y0)), - f = cy0 * pow(tany(y0), n) / n; - - if (!n) return mercatorRaw; - - function project(x, y) { - if (f > 0) { if (y < -halfPi + epsilon) y = -halfPi + epsilon; } - else { if (y > halfPi - epsilon) y = halfPi - epsilon; } - var r = f / pow(tany(y), n); - return [r * sin(n * x), f - r * cos(n * x)]; - } - - project.invert = function(x, y) { - var fy = f - y, r = sign(n) * sqrt(x * x + fy * fy); - return [atan2(x, abs(fy)) / n * sign(fy), 2 * atan(pow(f / r, 1 / n)) - halfPi]; - }; - - return project; -} - -/* harmony default export */ function conicConformal() { - return conicProjection(conicConformalRaw) - .scale(109.5) - .parallels([30, 30]); -} - -;// ./node_modules/d3-geo/src/projection/equirectangular.js - - -function equirectangularRaw(lambda, phi) { - return [lambda, phi]; -} - -equirectangularRaw.invert = equirectangularRaw; - -/* harmony default export */ function equirectangular() { - return projection(equirectangularRaw) - .scale(152.63); -} - -;// ./node_modules/d3-geo/src/projection/conicEquidistant.js - - - - -function conicEquidistantRaw(y0, y1) { - var cy0 = cos(y0), - n = y0 === y1 ? sin(y0) : (cy0 - cos(y1)) / (y1 - y0), - g = cy0 / n + y0; - - if (abs(n) < epsilon) return equirectangularRaw; - - function project(x, y) { - var gy = g - y, nx = n * x; - return [gy * sin(nx), g - gy * cos(nx)]; - } - - project.invert = function(x, y) { - var gy = g - y; - return [atan2(x, abs(gy)) / n * sign(gy), g - sign(n) * sqrt(x * x + gy * gy)]; - }; - - return project; -} - -/* harmony default export */ function conicEquidistant() { - return conicProjection(conicEquidistantRaw) - .scale(131.154) - .center([0, 13.9389]); -} - -;// ./node_modules/d3-geo/src/projection/gnomonic.js - - - - -function gnomonicRaw(x, y) { - var cy = cos(y), k = cos(x) * cy; - return [cy * sin(x) / k, sin(y) / k]; -} - -gnomonicRaw.invert = azimuthalInvert(atan); - -/* harmony default export */ function gnomonic() { - return projection(gnomonicRaw) - .scale(144.049) - .clipAngle(60); -} - -;// ./node_modules/d3-geo/src/projection/identity.js - - - - - -function scaleTranslate(kx, ky, tx, ty) { - return kx === 1 && ky === 1 && tx === 0 && ty === 0 ? src_identity : transformer({ - point: function(x, y) { - this.stream.point(x * kx + tx, y * ky + ty); - } - }); -} - -/* harmony default export */ function projection_identity() { - var k = 1, tx = 0, ty = 0, sx = 1, sy = 1, transform = src_identity, // scale, translate and reflect - x0 = null, y0, x1, y1, clip = src_identity, // clip extent - cache, - cacheStream, - projection; - - function reset() { - cache = cacheStream = null; - return projection; - } - - return projection = { - stream: function(stream) { - return cache && cacheStream === stream ? cache : cache = transform(clip(cacheStream = stream)); - }, - clipExtent: function(_) { - return arguments.length ? (clip = _ == null ? (x0 = y0 = x1 = y1 = null, src_identity) : clipExtent(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]]; - }, - scale: function(_) { - return arguments.length ? (transform = scaleTranslate((k = +_) * sx, k * sy, tx, ty), reset()) : k; - }, - translate: function(_) { - return arguments.length ? (transform = scaleTranslate(k * sx, k * sy, tx = +_[0], ty = +_[1]), reset()) : [tx, ty]; - }, - reflectX: function(_) { - return arguments.length ? (transform = scaleTranslate(k * (sx = _ ? -1 : 1), k * sy, tx, ty), reset()) : sx < 0; - }, - reflectY: function(_) { - return arguments.length ? (transform = scaleTranslate(k * sx, k * (sy = _ ? -1 : 1), tx, ty), reset()) : sy < 0; - }, - fitExtent: function(extent, object) { - return fitExtent(projection, extent, object); - }, - fitSize: function(size, object) { - return fitSize(projection, size, object); - } - }; -} - -;// ./node_modules/d3-geo/src/projection/naturalEarth1.js - - - -function naturalEarth1Raw(lambda, phi) { - var phi2 = phi * phi, phi4 = phi2 * phi2; - return [ - lambda * (0.8707 - 0.131979 * phi2 + phi4 * (-0.013791 + phi4 * (0.003971 * phi2 - 0.001529 * phi4))), - phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 0.005916 * phi4))) - ]; -} - -naturalEarth1Raw.invert = function(x, y) { - var phi = y, i = 25, delta; - do { - var phi2 = phi * phi, phi4 = phi2 * phi2; - phi -= delta = (phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 0.005916 * phi4))) - y) / - (1.007226 + phi2 * (0.015085 * 3 + phi4 * (-0.044475 * 7 + 0.028874 * 9 * phi2 - 0.005916 * 11 * phi4))); - } while (abs(delta) > epsilon && --i > 0); - return [ - x / (0.8707 + (phi2 = phi * phi) * (-0.131979 + phi2 * (-0.013791 + phi2 * phi2 * phi2 * (0.003971 - 0.001529 * phi2)))), - phi - ]; -}; - -/* harmony default export */ function naturalEarth1() { - return projection(naturalEarth1Raw) - .scale(175.295); -} - -;// ./node_modules/d3-geo/src/projection/orthographic.js - - - - -function orthographicRaw(x, y) { - return [cos(y) * sin(x), sin(y)]; -} - -orthographicRaw.invert = azimuthalInvert(asin); - -/* harmony default export */ function orthographic() { - return projection(orthographicRaw) - .scale(249.5) - .clipAngle(90 + epsilon); -} - -;// ./node_modules/d3-geo/src/projection/stereographic.js - - - - -function stereographicRaw(x, y) { - var cy = cos(y), k = 1 + cos(x) * cy; - return [cy * sin(x) / k, sin(y) / k]; -} - -stereographicRaw.invert = azimuthalInvert(function(z) { - return 2 * atan(z); -}); - -/* harmony default export */ function stereographic() { - return projection(stereographicRaw) - .scale(250) - .clipAngle(142); -} - -;// ./node_modules/d3-geo/src/projection/transverseMercator.js - - - -function transverseMercatorRaw(lambda, phi) { - return [log(tan((halfPi + phi) / 2)), -lambda]; -} - -transverseMercatorRaw.invert = function(x, y) { - return [-y, 2 * atan(exp(x)) - halfPi]; -}; - -/* harmony default export */ function transverseMercator() { - var m = mercatorProjection(transverseMercatorRaw), - center = m.center, - rotate = m.rotate; - - m.center = function(_) { - return arguments.length ? center([-_[1], _[0]]) : (_ = center(), [_[1], -_[0]]); - }; - - m.rotate = function(_) { - return arguments.length ? rotate([_[0], _[1], _.length > 2 ? _[2] + 90 : 90]) : (_ = rotate(), [_[0], _[1], _[2] - 90]); - }; - - return rotate([0, 0, 90]) - .scale(159.155); -} - -;// ./node_modules/d3-geo/index.js - - - - - // DEPRECATED! Use d3.geoIdentity().clipExtent(…). - - - - - - - - - - - - - - - - - - - - - - - - - - - -/***/ }), - -/***/ 1734: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var boolean_disjoint_1 = __importDefault(__webpack_require__(1323)); -var meta_1 = __webpack_require__(8421); -/** - * Boolean-intersects returns (TRUE) two geometries intersect. - * - * @name booleanIntersects - * @param {Geometry|Feature} feature1 GeoJSON Feature or Geometry - * @param {Geometry|Feature} feature2 GeoJSON Feature or Geometry - * @returns {boolean} true/false - * @example - * var point = turf.point([2, 2]); - * var line = turf.lineString([[1, 1], [1, 2], [1, 3], [1, 4]]); - * - * turf.booleanIntersects(line, point); - * //=true - */ -function booleanIntersects(feature1, feature2) { - var bool = false; - meta_1.flattenEach(feature1, function (flatten1) { - meta_1.flattenEach(feature2, function (flatten2) { - if (bool === true) { - return true; - } - bool = !boolean_disjoint_1.default(flatten1.geometry, flatten2.geometry); - }); - }); - return bool; -} -exports["default"] = booleanIntersects; - - -/***/ }), - -/***/ 1756: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -/*jshint esversion: 6 */ - -var Distance = __webpack_require__(6766), - ClusterInit = __webpack_require__(5810), - eudist = Distance.eudist, - mandist = Distance.mandist, - dist = Distance.dist, - kmrand = ClusterInit.kmrand, - kmpp = ClusterInit.kmpp; - -var MAX = 10000; - -/** - * Inits an array with values - */ -function init(len, val, v) { - v = v || []; - for (var i = 0; i < len; i++) { - v[i] = val; - }return v; -} - -function skmeans(data, k, initial, maxit) { - var ks = [], - old = [], - idxs = [], - dist = []; - var conv = false, - it = maxit || MAX; - var len = data.length, - vlen = data[0].length, - multi = vlen > 0; - var count = []; - - if (!initial) { - var _idxs = {}; - while (ks.length < k) { - var idx = Math.floor(Math.random() * len); - if (!_idxs[idx]) { - _idxs[idx] = true; - ks.push(data[idx]); - } - } - } else if (initial == "kmrand") { - ks = kmrand(data, k); - } else if (initial == "kmpp") { - ks = kmpp(data, k); - } else { - ks = initial; - } - - do { - // Reset k count - init(k, 0, count); - - // For each value in data, find the nearest centroid - for (var i = 0; i < len; i++) { - var min = Infinity, - _idx = 0; - for (var j = 0; j < k; j++) { - // Multidimensional or unidimensional - var dist = multi ? eudist(data[i], ks[j]) : Math.abs(data[i] - ks[j]); - if (dist <= min) { - min = dist; - _idx = j; - } - } - idxs[i] = _idx; // Index of the selected centroid for that value - count[_idx]++; // Number of values for this centroid - } - - // Recalculate centroids - var sum = [], - old = [], - dif = 0; - for (var _j = 0; _j < k; _j++) { - // Multidimensional or unidimensional - sum[_j] = multi ? init(vlen, 0, sum[_j]) : 0; - old[_j] = ks[_j]; - } - - // If multidimensional - if (multi) { - for (var _j2 = 0; _j2 < k; _j2++) { - ks[_j2] = []; - } // Sum values and count for each centroid - for (var _i = 0; _i < len; _i++) { - var _idx2 = idxs[_i], - // Centroid for that item - vsum = sum[_idx2], - // Sum values for this centroid - vect = data[_i]; // Current vector - - // Accumulate value on the centroid for current vector - for (var h = 0; h < vlen; h++) { - vsum[h] += vect[h]; - } - } - // Calculate the average for each centroid - conv = true; - for (var _j3 = 0; _j3 < k; _j3++) { - var ksj = ks[_j3], - // Current centroid - sumj = sum[_j3], - // Accumulated centroid values - oldj = old[_j3], - // Old centroid value - cj = count[_j3]; // Number of elements for this centroid - - // New average - for (var _h = 0; _h < vlen; _h++) { - ksj[_h] = sumj[_h] / cj || 0; // New centroid - } - - // Find if centroids have moved - if (conv) { - for (var _h2 = 0; _h2 < vlen; _h2++) { - if (oldj[_h2] != ksj[_h2]) { - conv = false; - break; - } - } - } - } - } - // If unidimensional - else { - // Sum values and count for each centroid - for (var _i2 = 0; _i2 < len; _i2++) { - var _idx3 = idxs[_i2]; - sum[_idx3] += data[_i2]; - } - // Calculate the average for each centroid - for (var _j4 = 0; _j4 < k; _j4++) { - ks[_j4] = sum[_j4] / count[_j4] || 0; // New centroid - } - // Find if centroids have moved - conv = true; - for (var _j5 = 0; _j5 < k; _j5++) { - if (old[_j5] != ks[_j5]) { - conv = false; - break; - } - } - } - - conv = conv || --it <= 0; - } while (!conv); - - return { - it: MAX - it, - k: k, - idxs: idxs, - centroids: ks - }; -} - -module.exports = skmeans; -//# sourceMappingURL=main.js.map - - -/***/ }), - -/***/ 1786: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var circle = __webpack_require__(5764); -var lineArc = __webpack_require__(375); -var meta = __webpack_require__(8421); -var helpers = __webpack_require__(8967); -var invariant = __webpack_require__(8506); - -function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } - -var circle__default = /*#__PURE__*/_interopDefaultLegacy(circle); -var lineArc__default = /*#__PURE__*/_interopDefaultLegacy(lineArc); - -/** - * Creates a circular sector of a circle of given radius and center {@link Point}, - * between (clockwise) bearing1 and bearing2; 0 bearing is North of center point, positive clockwise. - * - * @name sector - * @param {Coord} center center point - * @param {number} radius radius of the circle - * @param {number} bearing1 angle, in decimal degrees, of the first radius of the sector - * @param {number} bearing2 angle, in decimal degrees, of the second radius of the sector - * @param {Object} [options={}] Optional parameters - * @param {string} [options.units='kilometers'] miles, kilometers, degrees, or radians - * @param {number} [options.steps=64] number of steps - * @param {Properties} [options.properties={}] Translate properties to Feature Polygon - * @returns {Feature} sector polygon - * @example - * var center = turf.point([-75, 40]); - * var radius = 5; - * var bearing1 = 25; - * var bearing2 = 45; - * - * var sector = turf.sector(center, radius, bearing1, bearing2); - * - * //addToMap - * var addToMap = [center, sector]; - */ -function sector(center, radius, bearing1, bearing2, options) { - // Optional parameters - options = options || {}; - if (!helpers.isObject(options)) throw new Error("options is invalid"); - var properties = options.properties; - - // validation - if (!center) throw new Error("center is required"); - if (bearing1 === undefined || bearing1 === null) - throw new Error("bearing1 is required"); - if (bearing2 === undefined || bearing2 === null) - throw new Error("bearing2 is required"); - if (!radius) throw new Error("radius is required"); - if (typeof options !== "object") throw new Error("options must be an object"); - - if (convertAngleTo360(bearing1) === convertAngleTo360(bearing2)) { - return circle__default['default'](center, radius, options); - } - var coords = invariant.getCoords(center); - var arc = lineArc__default['default'](center, radius, bearing1, bearing2, options); - var sliceCoords = [[coords]]; - meta.coordEach(arc, function (currentCoords) { - sliceCoords[0].push(currentCoords); - }); - sliceCoords[0].push(coords); - - return helpers.polygon(sliceCoords, properties); -} - -/** - * Takes any angle in degrees - * and returns a valid angle between 0-360 degrees - * - * @private - * @param {number} alfa angle between -180-180 degrees - * @returns {number} angle between 0-360 degrees - */ -function convertAngleTo360(alfa) { - var beta = alfa % 360; - if (beta < 0) beta += 360; - return beta; -} - -module.exports = sector; -module.exports["default"] = sector; - - -/***/ }), - -/***/ 1925: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var clone = __webpack_require__(3711); -var center = __webpack_require__(6649); -var centroid = __webpack_require__(4408); -var turfBBox = __webpack_require__(4383); -var rhumbBearing = __webpack_require__(2307); -var rhumbDistance = __webpack_require__(9778); -var rhumbDestination = __webpack_require__(7153); -var meta = __webpack_require__(8421); -var helpers = __webpack_require__(8967); -var invariant = __webpack_require__(8506); - -function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } - -var clone__default = /*#__PURE__*/_interopDefaultLegacy(clone); -var center__default = /*#__PURE__*/_interopDefaultLegacy(center); -var centroid__default = /*#__PURE__*/_interopDefaultLegacy(centroid); -var turfBBox__default = /*#__PURE__*/_interopDefaultLegacy(turfBBox); -var rhumbBearing__default = /*#__PURE__*/_interopDefaultLegacy(rhumbBearing); -var rhumbDistance__default = /*#__PURE__*/_interopDefaultLegacy(rhumbDistance); -var rhumbDestination__default = /*#__PURE__*/_interopDefaultLegacy(rhumbDestination); - -/** - * Scale a GeoJSON from a given point by a factor of scaling (ex: factor=2 would make the GeoJSON 200% larger). - * If a FeatureCollection is provided, the origin point will be calculated based on each individual Feature. - * - * @name transformScale - * @param {GeoJSON} geojson GeoJSON to be scaled - * @param {number} factor of scaling, positive or negative values greater than 0 - * @param {Object} [options={}] Optional parameters - * @param {string|Coord} [options.origin='centroid'] Point from which the scaling will occur (string options: sw/se/nw/ne/center/centroid) - * @param {boolean} [options.mutate=false] allows GeoJSON input to be mutated (significant performance increase if true) - * @returns {GeoJSON} scaled GeoJSON - * @example - * var poly = turf.polygon([[[0,29],[3.5,29],[2.5,32],[0,29]]]); - * var scaledPoly = turf.transformScale(poly, 3); - * - * //addToMap - * var addToMap = [poly, scaledPoly]; - * scaledPoly.properties = {stroke: '#F00', 'stroke-width': 4}; - */ -function transformScale(geojson, factor, options) { - // Optional parameters - options = options || {}; - if (!helpers.isObject(options)) throw new Error("options is invalid"); - var origin = options.origin; - var mutate = options.mutate; - - // Input validation - if (!geojson) throw new Error("geojson required"); - if (typeof factor !== "number" || factor === 0) - throw new Error("invalid factor"); - var originIsPoint = Array.isArray(origin) || typeof origin === "object"; - - // Clone geojson to avoid side effects - if (mutate !== true) geojson = clone__default['default'](geojson); - - // Scale each Feature separately - if (geojson.type === "FeatureCollection" && !originIsPoint) { - meta.featureEach(geojson, function (feature, index) { - geojson.features[index] = scale(feature, factor, origin); - }); - return geojson; - } - // Scale Feature/Geometry - return scale(geojson, factor, origin); -} - -/** - * Scale Feature/Geometry - * - * @private - * @param {Feature|Geometry} feature GeoJSON Feature/Geometry - * @param {number} factor of scaling, positive or negative values greater than 0 - * @param {string|Coord} [origin="centroid"] Point from which the scaling will occur (string options: sw/se/nw/ne/center/centroid) - * @returns {Feature|Geometry} scaled GeoJSON Feature/Geometry - */ -function scale(feature, factor, origin) { - // Default params - var isPoint = invariant.getType(feature) === "Point"; - origin = defineOrigin(feature, origin); - - // Shortcut no-scaling - if (factor === 1 || isPoint) return feature; - - // Scale each coordinate - meta.coordEach(feature, function (coord) { - var originalDistance = rhumbDistance__default['default'](origin, coord); - var bearing = rhumbBearing__default['default'](origin, coord); - var newDistance = originalDistance * factor; - var newCoord = invariant.getCoords(rhumbDestination__default['default'](origin, newDistance, bearing)); - coord[0] = newCoord[0]; - coord[1] = newCoord[1]; - if (coord.length === 3) coord[2] *= factor; - }); - - return feature; -} - -/** - * Define Origin - * - * @private - * @param {GeoJSON} geojson GeoJSON - * @param {string|Coord} origin sw/se/nw/ne/center/centroid - * @returns {Feature} Point origin - */ -function defineOrigin(geojson, origin) { - // Default params - if (origin === undefined || origin === null) origin = "centroid"; - - // Input Coord - if (Array.isArray(origin) || typeof origin === "object") - return invariant.getCoord(origin); - - // Define BBox - var bbox = geojson.bbox ? geojson.bbox : turfBBox__default['default'](geojson); - var west = bbox[0]; - var south = bbox[1]; - var east = bbox[2]; - var north = bbox[3]; - - switch (origin) { - case "sw": - case "southwest": - case "westsouth": - case "bottomleft": - return helpers.point([west, south]); - case "se": - case "southeast": - case "eastsouth": - case "bottomright": - return helpers.point([east, south]); - case "nw": - case "northwest": - case "westnorth": - case "topleft": - return helpers.point([west, north]); - case "ne": - case "northeast": - case "eastnorth": - case "topright": - return helpers.point([east, north]); - case "center": - return center__default['default'](geojson); - case undefined: - case null: - case "centroid": - return centroid__default['default'](geojson); - default: - throw new Error("invalid origin"); - } -} - -module.exports = transformScale; -module.exports["default"] = transformScale; - - -/***/ }), - -/***/ 1972: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var meta = __webpack_require__(8421); -var invariant = __webpack_require__(8506); -var helpers = __webpack_require__(8967); - -/** - * https://github.com/rook2pawn/node-intersection - * - * Author @rook2pawn - */ - -/** - * AB - * - * @private - * @param {Array>} segment - 2 vertex line segment - * @returns {Array} coordinates [x, y] - */ -function ab(segment) { - var start = segment[0]; - var end = segment[1]; - return [end[0] - start[0], end[1] - start[1]]; -} - -/** - * Cross Product - * - * @private - * @param {Array} v1 coordinates [x, y] - * @param {Array} v2 coordinates [x, y] - * @returns {Array} Cross Product - */ -function crossProduct(v1, v2) { - return v1[0] * v2[1] - v2[0] * v1[1]; -} - -/** - * Add - * - * @private - * @param {Array} v1 coordinates [x, y] - * @param {Array} v2 coordinates [x, y] - * @returns {Array} Add - */ -function add(v1, v2) { - return [v1[0] + v2[0], v1[1] + v2[1]]; -} - -/** - * Sub - * - * @private - * @param {Array} v1 coordinates [x, y] - * @param {Array} v2 coordinates [x, y] - * @returns {Array} Sub - */ -function sub(v1, v2) { - return [v1[0] - v2[0], v1[1] - v2[1]]; -} - -/** - * scalarMult - * - * @private - * @param {number} s scalar - * @param {Array} v coordinates [x, y] - * @returns {Array} scalarMult - */ -function scalarMult(s, v) { - return [s * v[0], s * v[1]]; -} - -/** - * Intersect Segments - * - * @private - * @param {Array} a coordinates [x, y] - * @param {Array} b coordinates [x, y] - * @returns {Array} intersection - */ -function intersectSegments(a, b) { - var p = a[0]; - var r = ab(a); - var q = b[0]; - var s = ab(b); - - var cross = crossProduct(r, s); - var qmp = sub(q, p); - var numerator = crossProduct(qmp, s); - var t = numerator / cross; - var intersection = add(p, scalarMult(t, r)); - return intersection; -} - -/** - * Is Parallel - * - * @private - * @param {Array} a coordinates [x, y] - * @param {Array} b coordinates [x, y] - * @returns {boolean} true if a and b are parallel (or co-linear) - */ -function isParallel(a, b) { - var r = ab(a); - var s = ab(b); - return crossProduct(r, s) === 0; -} - -/** - * Intersection - * - * @private - * @param {Array} a coordinates [x, y] - * @param {Array} b coordinates [x, y] - * @returns {Array|boolean} true if a and b are parallel (or co-linear) - */ -function intersection(a, b) { - if (isParallel(a, b)) return false; - return intersectSegments(a, b); -} - -/** - * Takes a {@link LineString|line} and returns a {@link LineString|line} at offset by the specified distance. - * - * @name lineOffset - * @param {Geometry|Feature} geojson input GeoJSON - * @param {number} distance distance to offset the line (can be of negative value) - * @param {Object} [options={}] Optional parameters - * @param {string} [options.units='kilometers'] can be degrees, radians, miles, kilometers, inches, yards, meters - * @returns {Feature} Line offset from the input line - * @example - * var line = turf.lineString([[-83, 30], [-84, 36], [-78, 41]], { "stroke": "#F00" }); - * - * var offsetLine = turf.lineOffset(line, 2, {units: 'miles'}); - * - * //addToMap - * var addToMap = [offsetLine, line] - * offsetLine.properties.stroke = "#00F" - */ -function lineOffset(geojson, distance, options) { - // Optional parameters - options = options || {}; - if (!helpers.isObject(options)) throw new Error("options is invalid"); - var units = options.units; - - // Valdiation - if (!geojson) throw new Error("geojson is required"); - if (distance === undefined || distance === null || isNaN(distance)) - throw new Error("distance is required"); - - var type = invariant.getType(geojson); - var properties = geojson.properties; - - switch (type) { - case "LineString": - return lineOffsetFeature(geojson, distance, units); - case "MultiLineString": - var coords = []; - meta.flattenEach(geojson, function (feature) { - coords.push( - lineOffsetFeature(feature, distance, units).geometry.coordinates - ); - }); - return helpers.multiLineString(coords, properties); - default: - throw new Error("geometry " + type + " is not supported"); - } -} - -/** - * Line Offset - * - * @private - * @param {Geometry|Feature} line input line - * @param {number} distance distance to offset the line (can be of negative value) - * @param {string} [units=kilometers] units - * @returns {Feature} Line offset from the input line - */ -function lineOffsetFeature(line, distance, units) { - var segments = []; - var offsetDegrees = helpers.lengthToDegrees(distance, units); - var coords = invariant.getCoords(line); - var finalCoords = []; - coords.forEach(function (currentCoords, index) { - if (index !== coords.length - 1) { - var segment = processSegment( - currentCoords, - coords[index + 1], - offsetDegrees - ); - segments.push(segment); - if (index > 0) { - var seg2Coords = segments[index - 1]; - var intersects = intersection(segment, seg2Coords); - - // Handling for line segments that aren't straight - if (intersects !== false) { - seg2Coords[1] = intersects; - segment[0] = intersects; - } - - finalCoords.push(seg2Coords[0]); - if (index === coords.length - 2) { - finalCoords.push(segment[0]); - finalCoords.push(segment[1]); - } - } - // Handling for lines that only have 1 segment - if (coords.length === 2) { - finalCoords.push(segment[0]); - finalCoords.push(segment[1]); - } - } - }); - return helpers.lineString(finalCoords, line.properties); -} - -/** - * Process Segment - * Inspiration taken from http://stackoverflow.com/questions/2825412/draw-a-parallel-line - * - * @private - * @param {Array} point1 Point coordinates - * @param {Array} point2 Point coordinates - * @param {number} offset Offset - * @returns {Array>} offset points - */ -function processSegment(point1, point2, offset) { - var L = Math.sqrt( - (point1[0] - point2[0]) * (point1[0] - point2[0]) + - (point1[1] - point2[1]) * (point1[1] - point2[1]) - ); - - var out1x = point1[0] + (offset * (point2[1] - point1[1])) / L; - var out2x = point2[0] + (offset * (point2[1] - point1[1])) / L; - var out1y = point1[1] + (offset * (point1[0] - point2[0])) / L; - var out2y = point2[1] + (offset * (point1[0] - point2[0])) / L; - return [ - [out1x, out1y], - [out2x, out2y], - ]; -} - -module.exports = lineOffset; -module.exports["default"] = lineOffset; - - -/***/ }), - -/***/ 2057: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var polygon_clipping_1 = __importDefault(__webpack_require__(9004)); -var invariant_1 = __webpack_require__(8506); -var helpers_1 = __webpack_require__(8967); -/** - * Takes two {@link (Multi)Polygon(s)} and returns a combined polygon. If the input polygons are not contiguous, this function returns a {@link MultiPolygon} feature. - * - * @name union - * @param {Feature} polygon1 input Polygon feature - * @param {Feature} polygon2 Polygon feature to difference from polygon1 - * @param {Object} [options={}] Optional Parameters - * @param {Object} [options.properties={}] Translate Properties to output Feature - * @returns {Feature<(Polygon|MultiPolygon)>} a combined {@link Polygon} or {@link MultiPolygon} feature, or null if the inputs are empty - * @example - * var poly1 = turf.polygon([[ - * [-82.574787, 35.594087], - * [-82.574787, 35.615581], - * [-82.545261, 35.615581], - * [-82.545261, 35.594087], - * [-82.574787, 35.594087] - * ]], {"fill": "#0f0"}); - * var poly2 = turf.polygon([[ - * [-82.560024, 35.585153], - * [-82.560024, 35.602602], - * [-82.52964, 35.602602], - * [-82.52964, 35.585153], - * [-82.560024, 35.585153] - * ]], {"fill": "#00f"}); - * - * var union = turf.union(poly1, poly2); - * - * //addToMap - * var addToMap = [poly1, poly2, union]; - */ -function union(poly1, poly2, options) { - if (options === void 0) { options = {}; } - var geom1 = invariant_1.getGeom(poly1); - var geom2 = invariant_1.getGeom(poly2); - var unioned = polygon_clipping_1.default.union(geom1.coordinates, geom2.coordinates); - if (unioned.length === 0) - return null; - if (unioned.length === 1) - return helpers_1.polygon(unioned[0], options.properties); - else - return helpers_1.multiPolygon(unioned, options.properties); -} -exports["default"] = union; - - -/***/ }), - -/***/ 2086: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -var helpers_1 = __webpack_require__(8967); -var invariant_1 = __webpack_require__(8506); -// To-Do => Improve Typescript GeoJSON handling -/** - * Removes redundant coordinates from any GeoJSON Geometry. - * - * @name cleanCoords - * @param {Geometry|Feature} geojson Feature or Geometry - * @param {Object} [options={}] Optional parameters - * @param {boolean} [options.mutate=false] allows GeoJSON input to be mutated - * @returns {Geometry|Feature} the cleaned input Feature/Geometry - * @example - * var line = turf.lineString([[0, 0], [0, 2], [0, 5], [0, 8], [0, 8], [0, 10]]); - * var multiPoint = turf.multiPoint([[0, 0], [0, 0], [2, 2]]); - * - * turf.cleanCoords(line).geometry.coordinates; - * //= [[0, 0], [0, 10]] - * - * turf.cleanCoords(multiPoint).geometry.coordinates; - * //= [[0, 0], [2, 2]] - */ -function cleanCoords(geojson, options) { - if (options === void 0) { options = {}; } - // Backwards compatible with v4.0 - var mutate = typeof options === "object" ? options.mutate : options; - if (!geojson) - throw new Error("geojson is required"); - var type = invariant_1.getType(geojson); - // Store new "clean" points in this Array - var newCoords = []; - switch (type) { - case "LineString": - newCoords = cleanLine(geojson); - break; - case "MultiLineString": - case "Polygon": - invariant_1.getCoords(geojson).forEach(function (line) { - newCoords.push(cleanLine(line)); - }); - break; - case "MultiPolygon": - invariant_1.getCoords(geojson).forEach(function (polygons) { - var polyPoints = []; - polygons.forEach(function (ring) { - polyPoints.push(cleanLine(ring)); - }); - newCoords.push(polyPoints); - }); - break; - case "Point": - return geojson; - case "MultiPoint": - var existing = {}; - invariant_1.getCoords(geojson).forEach(function (coord) { - var key = coord.join("-"); - if (!Object.prototype.hasOwnProperty.call(existing, key)) { - newCoords.push(coord); - existing[key] = true; - } - }); - break; - default: - throw new Error(type + " geometry not supported"); - } - // Support input mutation - if (geojson.coordinates) { - if (mutate === true) { - geojson.coordinates = newCoords; - return geojson; - } - return { type: type, coordinates: newCoords }; - } - else { - if (mutate === true) { - geojson.geometry.coordinates = newCoords; - return geojson; - } - return helpers_1.feature({ type: type, coordinates: newCoords }, geojson.properties, { - bbox: geojson.bbox, - id: geojson.id, - }); - } -} -/** - * Clean Coords - * - * @private - * @param {Array|LineString} line Line - * @returns {Array} Cleaned coordinates - */ -function cleanLine(line) { - var points = invariant_1.getCoords(line); - // handle "clean" segment - if (points.length === 2 && !equals(points[0], points[1])) - return points; - var newPoints = []; - var secondToLast = points.length - 1; - var newPointsLength = newPoints.length; - newPoints.push(points[0]); - for (var i = 1; i < secondToLast; i++) { - var prevAddedPoint = newPoints[newPoints.length - 1]; - if (points[i][0] === prevAddedPoint[0] && - points[i][1] === prevAddedPoint[1]) - continue; - else { - newPoints.push(points[i]); - newPointsLength = newPoints.length; - if (newPointsLength > 2) { - if (isPointOnLineSegment(newPoints[newPointsLength - 3], newPoints[newPointsLength - 1], newPoints[newPointsLength - 2])) - newPoints.splice(newPoints.length - 2, 1); - } - } - } - newPoints.push(points[points.length - 1]); - newPointsLength = newPoints.length; - if (equals(points[0], points[points.length - 1]) && newPointsLength < 4) - throw new Error("invalid polygon"); - if (isPointOnLineSegment(newPoints[newPointsLength - 3], newPoints[newPointsLength - 1], newPoints[newPointsLength - 2])) - newPoints.splice(newPoints.length - 2, 1); - return newPoints; -} -/** - * Compares two points and returns if they are equals - * - * @private - * @param {Position} pt1 point - * @param {Position} pt2 point - * @returns {boolean} true if they are equals - */ -function equals(pt1, pt2) { - return pt1[0] === pt2[0] && pt1[1] === pt2[1]; -} -/** - * Returns if `point` is on the segment between `start` and `end`. - * Borrowed from `@turf/boolean-point-on-line` to speed up the evaluation (instead of using the module as dependency) - * - * @private - * @param {Position} start coord pair of start of line - * @param {Position} end coord pair of end of line - * @param {Position} point coord pair of point to check - * @returns {boolean} true/false - */ -function isPointOnLineSegment(start, end, point) { - var x = point[0], y = point[1]; - var startX = start[0], startY = start[1]; - var endX = end[0], endY = end[1]; - var dxc = x - startX; - var dyc = y - startY; - var dxl = endX - startX; - var dyl = endY - startY; - var cross = dxc * dyl - dyc * dxl; - if (cross !== 0) - return false; - else if (Math.abs(dxl) >= Math.abs(dyl)) - return dxl > 0 ? startX <= x && x <= endX : endX <= x && x <= startX; - else - return dyl > 0 ? startY <= y && y <= endY : endY <= y && y <= startY; -} -exports["default"] = cleanCoords; - - -/***/ }), - -/***/ 2120: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var bbox = __webpack_require__(4383); -var bboxPolygon = __webpack_require__(3932); - -function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } - -var bbox__default = /*#__PURE__*/_interopDefaultLegacy(bbox); -var bboxPolygon__default = /*#__PURE__*/_interopDefaultLegacy(bboxPolygon); - -/** - * Takes any number of features and returns a rectangular {@link Polygon} that encompasses all vertices. - * - * @name envelope - * @param {GeoJSON} geojson input features - * @returns {Feature} a rectangular Polygon feature that encompasses all vertices - * @example - * var features = turf.featureCollection([ - * turf.point([-75.343, 39.984], {"name": "Location A"}), - * turf.point([-75.833, 39.284], {"name": "Location B"}), - * turf.point([-75.534, 39.123], {"name": "Location C"}) - * ]); - * - * var enveloped = turf.envelope(features); - * - * //addToMap - * var addToMap = [features, enveloped]; - */ -function envelope(geojson) { - return bboxPolygon__default['default'](bbox__default['default'](geojson)); -} - -module.exports = envelope; -module.exports["default"] = envelope; - - -/***/ }), - -/***/ 2141: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -// http://en.wikipedia.org/wiki/Delaunay_triangulation -// https://github.com/ironwallaby/delaunay -var helpers_1 = __webpack_require__(8967); -/** - * Takes a set of {@link Point|points} and creates a - * [Triangulated Irregular Network](http://en.wikipedia.org/wiki/Triangulated_irregular_network), - * or a TIN for short, returned as a collection of Polygons. These are often used - * for developing elevation contour maps or stepped heat visualizations. - * - * If an optional z-value property is provided then it is added as properties called `a`, `b`, - * and `c` representing its value at each of the points that represent the corners of the - * triangle. - * - * @name tin - * @param {FeatureCollection} points input points - * @param {String} [z] name of the property from which to pull z values - * This is optional: if not given, then there will be no extra data added to the derived triangles. - * @returns {FeatureCollection} TIN output - * @example - * // generate some random point data - * var points = turf.randomPoint(30, {bbox: [50, 30, 70, 50]}); - * - * // add a random property to each point between 0 and 9 - * for (var i = 0; i < points.features.length; i++) { - * points.features[i].properties.z = ~~(Math.random() * 9); - * } - * var tin = turf.tin(points, 'z'); - * - * //addToMap - * var addToMap = [tin, points] - * for (var i = 0; i < tin.features.length; i++) { - * var properties = tin.features[i].properties; - * properties.fill = '#' + properties.a + properties.b + properties.c; - * } - */ -function tin(points, z) { - // break down points - var isPointZ = false; - return helpers_1.featureCollection(triangulate(points.features.map(function (p) { - var point = { - x: p.geometry.coordinates[0], - y: p.geometry.coordinates[1], - }; - if (z) { - point.z = p.properties[z]; - } - else if (p.geometry.coordinates.length === 3) { - isPointZ = true; - point.z = p.geometry.coordinates[2]; - } - return point; - })).map(function (triangle) { - var a = [triangle.a.x, triangle.a.y]; - var b = [triangle.b.x, triangle.b.y]; - var c = [triangle.c.x, triangle.c.y]; - var properties = {}; - // Add z coordinates to triangle points if user passed - // them in that way otherwise add it as a property. - if (isPointZ) { - a.push(triangle.a.z); - b.push(triangle.b.z); - c.push(triangle.c.z); - } - else { - properties = { - a: triangle.a.z, - b: triangle.b.z, - c: triangle.c.z, - }; - } - return helpers_1.polygon([[a, b, c, a]], properties); - })); -} -exports["default"] = tin; -var Triangle = /** @class */ (function () { - function Triangle(a, b, c) { - this.a = a; - this.b = b; - this.c = c; - var A = b.x - a.x; - var B = b.y - a.y; - var C = c.x - a.x; - var D = c.y - a.y; - var E = A * (a.x + b.x) + B * (a.y + b.y); - var F = C * (a.x + c.x) + D * (a.y + c.y); - var G = 2 * (A * (c.y - b.y) - B * (c.x - b.x)); - var dx; - var dy; - // If the points of the triangle are collinear, then just find the - // extremes and use the midpoint as the center of the circumcircle. - this.x = (D * E - B * F) / G; - this.y = (A * F - C * E) / G; - dx = this.x - a.x; - dy = this.y - a.y; - this.r = dx * dx + dy * dy; - } - return Triangle; -}()); -function byX(a, b) { - return b.x - a.x; -} -function dedup(edges) { - var j = edges.length; - var a; - var b; - var i; - var m; - var n; - outer: while (j) { - b = edges[--j]; - a = edges[--j]; - i = j; - while (i) { - n = edges[--i]; - m = edges[--i]; - if ((a === m && b === n) || (a === n && b === m)) { - edges.splice(j, 2); - edges.splice(i, 2); - j -= 2; - continue outer; - } - } - } -} -function triangulate(vertices) { - // Bail if there aren't enough vertices to form any triangles. - if (vertices.length < 3) { - return []; - } - // Ensure the vertex array is in order of descending X coordinate - // (which is needed to ensure a subquadratic runtime), and then find - // the bounding box around the points. - vertices.sort(byX); - var i = vertices.length - 1; - var xmin = vertices[i].x; - var xmax = vertices[0].x; - var ymin = vertices[i].y; - var ymax = ymin; - var epsilon = 1e-12; - var a; - var b; - var c; - var A; - var B; - var G; - while (i--) { - if (vertices[i].y < ymin) { - ymin = vertices[i].y; - } - if (vertices[i].y > ymax) { - ymax = vertices[i].y; - } - } - // Find a supertriangle, which is a triangle that surrounds all the - // vertices. This is used like something of a sentinel value to remove - // cases in the main algorithm, and is removed before we return any - // results. - // Once found, put it in the "open" list. (The "open" list is for - // triangles who may still need to be considered; the "closed" list is - // for triangles which do not.) - var dx = xmax - xmin; - var dy = ymax - ymin; - var dmax = dx > dy ? dx : dy; - var xmid = (xmax + xmin) * 0.5; - var ymid = (ymax + ymin) * 0.5; - var open = [ - new Triangle({ - __sentinel: true, - x: xmid - 20 * dmax, - y: ymid - dmax, - }, { - __sentinel: true, - x: xmid, - y: ymid + 20 * dmax, - }, { - __sentinel: true, - x: xmid + 20 * dmax, - y: ymid - dmax, - }), - ]; - var closed = []; - var edges = []; - var j; - // Incrementally add each vertex to the mesh. - i = vertices.length; - while (i--) { - // For each open triangle, check to see if the current point is - // inside it's circumcircle. If it is, remove the triangle and add - // it's edges to an edge list. - edges.length = 0; - j = open.length; - while (j--) { - // If this point is to the right of this triangle's circumcircle, - // then this triangle should never get checked again. Remove it - // from the open list, add it to the closed list, and skip. - dx = vertices[i].x - open[j].x; - if (dx > 0 && dx * dx > open[j].r) { - closed.push(open[j]); - open.splice(j, 1); - continue; - } - // If not, skip this triangle. - dy = vertices[i].y - open[j].y; - if (dx * dx + dy * dy > open[j].r) { - continue; - } - // Remove the triangle and add it's edges to the edge list. - edges.push(open[j].a, open[j].b, open[j].b, open[j].c, open[j].c, open[j].a); - open.splice(j, 1); - } - // Remove any doubled edges. - dedup(edges); - // Add a new triangle for each edge. - j = edges.length; - while (j) { - b = edges[--j]; - a = edges[--j]; - c = vertices[i]; - // Avoid adding colinear triangles (which have error-prone - // circumcircles) - A = b.x - a.x; - B = b.y - a.y; - G = 2 * (A * (c.y - b.y) - B * (c.x - b.x)); - if (Math.abs(G) > epsilon) { - open.push(new Triangle(a, b, c)); - } - } - } - // Copy any remaining open triangles to the closed list, and then - // remove any triangles that share a vertex with the supertriangle. - Array.prototype.push.apply(closed, open); - i = closed.length; - while (i--) { - if (closed[i].a.__sentinel || - closed[i].b.__sentinel || - closed[i].c.__sentinel) { - closed.splice(i, 1); - } - } - return closed; -} - - -/***/ }), - -/***/ 2163: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var clone = __webpack_require__(3711); -var booleanClockwise = __webpack_require__(7333); -var meta = __webpack_require__(8421); -var invariant = __webpack_require__(8506); -var helpers = __webpack_require__(8967); - -function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } - -var clone__default = /*#__PURE__*/_interopDefaultLegacy(clone); -var booleanClockwise__default = /*#__PURE__*/_interopDefaultLegacy(booleanClockwise); - -/** - * Rewind {@link LineString|(Multi)LineString} or {@link Polygon|(Multi)Polygon} outer ring counterclockwise and inner rings clockwise (Uses {@link http://en.wikipedia.org/wiki/Shoelace_formula|Shoelace Formula}). - * - * @name rewind - * @param {GeoJSON} geojson input GeoJSON Polygon - * @param {Object} [options={}] Optional parameters - * @param {boolean} [options.reverse=false] enable reverse winding - * @param {boolean} [options.mutate=false] allows GeoJSON input to be mutated (significant performance increase if true) - * @returns {GeoJSON} rewind Polygon - * @example - * var polygon = turf.polygon([[[121, -29], [138, -29], [138, -18], [121, -18], [121, -29]]]); - * - * var rewind = turf.rewind(polygon); - * - * //addToMap - * var addToMap = [rewind]; - */ -function rewind(geojson, options) { - // Optional parameters - options = options || {}; - if (!helpers.isObject(options)) throw new Error("options is invalid"); - var reverse = options.reverse || false; - var mutate = options.mutate || false; - - // validation - if (!geojson) throw new Error(" is required"); - if (typeof reverse !== "boolean") - throw new Error(" must be a boolean"); - if (typeof mutate !== "boolean") - throw new Error(" must be a boolean"); - - // prevent input mutation - if (mutate === false) geojson = clone__default['default'](geojson); - - // Support Feature Collection or Geometry Collection - var results = []; - switch (geojson.type) { - case "GeometryCollection": - meta.geomEach(geojson, function (geometry) { - rewindFeature(geometry, reverse); - }); - return geojson; - case "FeatureCollection": - meta.featureEach(geojson, function (feature) { - meta.featureEach(rewindFeature(feature, reverse), function (result) { - results.push(result); - }); - }); - return helpers.featureCollection(results); - } - // Support Feature or Geometry Objects - return rewindFeature(geojson, reverse); -} - -/** - * Rewind - * - * @private - * @param {Geometry|Feature} geojson Geometry or Feature - * @param {Boolean} [reverse=false] enable reverse winding - * @returns {Geometry|Feature} rewind Geometry or Feature - */ -function rewindFeature(geojson, reverse) { - var type = geojson.type === "Feature" ? geojson.geometry.type : geojson.type; - - // Support all GeoJSON Geometry Objects - switch (type) { - case "GeometryCollection": - meta.geomEach(geojson, function (geometry) { - rewindFeature(geometry, reverse); - }); - return geojson; - case "LineString": - rewindLineString(invariant.getCoords(geojson), reverse); - return geojson; - case "Polygon": - rewindPolygon(invariant.getCoords(geojson), reverse); - return geojson; - case "MultiLineString": - invariant.getCoords(geojson).forEach(function (lineCoords) { - rewindLineString(lineCoords, reverse); - }); - return geojson; - case "MultiPolygon": - invariant.getCoords(geojson).forEach(function (lineCoords) { - rewindPolygon(lineCoords, reverse); - }); - return geojson; - case "Point": - case "MultiPoint": - return geojson; - } -} - -/** - * Rewind LineString - outer ring clockwise - * - * @private - * @param {Array>} coords GeoJSON LineString geometry coordinates - * @param {Boolean} [reverse=false] enable reverse winding - * @returns {void} mutates coordinates - */ -function rewindLineString(coords, reverse) { - if (booleanClockwise__default['default'](coords) === reverse) coords.reverse(); -} - -/** - * Rewind Polygon - outer ring counterclockwise and inner rings clockwise. - * - * @private - * @param {Array>>} coords GeoJSON Polygon geometry coordinates - * @param {Boolean} [reverse=false] enable reverse winding - * @returns {void} mutates coordinates - */ -function rewindPolygon(coords, reverse) { - // outer ring - if (booleanClockwise__default['default'](coords[0]) !== reverse) { - coords[0].reverse(); - } - // inner rings - for (var i = 1; i < coords.length; i++) { - if (booleanClockwise__default['default'](coords[i]) === reverse) { - coords[i].reverse(); - } - } -} - -module.exports = rewind; -module.exports["default"] = rewind; - - -/***/ }), - -/***/ 2222: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var length = __webpack_require__(8840); -var lineSliceAlong = __webpack_require__(4957); -var meta = __webpack_require__(8421); -var helpers = __webpack_require__(8967); - -function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } - -var length__default = /*#__PURE__*/_interopDefaultLegacy(length); -var lineSliceAlong__default = /*#__PURE__*/_interopDefaultLegacy(lineSliceAlong); - -/** - * Divides a {@link LineString} into chunks of a specified length. - * If the line is shorter than the segment length then the original line is returned. - * - * @name lineChunk - * @param {FeatureCollection|Geometry|Feature} geojson the lines to split - * @param {number} segmentLength how long to make each segment - * @param {Object} [options={}] Optional parameters - * @param {string} [options.units='kilometers'] units can be degrees, radians, miles, or kilometers - * @param {boolean} [options.reverse=false] reverses coordinates to start the first chunked segment at the end - * @returns {FeatureCollection} collection of line segments - * @example - * var line = turf.lineString([[-95, 40], [-93, 45], [-85, 50]]); - * - * var chunk = turf.lineChunk(line, 15, {units: 'miles'}); - * - * //addToMap - * var addToMap = [chunk]; - */ -function lineChunk(geojson, segmentLength, options) { - // Optional parameters - options = options || {}; - if (!helpers.isObject(options)) throw new Error("options is invalid"); - var units = options.units; - var reverse = options.reverse; - - // Validation - if (!geojson) throw new Error("geojson is required"); - if (segmentLength <= 0) - throw new Error("segmentLength must be greater than 0"); - - // Container - var results = []; - - // Flatten each feature to simple LineString - meta.flattenEach(geojson, function (feature) { - // reverses coordinates to start the first chunked segment at the end - if (reverse) - feature.geometry.coordinates = feature.geometry.coordinates.reverse(); - - sliceLineSegments(feature, segmentLength, units, function (segment) { - results.push(segment); - }); - }); - return helpers.featureCollection(results); -} - -/** - * Slice Line Segments - * - * @private - * @param {Feature} line GeoJSON LineString - * @param {number} segmentLength how long to make each segment - * @param {string}[units='kilometers'] units can be degrees, radians, miles, or kilometers - * @param {Function} callback iterate over sliced line segments - * @returns {void} - */ -function sliceLineSegments(line, segmentLength, units, callback) { - var lineLength = length__default['default'](line, { units: units }); - - // If the line is shorter than the segment length then the orginal line is returned. - if (lineLength <= segmentLength) return callback(line); - - var numberOfSegments = lineLength / segmentLength; - - // If numberOfSegments is integer, no need to plus 1 - if (!Number.isInteger(numberOfSegments)) { - numberOfSegments = Math.floor(numberOfSegments) + 1; - } - - for (var i = 0; i < numberOfSegments; i++) { - var outline = lineSliceAlong__default['default']( - line, - segmentLength * i, - segmentLength * (i + 1), - { units: units } - ); - callback(outline, i); - } -} - -module.exports = lineChunk; -module.exports["default"] = lineChunk; - - -/***/ }), - -/***/ 2307: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -// https://en.wikipedia.org/wiki/Rhumb_line -var helpers_1 = __webpack_require__(8967); -var invariant_1 = __webpack_require__(8506); -/** - * Takes two {@link Point|points} and finds the bearing angle between them along a Rhumb line - * i.e. the angle measured in degrees start the north line (0 degrees) - * - * @name rhumbBearing - * @param {Coord} start starting Point - * @param {Coord} end ending Point - * @param {Object} [options] Optional parameters - * @param {boolean} [options.final=false] calculates the final bearing if true - * @returns {number} bearing from north in decimal degrees, between -180 and 180 degrees (positive clockwise) - * @example - * var point1 = turf.point([-75.343, 39.984], {"marker-color": "#F00"}); - * var point2 = turf.point([-75.534, 39.123], {"marker-color": "#00F"}); - * - * var bearing = turf.rhumbBearing(point1, point2); - * - * //addToMap - * var addToMap = [point1, point2]; - * point1.properties.bearing = bearing; - * point2.properties.bearing = bearing; - */ -function rhumbBearing(start, end, options) { - if (options === void 0) { options = {}; } - var bear360; - if (options.final) { - bear360 = calculateRhumbBearing(invariant_1.getCoord(end), invariant_1.getCoord(start)); - } - else { - bear360 = calculateRhumbBearing(invariant_1.getCoord(start), invariant_1.getCoord(end)); - } - var bear180 = bear360 > 180 ? -(360 - bear360) : bear360; - return bear180; -} -/** - * Returns the bearing from ‘this’ point to destination point along a rhumb line. - * Adapted from Geodesy: https://github.com/chrisveness/geodesy/blob/master/latlon-spherical.js - * - * @private - * @param {Array} from - origin point. - * @param {Array} to - destination point. - * @returns {number} Bearing in degrees from north. - * @example - * var p1 = new LatLon(51.127, 1.338); - * var p2 = new LatLon(50.964, 1.853); - * var d = p1.rhumbBearingTo(p2); // 116.7 m - */ -function calculateRhumbBearing(from, to) { - // φ => phi - // Δλ => deltaLambda - // Δψ => deltaPsi - // θ => theta - var phi1 = helpers_1.degreesToRadians(from[1]); - var phi2 = helpers_1.degreesToRadians(to[1]); - var deltaLambda = helpers_1.degreesToRadians(to[0] - from[0]); - // if deltaLambdaon over 180° take shorter rhumb line across the anti-meridian: - if (deltaLambda > Math.PI) { - deltaLambda -= 2 * Math.PI; - } - if (deltaLambda < -Math.PI) { - deltaLambda += 2 * Math.PI; - } - var deltaPsi = Math.log(Math.tan(phi2 / 2 + Math.PI / 4) / Math.tan(phi1 / 2 + Math.PI / 4)); - var theta = Math.atan2(deltaLambda, deltaPsi); - return (helpers_1.radiansToDegrees(theta) + 360) % 360; -} -exports["default"] = rhumbBearing; - - -/***/ }), - -/***/ 2347: -/***/ ((module) => { - -/** - * KMEANS clustering - * - * @author Lukasz Krawczyk - * @copyright MIT - */ - -/** - * KMEANS class constructor - * @constructor - * - * @param {Array} dataset - * @param {number} k - number of clusters - * @param {function} distance - distance function - * @returns {KMEANS} - */ - function KMEANS(dataset, k, distance) { - this.k = 3; // number of clusters - this.dataset = []; // set of feature vectors - this.assignments = []; // set of associated clusters for each feature vector - this.centroids = []; // vectors for our clusters - - this.init(dataset, k, distance); -} - -/** - * @returns {undefined} - */ -KMEANS.prototype.init = function(dataset, k, distance) { - this.assignments = []; - this.centroids = []; - - if (typeof dataset !== 'undefined') { - this.dataset = dataset; - } - - if (typeof k !== 'undefined') { - this.k = k; - } - - if (typeof distance !== 'undefined') { - this.distance = distance; - } -}; - -/** - * @returns {undefined} - */ -KMEANS.prototype.run = function(dataset, k) { - this.init(dataset, k); - - var len = this.dataset.length; - - // initialize centroids - for (var i = 0; i < this.k; i++) { - this.centroids[i] = this.randomCentroid(); - } - - var change = true; - while(change) { - - // assign feature vectors to clusters - change = this.assign(); - - // adjust location of centroids - for (var centroidId = 0; centroidId < this.k; centroidId++) { - var mean = new Array(maxDim); - var count = 0; - - // init mean vector - for (var dim = 0; dim < maxDim; dim++) { - mean[dim] = 0; - } - - for (var j = 0; j < len; j++) { - var maxDim = this.dataset[j].length; - - // if current cluster id is assigned to point - if (centroidId === this.assignments[j]) { - for (var dim = 0; dim < maxDim; dim++) { - mean[dim] += this.dataset[j][dim]; - } - count++; - } - } - - if (count > 0) { - // if cluster contain points, adjust centroid position - for (var dim = 0; dim < maxDim; dim++) { - mean[dim] /= count; - } - this.centroids[centroidId] = mean; - } else { - // if cluster is empty, generate new random centroid - this.centroids[centroidId] = this.randomCentroid(); - change = true; - } - } - } - - return this.getClusters(); -}; - -/** - * Generate random centroid - * - * @returns {Array} - */ -KMEANS.prototype.randomCentroid = function() { - var maxId = this.dataset.length -1; - var centroid; - var id; - - do { - id = Math.round(Math.random() * maxId); - centroid = this.dataset[id]; - } while (this.centroids.indexOf(centroid) >= 0); - - return centroid; -} - -/** - * Assign points to clusters - * - * @returns {boolean} - */ -KMEANS.prototype.assign = function() { - var change = false; - var len = this.dataset.length; - var closestCentroid; - - for (var i = 0; i < len; i++) { - closestCentroid = this.argmin(this.dataset[i], this.centroids, this.distance); - - if (closestCentroid != this.assignments[i]) { - this.assignments[i] = closestCentroid; - change = true; - } - } - - return change; -} - -/** - * Extract information about clusters - * - * @returns {undefined} - */ -KMEANS.prototype.getClusters = function() { - var clusters = new Array(this.k); - var centroidId; - - for (var pointId = 0; pointId < this.assignments.length; pointId++) { - centroidId = this.assignments[pointId]; - - // init empty cluster - if (typeof clusters[centroidId] === 'undefined') { - clusters[centroidId] = []; - } - - clusters[centroidId].push(pointId); - } - - return clusters; -}; - -// utils - -/** - * @params {Array} point - * @params {Array.} set - * @params {Function} f - * @returns {number} - */ -KMEANS.prototype.argmin = function(point, set, f) { - var min = Number.MAX_VALUE; - var arg = 0; - var len = set.length; - var d; - - for (var i = 0; i < len; i++) { - d = f(point, set[i]); - if (d < min) { - min = d; - arg = i; - } - } - - return arg; -}; - -/** - * Euclidean distance - * - * @params {number} p - * @params {number} q - * @returns {number} - */ -KMEANS.prototype.distance = function(p, q) { - var sum = 0; - var i = Math.min(p.length, q.length); - - while (i--) { - var diff = p[i] - q[i]; - sum += diff * diff; - } - - return Math.sqrt(sum); -}; - -if ( true && module.exports) { - module.exports = KMEANS; -} - - -/***/ }), - -/***/ 2352: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var invariant = __webpack_require__(8506); - -var D2R = Math.PI / 180; -var R2D = 180 / Math.PI; - -var Coord = function (lon, lat) { - this.lon = lon; - this.lat = lat; - this.x = D2R * lon; - this.y = D2R * lat; -}; - -Coord.prototype.view = function () { - return String(this.lon).slice(0, 4) + "," + String(this.lat).slice(0, 4); -}; - -Coord.prototype.antipode = function () { - var anti_lat = -1 * this.lat; - var anti_lon = this.lon < 0 ? 180 + this.lon : (180 - this.lon) * -1; - return new Coord(anti_lon, anti_lat); -}; - -var LineString = function () { - this.coords = []; - this.length = 0; -}; - -LineString.prototype.move_to = function (coord) { - this.length++; - this.coords.push(coord); -}; - -var Arc = function (properties) { - this.properties = properties || {}; - this.geometries = []; -}; - -Arc.prototype.json = function () { - if (this.geometries.length <= 0) { - return { - geometry: { type: "LineString", coordinates: null }, - type: "Feature", - properties: this.properties, - }; - } else if (this.geometries.length === 1) { - return { - geometry: { type: "LineString", coordinates: this.geometries[0].coords }, - type: "Feature", - properties: this.properties, - }; - } else { - var multiline = []; - for (var i = 0; i < this.geometries.length; i++) { - multiline.push(this.geometries[i].coords); - } - return { - geometry: { type: "MultiLineString", coordinates: multiline }, - type: "Feature", - properties: this.properties, - }; - } -}; - -// TODO - output proper multilinestring -Arc.prototype.wkt = function () { - var wkt_string = ""; - var wkt = "LINESTRING("; - var collect = function (c) { - wkt += c[0] + " " + c[1] + ","; - }; - for (var i = 0; i < this.geometries.length; i++) { - if (this.geometries[i].coords.length === 0) { - return "LINESTRING(empty)"; - } else { - var coords = this.geometries[i].coords; - coords.forEach(collect); - wkt_string += wkt.substring(0, wkt.length - 1) + ")"; - } - } - return wkt_string; -}; - -/* - * http://en.wikipedia.org/wiki/Great-circle_distance - * - */ -var GreatCircle = function (start, end, properties) { - if (!start || start.x === undefined || start.y === undefined) { - throw new Error( - "GreatCircle constructor expects two args: start and end objects with x and y properties" - ); - } - if (!end || end.x === undefined || end.y === undefined) { - throw new Error( - "GreatCircle constructor expects two args: start and end objects with x and y properties" - ); - } - this.start = new Coord(start.x, start.y); - this.end = new Coord(end.x, end.y); - this.properties = properties || {}; - - var w = this.start.x - this.end.x; - var h = this.start.y - this.end.y; - var z = - Math.pow(Math.sin(h / 2.0), 2) + - Math.cos(this.start.y) * - Math.cos(this.end.y) * - Math.pow(Math.sin(w / 2.0), 2); - this.g = 2.0 * Math.asin(Math.sqrt(z)); - - if (this.g === Math.PI) { - throw new Error( - "it appears " + - start.view() + - " and " + - end.view() + - " are 'antipodal', e.g diametrically opposite, thus there is no single route but rather infinite" - ); - } else if (isNaN(this.g)) { - throw new Error( - "could not calculate great circle between " + start + " and " + end - ); - } -}; - -/* - * http://williams.best.vwh.net/avform.htm#Intermediate - */ -GreatCircle.prototype.interpolate = function (f) { - var A = Math.sin((1 - f) * this.g) / Math.sin(this.g); - var B = Math.sin(f * this.g) / Math.sin(this.g); - var x = - A * Math.cos(this.start.y) * Math.cos(this.start.x) + - B * Math.cos(this.end.y) * Math.cos(this.end.x); - var y = - A * Math.cos(this.start.y) * Math.sin(this.start.x) + - B * Math.cos(this.end.y) * Math.sin(this.end.x); - var z = A * Math.sin(this.start.y) + B * Math.sin(this.end.y); - var lat = R2D * Math.atan2(z, Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2))); - var lon = R2D * Math.atan2(y, x); - return [lon, lat]; -}; - -/* - * Generate points along the great circle - */ -GreatCircle.prototype.Arc = function (npoints, options) { - var first_pass = []; - if (!npoints || npoints <= 2) { - first_pass.push([this.start.lon, this.start.lat]); - first_pass.push([this.end.lon, this.end.lat]); - } else { - var delta = 1.0 / (npoints - 1); - for (var i = 0; i < npoints; ++i) { - var step = delta * i; - var pair = this.interpolate(step); - first_pass.push(pair); - } - } - /* partial port of dateline handling from: - gdal/ogr/ogrgeometryfactory.cpp - - TODO - does not handle all wrapping scenarios yet - */ - var bHasBigDiff = false; - var dfMaxSmallDiffLong = 0; - // from http://www.gdal.org/ogr2ogr.html - // -datelineoffset: - // (starting with GDAL 1.10) offset from dateline in degrees (default long. = +/- 10deg, geometries within 170deg to -170deg will be splited) - var dfDateLineOffset = options && options.offset ? options.offset : 10; - var dfLeftBorderX = 180 - dfDateLineOffset; - var dfRightBorderX = -180 + dfDateLineOffset; - var dfDiffSpace = 360 - dfDateLineOffset; - - // https://github.com/OSGeo/gdal/blob/7bfb9c452a59aac958bff0c8386b891edf8154ca/gdal/ogr/ogrgeometryfactory.cpp#L2342 - for (var j = 1; j < first_pass.length; ++j) { - var dfPrevX = first_pass[j - 1][0]; - var dfX = first_pass[j][0]; - var dfDiffLong = Math.abs(dfX - dfPrevX); - if ( - dfDiffLong > dfDiffSpace && - ((dfX > dfLeftBorderX && dfPrevX < dfRightBorderX) || - (dfPrevX > dfLeftBorderX && dfX < dfRightBorderX)) - ) { - bHasBigDiff = true; - } else if (dfDiffLong > dfMaxSmallDiffLong) { - dfMaxSmallDiffLong = dfDiffLong; - } - } - - var poMulti = []; - if (bHasBigDiff && dfMaxSmallDiffLong < dfDateLineOffset) { - var poNewLS = []; - poMulti.push(poNewLS); - for (var k = 0; k < first_pass.length; ++k) { - var dfX0 = parseFloat(first_pass[k][0]); - if (k > 0 && Math.abs(dfX0 - first_pass[k - 1][0]) > dfDiffSpace) { - var dfX1 = parseFloat(first_pass[k - 1][0]); - var dfY1 = parseFloat(first_pass[k - 1][1]); - var dfX2 = parseFloat(first_pass[k][0]); - var dfY2 = parseFloat(first_pass[k][1]); - if ( - dfX1 > -180 && - dfX1 < dfRightBorderX && - dfX2 === 180 && - k + 1 < first_pass.length && - first_pass[k - 1][0] > -180 && - first_pass[k - 1][0] < dfRightBorderX - ) { - poNewLS.push([-180, first_pass[k][1]]); - k++; - poNewLS.push([first_pass[k][0], first_pass[k][1]]); - continue; - } else if ( - dfX1 > dfLeftBorderX && - dfX1 < 180 && - dfX2 === -180 && - k + 1 < first_pass.length && - first_pass[k - 1][0] > dfLeftBorderX && - first_pass[k - 1][0] < 180 - ) { - poNewLS.push([180, first_pass[k][1]]); - k++; - poNewLS.push([first_pass[k][0], first_pass[k][1]]); - continue; - } - - if (dfX1 < dfRightBorderX && dfX2 > dfLeftBorderX) { - // swap dfX1, dfX2 - var tmpX = dfX1; - dfX1 = dfX2; - dfX2 = tmpX; - // swap dfY1, dfY2 - var tmpY = dfY1; - dfY1 = dfY2; - dfY2 = tmpY; - } - if (dfX1 > dfLeftBorderX && dfX2 < dfRightBorderX) { - dfX2 += 360; - } - - if (dfX1 <= 180 && dfX2 >= 180 && dfX1 < dfX2) { - var dfRatio = (180 - dfX1) / (dfX2 - dfX1); - var dfY = dfRatio * dfY2 + (1 - dfRatio) * dfY1; - poNewLS.push([ - first_pass[k - 1][0] > dfLeftBorderX ? 180 : -180, - dfY, - ]); - poNewLS = []; - poNewLS.push([ - first_pass[k - 1][0] > dfLeftBorderX ? -180 : 180, - dfY, - ]); - poMulti.push(poNewLS); - } else { - poNewLS = []; - poMulti.push(poNewLS); - } - poNewLS.push([dfX0, first_pass[k][1]]); - } else { - poNewLS.push([first_pass[k][0], first_pass[k][1]]); - } - } - } else { - // add normally - var poNewLS0 = []; - poMulti.push(poNewLS0); - for (var l = 0; l < first_pass.length; ++l) { - poNewLS0.push([first_pass[l][0], first_pass[l][1]]); - } - } - - var arc = new Arc(this.properties); - for (var m = 0; m < poMulti.length; ++m) { - var line = new LineString(); - arc.geometries.push(line); - var points = poMulti[m]; - for (var j0 = 0; j0 < points.length; ++j0) { - line.move_to(points[j0]); - } - } - return arc; -}; - -/** - * Calculate great circles routes as {@link LineString} or {@link MultiLineString}. - * If the `start` and `end` points span the antimeridian, the resulting feature will - * be split into a `MultiLineString`. - * - * @name greatCircle - * @param {Coord} start source point feature - * @param {Coord} end destination point feature - * @param {Object} [options={}] Optional parameters - * @param {Object} [options.properties={}] line feature properties - * @param {number} [options.npoints=100] number of points - * @param {number} [options.offset=10] offset controls the likelyhood that lines will - * be split which cross the dateline. The higher the number the more likely. - * @returns {Feature} great circle line feature - * @example - * var start = turf.point([-122, 48]); - * var end = turf.point([-77, 39]); - * - * var greatCircle = turf.greatCircle(start, end, {properties: {name: 'Seattle to DC'}}); - * - * //addToMap - * var addToMap = [start, end, greatCircle] - */ -function greatCircle(start, end, options) { - // Optional parameters - options = options || {}; - if (typeof options !== "object") throw new Error("options is invalid"); - var properties = options.properties; - var npoints = options.npoints; - var offset = options.offset; - - start = invariant.getCoord(start); - end = invariant.getCoord(end); - properties = properties || {}; - npoints = npoints || 100; - offset = offset || 10; - - var generator = new GreatCircle( - { x: start[0], y: start[1] }, - { x: end[0], y: end[1] }, - properties - ); - - var line = generator.Arc(npoints, { offset: offset }); - - return line.json(); -} - -module.exports = greatCircle; -module.exports["default"] = greatCircle; - - -/***/ }), - -/***/ 2363: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var distance = __webpack_require__(9391); - -function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } - -var distance__default = /*#__PURE__*/_interopDefaultLegacy(distance); - -/** - * Takes a bounding box and calculates the minimum square bounding box that - * would contain the input. - * - * @name square - * @param {BBox} bbox extent in [west, south, east, north] order - * @returns {BBox} a square surrounding `bbox` - * @example - * var bbox = [-20, -20, -15, 0]; - * var squared = turf.square(bbox); - * - * //addToMap - * var addToMap = [turf.bboxPolygon(bbox), turf.bboxPolygon(squared)] - */ -function square(bbox) { - var west = bbox[0]; - var south = bbox[1]; - var east = bbox[2]; - var north = bbox[3]; - - var horizontalDistance = distance__default['default'](bbox.slice(0, 2), [east, south]); - var verticalDistance = distance__default['default'](bbox.slice(0, 2), [west, north]); - if (horizontalDistance >= verticalDistance) { - var verticalMidpoint = (south + north) / 2; - return [ - west, - verticalMidpoint - (east - west) / 2, - east, - verticalMidpoint + (east - west) / 2, - ]; - } else { - var horizontalMidpoint = (west + east) / 2; - return [ - horizontalMidpoint - (north - south) / 2, - south, - horizontalMidpoint + (north - south) / 2, - north, - ]; - } -} - -module.exports = square; -module.exports["default"] = square; - - -/***/ }), - -/***/ 2446: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -var invariant_1 = __webpack_require__(8506); -// http://en.wikipedia.org/wiki/Even%E2%80%93odd_rule -// modified from: https://github.com/substack/point-in-polygon/blob/master/index.js -// which was modified from http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html -/** - * Takes a {@link Point} and a {@link Polygon} or {@link MultiPolygon} and determines if the point - * resides inside the polygon. The polygon can be convex or concave. The function accounts for holes. - * - * @name booleanPointInPolygon - * @param {Coord} point input point - * @param {Feature} polygon input polygon or multipolygon - * @param {Object} [options={}] Optional parameters - * @param {boolean} [options.ignoreBoundary=false] True if polygon boundary should be ignored when determining if - * the point is inside the polygon otherwise false. - * @returns {boolean} `true` if the Point is inside the Polygon; `false` if the Point is not inside the Polygon - * @example - * var pt = turf.point([-77, 44]); - * var poly = turf.polygon([[ - * [-81, 41], - * [-81, 47], - * [-72, 47], - * [-72, 41], - * [-81, 41] - * ]]); - * - * turf.booleanPointInPolygon(pt, poly); - * //= true - */ -function booleanPointInPolygon(point, polygon, options) { - if (options === void 0) { options = {}; } - // validation - if (!point) { - throw new Error("point is required"); - } - if (!polygon) { - throw new Error("polygon is required"); - } - var pt = invariant_1.getCoord(point); - var geom = invariant_1.getGeom(polygon); - var type = geom.type; - var bbox = polygon.bbox; - var polys = geom.coordinates; - // Quick elimination if point is not inside bbox - if (bbox && inBBox(pt, bbox) === false) { - return false; - } - // normalize to multipolygon - if (type === "Polygon") { - polys = [polys]; - } - var insidePoly = false; - for (var i = 0; i < polys.length && !insidePoly; i++) { - // check if it is in the outer ring first - if (inRing(pt, polys[i][0], options.ignoreBoundary)) { - var inHole = false; - var k = 1; - // check for the point in any of the holes - while (k < polys[i].length && !inHole) { - if (inRing(pt, polys[i][k], !options.ignoreBoundary)) { - inHole = true; - } - k++; - } - if (!inHole) { - insidePoly = true; - } - } - } - return insidePoly; -} -exports["default"] = booleanPointInPolygon; -/** - * inRing - * - * @private - * @param {Array} pt [x,y] - * @param {Array>} ring [[x,y], [x,y],..] - * @param {boolean} ignoreBoundary ignoreBoundary - * @returns {boolean} inRing - */ -function inRing(pt, ring, ignoreBoundary) { - var isInside = false; - if (ring[0][0] === ring[ring.length - 1][0] && - ring[0][1] === ring[ring.length - 1][1]) { - ring = ring.slice(0, ring.length - 1); - } - for (var i = 0, j = ring.length - 1; i < ring.length; j = i++) { - var xi = ring[i][0]; - var yi = ring[i][1]; - var xj = ring[j][0]; - var yj = ring[j][1]; - var onBoundary = pt[1] * (xi - xj) + yi * (xj - pt[0]) + yj * (pt[0] - xi) === 0 && - (xi - pt[0]) * (xj - pt[0]) <= 0 && - (yi - pt[1]) * (yj - pt[1]) <= 0; - if (onBoundary) { - return !ignoreBoundary; - } - var intersect = yi > pt[1] !== yj > pt[1] && - pt[0] < ((xj - xi) * (pt[1] - yi)) / (yj - yi) + xi; - if (intersect) { - isInside = !isInside; - } - } - return isInside; -} -/** - * inBBox - * - * @private - * @param {Position} pt point [x,y] - * @param {BBox} bbox BBox [west, south, east, north] - * @returns {boolean} true/false if point is inside BBox - */ -function inBBox(pt, bbox) { - return (bbox[0] <= pt[0] && bbox[1] <= pt[1] && bbox[2] >= pt[0] && bbox[3] >= pt[1]); -} - - -/***/ }), - -/***/ 2571: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.get_annotation_confidence = get_annotation_confidence; -exports.get_annotation_class_id = get_annotation_class_id; -exports.mark_deprecated = mark_deprecated; -exports.value_is_lower_than_filter = value_is_lower_than_filter; -exports.value_is_higher_than_filter = value_is_higher_than_filter; -exports.filter_high = filter_high; -exports.assign_closest_line_to_each_point = assign_closest_line_to_each_point; -exports.assign_closest_line_to_single_point = assign_closest_line_to_single_point; -exports.update_distance_from_line_to_each_point = update_distance_from_line_to_each_point; -exports.is_closest_line_to_point = is_closest_line_to_point; -exports.get_point_and_line_annotations = get_point_and_line_annotations; -exports.filter_points_distance_from_line = filter_points_distance_from_line; -exports.findAllPolylineClassDefinitions = findAllPolylineClassDefinitions; -/** - * Returns the confidence of the passed in ULabelAnnotation. - * In the case of multiple classifications in the classification_payloads, returns the largest confidence value. - * - * @param annotation ULabelAnnotation - * @returns The largest confidence value inside classification_payloads - */ -function get_annotation_confidence(annotation) { - var current_confidence = -1; - for (var type_of_id in annotation.classification_payloads) { - if (annotation.classification_payloads[type_of_id].confidence > current_confidence) { - current_confidence = annotation.classification_payloads[type_of_id].confidence; - } - } - return current_confidence; -} -/** - * Returns the class id of a ULabelAnnotation as a string. - * - * @param annotation ULabelAnnotation - * @returns The class id of the annotation as a string - */ -function get_annotation_class_id(annotation) { - // Keep track of the most likely class id and its confidence - var id, confidence; - // Go through each item in the classification payload - annotation.classification_payloads.forEach(function (current_payload) { - // The confidence will be undefined the first time through, so set the id and confidence for a baseline - // Otherwise replace the id if the conidence is higher - if (confidence === undefined || current_payload.confidence > confidence) { - id = current_payload.class_id; - confidence = current_payload.confidence; - } - }); - return id.toString(); -} -/** - * Takes in an annotation and marks it either deprecated or not deprecated. - * - * @param annotation ULabelAnnotation - * @param deprecated boolean - * @param deprecated_by_key - */ -function mark_deprecated(annotation, deprecated, deprecated_by_key) { - if (deprecated_by_key === void 0) { deprecated_by_key = "human"; } - if (annotation.deprecated_by === undefined) { - annotation.deprecated_by = {}; - } - annotation.deprecated_by[deprecated_by_key] = deprecated; - // If the annotation has been deprecated by any method, then deprecate the annotation - if (Object.values(annotation.deprecated_by).some(function (x) { return x; })) { - annotation.deprecated = true; - return; - } - // If the annotation hasn't been deprecated by any property, then set deprecated to false - annotation.deprecated = false; -} -/** - * If the value is less than the filter then return true, else return false. - * - * @param value Value to be compaired against the filter - * @param filter What the value is compared against - * @returns True if the value is less than the filter, false otherwise - */ -function value_is_lower_than_filter(value, filter) { - return value < filter; -} -/** - * If the value is greater than the filter then return true, else return false. - * - * @param value Value to be compaired against the filter - * @param filter What the value is compared against - * @returns True if the value is greater than the filter, false otherwise - */ -function value_is_higher_than_filter(value, filter) { - return value > filter; -} -/** - * Takes in a list of annotations and either deprecates or undeprecates them based on if their property is higher than the - * filter value. - * - * @param annotations List of annotations to be compared against the filter value - * @param property The property on the annotation to be compared against the filter. e.g. "confidence" - * @param filter The value all filters will be compared against - */ -function filter_high(annotations, property, filter, deprecated_by_key) { - // Loop through each point annotation and deprecate them if they don't pass the filter - annotations.forEach(function (annotation) { - // Make sure the annotation is not a human deprecated one - if (!annotation.deprecated_by["human"]) { - // Run the annotation through the filter with the passed in property - var should_deprecate = value_is_higher_than_filter(annotation[property], filter); - // Mark the point deprecated - mark_deprecated(annotation, should_deprecate, deprecated_by_key); - } - }); -} -/** - * Calculates the distance from a point to a line segment. - * - * @param point_x The point's x position - * @param point_y The point's y position - * @param line_x1 The first endpoint of the line's x position - * @param line_y1 The first endpoint of the line's y position - * @param line_x2 The second endpoint of the line's x position - * @param line_y2 The second endpoint of the line's y position - * @returns The distance from the point to the line segment - */ -function calculate_distance_from_point_to_line(point_x, point_y, line_x1, line_y1, line_x2, line_y2) { - var A = point_x - line_x1; - var B = point_y - line_y1; - var C = line_x2 - line_x1; - var D = line_y2 - line_y1; - var dot = A * C + B * D; - var len_sq = C * C + D * D; - // Initialize the param variable - var param; - // Check for a divide by 0 error in the case of 0 length line - if (len_sq != 0) { - param = dot / len_sq; - } - var xx, yy; - // If param is still undefined then the line should have 0 length - // In which case we can set xx and yy equal to any endpoint - if (param === undefined) { - xx = line_x1; - yy = line_y1; - } - else if (param < 0) { - xx = line_x1; - yy = line_y1; - } - else if (param > 1) { - xx = line_x2; - yy = line_y2; - } - else { - xx = line_x1 + param * C; - yy = line_y1 + param * D; - } - var dx = point_x - xx; - var dy = point_y - yy; - return Math.sqrt(dx * dx + dy * dy); -} -/** - * Calculates the distance from a point annotation to each segment of a polyline annotation, then returns the smallest distance. - * - * @param point_annotation Point annotation to get the distance of - * @param line_annotation Line annotation the point annotation is being compared against - * @param offset Offset of a particular annotation in the set. Used when an annotation is being moved by the user - * @returns The distance from a point to a polyline - */ -function get_distance_from_point_to_line(point_annotation, line_annotation, offset) { - if (offset === void 0) { offset = null; } - // Create constants for the point's x and y value - var point_x = point_annotation.spatial_payload[0][0]; - var point_y = point_annotation.spatial_payload[0][1]; - // Initialize the distance from the point to the polyline - var distance; - // Loop through each segment of the polyline - for (var idx = 0; idx < line_annotation.spatial_payload.length - 1; idx++) { - // Create constants for the segment's endpoints' x and y values - var line_x1 = line_annotation.spatial_payload[idx][0]; - var line_y1 = line_annotation.spatial_payload[idx][1]; - var line_x2 = line_annotation.spatial_payload[idx + 1][0]; - var line_y2 = line_annotation.spatial_payload[idx + 1][1]; - // Create offset variables - var line_offset_x = 0; - var line_offset_y = 0; - // Only apply the offset when the line annotation id matches with the offset id - // Check if offset !== null first to avoid an issue with reading properties of null - if ((offset !== null) && (line_annotation.id === offset.id)) { - line_offset_x = offset.diffX; - line_offset_y = offset.diffY; - } - // Calculate the distance from the point to the line segment - var distance_to_segment = calculate_distance_from_point_to_line(point_x, point_y, line_x1 + line_offset_x, line_y1 + line_offset_y, line_x2 + line_offset_x, line_y2 + line_offset_y); - // Check if the distance to this segment is undefined or less than the distance to another segment - if (distance === undefined || distance_to_segment < distance) { - distance = distance_to_segment; - } - } - return distance; -} -/** - * Wrapper for assign_closest_line_to_single_point() - * - * @param point_annotations Set of point annotations - * @param line_annotations Set of line annotations - * @param offset Offset of a particular annotation in the set. Used when an annotation is being moved by the user - */ -function assign_closest_line_to_each_point(point_annotations, line_annotations, offset) { - if (offset === void 0) { offset = null; } - // Loop through every point and assign it a distance from line - point_annotations.forEach(function (current_point) { - assign_closest_line_to_single_point(current_point, line_annotations, offset); - }); -} -/** - * Assigns a single point annotation a distance to the closest polyline - * from each diffrent class of polyline, as well as the distance from - * the closest line, regardless of class. - * - * @param point_annotation single point annotation - * @param line_annotations set of line annotations - * @param offset Offset of a particular annotation in the set. Used when an annotation is being moved by the user - */ -function assign_closest_line_to_single_point(point_annotation, line_annotations, offset) { - if (offset === void 0) { offset = null; } - // Create a new distance_from object for the point annotation - var distance_from = { closest_row: { distance: Infinity } }; - // Calculate the distance from each line and populate the distance_from accordingly - line_annotations.forEach(function (current_line) { - var line_class_id = get_annotation_class_id(current_line); - var distance = get_distance_from_point_to_line(point_annotation, current_line, offset); - // If the distance from the current class is undefined, then set it - // Otherwise replace the value if the current distance is less than the one set - if (distance_from[line_class_id] === undefined || distance < distance_from[line_class_id].distance) { - distance_from[line_class_id] = { - distance: distance, - polyline_id: current_line.id, - }; - } - // Likewise check to see if the current distance is less than a line of any class - if (distance < distance_from.closest_row.distance) { - distance_from.closest_row = { - distance: distance, - polyline_id: current_line.id, - }; - } - }); - // Assign the distance from object to the current point - point_annotation.distance_from = distance_from; -} -/** - * Update the distance from a single line to each point annotation. - * If a line was previously the closest line to a point, then the distance from that point to ALL lines will be recalculated. - * Used when a single polyline is modified. - * - * @param line_annotation line annotation - * @param point_annotations all point annotations - * @param all_line_annotations all line annotations - * @param offset offset of the line annotation - */ -function update_distance_from_line_to_each_point(line_annotation, point_annotations, all_line_annotations, offset) { - if (offset === void 0) { offset = null; } - // Get the class id of the line annotation - var line_class_id = get_annotation_class_id(line_annotation); - // Loop through each point and update the distance from the line to the point - point_annotations.forEach(function (current_point) { - // Check if the line was the closest line to the point for any class - if (is_closest_line_to_point(line_annotation.id, current_point)) { - // Recalculate the distance from the point to all lines, since this may no longer be its closest line - assign_closest_line_to_single_point(current_point, all_line_annotations, offset); - } - else { - // Otherwise only update the distance from the line to the point - var distance = get_distance_from_point_to_line(current_point, line_annotation, offset); - // Check if the line is the closest line of its class to the point - if (current_point.distance_from[line_class_id] === undefined || - distance < current_point.distance_from[line_class_id].distance) { - current_point.distance_from[line_class_id] = { - distance: distance, - polyline_id: line_annotation.id, - }; - } - // Check if the line is the closest line to the point - if (current_point.distance_from.closest_row === undefined || - distance < current_point.distance_from.closest_row.distance) { - current_point.distance_from.closest_row = { - distance: distance, - polyline_id: line_annotation.id, - }; - } - } - }); -} -/** - * Check if a line is the closest line to a point annotation, - * either the closest line for any class or the closest line for a specific class. - * - * @param line_id polyline id - * @param point_annotation point annotation - * @returns whether the line is the closest line to the point - */ -function is_closest_line_to_point(line_id, point_annotation) { - // Check if the distance_from is undefined - if (point_annotation.distance_from === undefined) { - console.error("is_closest_line_to_point called on a point without a distance_from object"); - } - // Loop through each class in the distance_from object - for (var class_id in point_annotation.distance_from) { - // Check if the line id matches the closest line id for any class - if (point_annotation.distance_from[class_id] !== undefined && - point_annotation.distance_from[class_id].polyline_id === line_id) { - return true; - } - } - return false; -} -function get_point_and_line_annotations(ulabel) { - // Initialize set of all point and line annotations - var point_annotations = []; - var line_annotations = []; - // Go through all annotations to populate a set of all point annotations and a set of all line annotations - // First loop through each subtask - for (var _i = 0, _a = Object.entries(ulabel.subtasks); _i < _a.length; _i++) { - var _b = _a[_i], subtask_key = _b[0], subtask = _b[1]; - // Then go through each annotation in the subtask - for (var annotation_key in subtask.annotations.access) { - var annotation = subtask.annotations.access[annotation_key]; - // Check for annotation type and push the annotation into the appropriate array - switch (annotation.spatial_type) { - case "point": - // Note the annotation's subtask - annotation.subtask_key = subtask_key; - // Add the point annotation to the set - point_annotations.push(annotation); - break; - case "polyline": - // Skip over deprecated line annotations - if (annotation.deprecated) - continue; - // Add non-deprecated line annotations to the set - line_annotations.push(annotation); - break; - } - } - } - return [point_annotations, line_annotations]; -} -/** - * Using the value of the FilterPointDistanceFromRow's slider, filter all point annotations based on their distance - * from a polyline annotation. - * - * @param ulabel ULabel object - * @param recalculate_distances whether to recalculate the distance from each point to the nearest line - * @param offset Offset of a particular annotation. Used when filter is called while an annotation is being moved - * @param override Used to filter annotations without calling the dom - */ -function filter_points_distance_from_line(ulabel, recalculate_distances, offset, override) { - if (recalculate_distances === void 0) { recalculate_distances = false; } - if (offset === void 0) { offset = null; } - if (override === void 0) { override = null; } - // Get a set of all point and polyline annotations - var annotations = get_point_and_line_annotations(ulabel); - var point_annotations = annotations[0]; - var line_annotations = annotations[1]; - // Initialize variables to hold info required from the dom - var multi_class_mode = false; - var show_overlay; - var should_redraw; - var distances = { closest_row: undefined }; - // If the override is null grab the necessary info from the dom - if (override === null) { - // Used for error checking - var return_early = false; - // Try to grab the elements from the dom - var multi_checkbox = document.querySelector("#filter-slider-distance-multi-checkbox"); - var show_overlay_checkbox = document.querySelector("#filter-slider-distance-toggle-overlay-checkbox"); - var sliders = document.querySelectorAll(".filter-row-distance-slider"); - // Check to make sure each element exists before trying to use - if (show_overlay_checkbox === null) { - console.error("filter_points_distance_from_line could not find show_overlay checkbox object"); - return_early = true; - } - if (sliders === null || sliders.length === 0) { - console.error("filter_points_distance_from_line could not find any filter distance slider objects"); - return_early = true; - } - if (return_early) - return; - // Checkbox may not exist if `disable_multi_class_mode` is set to true - if (multi_checkbox) { - multi_class_mode = multi_checkbox.checked; - } - show_overlay = show_overlay_checkbox.checked; - // Loop through each slider and populate distances - for (var idx = 0; idx < sliders.length; idx++) { - // Use a regex to get the string after the final - character in the slider id (Which is the class id or the string "closest_row") - var slider_class_name = /[^-]*$/.exec(sliders[idx].id)[0]; - // Use the class id as a key to store the slider's value - distances[slider_class_name] = { - distance: sliders[idx].valueAsNumber, - }; - } - // Always redraw when there's no override - should_redraw = true; - } - else { - multi_class_mode = override.multi_class_mode; - show_overlay = override.show_overlay; - distances = override.distances; - should_redraw = override.should_redraw; // Useful for filtering before annotations have been rendered - } - if (recalculate_distances) { - // Calculate and assign each point a distance from line value - assign_closest_line_to_each_point(point_annotations, line_annotations, offset); - } - // Store which annotations need to be redrawn - var annotations_ids_to_redraw_by_subtask = {}; - // Initialize the object with the subtask keys - for (var subtask_key in ulabel.subtasks) { - annotations_ids_to_redraw_by_subtask[subtask_key] = []; - } - // Filter each point based on current mode, distances, and its distance_from property - if (multi_class_mode) { - // Loop through each point and deprecate them if they fall outside the range of all lines - point_annotations.forEach(function (annotation) { - check_distances: { - for (var id in distances) { - // Ignore the single class slider - if (id === "closest_row") - continue; - // If the annotation is smaller than the filter value for any id, it passes - if (annotation.distance_from[id] !== undefined && - annotation.distance_from[id].distance <= distances[id].distance) { - if (annotation.deprecated) { - // Undeprecate the annotation - mark_deprecated(annotation, false, "distance_from_row"); - annotations_ids_to_redraw_by_subtask[annotation.subtask_key].push(annotation.id); - } - break check_distances; - } - } - // Only here if break not called - if (!annotation.deprecated) { - mark_deprecated(annotation, true, "distance_from_row"); - annotations_ids_to_redraw_by_subtask[annotation.subtask_key].push(annotation.id); - } - } - }); - } - else { - // Single-class mode - point_annotations.forEach(function (annotation) { - var should_deprecate = annotation.distance_from.closest_row.distance > distances.closest_row.distance; - // Only change deprecated status and redraw if it needs to be changed - if (should_deprecate && !annotation.deprecated) { - mark_deprecated(annotation, true, "distance_from_row"); - annotations_ids_to_redraw_by_subtask[annotation.subtask_key].push(annotation.id); - } - else if (!should_deprecate && annotation.deprecated) { - mark_deprecated(annotation, false, "distance_from_row"); - annotations_ids_to_redraw_by_subtask[annotation.subtask_key].push(annotation.id); - } - }); - } - if (should_redraw) { - // Redraw each subtask's annotations - for (var subtask_key in annotations_ids_to_redraw_by_subtask) { - ulabel.redraw_multiple_spatial_annotations(annotations_ids_to_redraw_by_subtask[subtask_key], subtask_key); - } - } - // Ensure the overlay exists before trying to access it - if (ulabel.filter_distance_overlay === null || ulabel.filter_distance_overlay === undefined) { - console.warn("\n filter_distance_overlay currently does not exist.\n As such, unable to update distance overlay\n "); - } - else { - // Update overlay properties first - ulabel.filter_distance_overlay.update_annotations(line_annotations); - ulabel.filter_distance_overlay.update_distances(distances); - ulabel.filter_distance_overlay.update_mode(multi_class_mode); - ulabel.filter_distance_overlay.update_display_overlay(show_overlay); - // Then redraw the overlay - ulabel.filter_distance_overlay.draw_overlay(offset); - } -} -/** - * Goes through all subtasks and finds all classes that polylines can be. Then returns a list of them. - * - * @returns A list of all classes which can be polylines - */ -function findAllPolylineClassDefinitions(ulabel) { - // Initialize potential class definitions - var potential_class_defs = []; - // Check each subtask to see if polyline is one of its allowed modes - for (var subtask_key in ulabel.subtasks) { - // Grab the subtask - var subtask = ulabel.subtasks[subtask_key]; - if (subtask.allowed_modes.includes("polyline")) { - // Loop through all the classes in the subtask - subtask.class_defs.forEach(function (current_class_def) { - potential_class_defs.push(current_class_def); - }); - } - } - return potential_class_defs; -} - - -/***/ }), - -/***/ 2583: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -var helpers_1 = __webpack_require__(8967); -var meta_1 = __webpack_require__(8421); -/** - * Combines a {@link FeatureCollection} of {@link Point}, {@link LineString}, or {@link Polygon} features - * into {@link MultiPoint}, {@link MultiLineString}, or {@link MultiPolygon} features. - * - * @name combine - * @param {FeatureCollection} fc a FeatureCollection of any type - * @returns {FeatureCollection} a FeatureCollection of corresponding type to input - * @example - * var fc = turf.featureCollection([ - * turf.point([19.026432, 47.49134]), - * turf.point([19.074497, 47.509548]) - * ]); - * - * var combined = turf.combine(fc); - * - * //addToMap - * var addToMap = [combined] - */ -function combine(fc) { - var groups = { - MultiPoint: { - coordinates: [], - properties: [], - }, - MultiLineString: { - coordinates: [], - properties: [], - }, - MultiPolygon: { - coordinates: [], - properties: [], - }, - }; - meta_1.featureEach(fc, function (feature) { - var _a, _b, _c; - var _d; - switch ((_d = feature.geometry) === null || _d === void 0 ? void 0 : _d.type) { - case "Point": - groups.MultiPoint.coordinates.push(feature.geometry.coordinates); - groups.MultiPoint.properties.push(feature.properties); - break; - case "MultiPoint": - (_a = groups.MultiPoint.coordinates).push.apply(_a, feature.geometry.coordinates); - groups.MultiPoint.properties.push(feature.properties); - break; - case "LineString": - groups.MultiLineString.coordinates.push(feature.geometry.coordinates); - groups.MultiLineString.properties.push(feature.properties); - break; - case "MultiLineString": - (_b = groups.MultiLineString.coordinates).push.apply(_b, feature.geometry.coordinates); - groups.MultiLineString.properties.push(feature.properties); - break; - case "Polygon": - groups.MultiPolygon.coordinates.push(feature.geometry.coordinates); - groups.MultiPolygon.properties.push(feature.properties); - break; - case "MultiPolygon": - (_c = groups.MultiPolygon.coordinates).push.apply(_c, feature.geometry.coordinates); - groups.MultiPolygon.properties.push(feature.properties); - break; - default: - break; - } - }); - return helpers_1.featureCollection(Object.keys(groups) - .filter(function (key) { - return groups[key].coordinates.length; - }) - .sort() - .map(function (key) { - var geometry = { type: key, coordinates: groups[key].coordinates }; - var properties = { collectedProperties: groups[key].properties }; - return helpers_1.feature(geometry, properties); - })); -} -exports["default"] = combine; - - -/***/ }), - -/***/ 2748: -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ BACK_Z_INDEX: () => (/* binding */ BACK_Z_INDEX), -/* harmony export */ BBOX3_SVG: () => (/* binding */ BBOX3_SVG), -/* harmony export */ BBOX_SVG: () => (/* binding */ BBOX_SVG), -/* harmony export */ BUTTON_LOADER_HTML: () => (/* binding */ BUTTON_LOADER_HTML), -/* harmony export */ COLORS: () => (/* binding */ COLORS), -/* harmony export */ CONTOUR_SVG: () => (/* binding */ CONTOUR_SVG), -/* harmony export */ DELETE_BBOX_SVG: () => (/* binding */ DELETE_BBOX_SVG), -/* harmony export */ DELETE_POLYGON_SVG: () => (/* binding */ DELETE_POLYGON_SVG), -/* harmony export */ DEMO_ANNOTATION: () => (/* binding */ DEMO_ANNOTATION), -/* harmony export */ FRONT_Z_INDEX: () => (/* binding */ FRONT_Z_INDEX), -/* harmony export */ GLOBAL_SVG: () => (/* binding */ GLOBAL_SVG), -/* harmony export */ POINT_SVG: () => (/* binding */ POINT_SVG), -/* harmony export */ POLYGON_SVG: () => (/* binding */ POLYGON_SVG), -/* harmony export */ POLYLINE_SVG: () => (/* binding */ POLYLINE_SVG), -/* harmony export */ TBAR_SVG: () => (/* binding */ TBAR_SVG), -/* harmony export */ WHOLE_IMAGE_SVG: () => (/* binding */ WHOLE_IMAGE_SVG), -/* harmony export */ get_init_style: () => (/* binding */ get_init_style) -/* harmony export */ }); -// z-indices for canvases -const FRONT_Z_INDEX = 100; -const BACK_Z_INDEX = 75; -const DEMO_ANNOTATION = { id: "7c64913a-9d8c-475a-af1a-658944e37c31", new: true, created_by: "TestUser", created_at: "2020-12-21T02:41:47.304Z", deprecated: false, spatial_type: "contour", spatial_payload: [[4, 25], [4, 25], [4, 24], [4, 23], [4, 22], [4, 22], [5, 22], [5, 21], [5, 20], [6, 20], [6, 19], [7, 19], [7, 18], [8, 18], [8, 18], [10, 18], [11, 18], [11, 17], [12, 17], [12, 16], [12, 16], [13, 16], [14, 15], [16, 14], [16, 14], [17, 14], [18, 14], [18, 13], [19, 13], [20, 13], [20, 13], [21, 13], [22, 13], [23, 13], [24, 13], [24, 13], [25, 13], [26, 13], [27, 13], [28, 13], [28, 13], [29, 13], [30, 13], [31, 13], [32, 13], [34, 13], [36, 14], [36, 14], [37, 15], [40, 15], [40, 16], [41, 16], [42, 17], [43, 17], [44, 18], [44, 18], [45, 18], [46, 18], [47, 18], [47, 18], [48, 18], [48, 18], [49, 19], [50, 20], [52, 20], [52, 20], [53, 21], [54, 21], [55, 21], [56, 21], [57, 21], [58, 22], [59, 22], [60, 22], [60, 22], [61, 22], [63, 22], [64, 22], [64, 22], [65, 22], [66, 22], [67, 22], [68, 22], [68, 21], [69, 21], [70, 20], [70, 19], [71, 19], [71, 18], [72, 18], [72, 18], [72, 18], [73, 18], [75, 17], [75, 16], [76, 16], [76, 16], [76, 15], [77, 14], [78, 14], [79, 14], [79, 13], [79, 12], [80, 12], [81, 12], [82, 11], [83, 11], [84, 10], [85, 10], [86, 10], [87, 10], [88, 10], [88, 10], [89, 10], [90, 10], [91, 10], [92, 10], [92, 10], [93, 10], [94, 10], [94, 10], [95, 10], [96, 10], [96, 11], [96, 11], [98, 11], [98, 12], [99, 12], [100, 13], [100, 14], [101, 14], [101, 15], [102, 15], [104, 16], [104, 17], [104, 18], [105, 18], [106, 18], [106, 18], [107, 18], [107, 19], [107, 20], [108, 20], [108, 21], [108, 21], [108, 22], [109, 22], [109, 22], [109, 23]], classification_payloads: null, annotation_meta: "is_assigned_to_each_annotation" }; -const BBOX_SVG = ` - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - -`; -const DELETE_BBOX_SVG = ` - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - -`; -const POINT_SVG = ` - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - -`; -const POLYGON_SVG = ` - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - -`; -const DELETE_POLYGON_SVG = ` - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - -`; -const CONTOUR_SVG = ` - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - -`; -const TBAR_SVG = ` - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - -`; -const GLOBAL_SVG = ` - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - -`; -const WHOLE_IMAGE_SVG = ` - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - -`; -const POLYLINE_SVG = ` - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - -`; -const BBOX3_SVG = ` - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - -`; - -let get_init_style = (prntid) => { - const NONSP_SZ = 400; - return ` -div#${prntid} { - display: none; -} -div#${prntid} * { - box-sizing: content-box; - text-align: center; -} -div#${prntid}.ulabel-night { - background-color: black; -} -div#${prntid} div.full_ulabel_container_ { - font-family: sans-serif; -} - -div#${prntid} .ulabel-hidden { - display: none !important; -} - -div#${prntid} div.annbox_cls, div#${prntid} div.toolbox_cls { - height: 100%; -} -div#${prntid} div.annbox_cls { - width: calc(100% - 320px); - background-color: black; - overflow: scroll; - position: absolute; - top: 0; - left: 0; -} -div#${prntid} div.annbox_cls img.image_frame { - position: absolute; - top: 0; - left: 0; - max-width: none; - max-height: none; -} - - -/* Frame annotation dialog */ -div#${prntid} div.frame_annotation_dialog { - width: 60px; - overflow: hidden; - position: absolute; - z-index: 80; - background-color: rgb(255, 255, 255); - border: 1px solid rgb(143, 143, 143); - transition: opacity 0.1s, width 0.3s, height 0.3s, min-height 0.3s; - opacity: 0.5; - top: 40px; -} -div#${prntid} div.frame_annotation_dialog.fad_ind__0 { - right: 360px; -} -div#${prntid} div.frame_annotation_dialog.fad_ind__1 { - right: 445px; -} -div#${prntid} div.frame_annotation_dialog.fad_ind__2 { - right: 530px; -} -div#${prntid} div.frame_annotation_dialog.fad_ind__3 { - right: 615px; -} -div#${prntid} div.frame_annotation_dialog div.hide_overflow_container { - width: 100%; - /* position: absolute; - right: 0; */ - overflow: hidden; -} -div#${prntid} div.frame_annotation_dialog.active:hover, div#${prntid} div.frame_annotation_dialog.active.permopen { - max-width: none; - width: ${NONSP_SZ}px; - overflow: visible; -} -div#${prntid} div.frame_annotation_dialog.active { - z-index: 125; - opacity: 1.0; -} -div#${prntid}.ulabel-night div.frame_annotation_dialog { - background-color: rgb(37, 37, 37); - border: 1px solid rgb(102, 102, 102); - text-align: right; -} -div.front_dialogs { - position: absolute; - top: 0; - right: 0; - z-index: -1; -} -div#${prntid} div.frame_annotation_dialog div.row_container { - position: relative; - width: ${NONSP_SZ}px; - left: ${60 - NONSP_SZ}px; - overflow: visible; - transition: left 0.3s; -} -div#${prntid} div.frame_annotation_dialog:hover div.row_container, div#${prntid} div.frame_annotation_dialog.active.permopen div.row_container { - left: 0; - overflow: visible; -} -/* ROWS */ -div#${prntid} div.frame_annotation_dialog div.fad_row { - width: ${NONSP_SZ}px; -} -div#${prntid} div.frame_annotation_dialog div.fad_row div.fad_row_inner { - width: ${NONSP_SZ}px; - text-align: right; -} - -/* NAME */ -div#${prntid} div.fad_st_name { - font-size: 8px; - padding: 4px; - width: 52px; - overflow: hidden; - text-align: center; - display: inline-block; -} -div#${prntid}.ulabel-night div.fad_st_name { - color: white; -} - -/* ADD BUTTON */ -div#${prntid} div.fad_st_add { - width: 60px; - height: 50px; - display: none; - position: relative; -} -div#${prntid} div.frame_annotation_dialog.active div.fad_st_add { - display: inline-block; -} -div#${prntid} div.frame_annotation_dialog div.fad_row.add a.add-glob-button { - position: absolute; - font-size: 20px; - width: 25px; - height: 25px; - border-radius: 12.5px; - text-decoration: none; - background-color: rgba(128, 128, 128, 0.198); - color: gray; - border: 1px solid gray; - top: 25px; - left: 30px; - transform: translateX(-50%) translateY(-50%); - line-height: 25px; - text-align: center; -} -/* div#${prntid} div.frame_annotation_dialog div.fad_row.add a.add-glob-button span.plus { - display: block; - text-align: center; - width: 25px; - height: 25px; - position: absolute; - top: 12.5px; - left: 12.5px; - transform: translateX(-50%) translateY(-50%); - color: black; -} */ -div#${prntid} div.frame_annotation_dialog div.fad_row.add a.add-glob-button:hover { - border-color: black; - color: black; -} -div#${prntid}.ulabel-night div.frame_annotation_dialog div.fad_row.add a.add-glob-button:hover { - border-color: white; - color: white; -} -div#${prntid}.ulabel-night div.frame_annotation_dialog div.fad_row.add a.add-glob-button span.plus { - color: white; -} -div#${prntid} div.frame_annotation_dialog.active div.fad_row.add { - display: inline-block; -} - -div#${prntid} div.frame_annotation_dialog div.fad_annotation_rows { - width: ${NONSP_SZ}px; - display: inline-block; -} - -div#${prntid} div.frame_annotation_dialog div.fad_row div.fad_buttons { - display: inline-block; - vertical-align: top; - min-height: 60px; - width: ${NONSP_SZ - 60}px; -} -div#${prntid} div.frame_annotation_dialog div.fad_row div.fad_type_icon { - display: inline-block; - vertical-align: top; - height: 60px; - width: 60px; - position: relative; - text-align: center; -} -div#${prntid} div.frame_annotation_dialog div.fad_row div.fad_type_icon svg { - height: 50px; - width: 50px; - padding: 5px; -} -div#${prntid} div.frame_annotation_dialog div.fad_row div.fad_buttons div.fad_inp_container { - display: inline-block; - vertical-align: top; -} -div#${prntid} div.frame_annotation_dialog div.fad_row div.fad_buttons div.fad_inp_container.text { - width: ${NONSP_SZ - 180}px; - margin: 0; - border: none; - padding: none; -} -div#${prntid} div.frame_annotation_dialog div.fad_row div.fad_buttons div.fad_inp_container.text textarea { - box-sizing: border-box; - width: calc(100% - 2px); - height: 58px; - min-height: 58px; - resize: vertical; - background-color: rgba(0,0,0,0); -} -div#${prntid}.ulabel-night div.frame_annotation_dialog div.fad_row div.fad_buttons div.fad_inp_container.text textarea { - color: white; -} -div#${prntid} div.frame_annotation_dialog div.fad_row div.fad_buttons div.fad_inp_container.button { - width: 30px; - height: 30px; - padding: 15px; - padding-right: 20px; - padding-left: 0; -} -div#${prntid} div.frame_annotation_dialog div.fad_row div.fad_buttons div.fad_inp_container.button.frst { - padding-left: 20px; -} -div#${prntid} div.frame_annotation_dialog div.fad_row div.fad_buttons a.fad_button { - display: block; - width: 28px; - height: 28px; - background-color: rgba(128, 128, 128, 0.198); - border-radius: 14px; - border: 1px solid gray; - color: gray; -} -div#${prntid} div.frame_annotation_dialog div.fad_row div.fad_buttons a.fad_button:hover { - border-color: black; - color: black; -} -div#${prntid}.ulabel-night div.frame_annotation_dialog div.fad_row div.fad_buttons a.fad_button:hover { - border-color: white; - color: white; -} -div#${prntid} div.frame_annotation_dialog div.fad_row div.fad_buttons a.fad_button.reclf { - position: relative; -} -div#${prntid} div.frame_annotation_dialog div.fad_row div.fad_buttons a.fad_button.delete { - text-decoration: none; - text-align: center; - line-height: 28px; - font-size: 22px; -} - -div#${prntid} div.canvasses { - position: absolute; - top: 0; - left: 0; - padding-right: 100%; - padding-bottom: 100%; -} -div#${prntid} canvas.canvas_cls { - position: absolute; - top: 0; - left: 0; -} -div#${prntid} canvas.annotation_canvas { - pointer-events: none; -} - -div#${prntid} .id_dialog { - width: 400px; - height: 400px; - background-color: rgba(0, 0, 0, 0.0); - position: absolute; - display: none; -} -/* .id_dialog.thumb { - transform: scale(0.375); - opacity: 0.5; -} -.id_dialog.thumb:hover { - opacity: 1.0; -} */ -div#${prntid} .ender_outer { - display: block; - position: absolute; - width: 50px; - height: 50px; - background-color: transparent; - box-shadow: 0 0 0 2px white; - border-radius: 25px; - z-index: ${FRONT_Z_INDEX}; -} -div#${prntid} .ender_inner { - display: block; - position: absolute; - left: 20px; - top: 20px; - width: 10px; - height: 10px; - background-color: transparent; - border-radius: 10px; -} -div#${prntid} .brush_circle { - display: block; - position: absolute; - width: 50px; - height: 50px; - background-color: white; - opacity: 0.4; - border-radius: 25px; - z-index: ${FRONT_Z_INDEX}; -} - -/* ================== TOOLBOX ================== */ - -div#${prntid} div.zpcont { - height: 90px; - position: relative; - background-color: white; -} - -div#${prntid}.ulabel-night div.zpcont { - background-color: rgb(24, 24, 24); -} - -div#${prntid} div.zpcont:hover, div#${prntid}.ulabel-night div.zpcont:hover { - background-color: rgba(0,0,0,0); -} - -div#${prntid} div.linestyle { - padding: 10px 30px; -} - -div#${prntid} canvas.demo-canvas { - width: 120px; - height: 40px; - border: 1px solid lightgray; -} -div#${prntid}.ulabel-night canvas.demo-canvas { - border: 1px solid rgb(87, 87, 87); -} -div#${prntid} div.line-expl { - width: 185px; -} - -div#${prntid} div.line-expl a { - display: inline-block; - vertical-align: middle; -} -div#${prntid} div.line-expl canvas { - display: inline-block; - vertical-align: middle; - width: 120px; - height: 40px; -} -div#${prntid} div.lstyl-row div.line-expl, div#${prntid} div.lstyl-row div.setting { - display: inline-block; - vertical-align: middle; -} -div#${prntid} div.setting { - width: calc(100% - 185px); - text-align: right; -} -div#${prntid} div.lstyl-row div.setting a { - display: inline-block; - border-radius: 5px; - padding: 3px 6px; - margin-bottom: 5px; - text-decoration: none; - color: black; - font-size: 14px; -} -div#${prntid}.ulabel-night div.lstyl-row div.setting a { - color: white; -} -div#${prntid} div.lstyl-row div.setting a { - background-color: rgba(100, 148, 237, 0.479); - color: black; -} -div#${prntid} div.lstyl-row div.setting a[href="#"] { - background-color: rgba(0,0,0,0); - color: black; -} -div#${prntid}.ulabel-night div.lstyl-row div.setting a[href="#"] { - color: white; -} -div#${prntid} div.lstyl-row div.setting a[href="#"]:hover { - background-color: rgba(255, 181, 44, 0.397); -} - -div#${prntid} div.dialogs_container { - position: absolute; - top: 0; - left: 0; -} - -div.toolbox_inner_cls { - height: calc(100% - 38px); - overflow-y: scroll; - overflow-x: hidden; -} - - -/* ========== Tab Buttons ========== */ - -div#${prntid} div.toolbox-tabs { - position: absolute; - bottom: 0; - width: 100%; - opacity: 0.8; -} -div#${prntid} div.toolbox-tabs div.tb-st-tab { - display: block; - width: 100%; - padding: 5px 0; - background-color: rgba(0, 3, 161, 0.144); -} -div#${prntid} div.toolbox-tabs div.tb-st-tab.sel { - display: block; - width: 100%; - background-color: rgba(0, 3, 161, 0.561); -} -div#${prntid} div.toolbox-tabs div.tb-st-tab * { - vertical-align: middle; -} -div#${prntid} div.toolbox-tabs div.tb-st-tab a.tb-st-switch { - display: inline-block; - width: 70px; - padding: 0 15px; - text-decoration: none; - color: rgb(37, 37, 37); -} -div#${prntid}.ulabel-night div.toolbox-tabs div.tb-st-tab a.tb-st-switch { - color: rgb(150, 150, 150); -} -div#${prntid} div.toolbox-tabs div.tb-st-tab.sel a.tb-st-switch { - color: rgb(238, 238, 238); -} -div#${prntid}.ulabel-night div.toolbox-tabs div.tb-st-tab.sel a.tb-st-switch { - color: rgb(238, 238, 238); -} -div#${prntid} div.toolbox-tabs div.tb-st-tab a.tb-st-switch[href]:hover { - color: cornflowerblue; -} -div#${prntid}.ulabel-night div.toolbox-tabs div.tb-st-tab a.tb-st-switch[href]:hover { - color: rgb(238, 238, 238); -} -div#${prntid} div.toolbox-tabs div.tb-st-tab span.tb-st-range { - display: inline-block; - width: calc(100% - 100px); - text-align: center; -} -div#${prntid} div.toolbox-tabs div.tb-st-tab span.tb-st-range input { - width: 80%; - transform: rotate(180deg); -} - -/* ========== Annotation Box Dialogs ========== */ - -div#${prntid} div.global_edit_suggestion { - display: none; - position: absolute; - width: 150px; - /*height: 75px;*/ - height: 0px; - text-align: center; - z-index: 1; - /* background-color: white; */ - transform: scale(0.66666); - overflow: visible; -} -div#${prntid} div.global_edit_suggestion.mcm { - width: 225px; - transform: scale(0.5); -} -div#${prntid} a.global_sub_suggestion { - width: 60px; - height: 60px; - margin-left: 7.5px; - margin-right: 7.5px; - display: inline-block; - border-radius: 37.5px; - background-color: white; - overflow: hidden; - transform: translateY(-50%); -} -div#${prntid} a.global_sub_suggestion img { - display: block; - width: 40px; - height: 40px; - padding: 10px; -} -div#${prntid} a.global_sub_suggestion span.bigx { - position: absolute; - display: block; - font-size: 4em; - text-align: center; - width: 60px; - top: 50%; - -ms-transform: translateY(-50%); - transform: translateY(-50%); - color: black; - text-decoration: none; -} -div#${prntid} a.global_sub_suggestion.reid_suggestion { - opacity: 0.3; - background-color: black; -} -div#${prntid} a.global_sub_suggestion.reid_suggestion:hover { - opacity: 0; -} - -div#${prntid} a.tbid-opt { - display: inline-block; - text-decoration: none; - padding: 5px 8px; - border-radius: 5px; - color: black; -} -div#${prntid} div.colprev { - display: inline-block; - vertical-align: middle; - height: 15px; - width: 15px; -} -div#${prntid} span.tb-cls-nam { - display: inline-block; - vertical-align: middle; -} -div#${prntid}.ulabel-night span.tb-cls-nam { - color: white; -} -div#${prntid} a.tbid-opt:hover { - background-color: rgba(255, 181, 44, 0.397); -} -div#${prntid} a.tbid-opt.sel { - background-color: rgba(100, 148, 237, 0.459); -} -div#${prntid} div.toolbox-name-header { - background-color: rgb(0, 128, 202); - margin: 0; -} -div#${prntid}.ulabel-night div.toolbox-name-header { - background-color: rgb(0, 60, 95); -} -div#${prntid} div.toolbox-name-header h1 { - margin: 0; - padding: 0; - font-size: 15px; - display: inline-block; - padding: 10px 15px; - width: calc(70% - 30px); - vertical-align: middle; -} -div#${prntid} div.toolbox-name-header h1 a { - color: white; - font-weight: 100; - text-decoration: none; -} -div#${prntid} div.toolbox-name-header h1 { - color: rgb(212, 212, 212); - font-size: 12px; - font-weight: 100; -} -div#${prntid}.ulabel-night div.toolbox-name-header h1 span.version-number { - color: rgb(190, 190, 190); -} -div#${prntid} div.night-button-cont { - text-align: right; - display: inline-block; - vertical-align: middle; - position: relative; - padding-right: 10px; - width: calc(30% - 10px); -} -div#${prntid} a.night-button { - display: inline-block; - padding: 10px; - opacity: 0.7; -} -div#${prntid} div.night-button-track { - width: 35px; - height: 12px; - border-radius: 6px; - position: relative; - display: inline-block; - background-color: rgba(0, 0, 0, 0.52); -} -div#${prntid} div.night-status { - width: 20px; - height: 20px; - border-radius: 10px; - position: absolute; - background-color: rgb(139, 139, 139); - left: -4px; - top: -4px; - transition: left 0.2s; -} -div#${prntid} a.night-button:hover { - opacity: 1; -} -div#${prntid}.ulabel-night div.night-button-track { - background-color: rgba(255, 255, 255, 0.52); -} -div#${prntid}.ulabel-night div.night-status { - left: 19px; -} - - -div#${prntid}.ulabel-night *::-webkit-scrollbar { - background-color: black; -} -div#${prntid}.ulabel-night *::-webkit-scrollbar-track { - background-color: black; -} -div#${prntid}.ulabel-night *::-webkit-scrollbar-thumb { - border: 1px solid rgb(110, 110, 110); - background-color: rgb(51, 51, 51); -} -div#${prntid}.ulabel-night *::-webkit-scrollbar-thumb:hover { - background-color: rgb(90, 90, 90); -} -div#${prntid}.ulabel-night *::-webkit-scrollbar-corner { - background-color:rgb(0, 60, 95); -} - -div#${prntid} a.repo-anchor { - text-transform: uppercase; -} - - -div#${prntid} a.id-dialog-clickable-indicator { - position: absolute; - top: 0; - left: 0; - display: block; - border-radius: 200px; - height: 400px; - width: 400px; - overflow: hidden; -} -div#${prntid} a.id-dialog-clickable-indicator svg { - position: absolute; - top: 0; - left: 0; -} - -div#${prntid} .editable { - display: none; - position: absolute; - width: 50px; - height: 50px; - background-color: gray; - opacity: 0.7; - border-radius: 25px; - z-index: 0; -} -div#${prntid} .editable.soft { - opacity: 0.4; -} -div#${prntid} .editable:hover { - background-color: white; - opacity: 1.0; -} -div#${prntid} .editable.soft:hover { - opacity: 0.7; -} - -div#${prntid} div.toolbox-refs { - text-align: center; -} -div#${prntid} div.toolbox-refs a { - color: rgb(5, 50, 133); - display: inline-block; - margin-top: 10px; -} -div#${prntid} div.toolbox-refs a:hover { - color: rgb(44, 77, 139); -} -div#${prntid}.ulabel-night div.toolbox-refs a { - color: rgb(176, 202, 250); -} -div#${prntid}.ulabel-night div.toolbox-refs a:hover { - color: rgb(123, 160, 228); -} - -div#${prntid} .submit-button-container { - display: flex; - flex-direction: column; -} -div#${prntid} .submit-button-row { - display: flex; - align-items: center; - gap: 0.5em; - overflow-x: auto; - margin-bottom: -0.5em; -} -div#${prntid} .submit-button { - display: flex; - justify-content: center; - align-items: center; - color: white; - background-color: rgba(255, 166, 0, 0.739); - margin-right: auto; - margin-left: auto; - margin-top: 0.5em; - margin-bottom: 0.5em; - cursor: pointer; -} - -/* Dual ring loader */ -.lds-dual-ring { - position: absolute; - display: block; - width: 18px; - height: 18px; - top: 50%; - left: 50%; - transform: translateY(-50%) translateX(-50%); -} -.lds-dual-ring:after { - content: " "; - display: block; - width: 14.4px; - height: 14.4px; - margin: 1.8px; - border-radius: 50%; - border: 1.35px solid #fff; - border-color: #fff transparent #fff transparent; - animation: lds-dual-ring 1.2s linear infinite; -} -@keyframes lds-dual-ring { - 0% { - transform: rotate(0deg); - } - 100% { - transform: rotate(360deg); - } -} -`; -}; - -const BUTTON_LOADER_HTML = `
`; - -// TODO more of these -const COLORS = [ - "orange", - "crimson", - "dodgerblue", - "midnightblue", - "seagreen", - "tan", - "blueviolet", - "chocolate", - "darksalmon", - "deeppink", - "fuchsia", -]; - - - - -/***/ }), - -/***/ 2779: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -var meta_1 = __webpack_require__(8421); -var helpers_1 = __webpack_require__(8967); -/** - * Takes a {@link Feature} or {@link FeatureCollection} and returns the mean center. Can be weighted. - * - * @name centerMean - * @param {GeoJSON} geojson GeoJSON to be centered - * @param {Object} [options={}] Optional parameters - * @param {Object} [options.properties={}] Translate GeoJSON Properties to Point - * @param {Object} [options.bbox={}] Translate GeoJSON BBox to Point - * @param {Object} [options.id={}] Translate GeoJSON Id to Point - * @param {string} [options.weight] the property name used to weight the center - * @returns {Feature} a Point feature at the mean center point of all input features - * @example - * var features = turf.featureCollection([ - * turf.point([-97.522259, 35.4691], {value: 10}), - * turf.point([-97.502754, 35.463455], {value: 3}), - * turf.point([-97.508269, 35.463245], {value: 5}) - * ]); - * - * var options = {weight: "value"} - * var mean = turf.centerMean(features, options); - * - * //addToMap - * var addToMap = [features, mean] - * mean.properties['marker-size'] = 'large'; - * mean.properties['marker-color'] = '#000'; - */ -function centerMean(geojson, // To-Do include Typescript AllGeoJSON -options) { - if (options === void 0) { options = {}; } - var sumXs = 0; - var sumYs = 0; - var sumNs = 0; - meta_1.geomEach(geojson, function (geom, featureIndex, properties) { - var weight = options.weight ? properties === null || properties === void 0 ? void 0 : properties[options.weight] : undefined; - weight = weight === undefined || weight === null ? 1 : weight; - if (!helpers_1.isNumber(weight)) - throw new Error("weight value must be a number for feature index " + featureIndex); - weight = Number(weight); - if (weight > 0) { - meta_1.coordEach(geom, function (coord) { - sumXs += coord[0] * weight; - sumYs += coord[1] * weight; - sumNs += weight; - }); - } - }); - return helpers_1.point([sumXs / sumNs, sumYs / sumNs], options.properties, options); -} -exports["default"] = centerMean; - - -/***/ }), - -/***/ 2903: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -module.exports = rbush; -module.exports["default"] = rbush; - -var quickselect = __webpack_require__(3351); - -function rbush(maxEntries, format) { - if (!(this instanceof rbush)) return new rbush(maxEntries, format); - - // max entries in a node is 9 by default; min node fill is 40% for best performance - this._maxEntries = Math.max(4, maxEntries || 9); - this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4)); - - if (format) { - this._initFormat(format); - } - - this.clear(); -} - -rbush.prototype = { - - all: function () { - return this._all(this.data, []); - }, - - search: function (bbox) { - - var node = this.data, - result = [], - toBBox = this.toBBox; - - if (!intersects(bbox, node)) return result; - - var nodesToSearch = [], - i, len, child, childBBox; - - while (node) { - for (i = 0, len = node.children.length; i < len; i++) { - - child = node.children[i]; - childBBox = node.leaf ? toBBox(child) : child; - - if (intersects(bbox, childBBox)) { - if (node.leaf) result.push(child); - else if (contains(bbox, childBBox)) this._all(child, result); - else nodesToSearch.push(child); - } - } - node = nodesToSearch.pop(); - } - - return result; - }, - - collides: function (bbox) { - - var node = this.data, - toBBox = this.toBBox; - - if (!intersects(bbox, node)) return false; - - var nodesToSearch = [], - i, len, child, childBBox; - - while (node) { - for (i = 0, len = node.children.length; i < len; i++) { - - child = node.children[i]; - childBBox = node.leaf ? toBBox(child) : child; - - if (intersects(bbox, childBBox)) { - if (node.leaf || contains(bbox, childBBox)) return true; - nodesToSearch.push(child); - } - } - node = nodesToSearch.pop(); - } - - return false; - }, - - load: function (data) { - if (!(data && data.length)) return this; - - if (data.length < this._minEntries) { - for (var i = 0, len = data.length; i < len; i++) { - this.insert(data[i]); - } - return this; - } - - // recursively build the tree with the given data from scratch using OMT algorithm - var node = this._build(data.slice(), 0, data.length - 1, 0); - - if (!this.data.children.length) { - // save as is if tree is empty - this.data = node; - - } else if (this.data.height === node.height) { - // split root if trees have the same height - this._splitRoot(this.data, node); - - } else { - if (this.data.height < node.height) { - // swap trees if inserted one is bigger - var tmpNode = this.data; - this.data = node; - node = tmpNode; - } - - // insert the small tree into the large tree at appropriate level - this._insert(node, this.data.height - node.height - 1, true); - } - - return this; - }, - - insert: function (item) { - if (item) this._insert(item, this.data.height - 1); - return this; - }, - - clear: function () { - this.data = createNode([]); - return this; - }, - - remove: function (item, equalsFn) { - if (!item) return this; - - var node = this.data, - bbox = this.toBBox(item), - path = [], - indexes = [], - i, parent, index, goingUp; - - // depth-first iterative tree traversal - while (node || path.length) { - - if (!node) { // go up - node = path.pop(); - parent = path[path.length - 1]; - i = indexes.pop(); - goingUp = true; - } - - if (node.leaf) { // check current node - index = findItem(item, node.children, equalsFn); - - if (index !== -1) { - // item found, remove the item and condense tree upwards - node.children.splice(index, 1); - path.push(node); - this._condense(path); - return this; - } - } - - if (!goingUp && !node.leaf && contains(node, bbox)) { // go down - path.push(node); - indexes.push(i); - i = 0; - parent = node; - node = node.children[0]; - - } else if (parent) { // go right - i++; - node = parent.children[i]; - goingUp = false; - - } else node = null; // nothing found - } - - return this; - }, - - toBBox: function (item) { return item; }, - - compareMinX: compareNodeMinX, - compareMinY: compareNodeMinY, - - toJSON: function () { return this.data; }, - - fromJSON: function (data) { - this.data = data; - return this; - }, - - _all: function (node, result) { - var nodesToSearch = []; - while (node) { - if (node.leaf) result.push.apply(result, node.children); - else nodesToSearch.push.apply(nodesToSearch, node.children); - - node = nodesToSearch.pop(); - } - return result; - }, - - _build: function (items, left, right, height) { - - var N = right - left + 1, - M = this._maxEntries, - node; - - if (N <= M) { - // reached leaf level; return leaf - node = createNode(items.slice(left, right + 1)); - calcBBox(node, this.toBBox); - return node; - } - - if (!height) { - // target height of the bulk-loaded tree - height = Math.ceil(Math.log(N) / Math.log(M)); - - // target number of root entries to maximize storage utilization - M = Math.ceil(N / Math.pow(M, height - 1)); - } - - node = createNode([]); - node.leaf = false; - node.height = height; - - // split the items into M mostly square tiles - - var N2 = Math.ceil(N / M), - N1 = N2 * Math.ceil(Math.sqrt(M)), - i, j, right2, right3; - - multiSelect(items, left, right, N1, this.compareMinX); - - for (i = left; i <= right; i += N1) { - - right2 = Math.min(i + N1 - 1, right); - - multiSelect(items, i, right2, N2, this.compareMinY); - - for (j = i; j <= right2; j += N2) { - - right3 = Math.min(j + N2 - 1, right2); - - // pack each entry recursively - node.children.push(this._build(items, j, right3, height - 1)); - } - } - - calcBBox(node, this.toBBox); - - return node; - }, - - _chooseSubtree: function (bbox, node, level, path) { - - var i, len, child, targetNode, area, enlargement, minArea, minEnlargement; - - while (true) { - path.push(node); - - if (node.leaf || path.length - 1 === level) break; - - minArea = minEnlargement = Infinity; - - for (i = 0, len = node.children.length; i < len; i++) { - child = node.children[i]; - area = bboxArea(child); - enlargement = enlargedArea(bbox, child) - area; - - // choose entry with the least area enlargement - if (enlargement < minEnlargement) { - minEnlargement = enlargement; - minArea = area < minArea ? area : minArea; - targetNode = child; - - } else if (enlargement === minEnlargement) { - // otherwise choose one with the smallest area - if (area < minArea) { - minArea = area; - targetNode = child; - } - } - } - - node = targetNode || node.children[0]; - } - - return node; - }, - - _insert: function (item, level, isNode) { - - var toBBox = this.toBBox, - bbox = isNode ? item : toBBox(item), - insertPath = []; - - // find the best node for accommodating the item, saving all nodes along the path too - var node = this._chooseSubtree(bbox, this.data, level, insertPath); - - // put the item into the node - node.children.push(item); - extend(node, bbox); - - // split on node overflow; propagate upwards if necessary - while (level >= 0) { - if (insertPath[level].children.length > this._maxEntries) { - this._split(insertPath, level); - level--; - } else break; - } - - // adjust bboxes along the insertion path - this._adjustParentBBoxes(bbox, insertPath, level); - }, - - // split overflowed node into two - _split: function (insertPath, level) { - - var node = insertPath[level], - M = node.children.length, - m = this._minEntries; - - this._chooseSplitAxis(node, m, M); - - var splitIndex = this._chooseSplitIndex(node, m, M); - - var newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex)); - newNode.height = node.height; - newNode.leaf = node.leaf; - - calcBBox(node, this.toBBox); - calcBBox(newNode, this.toBBox); - - if (level) insertPath[level - 1].children.push(newNode); - else this._splitRoot(node, newNode); - }, - - _splitRoot: function (node, newNode) { - // split root node - this.data = createNode([node, newNode]); - this.data.height = node.height + 1; - this.data.leaf = false; - calcBBox(this.data, this.toBBox); - }, - - _chooseSplitIndex: function (node, m, M) { - - var i, bbox1, bbox2, overlap, area, minOverlap, minArea, index; - - minOverlap = minArea = Infinity; - - for (i = m; i <= M - m; i++) { - bbox1 = distBBox(node, 0, i, this.toBBox); - bbox2 = distBBox(node, i, M, this.toBBox); - - overlap = intersectionArea(bbox1, bbox2); - area = bboxArea(bbox1) + bboxArea(bbox2); - - // choose distribution with minimum overlap - if (overlap < minOverlap) { - minOverlap = overlap; - index = i; - - minArea = area < minArea ? area : minArea; - - } else if (overlap === minOverlap) { - // otherwise choose distribution with minimum area - if (area < minArea) { - minArea = area; - index = i; - } - } - } - - return index; - }, - - // sorts node children by the best axis for split - _chooseSplitAxis: function (node, m, M) { - - var compareMinX = node.leaf ? this.compareMinX : compareNodeMinX, - compareMinY = node.leaf ? this.compareMinY : compareNodeMinY, - xMargin = this._allDistMargin(node, m, M, compareMinX), - yMargin = this._allDistMargin(node, m, M, compareMinY); - - // if total distributions margin value is minimal for x, sort by minX, - // otherwise it's already sorted by minY - if (xMargin < yMargin) node.children.sort(compareMinX); - }, - - // total margin of all possible split distributions where each node is at least m full - _allDistMargin: function (node, m, M, compare) { - - node.children.sort(compare); - - var toBBox = this.toBBox, - leftBBox = distBBox(node, 0, m, toBBox), - rightBBox = distBBox(node, M - m, M, toBBox), - margin = bboxMargin(leftBBox) + bboxMargin(rightBBox), - i, child; - - for (i = m; i < M - m; i++) { - child = node.children[i]; - extend(leftBBox, node.leaf ? toBBox(child) : child); - margin += bboxMargin(leftBBox); - } - - for (i = M - m - 1; i >= m; i--) { - child = node.children[i]; - extend(rightBBox, node.leaf ? toBBox(child) : child); - margin += bboxMargin(rightBBox); - } - - return margin; - }, - - _adjustParentBBoxes: function (bbox, path, level) { - // adjust bboxes along the given tree path - for (var i = level; i >= 0; i--) { - extend(path[i], bbox); - } - }, - - _condense: function (path) { - // go through the path, removing empty nodes and updating bboxes - for (var i = path.length - 1, siblings; i >= 0; i--) { - if (path[i].children.length === 0) { - if (i > 0) { - siblings = path[i - 1].children; - siblings.splice(siblings.indexOf(path[i]), 1); - - } else this.clear(); - - } else calcBBox(path[i], this.toBBox); - } - }, - - _initFormat: function (format) { - // data format (minX, minY, maxX, maxY accessors) - - // uses eval-type function compilation instead of just accepting a toBBox function - // because the algorithms are very sensitive to sorting functions performance, - // so they should be dead simple and without inner calls - - var compareArr = ['return a', ' - b', ';']; - - this.compareMinX = new Function('a', 'b', compareArr.join(format[0])); - this.compareMinY = new Function('a', 'b', compareArr.join(format[1])); - - this.toBBox = new Function('a', - 'return {minX: a' + format[0] + - ', minY: a' + format[1] + - ', maxX: a' + format[2] + - ', maxY: a' + format[3] + '};'); - } -}; - -function findItem(item, items, equalsFn) { - if (!equalsFn) return items.indexOf(item); - - for (var i = 0; i < items.length; i++) { - if (equalsFn(item, items[i])) return i; - } - return -1; -} - -// calculate node's bbox from bboxes of its children -function calcBBox(node, toBBox) { - distBBox(node, 0, node.children.length, toBBox, node); -} - -// min bounding rectangle of node children from k to p-1 -function distBBox(node, k, p, toBBox, destNode) { - if (!destNode) destNode = createNode(null); - destNode.minX = Infinity; - destNode.minY = Infinity; - destNode.maxX = -Infinity; - destNode.maxY = -Infinity; - - for (var i = k, child; i < p; i++) { - child = node.children[i]; - extend(destNode, node.leaf ? toBBox(child) : child); - } - - return destNode; -} - -function extend(a, b) { - a.minX = Math.min(a.minX, b.minX); - a.minY = Math.min(a.minY, b.minY); - a.maxX = Math.max(a.maxX, b.maxX); - a.maxY = Math.max(a.maxY, b.maxY); - return a; -} - -function compareNodeMinX(a, b) { return a.minX - b.minX; } -function compareNodeMinY(a, b) { return a.minY - b.minY; } - -function bboxArea(a) { return (a.maxX - a.minX) * (a.maxY - a.minY); } -function bboxMargin(a) { return (a.maxX - a.minX) + (a.maxY - a.minY); } - -function enlargedArea(a, b) { - return (Math.max(b.maxX, a.maxX) - Math.min(b.minX, a.minX)) * - (Math.max(b.maxY, a.maxY) - Math.min(b.minY, a.minY)); -} - -function intersectionArea(a, b) { - var minX = Math.max(a.minX, b.minX), - minY = Math.max(a.minY, b.minY), - maxX = Math.min(a.maxX, b.maxX), - maxY = Math.min(a.maxY, b.maxY); - - return Math.max(0, maxX - minX) * - Math.max(0, maxY - minY); -} - -function contains(a, b) { - return a.minX <= b.minX && - a.minY <= b.minY && - b.maxX <= a.maxX && - b.maxY <= a.maxY; -} - -function intersects(a, b) { - return b.minX <= a.maxX && - b.minY <= a.maxY && - b.maxX >= a.minX && - b.maxY >= a.minY; -} - -function createNode(children) { - return { - children: children, - height: 1, - leaf: true, - minX: Infinity, - minY: Infinity, - maxX: -Infinity, - maxY: -Infinity - }; -} - -// sort an array so that items come in groups of n unsorted items, with groups sorted between each other; -// combines selection algorithm with binary divide & conquer approach - -function multiSelect(arr, left, right, n, compare) { - var stack = [left, right], - mid; - - while (stack.length) { - right = stack.pop(); - left = stack.pop(); - - if (right - left <= n) continue; - - mid = left + Math.ceil((right - left) / n / 2) * n; - quickselect(arr, mid, left, right, compare); - - stack.push(left, mid, mid, right); - } -} - - -/***/ }), - -/***/ 3045: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.FilterPointDistanceFromRow = exports.KeypointSliderItem = exports.RecolorActiveItem = exports.AnnotationResizeItem = exports.ClassCounterToolboxItem = exports.AnnotationIDToolboxItem = exports.ZoomPanToolboxItem = exports.BrushToolboxItem = exports.ModeSelectionToolboxItem = exports.ToolboxItem = exports.ToolboxTab = exports.Toolbox = void 0; -var configuration_1 = __webpack_require__(496); -var annotation_operators_1 = __webpack_require__(2571); -var html_builder_1 = __webpack_require__(4493); -var overlays_1 = __webpack_require__(8505); -var utilities_1 = __webpack_require__(8286); -// For ResizeToolboxItem -var ValidResizeValues; -(function (ValidResizeValues) { - ValidResizeValues["VANISH"] = "v"; - ValidResizeValues["SMALL"] = "s"; - ValidResizeValues["LARGE"] = "l"; - ValidResizeValues["INCREMENT"] = "inc"; - ValidResizeValues["DECREMENT"] = "dec"; -})(ValidResizeValues || (ValidResizeValues = {})); -var toolboxDividerDiv = "
"; -var vanish_size = 0.01; -/** Chains the replaceAll method and the toLowerCase method. - * Optionally concatenates a string at the end of the method. - */ -String.prototype.replaceLowerConcat = function (before, after, concat_string) { - if (concat_string === void 0) { concat_string = null; } - if (typeof (concat_string) === "string") { - return this.replaceAll(before, after).toLowerCase().concat(concat_string); - } - return this.replaceAll(before, after).toLowerCase(); -}; -/** - * Manager for toolbox. Contains ToolboxTab items. - */ -var Toolbox = /** @class */ (function () { - function Toolbox(tabs, items) { - if (tabs === void 0) { tabs = []; } - if (items === void 0) { items = []; } - this.tabs = tabs; - this.items = items; - } - Toolbox.create_toolbox = function (ulabel, toolbox_item_order) { - // Grab the default toolbox if one wasn't provided - if (toolbox_item_order == null) { - toolbox_item_order = ulabel.config.toolbox_order; - } - // There's no point to having an empty toolbox, so throw an error if the toolbox is empty. - // The toolbox won't actually break if there aren't any items in the toolbox, so this - // error isn't strictly neccesary. - if (toolbox_item_order.length === 0) { - throw new Error("No Toolbox Items Given"); - } - this.add_styles(); - var toolbox_instance_list = []; - // Go through the items in toolbox_item_order and add their instance to the toolbox instance list - for (var i = 0; i < toolbox_item_order.length; i++) { - var args = void 0, toolbox_key = void 0; - // If the value of toolbox_item_order[i] is a number then that means the it is one of the - // enumerated toolbox items, so set it to the key, otherwise the element must be an array - // of which the first element of that array must be the enumerated value, and the arguments - // must be the second value - if (typeof (toolbox_item_order[i]) === "number") { - toolbox_key = toolbox_item_order[i]; - } - else { - toolbox_key = toolbox_item_order[i][0]; - args = toolbox_item_order[i][1]; - } - var toolbox_item_class = ulabel.config.toolbox_map.get(toolbox_key); - if (args == null) { - toolbox_instance_list.push(new toolbox_item_class(ulabel)); - } - else { - toolbox_instance_list.push(new toolbox_item_class(ulabel, args)); - } - } - return toolbox_instance_list; - }; - Toolbox.add_styles = function () { - var css = "\n #toolbox {\n width: 320px;\n background-color: white;\n overflow-y: hidden;\n position: absolute;\n top: 0;\n right: 0;\n }\n\n .ulabel-night #toolbox {\n color: white;\n }\n\n .ulabel-night #toolbox div.toolbox_inner_cls {\n background-color: black;\n }\n\n .ulabel-night div.toolbox_cls {\n background-color: rgb(24, 24, 24);\n }\n\n .ulabel-night .invert-this-svg svg {\n filter: invert(90%);\n }\n\n #toolbox button {\n border: 1px solid rgba(128, 128, 128, 0.5);\n color: white;\n background-color: rgba(0, 128, 255, 0.7);\n transition: background-color 250ms;\n cursor: pointer;\n }\n \n #toolbox button:hover {\n background-color: rgba(0, 128, 255, 0.9);\n }\n\n #toolbox button.circle {\n position: relative;\n border-radius: 50%;\n font-size: 1.2rem;\n font-weight: bold;\n width: 20px;\n height: 20px;\n padding: 0;\n }\n\n #toolbox button.circle:hover {\n box-shadow: 0 0 4px 2px lightgray, 0 0 white;\n }\n \n /* No shadow effect in night-mode */\n .ulabel-night #toolbox button.circle:hover {\n box-shadow: initial;\n }\n\n #toolbox input {\n cursor: pointer;\n }\n\n #toolbox label {\n cursor: pointer;\n }\n \n #toolbox div.toolbox-divider {\n width: 90%;\n margin: 0 auto;\n height: 1px;\n background-color: lightgray;\n }\n\n .ulabel-night #toolbox div.toolbox-divider {\n background-color: gray;\n }"; - // Create an id so this specific style tag can be referenced - var style_id = "toolbox-styles"; - // Don't add the style tag if its already been added once - if (document.getElementById(style_id)) - return; - // Grab the document's head and create a style tag - var head = document.head || document.querySelector("head"); - var style = document.createElement("style"); - // Add the css and id to the style tag - style.appendChild(document.createTextNode(css)); - style.id = style_id; - // Add the style tag to the document's head - head.appendChild(style); - }; - Toolbox.prototype.setup_toolbox_html = function (ulabel, frame_annotation_dialogs, images, ULABEL_VERSION) { - // Setup base div and ULabel version header - var toolbox_html = "\n
\n ".concat(frame_annotation_dialogs, "\n
\n
\n ").concat(images, "\n
\n
\n
\n
\n

ULabel v").concat(ULABEL_VERSION, "

\n
\n
\n "); - for (var tbitem in this.items) { - toolbox_html += this.items[tbitem].get_html() + toolboxDividerDiv; - } - toolbox_html += "\n
\n
\n ".concat(this.get_toolbox_tabs(ulabel), "\n
\n
\n
"); - return toolbox_html; - }; - /** - * Adds tabs for each ULabel subtask to the toolbox. - */ - Toolbox.prototype.get_toolbox_tabs = function (ulabel) { - var ret = ""; - for (var st_key in ulabel.subtasks) { - var selected = st_key == ulabel.get_current_subtask_key(); - var subtask = ulabel.subtasks[st_key]; - var current_tab = new ToolboxTab([], subtask, st_key, selected); - ret += current_tab.html; - this.tabs.push(current_tab); - } - return ret; - }; - Toolbox.prototype.redraw_update_items = function (ulabel) { - for (var _i = 0, _a = this.items; _i < _a.length; _i++) { - var tbitem = _a[_i]; - tbitem.redraw_update(ulabel); - } - }; - return Toolbox; -}()); -exports.Toolbox = Toolbox; -var ToolboxTab = /** @class */ (function () { - function ToolboxTab(toolboxitems, subtask, subtask_key, selected) { - if (toolboxitems === void 0) { toolboxitems = []; } - if (selected === void 0) { selected = false; } - this.toolboxitems = toolboxitems; - this.subtask = subtask; - this.subtask_key = subtask_key; - this.selected = selected; - var sel = ""; - var href = " href=\"#\""; - var val = subtask.inactive_opacity * 100; - if (this.selected) { - if (this.subtask.read_only) { - href = ""; - } - sel = " sel"; - val = 100; - } - console.log(subtask.display_name, subtask); - this.html = "\n
\n ").concat(this.subtask.display_name, "\n \n \n
\n "); - } - return ToolboxTab; -}()); -exports.ToolboxTab = ToolboxTab; -var ToolboxItem = /** @class */ (function () { - function ToolboxItem() { - } - // TODO (joshua-dean): Find the right way to handle this with abstract classes - /* eslint-disable @typescript-eslint/no-unused-vars */ - ToolboxItem.prototype.redraw_update = function (ulabel) { }; - ToolboxItem.prototype.frame_update = function (ulabel) { }; - return ToolboxItem; -}()); -exports.ToolboxItem = ToolboxItem; -/** - * Toolbox item for selecting annotation mode. - */ -var ModeSelectionToolboxItem = /** @class */ (function (_super) { - __extends(ModeSelectionToolboxItem, _super); - function ModeSelectionToolboxItem(ulabel) { - var _this = _super.call(this) || this; - _this.ulabel = ulabel; - _this.add_styles(); - // Buttons to change annotation mode - $(document).on("click.ulabel", "a.md-btn", function (e) { - // Grab the current target and the current subtask - var target_jq = $(e.currentTarget); - var current_subtask = ulabel.get_current_subtask(); - // Check if button clicked is already selected, or if creation of a new annotation is in progress - if (target_jq.hasClass("sel") || current_subtask["state"]["is_in_progress"]) - return; - // Get the new mode and set it to ulabel's current mode - var new_mode = target_jq.attr("id").split("--")[1]; - current_subtask["state"]["annotation_mode"] = new_mode; - // Show the BrushToolboxItem when polygon mode is selected - if (new_mode === "polygon") { - BrushToolboxItem.show_brush_toolbox_item(); - } - else { - BrushToolboxItem.hide_brush_toolbox_item(); - // Turn off erase mode if it's on - if (current_subtask["state"]["is_in_erase_mode"]) { - ulabel.toggle_erase_mode(e); - } - // Turn off brush mode if it's on - if (current_subtask["state"]["is_in_brush_mode"]) { - ulabel.toggle_brush_mode(e); - } - } - // Reset the previously selected mode button - $("a.md-btn.sel").attr("href", "#"); - $("a.md-btn.sel").removeClass("sel"); - // Make the selected class look selected - target_jq.addClass("sel"); - target_jq.removeAttr("href"); - ulabel.show_annotation_mode(target_jq); - ulabel.toggle_delete_class_id_in_toolbox(); - }); - $(document).on("keypress.ulabel", function (e) { - // If creation of a new annotation is in progress, don't change the mode - if (ulabel.get_current_subtask()["state"]["is_in_progress"]) - return; - // Check if the correct key was pressed - if (e.key == ulabel.config.toggle_annotation_mode_keybind) { - var mode_button_array = []; - // Loop through all of the mode buttons - for (var idx in Array.from(document.getElementsByClassName("md-btn"))) { - // Grab mode button - var mode_button = document.getElementsByClassName("md-btn")[idx]; - // Continue without adding it to the array if its display is none - if (mode_button.style.display == "none") { - continue; - } - mode_button_array.push(mode_button); - } - // Grab the currently selected mode button - var selected_mode_button = Array.from(document.getElementsByClassName("md-btn sel"))[0]; // There's only ever going to be one element in this array, so grab the first one - var new_button_index = void 0; - // Loop through all of the mode select buttons that are currently displayed - // to find which one is the currently selected button. Once its found add 1 - // to get the index of the next mode select button. If the new button index - // is the same as the array's length, then loop back and set the new button - // to 0. - for (var idx in mode_button_array) { - if (mode_button_array[idx] === selected_mode_button) { - new_button_index = Number(idx) + 1; - if (new_button_index == mode_button_array.length) { - new_button_index = 0; - } - } - } - // Grab the button for the mode we want to switch to - var new_selected_button = mode_button_array[new_button_index]; - new_selected_button.click(); - } - }); - return _this; - } - /** - * Create the css for this ToolboxItem and append it to the page. - */ - ModeSelectionToolboxItem.prototype.add_styles = function () { - // Define the css - var css = "\n #toolbox div.mode-selection {\n padding: 10px 30px;\n }\n \n #toolbox div.mode-selection p.current_mode_container {\n margin-top: 0px;\n margin-bottom: 5px;\n }\n \n #toolbox div.mode-selection span.current_mode {\n color: cornflowerblue;\n }\n \n #toolbox div.mode-opt {\n display: inline-block;\n }\n \n #toolbox div.mode-selection a.md-btn {\n text-align: center;\n height: 30px;\n width: 30px;\n padding: 10px;\n margin: 0 auto;\n text-decoration: none;\n color: black;\n font-size: 1.2em;\n font-family: sans-serif;\n }\n \n #toolbox div.mode-selection a.md-btn svg {\n height: 30px;\n width: 30px;\n }\n \n #toolbox div.mode-selection a.md-btn:hover {\n background-color: rgba(255, 181, 44, 0.397);\n }\n \n #toolbox div.mode-selection a.md-btn.sel {\n background-color: rgba(100, 148, 237, 0.459);\n }\n\n \n \n \n "; - // Create an id so this specific style tag can be referenced - var style_id = "mode-selection-toolbox-item-styles"; - // Don't add the style tag if its already been added once - if (document.getElementById(style_id)) - return; - // Grab the document's head and create a style tag - var head = document.head || document.querySelector("head"); - var style = document.createElement("style"); - // Add the css and id to the style tag - style.appendChild(document.createTextNode(css)); - style.id = style_id; - // Add the style tag to the document's head - head.appendChild(style); - }; - ModeSelectionToolboxItem.prototype.get_html = function () { - return "\n
\n

\n Mode:\n \n

\n
\n "; - }; - ModeSelectionToolboxItem.prototype.after_init = function () { - // This toolbox item doesn't need to do anything after initialization - }; - ModeSelectionToolboxItem.prototype.get_toolbox_item_type = function () { - return "ModeSelection"; - }; - return ModeSelectionToolboxItem; -}(ToolboxItem)); -exports.ModeSelectionToolboxItem = ModeSelectionToolboxItem; -/** - * Toolbox item for resizing all annotations - */ -var BrushToolboxItem = /** @class */ (function (_super) { - __extends(BrushToolboxItem, _super); - function BrushToolboxItem(ulabel) { - var _this = _super.call(this) || this; - _this.ulabel = ulabel; - _this.add_styles(); - _this.add_event_listeners(); - return _this; - } - /** - * Create the css for this ToolboxItem and append it to the page. - */ - BrushToolboxItem.prototype.add_styles = function () { - // Define the css - var css = "\n #toolbox div.brush button:not(.circle) {\n padding: 1rem 0.5rem;\n border: 1px solid gray;\n border-radius: 10px\n }\n\n #toolbox div.brush div.brush-button-holder {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 0.5rem;\n margin-bottom: 1rem;\n }\n\n #toolbox div.brush span.brush-mode {\n display: flex;\n } \n \n #toolbox div.brush button.brush-button.".concat(BrushToolboxItem.BRUSH_BTN_ACTIVE_CLS, " {\n background-color: #1c2d4d;\n }\n "); - // Create an id so this specific style tag can be referenced - var style_id = "brush-toolbox-item-styles"; - // Don't add the style tag if its already been added once - if (document.getElementById(style_id)) - return; - // Grab the document's head and create a style tag - var head = document.head || document.querySelector("head"); - var style = document.createElement("style"); - // Add the css and id to the style tag - style.appendChild(document.createTextNode(css)); - style.id = style_id; - // Add the style tag to the document's head - head.appendChild(style); - }; - BrushToolboxItem.prototype.add_event_listeners = function () { - var _this = this; - $(document).on("click.ulabel", ".brush-button", function (event) { - // Get the clicked button - var button = $(event.currentTarget); - // Use the button id to get what size to resize the annotations to - var button_id = button.attr("id"); - switch (button_id) { - case "brush-mode": - _this.ulabel.toggle_brush_mode(event); - break; - case "erase-mode": - _this.ulabel.toggle_erase_mode(event); - break; - case "brush-inc": - _this.ulabel.change_brush_size(1.1); - break; - case "brush-dec": - _this.ulabel.change_brush_size(1 / 1.1); - break; - } - ; - }); - }; - BrushToolboxItem.prototype.get_html = function () { - return "\n
\n

Brush Tool

\n
\n \n \n \n \n \n \n \n \n
\n
\n "; - }; - BrushToolboxItem.show_brush_toolbox_item = function () { - // Remove hidden class from the brush toolbox item - $(".brush").removeClass("ulabel-hidden"); - }; - BrushToolboxItem.hide_brush_toolbox_item = function () { - // Add hidden class to the brush toolbox item - $(".brush").addClass("ulabel-hidden"); - }; - BrushToolboxItem.prototype.after_init = function () { - // Only show BrushToolboxItem if the current mode is polygon - if (this.ulabel.get_current_subtask().state["annotation_mode"] !== "polygon") { - BrushToolboxItem.hide_brush_toolbox_item(); - } - }; - BrushToolboxItem.prototype.get_toolbox_item_type = function () { - return "Brush"; - }; - /** - * CSS class indicating the brush button is active - */ - BrushToolboxItem.BRUSH_BTN_ACTIVE_CLS = "brush-button-active"; - return BrushToolboxItem; -}(ToolboxItem)); -exports.BrushToolboxItem = BrushToolboxItem; -/** - * Toolbox item for zooming and panning. - */ -var ZoomPanToolboxItem = /** @class */ (function (_super) { - __extends(ZoomPanToolboxItem, _super); - function ZoomPanToolboxItem(ulabel) { - var _this = _super.call(this) || this; - _this.ulabel = ulabel; - _this.set_frame_range(ulabel); - _this.add_styles(); - _this.add_event_listeners(); - return _this; - } - /** - * Create the css for this ToolboxItem and append it to the page. - */ - ZoomPanToolboxItem.prototype.add_styles = function () { - // Define the css - var css = "\n #toolbox div.zoom-pan {\n padding: 10px 30px;\n display: grid;\n grid-template-rows: auto 1.25rem auto;\n grid-template-columns: 1fr 1fr;\n grid-template-areas:\n \"zoom pan\"\n \"zoom-tip pan-tip\"\n \"recenter recenter\";\n }\n \n #toolbox div.zoom-pan > * {\n place-self: center;\n }\n \n #toolbox div.zoom-pan button {\n background-color: lightgray;\n }\n\n #toolbox div.zoom-pan button:hover {\n background-color: rgba(0, 128, 255, 0.9);\n }\n \n #toolbox div.zoom-pan div.set-zoom {\n grid-area: zoom;\n }\n \n #toolbox div.zoom-pan div.set-pan {\n grid-area: pan;\n }\n \n #toolbox div.zoom-pan div.set-pan div.pan-container {\n display: inline-flex;\n align-items: center;\n }\n \n #toolbox div.zoom-pan p.shortcut-tip {\n margin: 2px 0;\n font-size: 10px;\n color: white;\n }\n\n #toolbox div.zoom-pan:hover p.shortcut-tip {\n color: black;\n }\n\n .ulabel-night #toolbox div.zoom-pan p.shortcut-tip {\n margin: 0;\n font-size: 10px;\n color: black;\n }\n\n .ulabel-night #toolbox div.zoom-pan:hover p.shortcut-tip {\n color: white;\n }\n \n #toolbox.ulabel-night div.zoom-pan:hover p.pan-shortcut-tip {\n color: white;\n }\n \n #toolbox div.zoom-pan p.zoom-shortcut-tip {\n grid-area: zoom-tip;\n }\n \n #toolbox div.zoom-pan p.pan-shortcut-tip {\n grid-area: pan-tip;\n }\n \n #toolbox div.zoom-pan span.pan-label {\n margin-right: 10px;\n }\n \n #toolbox div.zoom-pan span.pan-button-holder {\n display: inline-grid;\n position: relative;\n grid-template-rows: 28px 28px;\n grid-template-columns: 28px 28px;\n grid-template-areas:\n \"left top\"\n \"bottom right\";\n transform: rotate(-45deg);\n gap: 1px;\n }\n \n #toolbox div.zoom-pan span.pan-button-holder > * {\n border: 1px solid gray;\n }\n \n #toolbox div.zoom-pan button.ulabel-pan:hover {\n background-color: cornflowerblue;\n }\n \n #toolbox div.zoom-pan button.ulabel-pan-left {\n grid-area: left;\n border-radius: 100% 0 0 0;\n }\n \n #toolbox div.zoom-pan button.ulabel-pan-right {\n grid-area: right;\n border-radius: 0 0 100% 0;\n }\n \n #toolbox div.zoom-pan button.ulabel-pan-up {\n grid-area: top;\n border-radius: 0 100% 0 0;\n }\n \n #toolbox div.zoom-pan button.ulabel-pan-down {\n grid-area: bottom;\n border-radius: 0 0 0 100%;\n }\n \n #toolbox div.zoom-pan span.spokes {\n background-color: white;\n width: 16px;\n height: 16px;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n border-radius: 50%;\n }\n \n .ulabel-night #toolbox div.zoom-pan span.spokes {\n background-color: black;\n }\n\n #toolbox div.zoom-pan div.recenter-container {\n grid-area: recenter;\n }\n \n .ulabel-night #toolbox div.zoom-pan a {\n color: lightblue;\n }\n\n .ulabel-night #toolbox div.zoom-pan a:active {\n color: white;\n }\n "; - // Create an id so this specific style tag can be referenced - var style_id = "zoom-pan-toolbox-item-styles"; - // Don't add the style tag if its already been added once - if (document.getElementById(style_id)) - return; - // Grab the document's head and create a style tag - var head = document.head || document.querySelector("head"); - var style = document.createElement("style"); - // Add the css and id to the style tag - style.appendChild(document.createTextNode(css)); - style.id = style_id; - // Add the style tag to the document's head - head.appendChild(style); - }; - ZoomPanToolboxItem.prototype.add_event_listeners = function () { - var _this = this; - var frames_exist = this.ulabel.config["image_data"].frames.length > 1; - $(document).on("click.ulabel", ".ulabel-zoom-button", function (event) { - var _a; - if ($(event.currentTarget).hasClass("ulabel-zoom-out")) { - _this.ulabel.state.zoom_val /= 1.1; - } - else if ($(event.currentTarget).hasClass("ulabel-zoom-in")) { - _this.ulabel.state.zoom_val *= 1.1; - } - _this.ulabel.rezoom(); - // Only try to update the overlay if it exists - (_a = _this.ulabel.filter_distance_overlay) === null || _a === void 0 ? void 0 : _a.draw_overlay(); - }); - $(document).on("click.ulabel", ".ulabel-pan", function (event) { - var annbox = $("#" + _this.ulabel.config.annbox_id); - if ($(event.currentTarget).hasClass("ulabel-pan-up")) { - annbox.scrollTop(annbox.scrollTop() - 20); - } - else if ($(event.currentTarget).hasClass("ulabel-pan-down")) { - annbox.scrollTop(annbox.scrollTop() + 20); - } - else if ($(event.currentTarget).hasClass("ulabel-pan-left")) { - annbox.scrollLeft(annbox.scrollLeft() - 20); - } - else if ($(event.currentTarget).hasClass("ulabel-pan-right")) { - annbox.scrollLeft(annbox.scrollLeft() + 20); - } - }); - // Add diffrent keypress events if frames exist - if (frames_exist) { - $(document).on("keypress.ulabel", function (event) { - event.preventDefault(); - switch (event.key) { - case "ArrowRight": - case "ArrowDown": - _this.ulabel.update_frame(1); - break; - case "ArrowUp": - case "ArrowLeft": - _this.ulabel.update_frame(-1); - } - }); - } - else { - $(document).on("keydown.ulabel", function (event) { - var annbox = $("#" + _this.ulabel.config.annbox_id); - switch (event.key) { - case "ArrowLeft": - annbox.scrollLeft(annbox.scrollLeft() - 20); - event.preventDefault(); - break; - case "ArrowRight": - annbox.scrollLeft(annbox.scrollLeft() + 20); - event.preventDefault(); - break; - case "ArrowUp": - annbox.scrollTop(annbox.scrollTop() - 20); - event.preventDefault(); - break; - case "ArrowDown": - annbox.scrollTop(annbox.scrollTop() + 20); - event.preventDefault(); - break; - default: - } - }); - } - $(document).on("click.ulabel", "#recenter-button", function () { - _this.ulabel.show_initial_crop(); - }); - $(document).on("click.ulabel", "#recenter-whole-image-button", function () { - _this.ulabel.show_whole_image(); - }); - $(document).on("keypress.ulabel", function (e) { - if (e.key == _this.ulabel.config.change_zoom_keybind.toLowerCase()) { - document.getElementById("recenter-button").click(); - } - if (e.key == _this.ulabel.config.change_zoom_keybind.toUpperCase()) { - document.getElementById("recenter-whole-image-button").click(); - } - }); - }; - ZoomPanToolboxItem.prototype.set_frame_range = function (ulabel) { - if (ulabel.config["image_data"]["frames"].length == 1) { - this.frame_range = ""; - return; - } - this.frame_range = "\n
\n

scroll to switch frames

\n
\n
\n Frame  \n \n
\n
\n
\n "); - }; - ZoomPanToolboxItem.prototype.get_html = function () { - return "\n
\n
\n Zoom\n \n \n \n \n
\n

ctrl+scroll or shift+drag

\n
\n
\n Pan\n \n \n \n \n \n \n \n
\n
\n

scrollclick+drag or ctrl+drag

\n \n ".concat(this.frame_range, "\n
\n "); - }; - ZoomPanToolboxItem.prototype.after_init = function () { - // This toolbox item doesn't need to do anything after initialization - }; - ZoomPanToolboxItem.prototype.get_toolbox_item_type = function () { - return "ZoomPan"; - }; - return ZoomPanToolboxItem; -}(ToolboxItem)); -exports.ZoomPanToolboxItem = ZoomPanToolboxItem; -/** - * Toolbox item for selection Annotation ID. - */ -var AnnotationIDToolboxItem = /** @class */ (function (_super) { - __extends(AnnotationIDToolboxItem, _super); - function AnnotationIDToolboxItem(ulabel) { - var _this = _super.call(this) || this; - _this.ulabel = ulabel; - _this.set_instructions(ulabel); - _this.add_styles(); - return _this; - } - /** - * Create the css for this ToolboxItem and append it to the page. - */ - AnnotationIDToolboxItem.prototype.add_styles = function () { - // Define the css - var css = "\n #toolbox div.classification div.id-toolbox-app {\n margin-bottom: 1rem;\n }\n "; - // Create an id so this specific style tag can be referenced - var style_id = "annotation-id-toolbox-item-styles"; - // Don't add the style tag if its already been added once - if (document.getElementById(style_id)) - return; - // Grab the document's head and create a style tag - var head = document.head || document.querySelector("head"); - var style = document.createElement("style"); - // Add the css and id to the style tag - style.appendChild(document.createTextNode(css)); - style.id = style_id; - // Add the style tag to the document's head - head.appendChild(style); - }; - AnnotationIDToolboxItem.prototype.set_instructions = function (ulabel) { - this.instructions = ""; - if (ulabel.config["instructions_url"] != null) { - this.instructions = "\n Instructions\n "); - } - }; - /** - * Get the html skeleton for this ToolboxItem. The actual ID selection items will be added - * in html_builder.ts in the function build_id_dialogs() - * - * @returns html string - */ - AnnotationIDToolboxItem.prototype.get_html = function () { - return "\n
\n

Annotation ID

\n
\n
\n
\n ".concat(this.instructions, "\n
\n "); - }; - AnnotationIDToolboxItem.prototype.after_init = function () { - // This toolbox item doesn't need to do anything after initialization - }; - AnnotationIDToolboxItem.prototype.get_toolbox_item_type = function () { - return "AnnotationID"; - }; - return AnnotationIDToolboxItem; -}(ToolboxItem)); -exports.AnnotationIDToolboxItem = AnnotationIDToolboxItem; -var ClassCounterToolboxItem = /** @class */ (function (_super) { - __extends(ClassCounterToolboxItem, _super); - // TODO (joshua-dean): Find the correct way to handle this - // eslint-disable-next-line @typescript-eslint/no-unused-vars - function ClassCounterToolboxItem() { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - var _this = _super.call(this) || this; - _this.inner_HTML = "

Annotation Count

"; - _this.add_styles(); - return _this; - } - /** - * Create the css for this ToolboxItem and append it to the page. - */ - ClassCounterToolboxItem.prototype.add_styles = function () { - // Define the css - var css = " /* ClassCounterToolboxItem currently requires no styling */ "; - // Create an id so this specific style tag can be referenced - var style_id = "class-counter-toolbox-item-styles"; - // Don't add the style tag if its already been added once - if (document.getElementById(style_id)) - return; - // Grab the document's head and create a style tag - var head = document.head || document.querySelector("head"); - var style = document.createElement("style"); - // Add the css and id to the style tag - style.appendChild(document.createTextNode(css)); - style.id = style_id; - // Add the style tag to the document's head - head.appendChild(style); - }; - /** - * Update the Class Counter with the current number of active annotations. - * - * @param {ULabelSubtask} subtask Subtask to update the counter for. - */ - ClassCounterToolboxItem.prototype.update_toolbox_counter = function (subtask) { - if (subtask == null) { - return; - } - var class_ids = subtask.class_ids; - var i, j; - var class_counts = {}; - for (i = 0; i < class_ids.length; i++) { - class_counts[class_ids[i]] = 0; - } - var annotations = subtask.annotations.access; - var annotation_ids = subtask.annotations.ordering; - var current_annotation, current_payload; - for (i = 0; i < annotation_ids.length; i++) { - current_annotation = annotations[annotation_ids[i]]; - if (current_annotation.deprecated === false) { - for (j = 0; j < current_annotation.classification_payloads.length; j++) { - current_payload = current_annotation.classification_payloads[j]; - if (current_payload.confidence > 0.0) { - class_counts[current_payload.class_id] += 1; - break; - } - } - } - } - var f_string = ""; - var class_name, class_count; - for (i = 0; i < class_ids.length; i++) { - class_name = subtask.class_defs[i].name; - // MF-Tassels Hack - if (class_name.includes("OVERWRITE")) { - continue; - } - class_count = class_counts[subtask.class_defs[i].id]; - f_string += "".concat(class_name, ": ").concat(class_count, "
"); - } - this.inner_HTML = "

Annotation Count

" + "

".concat(f_string, "

"); - }; - ClassCounterToolboxItem.prototype.get_html = function () { - return "\n
" + this.inner_HTML + "
"; - }; - ClassCounterToolboxItem.prototype.after_init = function () { - // This toolbox item doesn't need to do anything after initialization - }; - ClassCounterToolboxItem.prototype.redraw_update = function (ulabel) { - this.update_toolbox_counter(ulabel.get_current_subtask()); - $("#" + ulabel.config["toolbox_id"] + " div.toolbox-class-counter").html(this.inner_HTML); - }; - ClassCounterToolboxItem.prototype.get_toolbox_item_type = function () { - return "ClassCounter"; - }; - return ClassCounterToolboxItem; -}(ToolboxItem)); -exports.ClassCounterToolboxItem = ClassCounterToolboxItem; -/** - * Toolbox item for resizing all annotations - */ -var AnnotationResizeItem = /** @class */ (function (_super) { - __extends(AnnotationResizeItem, _super); - function AnnotationResizeItem(ulabel) { - var _this = _super.call(this) || this; - _this.cached_size = 1.5; - _this.ulabel = ulabel; - // Get default keybinds - _this.keybind_configuration = ulabel.config.default_keybinds; - // First check for a size cookie, if one isn't found then check the config - // for a default annotation size. If neither are found it will use the size - // that the annotation was saved as. - for (var subtask in ulabel.subtasks) { - var cached_size_property = ulabel.subtasks[subtask].display_name.replaceLowerConcat(" ", "-", "-cached-size"); - var size_cookie = _this.read_size_cookie(ulabel.subtasks[subtask]); - if ((size_cookie != null) && size_cookie != "NaN") { - _this.update_annotation_size(ulabel, ulabel.subtasks[subtask], Number(size_cookie)); - _this[cached_size_property] = Number(size_cookie); - } - else if (ulabel.config.default_annotation_size != undefined) { - _this.update_annotation_size(ulabel, ulabel.subtasks[subtask], ulabel.config.default_annotation_size); - _this[cached_size_property] = ulabel.config.default_annotation_size; - } - else { - var DEFAULT_SIZE = 5; - _this.update_annotation_size(ulabel, ulabel.subtasks[subtask], DEFAULT_SIZE); - _this[cached_size_property] = DEFAULT_SIZE; - } - } - _this.add_styles(); - _this.add_event_listeners(); - return _this; - } - /** - * Create the css for this ToolboxItem and append it to the page. - */ - AnnotationResizeItem.prototype.add_styles = function () { - // Define the css - var css = "\n #toolbox div.annotation-resize button:not(.circle) {\n padding: 1rem 0.5rem;\n border: 1px solid gray;\n border-radius: 10px\n }\n\n #toolbox div.annotation-resize div.annotation-resize-button-holder {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 0.5rem;\n margin-bottom: 1rem;\n }\n\n #toolbox div.annotation-resize span.annotation-vanish:hover,\n #toolbox div.annotation-resize span.annotation-size:hover {\n border-radius: 10px;\n box-shadow: 0 0 4px 2px lightgray, 0 0 white;\n }\n\n /* No box-shadow in night-mode */\n .ulabel-night #toolbox div.annotation-resize span.annotation-vanish:hover,\n .ulabel-night #toolbox div.annotation-resize span.annotation-size:hover {\n box-shadow: initial;\n }\n\n #toolbox div.annotation-resize span.annotation-size {\n display: flex;\n }\n\n #toolbox div.annotation-resize span.annotation-size #annotation-resize-s {\n border-radius: 10px 0 0 10px;\n }\n\n #toolbox div.annotation-resize span.annotation-size #annotation-resize-l {\n border-radius: 0 10px 10px 0;\n }\n \n #toolbox div.annotation-resize span.annotation-inc {\n display: flex;\n flex-direction: column;\n gap: 0.25rem;\n }\n\n #toolbox div.annotation-resize button.locked {\n background-color: #1c2d4d;\n }\n \n "; - // Create an id so this specific style tag can be referenced - var style_id = "resize-annotation-toolbox-item-styles"; - // Don't add the style tag if its already been added once - if (document.getElementById(style_id)) - return; - // Grab the document's head and create a style tag - var head = document.head || document.querySelector("head"); - var style = document.createElement("style"); - // Add the css and id to the style tag - style.appendChild(document.createTextNode(css)); - style.id = style_id; - // Add the style tag to the document's head - head.appendChild(style); - }; - AnnotationResizeItem.prototype.add_event_listeners = function () { - var _this = this; - $(document).on("click.ulabel", ".annotation-resize-button", function (event) { - // Get the current subtask - var current_subtask_key = _this.ulabel.get_current_subtask_key(); - var current_subtask = _this.ulabel.get_current_subtask(); - // Get the clicked button - var button = $(event.currentTarget); - // Use the button id to get what size to resize the annotations to - var annotation_size = button.attr("id").slice(18); - // Update the size of all annotations in the subtask - _this.update_annotation_size(_this.ulabel, current_subtask, annotation_size); - _this.ulabel.redraw_all_annotations(current_subtask_key, null, false); - }); - $(document).on("keydown.ulabel", function (event) { - // Get the current subtask - var current_subtask = _this.ulabel.get_current_subtask(); - switch (event.key) { - case _this.keybind_configuration.annotation_vanish.toUpperCase(): - _this.update_all_subtask_annotation_size(_this.ulabel, ValidResizeValues.VANISH); - break; - case _this.keybind_configuration.annotation_vanish.toLowerCase(): - _this.update_annotation_size(_this.ulabel, current_subtask, ValidResizeValues.VANISH); - break; - case _this.keybind_configuration.annotation_size_small: - _this.update_annotation_size(_this.ulabel, current_subtask, ValidResizeValues.SMALL); - break; - case _this.keybind_configuration.annotation_size_large: - _this.update_annotation_size(_this.ulabel, current_subtask, ValidResizeValues.LARGE); - break; - case _this.keybind_configuration.annotation_size_minus: - _this.update_annotation_size(_this.ulabel, current_subtask, ValidResizeValues.DECREMENT); - break; - case _this.keybind_configuration.annotation_size_plus: - _this.update_annotation_size(_this.ulabel, current_subtask, ValidResizeValues.INCREMENT); - break; - default: - // Return if no valid keybind was pressed - return; - } - // If the sizes were updated resize the annotations - _this.ulabel.redraw_all_annotations(null, null, false); - }); - }; - /** - * Takes in either a number or a ValidResizeValues.value. If given a number it will resize all annotations in the subtask to - * be that size. The ValidResizeValues will either set the size of all annotations to set values or increment/decrement the - * current size of the annotations. - * - * @param subtask Subtask which holds the annotations to act on - * @param size How to resize the annotations - */ - AnnotationResizeItem.prototype.update_annotation_size = function (ulabel, subtask, size) { - if (subtask === null) - return; - var small_size = 1.5; - var large_size = 5; - var increment_size = 0.5; - var subtask_cached_size = subtask.display_name.replaceLowerConcat(" ", "-", "-cached-size"); - var subtask_vanished_flag = subtask.display_name.replaceLowerConcat(" ", "-", "-vanished"); - // If the annotations are currently vanished and a button other than the vanish button is - // pressed, then we want to ignore the input - if (this[subtask_vanished_flag] && size !== "v") - return; - // If a number was passed in, set all annotations to be the size of the number - if (typeof (size) === "number") { - this.loop_through_annotations(subtask, size, "="); - return; - } - // Otherwise handle each ValidResizeValues case here - switch (size) { - case ValidResizeValues.SMALL: - this.loop_through_annotations(subtask, small_size, "="); - this[subtask_cached_size] = small_size; - break; - case ValidResizeValues.LARGE: - this.loop_through_annotations(subtask, large_size, "="); - this[subtask_cached_size] = large_size; - break; - case ValidResizeValues.DECREMENT: - this.loop_through_annotations(subtask, increment_size, "-"); - if (this[subtask_cached_size] - increment_size > vanish_size) { - this[subtask_cached_size] -= increment_size; - } - else { - this[subtask_cached_size] = vanish_size; - } - break; - case ValidResizeValues.INCREMENT: - this.loop_through_annotations(subtask, increment_size, "+"); - this[subtask_cached_size] += increment_size; - break; - case ValidResizeValues.VANISH: - if (this[subtask_vanished_flag]) { - // Re-apply the cashed annotation size - this.loop_through_annotations(subtask, this[subtask_cached_size], "="); - // Filp the state - this[subtask_vanished_flag] = !this[subtask_vanished_flag]; - // Unlock the vanish button - $("#annotation-resize-v").removeClass("locked"); - } - else { - // Apply the vanish size to make the annotations to small to see - this.loop_through_annotations(subtask, vanish_size, "="); - // Filp the state - this[subtask_vanished_flag] = !this[subtask_vanished_flag]; - // Lock the vanish button - $("#annotation-resize-v").addClass("locked"); - } - break; - default: - console.error("update_annotation_size called with unknown size"); - } - // Store the new size as the default if we should be tracking it - if (ulabel.state.line_size !== null) { - ulabel.state.line_size = this[subtask_cached_size]; - } - }; - // Loop through all annotations in a subtask and change their line size - AnnotationResizeItem.prototype.loop_through_annotations = function (subtask, size, operation) { - for (var annotation_id in subtask.annotations.access) { - switch (operation) { - case "=": - subtask.annotations.access[annotation_id].line_size = size; - break; - case "+": - subtask.annotations.access[annotation_id].line_size += size; - break; - case "-": - // Check to make sure annotation line size won't go 0 or negative. - // If it would, set it equal to a small positive number - if (subtask.annotations.access[annotation_id].line_size - size <= vanish_size) { - subtask.annotations.access[annotation_id].line_size = vanish_size; - } - else { - subtask.annotations.access[annotation_id].line_size -= size; - } - break; - default: - throw Error("Invalid Operation given to loop_through_annotations"); - } - } - if (subtask.annotations.ordering.length > 0) { - var line_size = subtask.annotations.access[subtask.annotations.ordering[0]].line_size; - if (line_size !== vanish_size) { - this.set_size_cookie(line_size, subtask); - } - } - }; - // Loop through all subtasks and apply a size to them all - AnnotationResizeItem.prototype.update_all_subtask_annotation_size = function (ulabel, size) { - for (var subtask in ulabel.subtasks) { - this.update_annotation_size(ulabel, ulabel.subtasks[subtask], size); - } - }; - AnnotationResizeItem.prototype.redraw_update = function (ulabel) { - // Ensure the vanish button reflects the vanish state of the current subtask - var current_subtask = ulabel.get_current_subtask(); - var subtask_vanished_flag = current_subtask.display_name.replaceLowerConcat(" ", "-", "-vanished"); - if (this[subtask_vanished_flag]) { - $("#annotation-resize-v").addClass("locked"); - } - else { - $("#annotation-resize-v").removeClass("locked"); - } - }; - AnnotationResizeItem.prototype.set_size_cookie = function (cookie_value, subtask) { - var d = new Date(); - d.setTime(d.getTime() + (10000 * 24 * 60 * 60 * 1000)); - var subtask_name = subtask.display_name.replaceLowerConcat(" ", "_"); - document.cookie = subtask_name + "_size=" + cookie_value + ";" + d.toUTCString() + ";path=/"; - }; - AnnotationResizeItem.prototype.read_size_cookie = function (subtask) { - var subtask_name = subtask.display_name.replaceLowerConcat(" ", "_"); - var cookie_name = subtask_name + "_size="; - var cookie_array = document.cookie.split(";"); - for (var i = 0; i < cookie_array.length; i++) { - var current_cookie = cookie_array[i]; - // while there's whitespace at the front of the cookie, loop through and remove it - while (current_cookie.charAt(0) == " ") { - current_cookie = current_cookie.substring(1); - } - if (current_cookie.indexOf(cookie_name) == 0) { - return current_cookie.substring(cookie_name.length, current_cookie.length); - } - } - return null; - }; - AnnotationResizeItem.prototype.get_html = function () { - return "\n
\n

Change Annotation Size

\n
\n \n \n \n \n \n \n \n \n \n \n \n
\n
\n "; - }; - AnnotationResizeItem.prototype.after_init = function () { - // This toolbox item doesn't need to do anything after initialization - }; - AnnotationResizeItem.prototype.get_toolbox_item_type = function () { - return "AnnotationResize"; - }; - return AnnotationResizeItem; -}(ToolboxItem)); -exports.AnnotationResizeItem = AnnotationResizeItem; -/** - * ToolboxItem for recoloring annotations and applying gradients to annotations based on confidence. - */ -var RecolorActiveItem = /** @class */ (function (_super) { - __extends(RecolorActiveItem, _super); - function RecolorActiveItem(ulabel) { - var _a; - var _this = _super.call(this) || this; - _this.most_recent_redraw_time = 0; - // Save ulabel to this object and grab this component's config from the main config - _this.ulabel = ulabel; - _this.config = _this.ulabel.config.recolor_active_toolbox_item; - // Add styles and event listeners for this component - _this.add_styles(); - _this.add_event_listeners(); - // Read local storage to see if any colors have been saved - _this.read_local_storage(); - // Use the config's default only if a value wasn't found inside local storage - (_a = _this.gradient_turned_on) !== null && _a !== void 0 ? _a : (_this.gradient_turned_on = _this.config.gradient_turned_on); - return _this; - } - RecolorActiveItem.prototype.save_local_storage_color = function (class_id, color) { - (0, utilities_1.set_local_storage_item)("RecolorActiveItem-".concat(class_id), color); - }; - RecolorActiveItem.prototype.save_local_storage_gradient = function (gradient_status) { - (0, utilities_1.set_local_storage_item)("RecolorActiveItem-Gradient", gradient_status); - }; - RecolorActiveItem.prototype.read_local_storage = function () { - // Loop through every valid id and see if a color has been saved for it in local storage - for (var _i = 0, _a = this.ulabel.valid_class_ids; _i < _a.length; _i++) { - var class_id = _a[_i]; - // Get the color from local storage based on the current class id - var color = (0, utilities_1.get_local_storage_item)("RecolorActiveItem-".concat(class_id)); - // Update the color if its not null - // Additionally no need to save the color to local storage since we got it from reading local storage - if (color !== null) - this.update_color(class_id, color, false); - } - // Then read whether or not the gradient should be on by default - this.gradient_turned_on = (0, utilities_1.get_local_storage_item)("RecolorActiveItem-Gradient"); - }; - RecolorActiveItem.prototype.replace_color_pie = function () { - // Only the current subtask's color can be changed, so only the current subtask needs to be updated - var current_subtask_key = this.ulabel.state.current_subtask; - var current_subtask = this.ulabel.subtasks[current_subtask_key]; - // Get the back and front id dialog's ids - var id_dialog_id = current_subtask.state.idd_id; - var front_id_dialog_id = this.ulabel.subtasks[current_subtask_key].state.idd_id_front; - // Need the width and inner radius of the pie to re-build it - var width = this.ulabel.config.outer_diameter; - var inner_radius = this.ulabel.config.inner_prop * width / 2; - var color_info = this.ulabel.color_info; - // Grab the dialogs and their containers - var subtask_dialog_container_jq = $("#dialogs__" + current_subtask_key); - var id_dialog_container = $("#id_dialog__".concat(current_subtask_key)); - var front_subtask_dialog_container_jq = $("#front_dialogs__" + current_subtask_key); - var front_id_dialog_container = $("#id_front_dialog__".concat(current_subtask_key)); - // Build the html - var dialog_html_v2 = (0, html_builder_1.get_idd_string)(id_dialog_id, width, this.ulabel.subtasks[current_subtask_key].class_ids, inner_radius, color_info); - var front_dialog_html_v2 = (0, html_builder_1.get_idd_string)(front_id_dialog_id, width, this.ulabel.subtasks[current_subtask_key].class_ids, inner_radius, color_info); - // Remove the old pies - id_dialog_container.remove(); - front_id_dialog_container.remove(); - // Add dialog to the document inside their containers - front_subtask_dialog_container_jq.append(front_dialog_html_v2); - subtask_dialog_container_jq.append(dialog_html_v2); - // Re-add the event listener for changing the opacity on hover - // Set that = this because this references the element inside the event listener instead of the toolbox item - // TODO (joshua-dean): Don't alias this - // https://typescript-eslint.io/rules/no-this-alias/ - // eslint-disable-next-line @typescript-eslint/no-this-alias - var that = this; - $(".id_dialog").on("mousemove.ulabel", function (mouse_event) { - if (!that.ulabel.subtasks[current_subtask_key].state.idd_thumbnail) { - that.ulabel.handle_id_dialog_hover(mouse_event); - } - }); - }; - RecolorActiveItem.prototype.update_color = function (class_id, color, need_to_save) { - if (need_to_save === void 0) { need_to_save = true; } - // Update the color_info for annotations appropriately - this.ulabel.color_info[class_id] = color; - // Update the color in the AnnotationId button for this class - var button_color_square = document.querySelector("#toolbox_sel_".concat(class_id, " > div")); - if (button_color_square) - button_color_square.style.backgroundColor = color; - // Update the id update pie - this.replace_color_pie(); - // Save the color to local storage if appropriate - if (need_to_save) - this.save_local_storage_color(class_id, color); - }; - RecolorActiveItem.prototype.add_styles = function () { - // Define the css - var css = "\n #toolbox div.recolor-active {\n padding: 0 2rem;\n }\n\n #toolbox div.recolor-active div.recolor-tbi-gradient {\n font-size: 80%;\n }\n\n #toolbox div.recolor-active div.gradient-toggle-container {\n text-align: left;\n display: flex;\n align-items: center;\n }\n\n #toolbox div.recolor-active div.gradient-slider-container {\n display: flex;\n align-items: center;\n }\n\n #toolbox div.recolor-active div.gradient-slider-container > input {\n width: 50%;\n }\n\n #toolbox div.recolor-active div.annotation-recolor-button-holder {\n margin: 0.5rem;\n display: grid;\n grid-template-columns: 2fr 1fr;\n grid-template-rows: 1fr 1fr 1fr;\n grid-template-areas:\n \"yellow picker\"\n \"red picker\"\n \"cyan picker\";\n gap: 0.25rem 0.75rem;\n }\n\n #toolbox div.recolor-active div.annotation-recolor-button-holder .color-change-btn {\n height: 1.5rem;\n border-radius: 0.5rem;\n }\n\n #toolbox div.recolor-active div.annotation-recolor-button-holder #color-change-yellow {\n grid-area: yellow;\n background-color: yellow;\n border: 1px solid rgb(200, 200, 0);\n }\n\n #toolbox div.recolor-active div.annotation-recolor-button-holder #color-change-red {\n grid-area: red;\n background-color: red;\n border: 1px solid rgb(200, 0, 0);\n }\n\n #toolbox div.recolor-active div.annotation-recolor-button-holder #color-change-cyan {\n grid-area: cyan;\n background-color: cyan;\n border: 1px solid rgb(0, 200, 200);\n }\n\n #toolbox div.recolor-active div.annotation-recolor-button-holder div.color-picker-border {\n grid-area: picker;\n background: linear-gradient(to bottom right, red, orange, yellow, green, blue, indigo, violet);\n border: 1px solid black;\n border-radius: 0.5rem;\n }\n\n #toolbox div.recolor-active div.annotation-recolor-button-holder div.color-picker-border div.color-picker-container {\n width: calc(100% - 8px);\n height: calc(100% - 8px);\n margin: 3px;\n background-color: black;\n border: 1px solid black;\n border-radius: 0.5rem;\n }\n\n #toolbox div.recolor-active div.color-picker-container input.color-change-picker {\n width: 100%;\n height: 100%;\n padding: 0;\n opacity: 0;\n }"; - // Create an id so this specific style tag can be referenced - var style_id = "recolor-toolbox-item-styles"; - // Don't add the style tag if its already been added once - if (document.getElementById(style_id)) - return; - // Grab the document's head and create a style tag - var head = document.head || document.querySelector("head"); - var style = document.createElement("style"); - // Add the css and id to the style tag - style.appendChild(document.createTextNode(css)); - style.id = style_id; - // Add the style tag to the document's head - head.appendChild(style); - }; - RecolorActiveItem.prototype.add_event_listeners = function () { - var _this = this; - // Listener for the static color change buttons - $(document).on("click.ulabel", ".color-change-btn", function (event) { - // Grab the color of what button was clicked - var color = event.target.id.slice(13); - // Get the currently selected class id - var active_class_id = (0, utilities_1.get_active_class_id)(_this.ulabel); - // Overwrite the color info with the new color - _this.update_color(active_class_id, color); - // Redraw the annotations with the new color - // Since this is a listener for a button, no limit needs to be imposed on the redrawing - _this.redraw(0); - }); - // Listener for the color picker - $(document).on("input.ulabel", "input.color-change-picker", function (event) { - // Get the selected color from the event - var color = event.currentTarget.value; - // Get the currently selected class id - var active_class_id = (0, utilities_1.get_active_class_id)(_this.ulabel); - // Update the color for this class - _this.update_color(active_class_id, color); - // Grab the color picker container and update its background to the selected color - var color_picker_container = document.getElementById("color-picker-container"); - color_picker_container.style.backgroundColor = color; - // Redraw the annotations with the new color - _this.redraw(); - }); - // Event listener for the gradient toggle - $(document).on("input.ulabel", "#gradient-toggle", function (event) { - // Redraw all annotations, not just those in the active subtask because all subtasks can be effected by the gradient - _this.redraw(0); - // Save whether or not the toggle is checked so when the page is reloaded it can remain in the same state - _this.save_local_storage_gradient(event.target.checked); - }); - // Event listener for the gradient max value slider - $(document).on("input.ulabel", "#gradient-slider", function (event) { - // Update the slider's label so the user knows exactly which value is selected - $("div.gradient-slider-value-display").text(event.currentTarget.value + "%"); - // Redraw all annotations because other subtasks can be effected by the gradient slider - _this.redraw(100, true); - }); - }; - /** - * Redraw all annotations in the current subtask. Limits how frequently annotations can be redrawn for performance reasons. - * - * @param wait_time Number of milliseconds that must pass since the previous redraw before drawing is allowed again - * @param redraw_all_annotations False by default. If true, redraws all subtasks. Otherwise only redraws current subtask - */ - RecolorActiveItem.prototype.redraw = function (wait_time, redraw_all_annotations) { - if (wait_time === void 0) { wait_time = 100; } - if (redraw_all_annotations === void 0) { redraw_all_annotations = false; } - // If less than the wait time has passed since since the most recent redraw, then return without drawing - if (Date.now() - this.most_recent_redraw_time < wait_time) - return; - if (redraw_all_annotations) { - // Redraw all annotations - this.ulabel.redraw_all_annotations(); - } - else { - // Otherwise only redraw the annotations in the subtask we updated - var current_subtask_key = this.ulabel.state.current_subtask; - this.ulabel.redraw_all_annotations(current_subtask_key); - } - // Update the most_recent_redraw_time - this.most_recent_redraw_time = Date.now(); - }; - RecolorActiveItem.prototype.get_html = function () { - return "\n
\n

Recolor Annotations

\n
\n
\n \n \n
\n
\n \n \n
100%
\n
\n
\n
\n \n \n \n
\n
\n \n
\n
\n
\n
\n "); - }; - RecolorActiveItem.prototype.after_init = function () { - // This toolbox item doesn't need to do anything after initialization - }; - RecolorActiveItem.prototype.get_toolbox_item_type = function () { - return "RecolorActive"; - }; - return RecolorActiveItem; -}(ToolboxItem)); -exports.RecolorActiveItem = RecolorActiveItem; -var KeypointSliderItem = /** @class */ (function (_super) { - __extends(KeypointSliderItem, _super); - // TODO (joshua-dean): See if we can narrow this any - // eslint-disable-next-line @typescript-eslint/no-explicit-any - function KeypointSliderItem(ulabel, kwargs) { - var _this = _super.call(this) || this; - _this.filter_value = 0; - _this.inner_HTML = "

Keypoint Slider

"; - _this.ulabel = ulabel; - // Use properties in kwargs if kwargs is present - if (kwargs !== undefined) { - _this.name = kwargs.name; - _this.filter_function = kwargs.filter_function; - _this.get_confidence = kwargs.confidence_function; - _this.mark_deprecated = kwargs.mark_deprecated; - _this.keybinds = kwargs.keybinds; - } - else { - // Otherwise use defaults - _this.name = "Keypoint Slider"; - _this.filter_function = annotation_operators_1.value_is_lower_than_filter; - _this.get_confidence = annotation_operators_1.get_annotation_confidence; - _this.mark_deprecated = annotation_operators_1.mark_deprecated; - _this.keybinds = { - increment: "2", - decrement: "1", - }; - kwargs = {}; - } - // Create slider bar id - _this.slider_bar_id = _this.name.replaceLowerConcat(" ", "-"); - // If the config has a default value override the filter_value - var has_filter_override = Object.prototype.hasOwnProperty.call(_this.ulabel.config, _this.name.replaceLowerConcat(" ", "_", "_default_value")); - if (has_filter_override) { - // Set the filter value - _this.filter_value = _this.ulabel.config[_this.name.replaceLowerConcat(" ", "_", "_default_value")]; - } - // Check the config to see if we should update the annotations with the default filter on load - if (_this.ulabel.config.filter_annotations_on_load) { - _this.filter_annotations(_this.ulabel); - } - _this.add_styles(); - return _this; - } - /** - * Create the css for this ToolboxItem and append it to the page. - */ - KeypointSliderItem.prototype.add_styles = function () { - // Define the css - var css = "\n /* Component has no css?? */\n "; - // Create an id so this specific style tag can be referenced - var style_id = "keypoint-slider-toolbox-item-styles"; - // Don't add the style tag if its already been added once - if (document.getElementById(style_id)) - return; - // Grab the document's head and create a style tag - var head = document.head || document.querySelector("head"); - var style = document.createElement("style"); - // Add the css and id to the style tag - style.appendChild(document.createTextNode(css)); - style.id = style_id; - // Add the style tag to the document's head - head.appendChild(style); - }; - /** - * Given the ulabel object and a filter value, go through each annotation and decide whether or - * not to deprecate it. - * - * @param ulabel ULabel object - * @param filter_value The number between 0-100 which annotation's confidence is compared against - * @param redraw whether or not to redraw the annotations after filtering - * @returns Annotations that were modified, organized by subtask key - */ - KeypointSliderItem.prototype.filter_annotations = function (ulabel, filter_value, redraw) { - if (filter_value === void 0) { filter_value = null; } - if (redraw === void 0) { redraw = false; } - if (filter_value === null) { - // Use stored filter value if none is passed in - filter_value = Math.round(this.filter_value * 100); - } - // Store which annotations need to be redrawn - var annotations_ids_to_redraw_by_subtask = {}; - // Initialize the object with the subtask keys - for (var subtask_key in ulabel.subtasks) { - annotations_ids_to_redraw_by_subtask[subtask_key] = []; - } - // Get all point annotations - var point_and_line_annotations = (0, annotation_operators_1.get_point_and_line_annotations)(ulabel); - for (var _i = 0, _a = point_and_line_annotations[0]; _i < _a.length; _i++) { - var annotation = _a[_i]; - // Get the annotation's confidence as decimal between 0-1 - var confidence = this.get_confidence(annotation); - // filter_value will be a number between 0-100, so convert the confidence to a percentage as well - confidence = Math.round(confidence * 100); - // Compare the confidence value against the filter value - var should_deprecate = this.filter_function(confidence, filter_value); - // Check if an annotation should be deprecated or undeprecated, else do nothing - if ((should_deprecate && !annotation.deprecated) || - (!should_deprecate && annotation.deprecated)) { - // Mark this annotation as either deprecated or undeprecated by the confidence filter - this.mark_deprecated(annotation, should_deprecate, "confidence_filter"); - annotations_ids_to_redraw_by_subtask[annotation.subtask_key].push(annotation.id); - } - } - if (redraw) { - // Redraw each subtask's annotations - for (var subtask_key in annotations_ids_to_redraw_by_subtask) { - ulabel.redraw_multiple_spatial_annotations(annotations_ids_to_redraw_by_subtask[subtask_key], subtask_key); - } - // Update class counter - ulabel.toolbox.redraw_update_items(ulabel); - } - }; - KeypointSliderItem.prototype.get_html = function () { - var _this = this; - // Create a SliderHandler instance to handle slider interactions - var slider_handler = new html_builder_1.SliderHandler({ - id: this.name.replaceLowerConcat(" ", "-"), - class: "keypoint-slider", - default_value: Math.round(this.filter_value * 100).toString(), - label_units: "%", - slider_event: function (slider_value) { - // Filter the annotations, then redraw them - _this.filter_annotations(_this.ulabel, slider_value, true); - }, - }); - return "\n
\n

".concat(this.name, "

\n ") + slider_handler.getSliderHTML() + "\n
\n "; - }; - KeypointSliderItem.prototype.after_init = function () { - // This toolbox item doesn't need to do anything after initialization - }; - KeypointSliderItem.prototype.get_toolbox_item_type = function () { - return "KeypointSlider"; - }; - return KeypointSliderItem; -}(ToolboxItem)); -exports.KeypointSliderItem = KeypointSliderItem; -var FilterPointDistanceFromRow = /** @class */ (function (_super) { - __extends(FilterPointDistanceFromRow, _super); - // TODO (joshua-dean): Resolve kwargs usage and narrow any - // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any - function FilterPointDistanceFromRow(ulabel, kwargs) { - if (kwargs === void 0) { kwargs = null; } - var _this = _super.call(this) || this; - _this.ulabel = ulabel; - // Get this component's config from ulabel's config - _this.config = _this.ulabel.config.distance_filter_toolbox_item; - // For each key missing from the config, set the default value - for (var key in configuration_1.DEFAULT_FILTER_DISTANCE_CONFIG) { - if (!Object.prototype.hasOwnProperty.call(_this.config, key)) { - _this.config[key] = configuration_1.DEFAULT_FILTER_DISTANCE_CONFIG[key]; - } - } - // Set the component's properties to be the same as the config's properties - for (var property in _this.config) { - _this[property] = _this.config[property]; - } - // Force disable multi-class mode if the config doesn't allow it - if (_this.disable_multi_class_mode) - _this.multi_class_mode = false; - // Get if the options should be collapsed from local storage - _this.collapse_options = (0, utilities_1.get_local_storage_item)("filterDistanceCollapseOptions"); - // Create an overlay and determine whether or not it should be displayed - _this.create_overlay(); - // Check if localStorage has a value for showing the overlay - var show_overlay = (0, utilities_1.get_local_storage_item)("filterDistanceShowOverlay"); - // Guard against null values - _this.show_overlay = show_overlay !== null ? show_overlay : _this.show_overlay; - _this.overlay.update_display_overlay(_this.show_overlay); - // Check if localStorage has a value for filtering during polyline move - var filter_during_polyline_move = (0, utilities_1.get_local_storage_item)("filterDistanceFilterDuringPolylineMove"); - // Guard against null values - _this.filter_during_polyline_move = filter_during_polyline_move !== null ? filter_during_polyline_move : _this.filter_during_polyline_move; - _this.add_styles(); - _this.add_event_listeners(); - return _this; - } - /** - * Create the css for this ToolboxItem and append it to the page. - */ - FilterPointDistanceFromRow.prototype.add_styles = function () { - // Define the css - var css = "\n #toolbox div.filter-row-distance {\n text-align: left;\n }\n\n #toolbox p.tb-header {\n margin: 0.75rem 0 0.5rem;\n }\n\n #toolbox div.filter-row-distance fieldset.filter-row-distance-options {\n display: inline-block;\n position: relative;\n left: 1rem;\n margin-bottom: 0.5rem;\n font-size: 80%;\n user-select: none;\n }\n\n #toolbox div.filter-row-distance fieldset.filter-row-distance-options * {\n text-align: left;\n }\n\n #toolbox div.filter-row-distance fieldset.filter-row-distance-options.ulabel-collapsed {\n border: none;\n margin-bottom: 0;\n padding: 0; /* Padding takes up too much space without the content */\n\n /* Needed to prevent the element from moving when ulabel-collapsed is toggled \n 0.75em comes from the previous padding, 2px comes from the removed border */\n padding-left: calc(0.75em + 2px)\n }\n\n #toolbox div.filter-row-distance fieldset.filter-row-distance-options legend {\n border-radius: 0.1rem;\n padding: 0.1rem 0.3rem;\n cursor: pointer;\n }\n\n #toolbox div.filter-row-distance fieldset.filter-row-distance-options.ulabel-collapsed legend {\n padding: 0.1rem 0.28rem;\n }\n\n #toolbox div.filter-row-distance fieldset.filter-row-distance-options.ulabel-collapsed :not(legend) {\n display: none;\n }\n\n #toolbox div.filter-row-distance fieldset.filter-row-distance-options legend:hover {\n background-color: rgba(128, 128, 128, 0.3)\n }\n\n #toolbox div.filter-row-distance fieldset.filter-row-distance-options input[type=\"checkbox\"] {\n margin: 0;\n }\n\n #toolbox div.filter-row-distance fieldset.filter-row-distance-options label {\n position: relative;\n top: -0.2rem;\n font-size: smaller;\n }"; - // Create an id so this specific style tag can be referenced - var style_id = "filter-distance-from-row-toolbox-item-styles"; - // Don't add the style tag if its already been added once - if (document.getElementById(style_id)) - return; - // Grab the document's head and create a style tag - var head = document.head || document.querySelector("head"); - var style = document.createElement("style"); - // Add the css and id to the style tag - style.appendChild(document.createTextNode(css)); - style.id = style_id; - // Add the style tag to the document's head - head.appendChild(style); - }; - FilterPointDistanceFromRow.prototype.add_event_listeners = function () { - var _this = this; - // Whenever the options legend is clicked, toggle displaying the options - $(document).on("click.ulabel", "fieldset.filter-row-distance-options > legend", function () { return _this.toggleCollapsedOptions(); }); - // Whenever the multi-class filtering checkbox is clicked, switch the displayed filter mode - $(document).on("click.ulabel", "#filter-slider-distance-multi-checkbox", function (event) { - // Update the multi-class state - _this.multi_class_mode = event.currentTarget.checked; - // Toggle whether the single-class slider, or the multi-class sliders are visible - _this.switchFilterMode(); - _this.overlay.update_mode(_this.multi_class_mode); - // Re-filter the points in the new mode, recalculating all distances if changing to multi-class - var recalculate_distances = _this.multi_class_mode; - (0, annotation_operators_1.filter_points_distance_from_line)(_this.ulabel, recalculate_distances); - }); - $(document).on("change.ulabel", "#filter-slider-distance-toggle-overlay-checkbox", function (event) { - // Save the new value of `show_overlay` - _this.show_overlay = event.currentTarget.checked; - // Update whether or not the overlay is allowed to be drawn - _this.overlay.update_display_overlay(_this.show_overlay); - // Try to draw the overlay - _this.overlay.draw_overlay(); - // Save whether or not the overlay is allowed to be drawn to local storage - (0, utilities_1.set_local_storage_item)("filterDistanceShowOverlay", _this.show_overlay); - }); - $(document).on("change.ulabel", "#filter-slider-distance-filter-during-polyline-move-checkbox", function (event) { - // Save new value of `filter_during_polyline_move` - _this.filter_during_polyline_move = event.currentTarget.checked; - // Save to local storage - (0, utilities_1.set_local_storage_item)("filterDistanceFilterDuringPolylineMove", _this.filter_during_polyline_move); - }); - $(document).on("keypress.ulabel", function (event) { - if (event.key !== _this.toggle_overlay_keybind) - return; - // Grab the show overlay checkbox and click it - var show_overlay_checkbox = document.querySelector("#filter-slider-distance-toggle-overlay-checkbox"); - show_overlay_checkbox.click(); - }); - }; - /** - * Toggle which filter mode is being displayed and which one is being hidden. - */ - FilterPointDistanceFromRow.prototype.switchFilterMode = function () { - $("#filter-single-class-mode").toggleClass("ulabel-hidden"); - $("#filter-multi-class-mode").toggleClass("ulabel-hidden"); - }; - /** - * Toggles whether or not the options should be displayed. - */ - FilterPointDistanceFromRow.prototype.toggleCollapsedOptions = function () { - // Toggle the class which collapses the options - $("fieldset.filter-row-distance-options").toggleClass("ulabel-collapsed"); - // Toggle the state - this.collapse_options = !this.collapse_options; - // Save the state to the user's browser so it can be re-loaded in the same state - (0, utilities_1.set_local_storage_item)("filterDistanceCollapseOptions", this.collapse_options); - }; - FilterPointDistanceFromRow.prototype.create_overlay = function () { - // Get only the set of all line annotations - var line_annotations = (0, annotation_operators_1.get_point_and_line_annotations)(this.ulabel)[1]; - // Initialize an object to hold the distances points are allowed to be from each class as well as any line - var filter_values = { closest_row: undefined }; - // Grab all filter-distance-sliders on the page - var sliders = document.querySelectorAll(".filter-row-distance-slider"); - // Loop through each slider and populate filter_values - for (var idx = 0; idx < sliders.length; idx++) { - // Use a regex to get the string after the final - character in the slider id (Which is the class id or the string "closest_row") - var slider_class_name = /[^-]*$/.exec(sliders[idx].id)[0]; - // Use the class id as a key to store the slider's value - filter_values[slider_class_name] = { - distance: sliders[idx].valueAsNumber, - }; - } - // Create and assign an overlay class instance to ulabel to be able to access it - this.overlay = new overlays_1.FilterDistanceOverlay(this.ulabel.config["image_width"] * this.ulabel.config["px_per_px"], this.ulabel.config["image_height"] * this.ulabel.config["px_per_px"], line_annotations, this.ulabel.config["px_per_px"]); - // Apply the generated distances to the overlay - this.overlay.update_distances(filter_values); - }; - FilterPointDistanceFromRow.prototype.get_overlay = function () { - return this.overlay; - }; - /** - * Gets all classes that polylines can be and creates a distance filter for each class. - * - * @returns {string} HTML for the multi-class filtering mode - */ - FilterPointDistanceFromRow.prototype.createMultiFilterHTML = function () { - var _this = this; - // Get all potential classes - var class_defs = (0, annotation_operators_1.findAllPolylineClassDefinitions)(this.ulabel); - var multi_class_html = ""; - // Loop through each class and create their html - for (var idx = 0; idx < class_defs.length; idx++) { - // Grab current class for convenience - var current_id = class_defs[idx].id; - var current_name = class_defs[idx].name; - var default_value = void 0; - if (this.default_values[current_id] !== undefined) { - default_value = this.default_values[current_id].distance.toString(); - } - else { - default_value = this.default_values.closest_row.distance.toString(); - } - var multi_class_slider_instance = new html_builder_1.SliderHandler({ - id: "filter-row-distance-".concat(current_id), - class: "filter-row-distance-slider filter-row-distance-class-slider", - min: this.filter_min.toString(), - max: this.filter_max.toString(), - default_value: default_value, - step: this.step_value.toString(), - label_units: "px", - main_label: current_name, - slider_event: function () { return (0, annotation_operators_1.filter_points_distance_from_line)(_this.ulabel, false); }, - }); - // Add current classes html to multi_class_html - multi_class_html += multi_class_slider_instance.getSliderHTML(); - } - return multi_class_html; - }; - /** - * Returns the component's html. - * - * @returns {String} Component's html - */ - FilterPointDistanceFromRow.prototype.get_html = function () { - var _this = this; - // Get the multi-class filter html - var multi_class_html = this.createMultiFilterHTML(); - /* Create a SliderHandler instance to take care of creating the single class slider's html - and its event handlers */ - var single_class_slider_handler = new html_builder_1.SliderHandler({ - class: "filter-row-distance-slider", - default_value: this.default_values.closest_row.distance.toString(), - id: "filter-row-distance-closest_row", // `closest_row` will be extracted using regex - label_units: "px", - slider_event: function () { return (0, annotation_operators_1.filter_points_distance_from_line)(_this.ulabel, false); }, - min: this.filter_min.toString(), - max: this.filter_max.toString(), - step: this.step_value.toString(), - }); - var multi_class_mode_checkbox = ""; - // If multi-class mode is allowed, create the checkbox - if (!this.disable_multi_class_mode) { - multi_class_mode_checkbox = "\n
\n \n \n Multi-Class Filtering\n \n
"); - } - return "\n
\n

".concat(this.name, "

\n
\n \n Options \u02C5\n \n ") + multi_class_mode_checkbox + "\n
\n \n \n Show Filter Range\n \n
\n
\n \n \n Filter During Move\n \n
\n
\n
\n ").concat(single_class_slider_handler.getSliderHTML(), "\n
\n
\n ") + multi_class_html + "\n
\n
\n "; - }; - FilterPointDistanceFromRow.prototype.after_init = function () { - // This toolbox item doesn't need to do anything after initialization - }; - FilterPointDistanceFromRow.prototype.get_toolbox_item_type = function () { - return "FilterDistance"; - }; - return FilterPointDistanceFromRow; -}(ToolboxItem)); -exports.FilterPointDistanceFromRow = FilterPointDistanceFromRow; - - -/***/ }), - -/***/ 3066: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -/** - * ULabel initializer utilities and logic. - * - * This also includes "staggered" initializers to test loading. - */ -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); - return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (g && (g = 0, op[0] && (_ = 0)), _) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ulabel_init = ulabel_init; -var canvas_utils_1 = __webpack_require__(5750); -var cookies_1 = __webpack_require__(7941); -var html_builder_1 = __webpack_require__(4493); -var listeners_1 = __webpack_require__(6847); -var loader_1 = __webpack_require__(3607); -/** - * Make canvases for each subtask - * - * @param ulabel ULabel instance to create canvases for - * @param loaded_img Single loaded image for sizing - */ -function make_image_canvases(ulabel, loaded_img) { - // Store image dimensions - ulabel.config["image_height"] = loaded_img.naturalHeight; - ulabel.config["image_width"] = loaded_img.naturalWidth; - // Add canvases for each subtask and get their rendering contexts - for (var st in ulabel.subtasks) { - $("#" + ulabel.config["imwrap_id"]).append("\n
\n \n \n
\n
\n ")); - $("#" + ulabel.config["container_id"] + " div#fad_st__".concat(st)).append("\n
\n ")); - // Get canvas contexts - var canvas_bid = document.getElementById(ulabel.subtasks[st]["canvas_bid"]); - var canvas_fid = document.getElementById(ulabel.subtasks[st]["canvas_fid"]); - ulabel.subtasks[st]["state"]["back_context"] = canvas_bid.getContext("2d"); - ulabel.subtasks[st]["state"]["front_context"] = canvas_fid.getContext("2d"); - } -} -/** - * ULabel initializer logic. - * Async to ensure correct processing order; many steps are dependent on knowing the image/canvas size. - * - * @param ulabel ULabel instance to initialize. - * @param user_callback User-provided callback to run after initialization.` - */ -function ulabel_init(ulabel, user_callback) { - return __awaiter(this, void 0, void 0, function () { - var first_bg_img, image_height, image_width, _i, _a, subtask, _b, _c, anno; - return __generator(this, function (_d) { - switch (_d.label) { - case 0: - // Add stylesheet - (0, html_builder_1.add_style_to_document)(ulabel); - // Set current subtask to first subtask - ulabel.state["current_subtask"] = Object.keys(ulabel.subtasks)[0]; - // Place image element - (0, html_builder_1.prep_window_html)(ulabel, ulabel.config.toolbox_order); - // Detect night cookie - if (cookies_1.NightModeCookie.exists_in_document()) { - $("#" + ulabel.config["container_id"]).addClass("ulabel-night"); - } - first_bg_img = document.getElementById("".concat(ulabel.config["image_id_pfx"], "__0")); - return [4 /*yield*/, first_bg_img.decode()]; - case 1: - _d.sent(); - make_image_canvases(ulabel, first_bg_img); - // Once the image dimensions are known, we can resize annotations if needed - if (!ulabel.config.allow_annotations_outside_image) { - image_height = ulabel.config["image_height"]; - image_width = ulabel.config["image_width"]; - for (_i = 0, _a = Object.values(ulabel.subtasks); _i < _a.length; _i++) { - subtask = _a[_i]; - for (_b = 0, _c = Object.values(subtask.annotations.access); _b < _c.length; _b++) { - anno = _c[_b]; - anno.clamp_annotation_to_image_bounds(image_width, image_height); - } - } - } - // This step is hoisted up to show the container before the rest of the initialization - $("div#".concat(ulabel.config["container_id"])).css("display", "block"); - // Create the annotation canvases for the resume_from annotations - (0, canvas_utils_1.initialize_annotation_canvases)(ulabel); - // Add the ID dialogs' HTML to the document - (0, html_builder_1.build_id_dialogs)(ulabel); - // Add the HTML for the edit suggestion to the window - (0, html_builder_1.build_edit_suggestion)(ulabel); - // Add dialog to show annotation confidence - (0, html_builder_1.build_confidence_dialog)(ulabel); - // Create listers to manipulate and export this object - (0, listeners_1.create_ulabel_listeners)(ulabel); - ulabel.handle_toolbox_overflow(); - // Set the canvas elements in the correct stacking order given current subtask - ulabel.set_subtask(ulabel.state["current_subtask"]); - ulabel.create_overlays(); - // Indicate that the object is now init! - ulabel.is_init = true; - ulabel.show_initial_crop(); - ulabel.update_frame(); - // Draw demo annotation - ulabel.redraw_demo(); - // Draw resumed from annotations - ulabel.redraw_all_annotations(); - // Update class counter - ulabel.toolbox.redraw_update_items(ulabel); - loader_1.ULabelLoader.remove_loader_div(); - // Call the user-provided callback - user_callback(); - ulabel.after_init(); - console.log("Time taken to construct and initialize: ".concat(Date.now() - ulabel.begining_time)); - return [2 /*return*/]; - } - }); - }); -} - - -/***/ }), - -/***/ 3093: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var $isNaN = __webpack_require__(4459); - -/** @type {import('./sign')} */ -module.exports = function sign(number) { - if ($isNaN(number) || number === 0) { - return number; - } - return number < 0 ? -1 : +1; -}; - - -/***/ }), - -/***/ 3126: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var bind = __webpack_require__(6743); -var $TypeError = __webpack_require__(9675); - -var $call = __webpack_require__(76); -var $actualApply = __webpack_require__(3144); - -/** @type {(args: [Function, thisArg?: unknown, ...args: unknown[]]) => Function} TODO FIXME, find a way to use import('.') */ -module.exports = function callBindBasic(args) { - if (args.length < 1 || typeof args[0] !== 'function') { - throw new $TypeError('a function is required'); - } - return $actualApply(bind, $call, args); -}; - - -/***/ }), - -/***/ 3144: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var bind = __webpack_require__(6743); - -var $apply = __webpack_require__(1002); -var $call = __webpack_require__(76); -var $reflectApply = __webpack_require__(7119); - -/** @type {import('./actualApply')} */ -module.exports = $reflectApply || bind.call($call, $apply); - - -/***/ }), - -/***/ 3154: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var helpers_1 = __webpack_require__(8967); -var invariant_1 = __webpack_require__(8506); -var line_segment_1 = __importDefault(__webpack_require__(7042)); -var meta_1 = __webpack_require__(8421); -var geojson_rbush_1 = __importDefault(__webpack_require__(4945)); -/** - * Takes any LineString or Polygon GeoJSON and returns the intersecting point(s). - * - * @name lineIntersect - * @param {GeoJSON} line1 any LineString or Polygon - * @param {GeoJSON} line2 any LineString or Polygon - * @returns {FeatureCollection} point(s) that intersect both - * @example - * var line1 = turf.lineString([[126, -11], [129, -21]]); - * var line2 = turf.lineString([[123, -18], [131, -14]]); - * var intersects = turf.lineIntersect(line1, line2); - * - * //addToMap - * var addToMap = [line1, line2, intersects] - */ -function lineIntersect(line1, line2) { - var unique = {}; - var results = []; - // First, normalize geometries to features - // Then, handle simple 2-vertex segments - if (line1.type === "LineString") { - line1 = helpers_1.feature(line1); - } - if (line2.type === "LineString") { - line2 = helpers_1.feature(line2); - } - if (line1.type === "Feature" && - line2.type === "Feature" && - line1.geometry !== null && - line2.geometry !== null && - line1.geometry.type === "LineString" && - line2.geometry.type === "LineString" && - line1.geometry.coordinates.length === 2 && - line2.geometry.coordinates.length === 2) { - var intersect = intersects(line1, line2); - if (intersect) { - results.push(intersect); - } - return helpers_1.featureCollection(results); - } - // Handles complex GeoJSON Geometries - var tree = geojson_rbush_1.default(); - tree.load(line_segment_1.default(line2)); - meta_1.featureEach(line_segment_1.default(line1), function (segment) { - meta_1.featureEach(tree.search(segment), function (match) { - var intersect = intersects(segment, match); - if (intersect) { - // prevent duplicate points https://github.com/Turfjs/turf/issues/688 - var key = invariant_1.getCoords(intersect).join(","); - if (!unique[key]) { - unique[key] = true; - results.push(intersect); - } - } - }); - }); - return helpers_1.featureCollection(results); -} -/** - * Find a point that intersects LineStrings with two coordinates each - * - * @private - * @param {Feature} line1 GeoJSON LineString (Must only contain 2 coordinates) - * @param {Feature} line2 GeoJSON LineString (Must only contain 2 coordinates) - * @returns {Feature} intersecting GeoJSON Point - */ -function intersects(line1, line2) { - var coords1 = invariant_1.getCoords(line1); - var coords2 = invariant_1.getCoords(line2); - if (coords1.length !== 2) { - throw new Error(" line1 must only contain 2 coordinates"); - } - if (coords2.length !== 2) { - throw new Error(" line2 must only contain 2 coordinates"); - } - var x1 = coords1[0][0]; - var y1 = coords1[0][1]; - var x2 = coords1[1][0]; - var y2 = coords1[1][1]; - var x3 = coords2[0][0]; - var y3 = coords2[0][1]; - var x4 = coords2[1][0]; - var y4 = coords2[1][1]; - var denom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1); - var numeA = (x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3); - var numeB = (x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3); - if (denom === 0) { - if (numeA === 0 && numeB === 0) { - return null; - } - return null; - } - var uA = numeA / denom; - var uB = numeB / denom; - if (uA >= 0 && uA <= 1 && uB >= 0 && uB <= 1) { - var x = x1 + uA * (x2 - x1); - var y = y1 + uA * (y2 - y1); - return helpers_1.point([x, y]); - } - return null; -} -exports["default"] = lineIntersect; - - -/***/ }), - -/***/ 3183: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -// Taken from http://geomalgorithms.com/a02-_lines.html -var distance_1 = __importDefault(__webpack_require__(9391)); -var helpers_1 = __webpack_require__(8967); -var invariant_1 = __webpack_require__(8506); -var meta_1 = __webpack_require__(8421); -var rhumb_distance_1 = __importDefault(__webpack_require__(9778)); -/** - * Returns the minimum distance between a {@link Point} and a {@link LineString}, being the distance from a line the - * minimum distance between the point and any segment of the `LineString`. - * - * @name pointToLineDistance - * @param {Feature|Array} pt Feature or Geometry - * @param {Feature} line GeoJSON Feature or Geometry - * @param {Object} [options={}] Optional parameters - * @param {string} [options.units="kilometers"] can be anything supported by turf/convertLength - * (ex: degrees, radians, miles, or kilometers) - * @param {string} [options.method="geodesic"] wether to calculate the distance based on geodesic (spheroid) or - * planar (flat) method. Valid options are 'geodesic' or 'planar'. - * @returns {number} distance between point and line - * @example - * var pt = turf.point([0, 0]); - * var line = turf.lineString([[1, 1],[-1, 1]]); - * - * var distance = turf.pointToLineDistance(pt, line, {units: 'miles'}); - * //=69.11854715938406 - */ -function pointToLineDistance(pt, line, options) { - if (options === void 0) { options = {}; } - // Optional parameters - if (!options.method) { - options.method = "geodesic"; - } - if (!options.units) { - options.units = "kilometers"; - } - // validation - if (!pt) { - throw new Error("pt is required"); - } - if (Array.isArray(pt)) { - pt = helpers_1.point(pt); - } - else if (pt.type === "Point") { - pt = helpers_1.feature(pt); - } - else { - invariant_1.featureOf(pt, "Point", "point"); - } - if (!line) { - throw new Error("line is required"); - } - if (Array.isArray(line)) { - line = helpers_1.lineString(line); - } - else if (line.type === "LineString") { - line = helpers_1.feature(line); - } - else { - invariant_1.featureOf(line, "LineString", "line"); - } - var distance = Infinity; - var p = pt.geometry.coordinates; - meta_1.segmentEach(line, function (segment) { - var a = segment.geometry.coordinates[0]; - var b = segment.geometry.coordinates[1]; - var d = distanceToSegment(p, a, b, options); - if (d < distance) { - distance = d; - } - }); - return helpers_1.convertLength(distance, "degrees", options.units); -} -/** - * Returns the distance between a point P on a segment AB. - * - * @private - * @param {Array} p external point - * @param {Array} a first segment point - * @param {Array} b second segment point - * @param {Object} [options={}] Optional parameters - * @returns {number} distance - */ -function distanceToSegment(p, a, b, options) { - var v = [b[0] - a[0], b[1] - a[1]]; - var w = [p[0] - a[0], p[1] - a[1]]; - var c1 = dot(w, v); - if (c1 <= 0) { - return calcDistance(p, a, { method: options.method, units: "degrees" }); - } - var c2 = dot(v, v); - if (c2 <= c1) { - return calcDistance(p, b, { method: options.method, units: "degrees" }); - } - var b2 = c1 / c2; - var Pb = [a[0] + b2 * v[0], a[1] + b2 * v[1]]; - return calcDistance(p, Pb, { method: options.method, units: "degrees" }); -} -function dot(u, v) { - return u[0] * v[0] + u[1] * v[1]; -} -function calcDistance(a, b, options) { - return options.method === "planar" - ? rhumb_distance_1.default(a, b, options) - : distance_1.default(a, b, options); -} -exports["default"] = pointToLineDistance; - - -/***/ }), - -/***/ 3206: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var define = __webpack_require__(41); -var hasDescriptors = __webpack_require__(592)(); -var functionsHaveConfigurableNames = (__webpack_require__(4462).functionsHaveConfigurableNames)(); - -var $TypeError = TypeError; - -module.exports = function setFunctionName(fn, name) { - if (typeof fn !== 'function') { - throw new $TypeError('`fn` is not a function'); - } - var loose = arguments.length > 2 && !!arguments[2]; - if (!loose || functionsHaveConfigurableNames) { - if (hasDescriptors) { - define(fn, 'name', name, true, true); - } else { - define(fn, 'name', name); - } - } - return fn; -}; - - -/***/ }), - -/***/ 3227: -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -// ESM COMPAT FLAG -__webpack_require__.r(__webpack_exports__); - -// EXPORTS -__webpack_require__.d(__webpack_exports__, { - voronoi: () => (/* reexport */ voronoi) -}); - -;// ./node_modules/d3-voronoi/src/constant.js -/* harmony default export */ function constant(x) { - return function() { - return x; - }; -} - -;// ./node_modules/d3-voronoi/src/point.js -function point_x(d) { - return d[0]; -} - -function point_y(d) { - return d[1]; -} - -;// ./node_modules/d3-voronoi/src/RedBlackTree.js -function RedBlackTree() { - this._ = null; // root node -} - -function RedBlackNode(node) { - node.U = // parent node - node.C = // color - true for red, false for black - node.L = // left node - node.R = // right node - node.P = // previous node - node.N = null; // next node -} - -RedBlackTree.prototype = { - constructor: RedBlackTree, - - insert: function(after, node) { - var parent, grandpa, uncle; - - if (after) { - node.P = after; - node.N = after.N; - if (after.N) after.N.P = node; - after.N = node; - if (after.R) { - after = after.R; - while (after.L) after = after.L; - after.L = node; - } else { - after.R = node; - } - parent = after; - } else if (this._) { - after = RedBlackFirst(this._); - node.P = null; - node.N = after; - after.P = after.L = node; - parent = after; - } else { - node.P = node.N = null; - this._ = node; - parent = null; - } - node.L = node.R = null; - node.U = parent; - node.C = true; - - after = node; - while (parent && parent.C) { - grandpa = parent.U; - if (parent === grandpa.L) { - uncle = grandpa.R; - if (uncle && uncle.C) { - parent.C = uncle.C = false; - grandpa.C = true; - after = grandpa; - } else { - if (after === parent.R) { - RedBlackRotateLeft(this, parent); - after = parent; - parent = after.U; - } - parent.C = false; - grandpa.C = true; - RedBlackRotateRight(this, grandpa); - } - } else { - uncle = grandpa.L; - if (uncle && uncle.C) { - parent.C = uncle.C = false; - grandpa.C = true; - after = grandpa; - } else { - if (after === parent.L) { - RedBlackRotateRight(this, parent); - after = parent; - parent = after.U; - } - parent.C = false; - grandpa.C = true; - RedBlackRotateLeft(this, grandpa); - } - } - parent = after.U; - } - this._.C = false; - }, - - remove: function(node) { - if (node.N) node.N.P = node.P; - if (node.P) node.P.N = node.N; - node.N = node.P = null; - - var parent = node.U, - sibling, - left = node.L, - right = node.R, - next, - red; - - if (!left) next = right; - else if (!right) next = left; - else next = RedBlackFirst(right); - - if (parent) { - if (parent.L === node) parent.L = next; - else parent.R = next; - } else { - this._ = next; - } - - if (left && right) { - red = next.C; - next.C = node.C; - next.L = left; - left.U = next; - if (next !== right) { - parent = next.U; - next.U = node.U; - node = next.R; - parent.L = node; - next.R = right; - right.U = next; - } else { - next.U = parent; - parent = next; - node = next.R; - } - } else { - red = node.C; - node = next; - } - - if (node) node.U = parent; - if (red) return; - if (node && node.C) { node.C = false; return; } - - do { - if (node === this._) break; - if (node === parent.L) { - sibling = parent.R; - if (sibling.C) { - sibling.C = false; - parent.C = true; - RedBlackRotateLeft(this, parent); - sibling = parent.R; - } - if ((sibling.L && sibling.L.C) - || (sibling.R && sibling.R.C)) { - if (!sibling.R || !sibling.R.C) { - sibling.L.C = false; - sibling.C = true; - RedBlackRotateRight(this, sibling); - sibling = parent.R; - } - sibling.C = parent.C; - parent.C = sibling.R.C = false; - RedBlackRotateLeft(this, parent); - node = this._; - break; - } - } else { - sibling = parent.L; - if (sibling.C) { - sibling.C = false; - parent.C = true; - RedBlackRotateRight(this, parent); - sibling = parent.L; - } - if ((sibling.L && sibling.L.C) - || (sibling.R && sibling.R.C)) { - if (!sibling.L || !sibling.L.C) { - sibling.R.C = false; - sibling.C = true; - RedBlackRotateLeft(this, sibling); - sibling = parent.L; - } - sibling.C = parent.C; - parent.C = sibling.L.C = false; - RedBlackRotateRight(this, parent); - node = this._; - break; - } - } - sibling.C = true; - node = parent; - parent = parent.U; - } while (!node.C); - - if (node) node.C = false; - } -}; - -function RedBlackRotateLeft(tree, node) { - var p = node, - q = node.R, - parent = p.U; - - if (parent) { - if (parent.L === p) parent.L = q; - else parent.R = q; - } else { - tree._ = q; - } - - q.U = parent; - p.U = q; - p.R = q.L; - if (p.R) p.R.U = p; - q.L = p; -} - -function RedBlackRotateRight(tree, node) { - var p = node, - q = node.L, - parent = p.U; - - if (parent) { - if (parent.L === p) parent.L = q; - else parent.R = q; - } else { - tree._ = q; - } - - q.U = parent; - p.U = q; - p.L = q.R; - if (p.L) p.L.U = p; - q.R = p; -} - -function RedBlackFirst(node) { - while (node.L) node = node.L; - return node; -} - -/* harmony default export */ const src_RedBlackTree = (RedBlackTree); - -;// ./node_modules/d3-voronoi/src/Edge.js - - -function createEdge(left, right, v0, v1) { - var edge = [null, null], - index = edges.push(edge) - 1; - edge.left = left; - edge.right = right; - if (v0) setEdgeEnd(edge, left, right, v0); - if (v1) setEdgeEnd(edge, right, left, v1); - cells[left.index].halfedges.push(index); - cells[right.index].halfedges.push(index); - return edge; -} - -function createBorderEdge(left, v0, v1) { - var edge = [v0, v1]; - edge.left = left; - return edge; -} - -function setEdgeEnd(edge, left, right, vertex) { - if (!edge[0] && !edge[1]) { - edge[0] = vertex; - edge.left = left; - edge.right = right; - } else if (edge.left === right) { - edge[1] = vertex; - } else { - edge[0] = vertex; - } -} - -// Liang–Barsky line clipping. -function clipEdge(edge, x0, y0, x1, y1) { - var a = edge[0], - b = edge[1], - ax = a[0], - ay = a[1], - bx = b[0], - by = b[1], - t0 = 0, - t1 = 1, - dx = bx - ax, - dy = by - ay, - r; - - r = x0 - ax; - if (!dx && r > 0) return; - r /= dx; - if (dx < 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } else if (dx > 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } - - r = x1 - ax; - if (!dx && r < 0) return; - r /= dx; - if (dx < 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } else if (dx > 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } - - r = y0 - ay; - if (!dy && r > 0) return; - r /= dy; - if (dy < 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } else if (dy > 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } - - r = y1 - ay; - if (!dy && r < 0) return; - r /= dy; - if (dy < 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } else if (dy > 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } - - if (!(t0 > 0) && !(t1 < 1)) return true; // TODO Better check? - - if (t0 > 0) edge[0] = [ax + t0 * dx, ay + t0 * dy]; - if (t1 < 1) edge[1] = [ax + t1 * dx, ay + t1 * dy]; - return true; -} - -function connectEdge(edge, x0, y0, x1, y1) { - var v1 = edge[1]; - if (v1) return true; - - var v0 = edge[0], - left = edge.left, - right = edge.right, - lx = left[0], - ly = left[1], - rx = right[0], - ry = right[1], - fx = (lx + rx) / 2, - fy = (ly + ry) / 2, - fm, - fb; - - if (ry === ly) { - if (fx < x0 || fx >= x1) return; - if (lx > rx) { - if (!v0) v0 = [fx, y0]; - else if (v0[1] >= y1) return; - v1 = [fx, y1]; - } else { - if (!v0) v0 = [fx, y1]; - else if (v0[1] < y0) return; - v1 = [fx, y0]; - } - } else { - fm = (lx - rx) / (ry - ly); - fb = fy - fm * fx; - if (fm < -1 || fm > 1) { - if (lx > rx) { - if (!v0) v0 = [(y0 - fb) / fm, y0]; - else if (v0[1] >= y1) return; - v1 = [(y1 - fb) / fm, y1]; - } else { - if (!v0) v0 = [(y1 - fb) / fm, y1]; - else if (v0[1] < y0) return; - v1 = [(y0 - fb) / fm, y0]; - } - } else { - if (ly < ry) { - if (!v0) v0 = [x0, fm * x0 + fb]; - else if (v0[0] >= x1) return; - v1 = [x1, fm * x1 + fb]; - } else { - if (!v0) v0 = [x1, fm * x1 + fb]; - else if (v0[0] < x0) return; - v1 = [x0, fm * x0 + fb]; - } - } - } - - edge[0] = v0; - edge[1] = v1; - return true; -} - -function clipEdges(x0, y0, x1, y1) { - var i = edges.length, - edge; - - while (i--) { - if (!connectEdge(edge = edges[i], x0, y0, x1, y1) - || !clipEdge(edge, x0, y0, x1, y1) - || !(Math.abs(edge[0][0] - edge[1][0]) > epsilon - || Math.abs(edge[0][1] - edge[1][1]) > epsilon)) { - delete edges[i]; - } - } -} - -;// ./node_modules/d3-voronoi/src/Cell.js - - - -function createCell(site) { - return cells[site.index] = { - site: site, - halfedges: [] - }; -} - -function cellHalfedgeAngle(cell, edge) { - var site = cell.site, - va = edge.left, - vb = edge.right; - if (site === vb) vb = va, va = site; - if (vb) return Math.atan2(vb[1] - va[1], vb[0] - va[0]); - if (site === va) va = edge[1], vb = edge[0]; - else va = edge[0], vb = edge[1]; - return Math.atan2(va[0] - vb[0], vb[1] - va[1]); -} - -function cellHalfedgeStart(cell, edge) { - return edge[+(edge.left !== cell.site)]; -} - -function cellHalfedgeEnd(cell, edge) { - return edge[+(edge.left === cell.site)]; -} - -function sortCellHalfedges() { - for (var i = 0, n = cells.length, cell, halfedges, j, m; i < n; ++i) { - if ((cell = cells[i]) && (m = (halfedges = cell.halfedges).length)) { - var index = new Array(m), - array = new Array(m); - for (j = 0; j < m; ++j) index[j] = j, array[j] = cellHalfedgeAngle(cell, edges[halfedges[j]]); - index.sort(function(i, j) { return array[j] - array[i]; }); - for (j = 0; j < m; ++j) array[j] = halfedges[index[j]]; - for (j = 0; j < m; ++j) halfedges[j] = array[j]; - } - } -} - -function clipCells(x0, y0, x1, y1) { - var nCells = cells.length, - iCell, - cell, - site, - iHalfedge, - halfedges, - nHalfedges, - start, - startX, - startY, - end, - endX, - endY, - cover = true; - - for (iCell = 0; iCell < nCells; ++iCell) { - if (cell = cells[iCell]) { - site = cell.site; - halfedges = cell.halfedges; - iHalfedge = halfedges.length; - - // Remove any dangling clipped edges. - while (iHalfedge--) { - if (!edges[halfedges[iHalfedge]]) { - halfedges.splice(iHalfedge, 1); - } - } - - // Insert any border edges as necessary. - iHalfedge = 0, nHalfedges = halfedges.length; - while (iHalfedge < nHalfedges) { - end = cellHalfedgeEnd(cell, edges[halfedges[iHalfedge]]), endX = end[0], endY = end[1]; - start = cellHalfedgeStart(cell, edges[halfedges[++iHalfedge % nHalfedges]]), startX = start[0], startY = start[1]; - if (Math.abs(endX - startX) > epsilon || Math.abs(endY - startY) > epsilon) { - halfedges.splice(iHalfedge, 0, edges.push(createBorderEdge(site, end, - Math.abs(endX - x0) < epsilon && y1 - endY > epsilon ? [x0, Math.abs(startX - x0) < epsilon ? startY : y1] - : Math.abs(endY - y1) < epsilon && x1 - endX > epsilon ? [Math.abs(startY - y1) < epsilon ? startX : x1, y1] - : Math.abs(endX - x1) < epsilon && endY - y0 > epsilon ? [x1, Math.abs(startX - x1) < epsilon ? startY : y0] - : Math.abs(endY - y0) < epsilon && endX - x0 > epsilon ? [Math.abs(startY - y0) < epsilon ? startX : x0, y0] - : null)) - 1); - ++nHalfedges; - } - } - - if (nHalfedges) cover = false; - } - } - - // If there weren’t any edges, have the closest site cover the extent. - // It doesn’t matter which corner of the extent we measure! - if (cover) { - var dx, dy, d2, dc = Infinity; - - for (iCell = 0, cover = null; iCell < nCells; ++iCell) { - if (cell = cells[iCell]) { - site = cell.site; - dx = site[0] - x0; - dy = site[1] - y0; - d2 = dx * dx + dy * dy; - if (d2 < dc) dc = d2, cover = cell; - } - } - - if (cover) { - var v00 = [x0, y0], v01 = [x0, y1], v11 = [x1, y1], v10 = [x1, y0]; - cover.halfedges.push( - edges.push(createBorderEdge(site = cover.site, v00, v01)) - 1, - edges.push(createBorderEdge(site, v01, v11)) - 1, - edges.push(createBorderEdge(site, v11, v10)) - 1, - edges.push(createBorderEdge(site, v10, v00)) - 1 - ); - } - } - - // Lastly delete any cells with no edges; these were entirely clipped. - for (iCell = 0; iCell < nCells; ++iCell) { - if (cell = cells[iCell]) { - if (!cell.halfedges.length) { - delete cells[iCell]; - } - } - } -} - -;// ./node_modules/d3-voronoi/src/Circle.js - - - -var circlePool = []; - -var firstCircle; - -function Circle() { - RedBlackNode(this); - this.x = - this.y = - this.arc = - this.site = - this.cy = null; -} - -function attachCircle(arc) { - var lArc = arc.P, - rArc = arc.N; - - if (!lArc || !rArc) return; - - var lSite = lArc.site, - cSite = arc.site, - rSite = rArc.site; - - if (lSite === rSite) return; - - var bx = cSite[0], - by = cSite[1], - ax = lSite[0] - bx, - ay = lSite[1] - by, - cx = rSite[0] - bx, - cy = rSite[1] - by; - - var d = 2 * (ax * cy - ay * cx); - if (d >= -epsilon2) return; - - var ha = ax * ax + ay * ay, - hc = cx * cx + cy * cy, - x = (cy * ha - ay * hc) / d, - y = (ax * hc - cx * ha) / d; - - var circle = circlePool.pop() || new Circle; - circle.arc = arc; - circle.site = cSite; - circle.x = x + bx; - circle.y = (circle.cy = y + by) + Math.sqrt(x * x + y * y); // y bottom - - arc.circle = circle; - - var before = null, - node = circles._; - - while (node) { - if (circle.y < node.y || (circle.y === node.y && circle.x <= node.x)) { - if (node.L) node = node.L; - else { before = node.P; break; } - } else { - if (node.R) node = node.R; - else { before = node; break; } - } - } - - circles.insert(before, circle); - if (!before) firstCircle = circle; -} - -function detachCircle(arc) { - var circle = arc.circle; - if (circle) { - if (!circle.P) firstCircle = circle.N; - circles.remove(circle); - circlePool.push(circle); - RedBlackNode(circle); - arc.circle = null; - } -} - -;// ./node_modules/d3-voronoi/src/Beach.js - - - - - - -var beachPool = []; - -function Beach() { - RedBlackNode(this); - this.edge = - this.site = - this.circle = null; -} - -function createBeach(site) { - var beach = beachPool.pop() || new Beach; - beach.site = site; - return beach; -} - -function detachBeach(beach) { - detachCircle(beach); - beaches.remove(beach); - beachPool.push(beach); - RedBlackNode(beach); -} - -function removeBeach(beach) { - var circle = beach.circle, - x = circle.x, - y = circle.cy, - vertex = [x, y], - previous = beach.P, - next = beach.N, - disappearing = [beach]; - - detachBeach(beach); - - var lArc = previous; - while (lArc.circle - && Math.abs(x - lArc.circle.x) < epsilon - && Math.abs(y - lArc.circle.cy) < epsilon) { - previous = lArc.P; - disappearing.unshift(lArc); - detachBeach(lArc); - lArc = previous; - } - - disappearing.unshift(lArc); - detachCircle(lArc); - - var rArc = next; - while (rArc.circle - && Math.abs(x - rArc.circle.x) < epsilon - && Math.abs(y - rArc.circle.cy) < epsilon) { - next = rArc.N; - disappearing.push(rArc); - detachBeach(rArc); - rArc = next; - } - - disappearing.push(rArc); - detachCircle(rArc); - - var nArcs = disappearing.length, - iArc; - for (iArc = 1; iArc < nArcs; ++iArc) { - rArc = disappearing[iArc]; - lArc = disappearing[iArc - 1]; - setEdgeEnd(rArc.edge, lArc.site, rArc.site, vertex); - } - - lArc = disappearing[0]; - rArc = disappearing[nArcs - 1]; - rArc.edge = createEdge(lArc.site, rArc.site, null, vertex); - - attachCircle(lArc); - attachCircle(rArc); -} - -function addBeach(site) { - var x = site[0], - directrix = site[1], - lArc, - rArc, - dxl, - dxr, - node = beaches._; - - while (node) { - dxl = leftBreakPoint(node, directrix) - x; - if (dxl > epsilon) node = node.L; else { - dxr = x - rightBreakPoint(node, directrix); - if (dxr > epsilon) { - if (!node.R) { - lArc = node; - break; - } - node = node.R; - } else { - if (dxl > -epsilon) { - lArc = node.P; - rArc = node; - } else if (dxr > -epsilon) { - lArc = node; - rArc = node.N; - } else { - lArc = rArc = node; - } - break; - } - } - } - - createCell(site); - var newArc = createBeach(site); - beaches.insert(lArc, newArc); - - if (!lArc && !rArc) return; - - if (lArc === rArc) { - detachCircle(lArc); - rArc = createBeach(lArc.site); - beaches.insert(newArc, rArc); - newArc.edge = rArc.edge = createEdge(lArc.site, newArc.site); - attachCircle(lArc); - attachCircle(rArc); - return; - } - - if (!rArc) { // && lArc - newArc.edge = createEdge(lArc.site, newArc.site); - return; - } - - // else lArc !== rArc - detachCircle(lArc); - detachCircle(rArc); - - var lSite = lArc.site, - ax = lSite[0], - ay = lSite[1], - bx = site[0] - ax, - by = site[1] - ay, - rSite = rArc.site, - cx = rSite[0] - ax, - cy = rSite[1] - ay, - d = 2 * (bx * cy - by * cx), - hb = bx * bx + by * by, - hc = cx * cx + cy * cy, - vertex = [(cy * hb - by * hc) / d + ax, (bx * hc - cx * hb) / d + ay]; - - setEdgeEnd(rArc.edge, lSite, rSite, vertex); - newArc.edge = createEdge(lSite, site, null, vertex); - rArc.edge = createEdge(site, rSite, null, vertex); - attachCircle(lArc); - attachCircle(rArc); -} - -function leftBreakPoint(arc, directrix) { - var site = arc.site, - rfocx = site[0], - rfocy = site[1], - pby2 = rfocy - directrix; - - if (!pby2) return rfocx; - - var lArc = arc.P; - if (!lArc) return -Infinity; - - site = lArc.site; - var lfocx = site[0], - lfocy = site[1], - plby2 = lfocy - directrix; - - if (!plby2) return lfocx; - - var hl = lfocx - rfocx, - aby2 = 1 / pby2 - 1 / plby2, - b = hl / plby2; - - if (aby2) return (-b + Math.sqrt(b * b - 2 * aby2 * (hl * hl / (-2 * plby2) - lfocy + plby2 / 2 + rfocy - pby2 / 2))) / aby2 + rfocx; - - return (rfocx + lfocx) / 2; -} - -function rightBreakPoint(arc, directrix) { - var rArc = arc.N; - if (rArc) return leftBreakPoint(rArc, directrix); - var site = arc.site; - return site[1] === directrix ? site[0] : Infinity; -} - -;// ./node_modules/d3-voronoi/src/Diagram.js - - - - - - -var epsilon = 1e-6; -var epsilon2 = 1e-12; -var beaches; -var cells; -var circles; -var edges; - -function triangleArea(a, b, c) { - return (a[0] - c[0]) * (b[1] - a[1]) - (a[0] - b[0]) * (c[1] - a[1]); -} - -function lexicographic(a, b) { - return b[1] - a[1] - || b[0] - a[0]; -} - -function Diagram(sites, extent) { - var site = sites.sort(lexicographic).pop(), - x, - y, - circle; - - edges = []; - cells = new Array(sites.length); - beaches = new src_RedBlackTree; - circles = new src_RedBlackTree; - - while (true) { - circle = firstCircle; - if (site && (!circle || site[1] < circle.y || (site[1] === circle.y && site[0] < circle.x))) { - if (site[0] !== x || site[1] !== y) { - addBeach(site); - x = site[0], y = site[1]; - } - site = sites.pop(); - } else if (circle) { - removeBeach(circle.arc); - } else { - break; - } - } - - sortCellHalfedges(); - - if (extent) { - var x0 = +extent[0][0], - y0 = +extent[0][1], - x1 = +extent[1][0], - y1 = +extent[1][1]; - clipEdges(x0, y0, x1, y1); - clipCells(x0, y0, x1, y1); - } - - this.edges = edges; - this.cells = cells; - - beaches = - circles = - edges = - cells = null; -} - -Diagram.prototype = { - constructor: Diagram, - - polygons: function() { - var edges = this.edges; - - return this.cells.map(function(cell) { - var polygon = cell.halfedges.map(function(i) { return cellHalfedgeStart(cell, edges[i]); }); - polygon.data = cell.site.data; - return polygon; - }); - }, - - triangles: function() { - var triangles = [], - edges = this.edges; - - this.cells.forEach(function(cell, i) { - if (!(m = (halfedges = cell.halfedges).length)) return; - var site = cell.site, - halfedges, - j = -1, - m, - s0, - e1 = edges[halfedges[m - 1]], - s1 = e1.left === site ? e1.right : e1.left; - - while (++j < m) { - s0 = s1; - e1 = edges[halfedges[j]]; - s1 = e1.left === site ? e1.right : e1.left; - if (s0 && s1 && i < s0.index && i < s1.index && triangleArea(site, s0, s1) < 0) { - triangles.push([site.data, s0.data, s1.data]); - } - } - }); - - return triangles; - }, - - links: function() { - return this.edges.filter(function(edge) { - return edge.right; - }).map(function(edge) { - return { - source: edge.left.data, - target: edge.right.data - }; - }); - }, - - find: function(x, y, radius) { - var that = this, i0, i1 = that._found || 0, n = that.cells.length, cell; - - // Use the previously-found cell, or start with an arbitrary one. - while (!(cell = that.cells[i1])) if (++i1 >= n) return null; - var dx = x - cell.site[0], dy = y - cell.site[1], d2 = dx * dx + dy * dy; - - // Traverse the half-edges to find a closer cell, if any. - do { - cell = that.cells[i0 = i1], i1 = null; - cell.halfedges.forEach(function(e) { - var edge = that.edges[e], v = edge.left; - if ((v === cell.site || !v) && !(v = edge.right)) return; - var vx = x - v[0], vy = y - v[1], v2 = vx * vx + vy * vy; - if (v2 < d2) d2 = v2, i1 = v.index; - }); - } while (i1 !== null); - - that._found = i0; - - return radius == null || d2 <= radius * radius ? cell.site : null; - } -} - -;// ./node_modules/d3-voronoi/src/voronoi.js - - - - -/* harmony default export */ function voronoi() { - var x = point_x, - y = point_y, - extent = null; - - function voronoi(data) { - return new Diagram(data.map(function(d, i) { - var s = [Math.round(x(d, i, data) / epsilon) * epsilon, Math.round(y(d, i, data) / epsilon) * epsilon]; - s.index = i; - s.data = d; - return s; - }), extent); - } - - voronoi.polygons = function(data) { - return voronoi(data).polygons(); - }; - - voronoi.links = function(data) { - return voronoi(data).links(); - }; - - voronoi.triangles = function(data) { - return voronoi(data).triangles(); - }; - - voronoi.x = function(_) { - return arguments.length ? (x = typeof _ === "function" ? _ : constant(+_), voronoi) : x; - }; - - voronoi.y = function(_) { - return arguments.length ? (y = typeof _ === "function" ? _ : constant(+_), voronoi) : y; - }; - - voronoi.extent = function(_) { - return arguments.length ? (extent = _ == null ? null : [[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]], voronoi) : extent && [[extent[0][0], extent[0][1]], [extent[1][0], extent[1][1]]]; - }; - - voronoi.size = function(_) { - return arguments.length ? (extent = _ == null ? null : [[0, 0], [+_[0], +_[1]]], voronoi) : extent && [extent[1][0] - extent[0][0], extent[1][1] - extent[0][1]]; - }; - - return voronoi; -} - -;// ./node_modules/d3-voronoi/index.js - - - -/***/ }), - -/***/ 3284: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var invariant_1 = __webpack_require__(8506); -var meta_1 = __webpack_require__(8421); -var point_to_line_distance_1 = __importDefault(__webpack_require__(3183)); -var object_assign_1 = __importDefault(__webpack_require__(5228)); -/** - * Returns the closest {@link Point|point}, of a {@link FeatureCollection|collection} of points, - * to a {@link LineString|line}. The returned point has a `dist` property indicating its distance to the line. - * - * @name nearestPointToLine - * @param {FeatureCollection|GeometryCollection} points Point Collection - * @param {Feature|Geometry} line Line Feature - * @param {Object} [options] Optional parameters - * @param {string} [options.units='kilometers'] unit of the output distance property - * (eg: degrees, radians, miles, or kilometers) - * @param {Object} [options.properties={}] Translate Properties to Point - * @returns {Feature} the closest point - * @example - * var pt1 = turf.point([0, 0]); - * var pt2 = turf.point([0.5, 0.5]); - * var points = turf.featureCollection([pt1, pt2]); - * var line = turf.lineString([[1,1], [-1,1]]); - * - * var nearest = turf.nearestPointToLine(points, line); - * - * //addToMap - * var addToMap = [nearest, line]; - */ -function nearestPointToLine(points, line, options) { - if (options === void 0) { options = {}; } - var units = options.units; - var properties = options.properties || {}; - // validation - var pts = normalize(points); - if (!pts.features.length) { - throw new Error("points must contain features"); - } - if (!line) { - throw new Error("line is required"); - } - if (invariant_1.getType(line) !== "LineString") { - throw new Error("line must be a LineString"); - } - var dist = Infinity; - var pt = null; - meta_1.featureEach(pts, function (point) { - var d = point_to_line_distance_1.default(point, line, { units: units }); - if (d < dist) { - dist = d; - pt = point; - } - }); - /** - * Translate Properties to final Point, priorities: - * 1. options.properties - * 2. inherent Point properties - * 3. dist custom properties created by NearestPointToLine - */ - if (pt) { - pt.properties = object_assign_1.default({ dist: dist }, pt.properties, properties); - } - // if (pt) { pt.properties = objectAssign({dist}, pt.properties, properties); } - return pt; -} -/** - * Convert Collection to FeatureCollection - * - * @private - * @param {FeatureCollection|GeometryCollection} points Points - * @returns {FeatureCollection} points - */ -function normalize(points) { - var features = []; - var type = points.geometry ? points.geometry.type : points.type; - switch (type) { - case "GeometryCollection": - meta_1.geomEach(points, function (geom) { - if (geom.type === "Point") { - features.push({ type: "Feature", properties: {}, geometry: geom }); - } - }); - return { type: "FeatureCollection", features: features }; - case "FeatureCollection": - points.features = points.features.filter(function (feature) { - return feature.geometry.type === "Point"; - }); - return points; - default: - throw new Error("points must be a Point Collection"); - } -} -exports["default"] = nearestPointToLine; - - -/***/ }), - -/***/ 3351: -/***/ (function(module) { - -(function (global, factory) { - true ? module.exports = factory() : - 0; -}(this, (function () { 'use strict'; - -function quickselect(arr, k, left, right, compare) { - quickselectStep(arr, k, left || 0, right || (arr.length - 1), compare || defaultCompare); -} - -function quickselectStep(arr, k, left, right, compare) { - - while (right > left) { - if (right - left > 600) { - var n = right - left + 1; - var m = k - left + 1; - var z = Math.log(n); - var s = 0.5 * Math.exp(2 * z / 3); - var sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1); - var newLeft = Math.max(left, Math.floor(k - m * s / n + sd)); - var newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd)); - quickselectStep(arr, k, newLeft, newRight, compare); - } - - var t = arr[k]; - var i = left; - var j = right; - - swap(arr, left, k); - if (compare(arr[right], t) > 0) swap(arr, left, right); - - while (i < j) { - swap(arr, i, j); - i++; - j--; - while (compare(arr[i], t) < 0) i++; - while (compare(arr[j], t) > 0) j--; - } - - if (compare(arr[left], t) === 0) swap(arr, left, j); - else { - j++; - swap(arr, j, right); - } - - if (j <= k) left = j + 1; - if (k <= j) right = j - 1; - } -} - -function swap(arr, i, j) { - var tmp = arr[i]; - arr[i] = arr[j]; - arr[j] = tmp; -} - -function defaultCompare(a, b) { - return a < b ? -1 : a > b ? 1 : 0; -} - -return quickselect; - -}))); - - -/***/ }), - -/***/ 3414: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var earcut = __webpack_require__(6570); -var helpers = __webpack_require__(8967); - -function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } - -var earcut__default = /*#__PURE__*/_interopDefaultLegacy(earcut); - -/** - * Tesselates a {@link Feature} into a {@link FeatureCollection} of triangles - * using [earcut](https://github.com/mapbox/earcut). - * - * @name tesselate - * @param {Feature} poly the polygon to tesselate - * @returns {FeatureCollection} a geometrycollection feature - * @example - * var poly = turf.polygon([[[11, 0], [22, 4], [31, 0], [31, 11], [21, 15], [11, 11], [11, 0]]]); - * var triangles = turf.tesselate(poly); - * - * //addToMap - * var addToMap = [poly, triangles] - */ -function tesselate(poly) { - if ( - !poly.geometry || - (poly.geometry.type !== "Polygon" && poly.geometry.type !== "MultiPolygon") - ) { - throw new Error("input must be a Polygon or MultiPolygon"); - } - - var fc = { type: "FeatureCollection", features: [] }; - - if (poly.geometry.type === "Polygon") { - fc.features = processPolygon(poly.geometry.coordinates); - } else { - poly.geometry.coordinates.forEach(function (coordinates) { - fc.features = fc.features.concat(processPolygon(coordinates)); - }); - } - - return fc; -} - -function processPolygon(coordinates) { - var data = flattenCoords(coordinates); - var dim = 2; - var result = earcut__default['default'](data.vertices, data.holes, dim); - - var features = []; - var vertices = []; - - result.forEach(function (vert, i) { - var index = result[i]; - vertices.push([data.vertices[index * dim], data.vertices[index * dim + 1]]); - }); - - for (var i = 0; i < vertices.length; i += 3) { - var coords = vertices.slice(i, i + 3); - coords.push(vertices[i]); - features.push(helpers.polygon([coords])); - } - - return features; -} - -function flattenCoords(data) { - var dim = data[0][0].length, - result = { vertices: [], holes: [], dimensions: dim }, - holeIndex = 0; - - for (var i = 0; i < data.length; i++) { - for (var j = 0; j < data[i].length; j++) { - for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]); - } - if (i > 0) { - holeIndex += data[i - 1].length; - result.holes.push(holeIndex); - } - } - - return result; -} - -module.exports = tesselate; -module.exports["default"] = tesselate; - - -/***/ }), - -/***/ 3467: -/***/ (function(__unused_webpack_module, exports) { - -!function(t,e){ true?e(exports):0}(this,function(t){"use strict";const e=134217729,n=33306690738754706e-32;function r(t,e,n,r,o){let f,i,u,c,s=e[0],a=r[0],d=0,l=0;a>s==a>-s?(f=s,s=e[++d]):(f=a,a=r[++l]);let p=0;if(ds==a>-s?(u=f-((i=s+f)-s),s=e[++d]):(u=f-((i=a+f)-a),a=r[++l]),f=i,0!==u&&(o[p++]=u);ds==a>-s?(u=f-((i=f+s)-(c=i-f))+(s-c),s=e[++d]):(u=f-((i=f+a)-(c=i-f))+(a-c),a=r[++l]),f=i,0!==u&&(o[p++]=u);for(;d0!=x>0)return j;const m=Math.abs(M+x);return Math.abs(j)>=f*m?j:-function(t,o,f,p,b,y,h){let M,x,j,m,_,v,w,A,F,O,P,g,k,q,z,B,C,D;const E=t-b,G=f-b,H=o-y,I=p-y;_=(z=(A=E-(w=(v=e*E)-(v-E)))*(O=I-(F=(v=e*I)-(v-I)))-((q=E*I)-w*F-A*F-w*O))-(P=z-(C=(A=H-(w=(v=e*H)-(v-H)))*(O=G-(F=(v=e*G)-(v-G)))-((B=H*G)-w*F-A*F-w*O))),c[0]=z-(P+_)+(_-C),_=(k=q-((g=q+P)-(_=g-q))+(P-_))-(P=k-B),c[1]=k-(P+_)+(_-B),_=(D=g+P)-g,c[2]=g-(D-_)+(P-_),c[3]=D;let J=function(t,e){let n=e[0];for(let r=1;r=K||-J>=K)return J;if(M=t-(E+(_=t-E))+(_-b),j=f-(G+(_=f-G))+(_-b),x=o-(H+(_=o-H))+(_-y),m=p-(I+(_=p-I))+(_-y),0===M&&0===x&&0===j&&0===m)return J;if(K=u*h+n*Math.abs(J),(J+=E*m+I*M-(H*j+G*x))>=K||-J>=K)return J;_=(z=(A=M-(w=(v=e*M)-(v-M)))*(O=I-(F=(v=e*I)-(v-I)))-((q=M*I)-w*F-A*F-w*O))-(P=z-(C=(A=x-(w=(v=e*x)-(v-x)))*(O=G-(F=(v=e*G)-(v-G)))-((B=x*G)-w*F-A*F-w*O))),l[0]=z-(P+_)+(_-C),_=(k=q-((g=q+P)-(_=g-q))+(P-_))-(P=k-B),l[1]=k-(P+_)+(_-B),_=(D=g+P)-g,l[2]=g-(D-_)+(P-_),l[3]=D;const L=r(4,c,4,l,s);_=(z=(A=E-(w=(v=e*E)-(v-E)))*(O=m-(F=(v=e*m)-(v-m)))-((q=E*m)-w*F-A*F-w*O))-(P=z-(C=(A=H-(w=(v=e*H)-(v-H)))*(O=j-(F=(v=e*j)-(v-j)))-((B=H*j)-w*F-A*F-w*O))),l[0]=z-(P+_)+(_-C),_=(k=q-((g=q+P)-(_=g-q))+(P-_))-(P=k-B),l[1]=k-(P+_)+(_-B),_=(D=g+P)-g,l[2]=g-(D-_)+(P-_),l[3]=D;const N=r(L,s,4,l,a);_=(z=(A=M-(w=(v=e*M)-(v-M)))*(O=m-(F=(v=e*m)-(v-m)))-((q=M*m)-w*F-A*F-w*O))-(P=z-(C=(A=x-(w=(v=e*x)-(v-x)))*(O=j-(F=(v=e*j)-(v-j)))-((B=x*j)-w*F-A*F-w*O))),l[0]=z-(P+_)+(_-C),_=(k=q-((g=q+P)-(_=g-q))+(P-_))-(P=k-B),l[1]=k-(P+_)+(_-B),_=(D=g+P)-g,l[2]=g-(D-_)+(P-_),l[3]=D;const Q=r(N,a,4,l,d);return d[Q-1]}(t,o,p,b,y,h,m)},t.orient2dfast=function(t,e,n,r,o,f){return(e-f)*(n-o)-(t-o)*(r-f)},Object.defineProperty(t,"__esModule",{value:!0})}); - - -/***/ }), - -/***/ 3509: -/***/ ((module) => { - -/** - * DBSCAN - Density based clustering - * - * @author Lukasz Krawczyk - * @copyright MIT - */ - -/** - * DBSCAN class construcotr - * @constructor - * - * @param {Array} dataset - * @param {number} epsilon - * @param {number} minPts - * @param {function} distanceFunction - * @returns {DBSCAN} - */ -function DBSCAN(dataset, epsilon, minPts, distanceFunction) { - /** @type {Array} */ - this.dataset = []; - /** @type {number} */ - this.epsilon = 1; - /** @type {number} */ - this.minPts = 2; - /** @type {function} */ - this.distance = this._euclideanDistance; - /** @type {Array} */ - this.clusters = []; - /** @type {Array} */ - this.noise = []; - - // temporary variables used during computation - - /** @type {Array} */ - this._visited = []; - /** @type {Array} */ - this._assigned = []; - /** @type {number} */ - this._datasetLength = 0; - - this._init(dataset, epsilon, minPts, distanceFunction); -}; - -/******************************************************************************/ -// public functions - -/** - * Start clustering - * - * @param {Array} dataset - * @param {number} epsilon - * @param {number} minPts - * @param {function} distanceFunction - * @returns {undefined} - * @access public - */ -DBSCAN.prototype.run = function(dataset, epsilon, minPts, distanceFunction) { - this._init(dataset, epsilon, minPts, distanceFunction); - - for (var pointId = 0; pointId < this._datasetLength; pointId++) { - // if point is not visited, check if it forms a cluster - if (this._visited[pointId] !== 1) { - this._visited[pointId] = 1; - - // if closest neighborhood is too small to form a cluster, mark as noise - var neighbors = this._regionQuery(pointId); - - if (neighbors.length < this.minPts) { - this.noise.push(pointId); - } else { - // create new cluster and add point - var clusterId = this.clusters.length; - this.clusters.push([]); - this._addToCluster(pointId, clusterId); - - this._expandCluster(clusterId, neighbors); - } - } - } - - return this.clusters; -}; - -/******************************************************************************/ -// protected functions - -/** - * Set object properties - * - * @param {Array} dataset - * @param {number} epsilon - * @param {number} minPts - * @param {function} distance - * @returns {undefined} - * @access protected - */ -DBSCAN.prototype._init = function(dataset, epsilon, minPts, distance) { - - if (dataset) { - - if (!(dataset instanceof Array)) { - throw Error('Dataset must be of type array, ' + - typeof dataset + ' given'); - } - - this.dataset = dataset; - this.clusters = []; - this.noise = []; - - this._datasetLength = dataset.length; - this._visited = new Array(this._datasetLength); - this._assigned = new Array(this._datasetLength); - } - - if (epsilon) { - this.epsilon = epsilon; - } - - if (minPts) { - this.minPts = minPts; - } - - if (distance) { - this.distance = distance; - } -}; - -/** - * Expand cluster to closest points of given neighborhood - * - * @param {number} clusterId - * @param {Array} neighbors - * @returns {undefined} - * @access protected - */ -DBSCAN.prototype._expandCluster = function(clusterId, neighbors) { - - /** - * It's very important to calculate length of neighbors array each time, - * as the number of elements changes over time - */ - for (var i = 0; i < neighbors.length; i++) { - var pointId2 = neighbors[i]; - - if (this._visited[pointId2] !== 1) { - this._visited[pointId2] = 1; - var neighbors2 = this._regionQuery(pointId2); - - if (neighbors2.length >= this.minPts) { - neighbors = this._mergeArrays(neighbors, neighbors2); - } - } - - // add to cluster - if (this._assigned[pointId2] !== 1) { - this._addToCluster(pointId2, clusterId); - } - } -}; - -/** - * Add new point to cluster - * - * @param {number} pointId - * @param {number} clusterId - */ -DBSCAN.prototype._addToCluster = function(pointId, clusterId) { - this.clusters[clusterId].push(pointId); - this._assigned[pointId] = 1; -}; - -/** - * Find all neighbors around given point - * - * @param {number} pointId, - * @param {number} epsilon - * @returns {Array} - * @access protected - */ -DBSCAN.prototype._regionQuery = function(pointId) { - var neighbors = []; - - for (var id = 0; id < this._datasetLength; id++) { - var dist = this.distance(this.dataset[pointId], this.dataset[id]); - if (dist < this.epsilon) { - neighbors.push(id); - } - } - - return neighbors; -}; - -/******************************************************************************/ -// helpers - -/** - * @param {Array} a - * @param {Array} b - * @returns {Array} - * @access protected - */ -DBSCAN.prototype._mergeArrays = function(a, b) { - var len = b.length; - - for (var i = 0; i < len; i++) { - var P = b[i]; - if (a.indexOf(P) < 0) { - a.push(P); - } - } - - return a; -}; - -/** - * Calculate euclidean distance in multidimensional space - * - * @param {Array} p - * @param {Array} q - * @returns {number} - * @access protected - */ -DBSCAN.prototype._euclideanDistance = function(p, q) { - var sum = 0; - var i = Math.min(p.length, q.length); - - while (i--) { - sum += (p[i] - q[i]) * (p[i] - q[i]); - } - - return Math.sqrt(sum); -}; - -if ( true && module.exports) { - module.exports = DBSCAN; -} - - -/***/ }), - -/***/ 3574: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -var helpers_1 = __webpack_require__(8967); -var invariant_1 = __webpack_require__(8506); -var lineclip_1 = __webpack_require__(4828); -/** - * Takes a {@link Feature} and a bbox and clips the feature to the bbox using - * [lineclip](https://github.com/mapbox/lineclip). - * May result in degenerate edges when clipping Polygons. - * - * @name bboxClip - * @param {Feature} feature feature to clip to the bbox - * @param {BBox} bbox extent in [minX, minY, maxX, maxY] order - * @returns {Feature} clipped Feature - * @example - * var bbox = [0, 0, 10, 10]; - * var poly = turf.polygon([[[2, 2], [8, 4], [12, 8], [3, 7], [2, 2]]]); - * - * var clipped = turf.bboxClip(poly, bbox); - * - * //addToMap - * var addToMap = [bbox, poly, clipped] - */ -function bboxClip(feature, bbox) { - var geom = invariant_1.getGeom(feature); - var type = geom.type; - var properties = feature.type === "Feature" ? feature.properties : {}; - var coords = geom.coordinates; - switch (type) { - case "LineString": - case "MultiLineString": { - var lines_1 = []; - if (type === "LineString") { - coords = [coords]; - } - coords.forEach(function (line) { - lineclip_1.lineclip(line, bbox, lines_1); - }); - if (lines_1.length === 1) { - return helpers_1.lineString(lines_1[0], properties); - } - return helpers_1.multiLineString(lines_1, properties); - } - case "Polygon": - return helpers_1.polygon(clipPolygon(coords, bbox), properties); - case "MultiPolygon": - return helpers_1.multiPolygon(coords.map(function (poly) { - return clipPolygon(poly, bbox); - }), properties); - default: - throw new Error("geometry " + type + " not supported"); - } -} -exports["default"] = bboxClip; -function clipPolygon(rings, bbox) { - var outRings = []; - for (var _i = 0, rings_1 = rings; _i < rings_1.length; _i++) { - var ring = rings_1[_i]; - var clipped = lineclip_1.polygonclip(ring, bbox); - if (clipped.length > 0) { - if (clipped[0][0] !== clipped[clipped.length - 1][0] || - clipped[0][1] !== clipped[clipped.length - 1][1]) { - clipped.push(clipped[0]); - } - if (clipped.length >= 4) { - outRings.push(clipped); - } - } - } - return outRings; -} - - -/***/ }), - -/***/ 3607: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ULabelLoader = void 0; -/** - * Animated loader for initial loading screen. - */ -var ULabelLoader = /** @class */ (function () { - function ULabelLoader() { - } - ULabelLoader.add_loader_div = function (container) { - var loader_overlay = document.createElement("div"); - loader_overlay.classList.add("ulabel-loader-overlay"); - var loader = document.createElement("div"); - loader.classList.add("ulabel-loader"); - var style = ULabelLoader.build_loader_style(); - loader_overlay.appendChild(loader); - loader_overlay.appendChild(style); - container.appendChild(loader_overlay); - }; - ULabelLoader.remove_loader_div = function () { - var loader = document.querySelector(".ulabel-loader-overlay"); - if (loader) { - loader.remove(); - } - }; - ULabelLoader.build_loader_style = function () { - var css = "\n .ulabel-loader-overlay {\n position: fixed;\n width: 100%;\n height: 100%;\n inset: 0;\n background-color: rgba(0, 0, 0, 0.5);\n z-index: 100;\n }\n .ulabel-loader {\n border: 16px solid #f3f3f3;\n border-top: 16px solid #3498db;\n border-radius: 50%;\n width: 120px;\n height: 120px;\n animation: spin 2s linear infinite;\n position: fixed;\n inset: 0;\n margin: auto;\n }\n \n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "; - var style = document.createElement("style"); - style.innerHTML = css; - return style; - }; - return ULabelLoader; -}()); -exports.ULabelLoader = ULabelLoader; - - -/***/ }), - -/***/ 3628: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var reflectGetProto = __webpack_require__(8648); -var originalGetProto = __webpack_require__(1064); - -var getDunderProto = __webpack_require__(7176); - -/** @type {import('.')} */ -module.exports = reflectGetProto - ? function getProto(O) { - // @ts-expect-error TS can't narrow inside a closure, for some reason - return reflectGetProto(O); - } - : originalGetProto - ? function getProto(O) { - if (!O || (typeof O !== 'object' && typeof O !== 'function')) { - throw new TypeError('getProto: not an object'); - } - // @ts-expect-error TS can't narrow inside a closure, for some reason - return originalGetProto(O); - } - : getDunderProto - ? function getProto(O) { - // @ts-expect-error TS can't narrow inside a closure, for some reason - return getDunderProto(O); - } - : null; - - -/***/ }), - -/***/ 3707: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var meta = __webpack_require__(8421); -var helpers = __webpack_require__(8967); - -/** - * Takes a feature or set of features and returns all positions as {@link Point|points}. - * - * @name explode - * @param {GeoJSON} geojson input features - * @returns {FeatureCollection} points representing the exploded input features - * @throws {Error} if it encounters an unknown geometry type - * @example - * var polygon = turf.polygon([[[-81, 41], [-88, 36], [-84, 31], [-80, 33], [-77, 39], [-81, 41]]]); - * - * var explode = turf.explode(polygon); - * - * //addToMap - * var addToMap = [polygon, explode] - */ -function explode(geojson) { - var points = []; - if (geojson.type === "FeatureCollection") { - meta.featureEach(geojson, function (feature) { - meta.coordEach(feature, function (coord) { - points.push(helpers.point(coord, feature.properties)); - }); - }); - } else { - meta.coordEach(geojson, function (coord) { - points.push(helpers.point(coord, geojson.properties)); - }); - } - return helpers.featureCollection(points); -} - -module.exports = explode; -module.exports["default"] = explode; - - -/***/ }), - -/***/ 3711: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -/** - * Returns a cloned copy of the passed GeoJSON Object, including possible 'Foreign Members'. - * ~3-5x faster than the common JSON.parse + JSON.stringify combo method. - * - * @name clone - * @param {GeoJSON} geojson GeoJSON Object - * @returns {GeoJSON} cloned GeoJSON Object - * @example - * var line = turf.lineString([[-74, 40], [-78, 42], [-82, 35]], {color: 'red'}); - * - * var lineCloned = turf.clone(line); - */ -function clone(geojson) { - if (!geojson) { - throw new Error("geojson is required"); - } - switch (geojson.type) { - case "Feature": - return cloneFeature(geojson); - case "FeatureCollection": - return cloneFeatureCollection(geojson); - case "Point": - case "LineString": - case "Polygon": - case "MultiPoint": - case "MultiLineString": - case "MultiPolygon": - case "GeometryCollection": - return cloneGeometry(geojson); - default: - throw new Error("unknown GeoJSON type"); - } -} -/** - * Clone Feature - * - * @private - * @param {Feature} geojson GeoJSON Feature - * @returns {Feature} cloned Feature - */ -function cloneFeature(geojson) { - var cloned = { type: "Feature" }; - // Preserve Foreign Members - Object.keys(geojson).forEach(function (key) { - switch (key) { - case "type": - case "properties": - case "geometry": - return; - default: - cloned[key] = geojson[key]; - } - }); - // Add properties & geometry last - cloned.properties = cloneProperties(geojson.properties); - cloned.geometry = cloneGeometry(geojson.geometry); - return cloned; -} -/** - * Clone Properties - * - * @private - * @param {Object} properties GeoJSON Properties - * @returns {Object} cloned Properties - */ -function cloneProperties(properties) { - var cloned = {}; - if (!properties) { - return cloned; - } - Object.keys(properties).forEach(function (key) { - var value = properties[key]; - if (typeof value === "object") { - if (value === null) { - // handle null - cloned[key] = null; - } - else if (Array.isArray(value)) { - // handle Array - cloned[key] = value.map(function (item) { - return item; - }); - } - else { - // handle generic Object - cloned[key] = cloneProperties(value); - } - } - else { - cloned[key] = value; - } - }); - return cloned; -} -/** - * Clone Feature Collection - * - * @private - * @param {FeatureCollection} geojson GeoJSON Feature Collection - * @returns {FeatureCollection} cloned Feature Collection - */ -function cloneFeatureCollection(geojson) { - var cloned = { type: "FeatureCollection" }; - // Preserve Foreign Members - Object.keys(geojson).forEach(function (key) { - switch (key) { - case "type": - case "features": - return; - default: - cloned[key] = geojson[key]; - } - }); - // Add features - cloned.features = geojson.features.map(function (feature) { - return cloneFeature(feature); - }); - return cloned; -} -/** - * Clone Geometry - * - * @private - * @param {Geometry} geometry GeoJSON Geometry - * @returns {Geometry} cloned Geometry - */ -function cloneGeometry(geometry) { - var geom = { type: geometry.type }; - if (geometry.bbox) { - geom.bbox = geometry.bbox; - } - if (geometry.type === "GeometryCollection") { - geom.geometries = geometry.geometries.map(function (g) { - return cloneGeometry(g); - }); - return geom; - } - geom.coordinates = deepSlice(geometry.coordinates); - return geom; -} -/** - * Deep Slice coordinates - * - * @private - * @param {Coordinates} coords Coordinates - * @returns {Coordinates} all coordinates sliced - */ -function deepSlice(coords) { - var cloned = coords; - if (typeof cloned[0] !== "object") { - return cloned.slice(); - } - return cloned.map(function (coord) { - return deepSlice(coord); - }); -} -exports["default"] = clone; - - -/***/ }), - -/***/ 3841: -/***/ ((module) => { - -module.exports = function pointInPolygonFlat (point, vs, start, end) { - var x = point[0], y = point[1]; - var inside = false; - if (start === undefined) start = 0; - if (end === undefined) end = vs.length; - var len = (end-start)/2; - for (var i = 0, j = len - 1; i < len; j = i++) { - var xi = vs[start+i*2+0], yi = vs[start+i*2+1]; - var xj = vs[start+j*2+0], yj = vs[start+j*2+1]; - var intersect = ((yi > y) !== (yj > y)) - && (x < (xj - xi) * (y - yi) / (yj - yi) + xi); - if (intersect) inside = !inside; - } - return inside; -}; - - -/***/ }), - -/***/ 3855: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ value: true })); - -var isolines = __webpack_require__(5784); -var convex = __webpack_require__(1207); -var pointsWithinPolygon = __webpack_require__(6432); -var concave = __webpack_require__(347); -var collect = __webpack_require__(1484); -var flip = __webpack_require__(9387); -var simplify = __webpack_require__(1111); -var bezierSpline = __webpack_require__(301); -var tag = __webpack_require__(7974); -var sample = __webpack_require__(9730); -var envelope = __webpack_require__(2120); -var square = __webpack_require__(2363); -var circle = __webpack_require__(5764); -var midpoint = __webpack_require__(8748); -var center = __webpack_require__(6649); -var centerOfMass = __webpack_require__(6320); -var centroid = __webpack_require__(4408); -var combine = __webpack_require__(2583); -var distance = __webpack_require__(9391); -var explode = __webpack_require__(3707); -var bbox = __webpack_require__(4383); -var tesselate = __webpack_require__(3414); -var bboxPolygon = __webpack_require__(3932); -var booleanPointInPolygon = __webpack_require__(2446); -var nearestPoint = __webpack_require__(9791); -var nearestPointOnLine = __webpack_require__(7696); -var nearestPointToLine = __webpack_require__(3284); -var planepoint = __webpack_require__(8220); -var tin = __webpack_require__(2141); -var bearing = __webpack_require__(1288); -var destination = __webpack_require__(4202); -var kinks = __webpack_require__(5518); -var pointOnFeature = __webpack_require__(6979); -var area = __webpack_require__(7849); -var along = __webpack_require__(9399); -var length = __webpack_require__(8840); -var lineSlice = __webpack_require__(7969); -var lineSliceAlong = __webpack_require__(4957); -var pointGrid = __webpack_require__(7497); -var truncate = __webpack_require__(6834); -var flatten = __webpack_require__(4036); -var lineIntersect = __webpack_require__(3154); -var lineChunk = __webpack_require__(2222); -var unkinkPolygon = __webpack_require__(7911); -var greatCircle = __webpack_require__(2352); -var lineSegment = __webpack_require__(7042); -var lineSplit = __webpack_require__(5848); -var lineArc = __webpack_require__(375); -var polygonToLine = __webpack_require__(4527); -var lineToPolygon = __webpack_require__(8785); -var bboxClip = __webpack_require__(3574); -var lineOverlap = __webpack_require__(4300); -var sector = __webpack_require__(1786); -var rhumbBearing = __webpack_require__(2307); -var rhumbDistance = __webpack_require__(9778); -var rhumbDestination = __webpack_require__(7153); -var polygonTangents = __webpack_require__(4951); -var rewind = __webpack_require__(2163); -var isobands = __webpack_require__(1279); -var transformRotate = __webpack_require__(7948); -var transformScale = __webpack_require__(1925); -var transformTranslate = __webpack_require__(8509); -var lineOffset = __webpack_require__(1972); -var polygonize = __webpack_require__(7804); -var booleanDisjoint = __webpack_require__(1323); -var booleanContains = __webpack_require__(3974); -var booleanCrosses = __webpack_require__(7971); -var booleanClockwise = __webpack_require__(7333); -var booleanOverlap = __webpack_require__(8436); -var booleanPointOnLine = __webpack_require__(5378); -var booleanEqual = __webpack_require__(7447); -var booleanWithin = __webpack_require__(4960); -var booleanIntersects = __webpack_require__(1734); -var clone = __webpack_require__(3711); -var cleanCoords = __webpack_require__(2086); -var clustersDbscan = __webpack_require__(8703); -var clustersKmeans = __webpack_require__(7521); -var pointToLineDistance = __webpack_require__(3183); -var booleanParallel = __webpack_require__(3980); -var shortestPath = __webpack_require__(9736); -var voronoi = __webpack_require__(1356); -var ellipse = __webpack_require__(7420); -var centerMean = __webpack_require__(2779); -var centerMedian = __webpack_require__(6724); -var standardDeviationalEllipse = __webpack_require__(4333); -var angle = __webpack_require__(4309); -var polygonSmooth = __webpack_require__(6775); -var moranIndex = __webpack_require__(7938); -var distanceWeight = __webpack_require__(7484); -var projection = __webpack_require__(1101); -var random = __webpack_require__(4575); -var clusters = __webpack_require__(5943); -var helpers = __webpack_require__(8967); -var invariant = __webpack_require__(8506); -var meta = __webpack_require__(8421); -var difference = __webpack_require__(4927); -var buffer = __webpack_require__(7262); -var union = __webpack_require__(2057); -var intersect = __webpack_require__(9627); -var dissolve = __webpack_require__(7095); -var hexGrid = __webpack_require__(7564); -var mask = __webpack_require__(7300); -var squareGrid = __webpack_require__(4512); -var triangleGrid = __webpack_require__(9269); -var interpolate = __webpack_require__(9933); - -function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } - -function _interopNamespace(e) { - if (e && e.__esModule) return e; - var n = Object.create(null); - if (e) { - Object.keys(e).forEach(function (k) { - if (k !== 'default') { - var d = Object.getOwnPropertyDescriptor(e, k); - Object.defineProperty(n, k, d.get ? d : { - enumerable: true, - get: function () { - return e[k]; - } - }); - } - }); - } - n['default'] = e; - return Object.freeze(n); -} - -var isolines__default = /*#__PURE__*/_interopDefaultLegacy(isolines); -var convex__default = /*#__PURE__*/_interopDefaultLegacy(convex); -var pointsWithinPolygon__default = /*#__PURE__*/_interopDefaultLegacy(pointsWithinPolygon); -var concave__default = /*#__PURE__*/_interopDefaultLegacy(concave); -var collect__default = /*#__PURE__*/_interopDefaultLegacy(collect); -var flip__default = /*#__PURE__*/_interopDefaultLegacy(flip); -var simplify__default = /*#__PURE__*/_interopDefaultLegacy(simplify); -var bezierSpline__default = /*#__PURE__*/_interopDefaultLegacy(bezierSpline); -var tag__default = /*#__PURE__*/_interopDefaultLegacy(tag); -var sample__default = /*#__PURE__*/_interopDefaultLegacy(sample); -var envelope__default = /*#__PURE__*/_interopDefaultLegacy(envelope); -var square__default = /*#__PURE__*/_interopDefaultLegacy(square); -var circle__default = /*#__PURE__*/_interopDefaultLegacy(circle); -var midpoint__default = /*#__PURE__*/_interopDefaultLegacy(midpoint); -var center__default = /*#__PURE__*/_interopDefaultLegacy(center); -var centerOfMass__default = /*#__PURE__*/_interopDefaultLegacy(centerOfMass); -var centroid__default = /*#__PURE__*/_interopDefaultLegacy(centroid); -var combine__default = /*#__PURE__*/_interopDefaultLegacy(combine); -var distance__default = /*#__PURE__*/_interopDefaultLegacy(distance); -var explode__default = /*#__PURE__*/_interopDefaultLegacy(explode); -var bbox__default = /*#__PURE__*/_interopDefaultLegacy(bbox); -var tesselate__default = /*#__PURE__*/_interopDefaultLegacy(tesselate); -var bboxPolygon__default = /*#__PURE__*/_interopDefaultLegacy(bboxPolygon); -var booleanPointInPolygon__default = /*#__PURE__*/_interopDefaultLegacy(booleanPointInPolygon); -var nearestPoint__default = /*#__PURE__*/_interopDefaultLegacy(nearestPoint); -var nearestPointOnLine__default = /*#__PURE__*/_interopDefaultLegacy(nearestPointOnLine); -var nearestPointToLine__default = /*#__PURE__*/_interopDefaultLegacy(nearestPointToLine); -var planepoint__default = /*#__PURE__*/_interopDefaultLegacy(planepoint); -var tin__default = /*#__PURE__*/_interopDefaultLegacy(tin); -var bearing__default = /*#__PURE__*/_interopDefaultLegacy(bearing); -var destination__default = /*#__PURE__*/_interopDefaultLegacy(destination); -var kinks__default = /*#__PURE__*/_interopDefaultLegacy(kinks); -var pointOnFeature__default = /*#__PURE__*/_interopDefaultLegacy(pointOnFeature); -var area__default = /*#__PURE__*/_interopDefaultLegacy(area); -var along__default = /*#__PURE__*/_interopDefaultLegacy(along); -var length__default = /*#__PURE__*/_interopDefaultLegacy(length); -var lineSlice__default = /*#__PURE__*/_interopDefaultLegacy(lineSlice); -var lineSliceAlong__default = /*#__PURE__*/_interopDefaultLegacy(lineSliceAlong); -var pointGrid__default = /*#__PURE__*/_interopDefaultLegacy(pointGrid); -var truncate__default = /*#__PURE__*/_interopDefaultLegacy(truncate); -var flatten__default = /*#__PURE__*/_interopDefaultLegacy(flatten); -var lineIntersect__default = /*#__PURE__*/_interopDefaultLegacy(lineIntersect); -var lineChunk__default = /*#__PURE__*/_interopDefaultLegacy(lineChunk); -var unkinkPolygon__default = /*#__PURE__*/_interopDefaultLegacy(unkinkPolygon); -var greatCircle__default = /*#__PURE__*/_interopDefaultLegacy(greatCircle); -var lineSegment__default = /*#__PURE__*/_interopDefaultLegacy(lineSegment); -var lineSplit__default = /*#__PURE__*/_interopDefaultLegacy(lineSplit); -var lineArc__default = /*#__PURE__*/_interopDefaultLegacy(lineArc); -var polygonToLine__default = /*#__PURE__*/_interopDefaultLegacy(polygonToLine); -var lineToPolygon__default = /*#__PURE__*/_interopDefaultLegacy(lineToPolygon); -var bboxClip__default = /*#__PURE__*/_interopDefaultLegacy(bboxClip); -var lineOverlap__default = /*#__PURE__*/_interopDefaultLegacy(lineOverlap); -var sector__default = /*#__PURE__*/_interopDefaultLegacy(sector); -var rhumbBearing__default = /*#__PURE__*/_interopDefaultLegacy(rhumbBearing); -var rhumbDistance__default = /*#__PURE__*/_interopDefaultLegacy(rhumbDistance); -var rhumbDestination__default = /*#__PURE__*/_interopDefaultLegacy(rhumbDestination); -var polygonTangents__default = /*#__PURE__*/_interopDefaultLegacy(polygonTangents); -var rewind__default = /*#__PURE__*/_interopDefaultLegacy(rewind); -var isobands__default = /*#__PURE__*/_interopDefaultLegacy(isobands); -var transformRotate__default = /*#__PURE__*/_interopDefaultLegacy(transformRotate); -var transformScale__default = /*#__PURE__*/_interopDefaultLegacy(transformScale); -var transformTranslate__default = /*#__PURE__*/_interopDefaultLegacy(transformTranslate); -var lineOffset__default = /*#__PURE__*/_interopDefaultLegacy(lineOffset); -var polygonize__default = /*#__PURE__*/_interopDefaultLegacy(polygonize); -var booleanDisjoint__default = /*#__PURE__*/_interopDefaultLegacy(booleanDisjoint); -var booleanContains__default = /*#__PURE__*/_interopDefaultLegacy(booleanContains); -var booleanCrosses__default = /*#__PURE__*/_interopDefaultLegacy(booleanCrosses); -var booleanClockwise__default = /*#__PURE__*/_interopDefaultLegacy(booleanClockwise); -var booleanOverlap__default = /*#__PURE__*/_interopDefaultLegacy(booleanOverlap); -var booleanPointOnLine__default = /*#__PURE__*/_interopDefaultLegacy(booleanPointOnLine); -var booleanEqual__default = /*#__PURE__*/_interopDefaultLegacy(booleanEqual); -var booleanWithin__default = /*#__PURE__*/_interopDefaultLegacy(booleanWithin); -var booleanIntersects__default = /*#__PURE__*/_interopDefaultLegacy(booleanIntersects); -var clone__default = /*#__PURE__*/_interopDefaultLegacy(clone); -var cleanCoords__default = /*#__PURE__*/_interopDefaultLegacy(cleanCoords); -var clustersDbscan__default = /*#__PURE__*/_interopDefaultLegacy(clustersDbscan); -var clustersKmeans__default = /*#__PURE__*/_interopDefaultLegacy(clustersKmeans); -var pointToLineDistance__default = /*#__PURE__*/_interopDefaultLegacy(pointToLineDistance); -var booleanParallel__default = /*#__PURE__*/_interopDefaultLegacy(booleanParallel); -var shortestPath__default = /*#__PURE__*/_interopDefaultLegacy(shortestPath); -var voronoi__default = /*#__PURE__*/_interopDefaultLegacy(voronoi); -var ellipse__default = /*#__PURE__*/_interopDefaultLegacy(ellipse); -var centerMean__default = /*#__PURE__*/_interopDefaultLegacy(centerMean); -var centerMedian__default = /*#__PURE__*/_interopDefaultLegacy(centerMedian); -var standardDeviationalEllipse__default = /*#__PURE__*/_interopDefaultLegacy(standardDeviationalEllipse); -var angle__default = /*#__PURE__*/_interopDefaultLegacy(angle); -var polygonSmooth__default = /*#__PURE__*/_interopDefaultLegacy(polygonSmooth); -var moranIndex__default = /*#__PURE__*/_interopDefaultLegacy(moranIndex); -var distanceWeight__default = /*#__PURE__*/_interopDefaultLegacy(distanceWeight); -var projection__namespace = /*#__PURE__*/_interopNamespace(projection); -var random__namespace = /*#__PURE__*/_interopNamespace(random); -var clusters__namespace = /*#__PURE__*/_interopNamespace(clusters); -var helpers__namespace = /*#__PURE__*/_interopNamespace(helpers); -var invariant__namespace = /*#__PURE__*/_interopNamespace(invariant); -var meta__namespace = /*#__PURE__*/_interopNamespace(meta); -var difference__default = /*#__PURE__*/_interopDefaultLegacy(difference); -var buffer__default = /*#__PURE__*/_interopDefaultLegacy(buffer); -var union__default = /*#__PURE__*/_interopDefaultLegacy(union); -var intersect__default = /*#__PURE__*/_interopDefaultLegacy(intersect); -var dissolve__default = /*#__PURE__*/_interopDefaultLegacy(dissolve); -var hexGrid__default = /*#__PURE__*/_interopDefaultLegacy(hexGrid); -var mask__default = /*#__PURE__*/_interopDefaultLegacy(mask); -var squareGrid__default = /*#__PURE__*/_interopDefaultLegacy(squareGrid); -var triangleGrid__default = /*#__PURE__*/_interopDefaultLegacy(triangleGrid); -var interpolate__default = /*#__PURE__*/_interopDefaultLegacy(interpolate); - - - -Object.keys(projection).forEach(function (k) { - if (k !== 'default') Object.defineProperty(exports, k, { - enumerable: true, - get: function () { - return projection[k]; - } - }); -}); -Object.keys(random).forEach(function (k) { - if (k !== 'default') Object.defineProperty(exports, k, { - enumerable: true, - get: function () { - return random[k]; - } - }); -}); -Object.keys(clusters).forEach(function (k) { - if (k !== 'default') Object.defineProperty(exports, k, { - enumerable: true, - get: function () { - return clusters[k]; - } - }); -}); -Object.keys(helpers).forEach(function (k) { - if (k !== 'default') Object.defineProperty(exports, k, { - enumerable: true, - get: function () { - return helpers[k]; - } - }); -}); -Object.keys(invariant).forEach(function (k) { - if (k !== 'default') Object.defineProperty(exports, k, { - enumerable: true, - get: function () { - return invariant[k]; - } - }); -}); -Object.keys(meta).forEach(function (k) { - if (k !== 'default') Object.defineProperty(exports, k, { - enumerable: true, - get: function () { - return meta[k]; - } - }); -}); -Object.defineProperty(exports, "isolines", ({ - enumerable: true, - get: function () { - return isolines__default['default']; - } -})); -Object.defineProperty(exports, "convex", ({ - enumerable: true, - get: function () { - return convex__default['default']; - } -})); -Object.defineProperty(exports, "pointsWithinPolygon", ({ - enumerable: true, - get: function () { - return pointsWithinPolygon__default['default']; - } -})); -Object.defineProperty(exports, "within", ({ - enumerable: true, - get: function () { - return pointsWithinPolygon__default['default']; - } -})); -Object.defineProperty(exports, "concave", ({ - enumerable: true, - get: function () { - return concave__default['default']; - } -})); -Object.defineProperty(exports, "collect", ({ - enumerable: true, - get: function () { - return collect__default['default']; - } -})); -Object.defineProperty(exports, "flip", ({ - enumerable: true, - get: function () { - return flip__default['default']; - } -})); -Object.defineProperty(exports, "simplify", ({ - enumerable: true, - get: function () { - return simplify__default['default']; - } -})); -Object.defineProperty(exports, "bezier", ({ - enumerable: true, - get: function () { - return bezierSpline__default['default']; - } -})); -Object.defineProperty(exports, "bezierSpline", ({ - enumerable: true, - get: function () { - return bezierSpline__default['default']; - } -})); -Object.defineProperty(exports, "tag", ({ - enumerable: true, - get: function () { - return tag__default['default']; - } -})); -Object.defineProperty(exports, "sample", ({ - enumerable: true, - get: function () { - return sample__default['default']; - } -})); -Object.defineProperty(exports, "envelope", ({ - enumerable: true, - get: function () { - return envelope__default['default']; - } -})); -Object.defineProperty(exports, "square", ({ - enumerable: true, - get: function () { - return square__default['default']; - } -})); -Object.defineProperty(exports, "circle", ({ - enumerable: true, - get: function () { - return circle__default['default']; - } -})); -Object.defineProperty(exports, "midpoint", ({ - enumerable: true, - get: function () { - return midpoint__default['default']; - } -})); -Object.defineProperty(exports, "center", ({ - enumerable: true, - get: function () { - return center__default['default']; - } -})); -Object.defineProperty(exports, "centerOfMass", ({ - enumerable: true, - get: function () { - return centerOfMass__default['default']; - } -})); -Object.defineProperty(exports, "centroid", ({ - enumerable: true, - get: function () { - return centroid__default['default']; - } -})); -Object.defineProperty(exports, "combine", ({ - enumerable: true, - get: function () { - return combine__default['default']; - } -})); -Object.defineProperty(exports, "distance", ({ - enumerable: true, - get: function () { - return distance__default['default']; - } -})); -Object.defineProperty(exports, "explode", ({ - enumerable: true, - get: function () { - return explode__default['default']; - } -})); -Object.defineProperty(exports, "bbox", ({ - enumerable: true, - get: function () { - return bbox__default['default']; - } -})); -Object.defineProperty(exports, "tesselate", ({ - enumerable: true, - get: function () { - return tesselate__default['default']; - } -})); -Object.defineProperty(exports, "bboxPolygon", ({ - enumerable: true, - get: function () { - return bboxPolygon__default['default']; - } -})); -Object.defineProperty(exports, "booleanPointInPolygon", ({ - enumerable: true, - get: function () { - return booleanPointInPolygon__default['default']; - } -})); -Object.defineProperty(exports, "inside", ({ - enumerable: true, - get: function () { - return booleanPointInPolygon__default['default']; - } -})); -Object.defineProperty(exports, "nearest", ({ - enumerable: true, - get: function () { - return nearestPoint__default['default']; - } -})); -Object.defineProperty(exports, "nearestPoint", ({ - enumerable: true, - get: function () { - return nearestPoint__default['default']; - } -})); -Object.defineProperty(exports, "nearestPointOnLine", ({ - enumerable: true, - get: function () { - return nearestPointOnLine__default['default']; - } -})); -Object.defineProperty(exports, "pointOnLine", ({ - enumerable: true, - get: function () { - return nearestPointOnLine__default['default']; - } -})); -Object.defineProperty(exports, "nearestPointToLine", ({ - enumerable: true, - get: function () { - return nearestPointToLine__default['default']; - } -})); -Object.defineProperty(exports, "planepoint", ({ - enumerable: true, - get: function () { - return planepoint__default['default']; - } -})); -Object.defineProperty(exports, "tin", ({ - enumerable: true, - get: function () { - return tin__default['default']; - } -})); -Object.defineProperty(exports, "bearing", ({ - enumerable: true, - get: function () { - return bearing__default['default']; - } -})); -Object.defineProperty(exports, "destination", ({ - enumerable: true, - get: function () { - return destination__default['default']; - } -})); -Object.defineProperty(exports, "kinks", ({ - enumerable: true, - get: function () { - return kinks__default['default']; - } -})); -Object.defineProperty(exports, "pointOnFeature", ({ - enumerable: true, - get: function () { - return pointOnFeature__default['default']; - } -})); -Object.defineProperty(exports, "pointOnSurface", ({ - enumerable: true, - get: function () { - return pointOnFeature__default['default']; - } -})); -Object.defineProperty(exports, "area", ({ - enumerable: true, - get: function () { - return area__default['default']; - } -})); -Object.defineProperty(exports, "along", ({ - enumerable: true, - get: function () { - return along__default['default']; - } -})); -Object.defineProperty(exports, "length", ({ - enumerable: true, - get: function () { - return length__default['default']; - } -})); -Object.defineProperty(exports, "lineDistance", ({ - enumerable: true, - get: function () { - return length__default['default']; - } -})); -Object.defineProperty(exports, "lineSlice", ({ - enumerable: true, - get: function () { - return lineSlice__default['default']; - } -})); -Object.defineProperty(exports, "lineSliceAlong", ({ - enumerable: true, - get: function () { - return lineSliceAlong__default['default']; - } -})); -Object.defineProperty(exports, "pointGrid", ({ - enumerable: true, - get: function () { - return pointGrid__default['default']; - } -})); -Object.defineProperty(exports, "truncate", ({ - enumerable: true, - get: function () { - return truncate__default['default']; - } -})); -Object.defineProperty(exports, "flatten", ({ - enumerable: true, - get: function () { - return flatten__default['default']; - } -})); -Object.defineProperty(exports, "lineIntersect", ({ - enumerable: true, - get: function () { - return lineIntersect__default['default']; - } -})); -Object.defineProperty(exports, "lineChunk", ({ - enumerable: true, - get: function () { - return lineChunk__default['default']; - } -})); -Object.defineProperty(exports, "unkinkPolygon", ({ - enumerable: true, - get: function () { - return unkinkPolygon__default['default']; - } -})); -Object.defineProperty(exports, "greatCircle", ({ - enumerable: true, - get: function () { - return greatCircle__default['default']; - } -})); -Object.defineProperty(exports, "lineSegment", ({ - enumerable: true, - get: function () { - return lineSegment__default['default']; - } -})); -Object.defineProperty(exports, "lineSplit", ({ - enumerable: true, - get: function () { - return lineSplit__default['default']; - } -})); -Object.defineProperty(exports, "lineArc", ({ - enumerable: true, - get: function () { - return lineArc__default['default']; - } -})); -Object.defineProperty(exports, "polygonToLine", ({ - enumerable: true, - get: function () { - return polygonToLine__default['default']; - } -})); -Object.defineProperty(exports, "polygonToLineString", ({ - enumerable: true, - get: function () { - return polygonToLine__default['default']; - } -})); -Object.defineProperty(exports, "lineStringToPolygon", ({ - enumerable: true, - get: function () { - return lineToPolygon__default['default']; - } -})); -Object.defineProperty(exports, "lineToPolygon", ({ - enumerable: true, - get: function () { - return lineToPolygon__default['default']; - } -})); -Object.defineProperty(exports, "bboxClip", ({ - enumerable: true, - get: function () { - return bboxClip__default['default']; - } -})); -Object.defineProperty(exports, "lineOverlap", ({ - enumerable: true, - get: function () { - return lineOverlap__default['default']; - } -})); -Object.defineProperty(exports, "sector", ({ - enumerable: true, - get: function () { - return sector__default['default']; - } -})); -Object.defineProperty(exports, "rhumbBearing", ({ - enumerable: true, - get: function () { - return rhumbBearing__default['default']; - } -})); -Object.defineProperty(exports, "rhumbDistance", ({ - enumerable: true, - get: function () { - return rhumbDistance__default['default']; - } -})); -Object.defineProperty(exports, "rhumbDestination", ({ - enumerable: true, - get: function () { - return rhumbDestination__default['default']; - } -})); -Object.defineProperty(exports, "polygonTangents", ({ - enumerable: true, - get: function () { - return polygonTangents__default['default']; - } -})); -Object.defineProperty(exports, "rewind", ({ - enumerable: true, - get: function () { - return rewind__default['default']; - } -})); -Object.defineProperty(exports, "isobands", ({ - enumerable: true, - get: function () { - return isobands__default['default']; - } -})); -Object.defineProperty(exports, "transformRotate", ({ - enumerable: true, - get: function () { - return transformRotate__default['default']; - } -})); -Object.defineProperty(exports, "transformScale", ({ - enumerable: true, - get: function () { - return transformScale__default['default']; - } -})); -Object.defineProperty(exports, "transformTranslate", ({ - enumerable: true, - get: function () { - return transformTranslate__default['default']; - } -})); -Object.defineProperty(exports, "lineOffset", ({ - enumerable: true, - get: function () { - return lineOffset__default['default']; - } -})); -Object.defineProperty(exports, "polygonize", ({ - enumerable: true, - get: function () { - return polygonize__default['default']; - } -})); -Object.defineProperty(exports, "booleanDisjoint", ({ - enumerable: true, - get: function () { - return booleanDisjoint__default['default']; - } -})); -Object.defineProperty(exports, "booleanContains", ({ - enumerable: true, - get: function () { - return booleanContains__default['default']; - } -})); -Object.defineProperty(exports, "booleanCrosses", ({ - enumerable: true, - get: function () { - return booleanCrosses__default['default']; - } -})); -Object.defineProperty(exports, "booleanClockwise", ({ - enumerable: true, - get: function () { - return booleanClockwise__default['default']; - } -})); -Object.defineProperty(exports, "booleanOverlap", ({ - enumerable: true, - get: function () { - return booleanOverlap__default['default']; - } -})); -Object.defineProperty(exports, "booleanPointOnLine", ({ - enumerable: true, - get: function () { - return booleanPointOnLine__default['default']; - } -})); -Object.defineProperty(exports, "booleanEqual", ({ - enumerable: true, - get: function () { - return booleanEqual__default['default']; - } -})); -Object.defineProperty(exports, "booleanWithin", ({ - enumerable: true, - get: function () { - return booleanWithin__default['default']; - } -})); -Object.defineProperty(exports, "booleanIntersects", ({ - enumerable: true, - get: function () { - return booleanIntersects__default['default']; - } -})); -Object.defineProperty(exports, "clone", ({ - enumerable: true, - get: function () { - return clone__default['default']; - } -})); -Object.defineProperty(exports, "cleanCoords", ({ - enumerable: true, - get: function () { - return cleanCoords__default['default']; - } -})); -Object.defineProperty(exports, "clustersDbscan", ({ - enumerable: true, - get: function () { - return clustersDbscan__default['default']; - } -})); -Object.defineProperty(exports, "clustersKmeans", ({ - enumerable: true, - get: function () { - return clustersKmeans__default['default']; - } -})); -Object.defineProperty(exports, "pointToLineDistance", ({ - enumerable: true, - get: function () { - return pointToLineDistance__default['default']; - } -})); -Object.defineProperty(exports, "booleanParallel", ({ - enumerable: true, - get: function () { - return booleanParallel__default['default']; - } -})); -Object.defineProperty(exports, "shortestPath", ({ - enumerable: true, - get: function () { - return shortestPath__default['default']; - } -})); -Object.defineProperty(exports, "voronoi", ({ - enumerable: true, - get: function () { - return voronoi__default['default']; - } -})); -Object.defineProperty(exports, "ellipse", ({ - enumerable: true, - get: function () { - return ellipse__default['default']; - } -})); -Object.defineProperty(exports, "centerMean", ({ - enumerable: true, - get: function () { - return centerMean__default['default']; - } -})); -Object.defineProperty(exports, "centerMedian", ({ - enumerable: true, - get: function () { - return centerMedian__default['default']; - } -})); -Object.defineProperty(exports, "standardDeviationalEllipse", ({ - enumerable: true, - get: function () { - return standardDeviationalEllipse__default['default']; - } -})); -Object.defineProperty(exports, "angle", ({ - enumerable: true, - get: function () { - return angle__default['default']; - } -})); -Object.defineProperty(exports, "polygonSmooth", ({ - enumerable: true, - get: function () { - return polygonSmooth__default['default']; - } -})); -Object.defineProperty(exports, "moranIndex", ({ - enumerable: true, - get: function () { - return moranIndex__default['default']; - } -})); -Object.defineProperty(exports, "distanceWeight", ({ - enumerable: true, - get: function () { - return distanceWeight__default['default']; - } -})); -exports.projection = projection__namespace; -exports.random = random__namespace; -exports.clusters = clusters__namespace; -Object.defineProperty(exports, "bearingToAngle", ({ - enumerable: true, - get: function () { - return helpers.bearingToAzimuth; - } -})); -Object.defineProperty(exports, "convertDistance", ({ - enumerable: true, - get: function () { - return helpers.convertLength; - } -})); -Object.defineProperty(exports, "degrees2radians", ({ - enumerable: true, - get: function () { - return helpers.degreesToRadians; - } -})); -Object.defineProperty(exports, "distanceToDegrees", ({ - enumerable: true, - get: function () { - return helpers.lengthToDegrees; - } -})); -Object.defineProperty(exports, "distanceToRadians", ({ - enumerable: true, - get: function () { - return helpers.lengthToRadians; - } -})); -exports.helpers = helpers__namespace; -Object.defineProperty(exports, "radians2degrees", ({ - enumerable: true, - get: function () { - return helpers.radiansToDegrees; - } -})); -Object.defineProperty(exports, "radiansToDistance", ({ - enumerable: true, - get: function () { - return helpers.radiansToLength; - } -})); -exports.invariant = invariant__namespace; -exports.meta = meta__namespace; -Object.defineProperty(exports, "difference", ({ - enumerable: true, - get: function () { - return difference__default['default']; - } -})); -Object.defineProperty(exports, "buffer", ({ - enumerable: true, - get: function () { - return buffer__default['default']; - } -})); -Object.defineProperty(exports, "union", ({ - enumerable: true, - get: function () { - return union__default['default']; - } -})); -Object.defineProperty(exports, "intersect", ({ - enumerable: true, - get: function () { - return intersect__default['default']; - } -})); -Object.defineProperty(exports, "dissolve", ({ - enumerable: true, - get: function () { - return dissolve__default['default']; - } -})); -Object.defineProperty(exports, "hexGrid", ({ - enumerable: true, - get: function () { - return hexGrid__default['default']; - } -})); -Object.defineProperty(exports, "mask", ({ - enumerable: true, - get: function () { - return mask__default['default']; - } -})); -Object.defineProperty(exports, "squareGrid", ({ - enumerable: true, - get: function () { - return squareGrid__default['default']; - } -})); -Object.defineProperty(exports, "triangleGrid", ({ - enumerable: true, - get: function () { - return triangleGrid__default['default']; - } -})); -Object.defineProperty(exports, "interpolate", ({ - enumerable: true, - get: function () { - return interpolate__default['default']; - } -})); - - -/***/ }), - -/***/ 3932: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -var helpers_1 = __webpack_require__(8967); -/** - * Takes a bbox and returns an equivalent {@link Polygon|polygon}. - * - * @name bboxPolygon - * @param {BBox} bbox extent in [minX, minY, maxX, maxY] order - * @param {Object} [options={}] Optional parameters - * @param {Properties} [options.properties={}] Translate properties to Polygon - * @param {string|number} [options.id={}] Translate Id to Polygon - * @returns {Feature} a Polygon representation of the bounding box - * @example - * var bbox = [0, 0, 10, 10]; - * - * var poly = turf.bboxPolygon(bbox); - * - * //addToMap - * var addToMap = [poly] - */ -function bboxPolygon(bbox, options) { - if (options === void 0) { options = {}; } - // Convert BBox positions to Numbers - // No performance loss for including Number() - // https://github.com/Turfjs/turf/issues/1119 - var west = Number(bbox[0]); - var south = Number(bbox[1]); - var east = Number(bbox[2]); - var north = Number(bbox[3]); - if (bbox.length === 6) { - throw new Error("@turf/bbox-polygon does not support BBox with 6 positions"); - } - var lowLeft = [west, south]; - var topLeft = [west, north]; - var topRight = [east, north]; - var lowRight = [east, south]; - return helpers_1.polygon([[lowLeft, lowRight, topRight, topLeft, lowLeft]], options.properties, { bbox: bbox, id: options.id }); -} -exports["default"] = bboxPolygon; - - -/***/ }), - -/***/ 3974: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var bbox_1 = __importDefault(__webpack_require__(4383)); -var boolean_point_in_polygon_1 = __importDefault(__webpack_require__(2446)); -var boolean_point_on_line_1 = __importDefault(__webpack_require__(5378)); -var invariant_1 = __webpack_require__(8506); -/** - * Boolean-contains returns True if the second geometry is completely contained by the first geometry. - * The interiors of both geometries must intersect and, the interior and boundary of the secondary (geometry b) - * must not intersect the exterior of the primary (geometry a). - * Boolean-contains returns the exact opposite result of the `@turf/boolean-within`. - * - * @name booleanContains - * @param {Geometry|Feature} feature1 GeoJSON Feature or Geometry - * @param {Geometry|Feature} feature2 GeoJSON Feature or Geometry - * @returns {boolean} true/false - * @example - * var line = turf.lineString([[1, 1], [1, 2], [1, 3], [1, 4]]); - * var point = turf.point([1, 2]); - * - * turf.booleanContains(line, point); - * //=true - */ -function booleanContains(feature1, feature2) { - var geom1 = invariant_1.getGeom(feature1); - var geom2 = invariant_1.getGeom(feature2); - var type1 = geom1.type; - var type2 = geom2.type; - var coords1 = geom1.coordinates; - var coords2 = geom2.coordinates; - switch (type1) { - case "Point": - switch (type2) { - case "Point": - return compareCoords(coords1, coords2); - default: - throw new Error("feature2 " + type2 + " geometry not supported"); - } - case "MultiPoint": - switch (type2) { - case "Point": - return isPointInMultiPoint(geom1, geom2); - case "MultiPoint": - return isMultiPointInMultiPoint(geom1, geom2); - default: - throw new Error("feature2 " + type2 + " geometry not supported"); - } - case "LineString": - switch (type2) { - case "Point": - return boolean_point_on_line_1.default(geom2, geom1, { ignoreEndVertices: true }); - case "LineString": - return isLineOnLine(geom1, geom2); - case "MultiPoint": - return isMultiPointOnLine(geom1, geom2); - default: - throw new Error("feature2 " + type2 + " geometry not supported"); - } - case "Polygon": - switch (type2) { - case "Point": - return boolean_point_in_polygon_1.default(geom2, geom1, { ignoreBoundary: true }); - case "LineString": - return isLineInPoly(geom1, geom2); - case "Polygon": - return isPolyInPoly(geom1, geom2); - case "MultiPoint": - return isMultiPointInPoly(geom1, geom2); - default: - throw new Error("feature2 " + type2 + " geometry not supported"); - } - default: - throw new Error("feature1 " + type1 + " geometry not supported"); - } -} -exports["default"] = booleanContains; -function isPointInMultiPoint(multiPoint, pt) { - var i; - var output = false; - for (i = 0; i < multiPoint.coordinates.length; i++) { - if (compareCoords(multiPoint.coordinates[i], pt.coordinates)) { - output = true; - break; - } - } - return output; -} -exports.isPointInMultiPoint = isPointInMultiPoint; -function isMultiPointInMultiPoint(multiPoint1, multiPoint2) { - for (var _i = 0, _a = multiPoint2.coordinates; _i < _a.length; _i++) { - var coord2 = _a[_i]; - var matchFound = false; - for (var _b = 0, _c = multiPoint1.coordinates; _b < _c.length; _b++) { - var coord1 = _c[_b]; - if (compareCoords(coord2, coord1)) { - matchFound = true; - break; - } - } - if (!matchFound) { - return false; - } - } - return true; -} -exports.isMultiPointInMultiPoint = isMultiPointInMultiPoint; -function isMultiPointOnLine(lineString, multiPoint) { - var haveFoundInteriorPoint = false; - for (var _i = 0, _a = multiPoint.coordinates; _i < _a.length; _i++) { - var coord = _a[_i]; - if (boolean_point_on_line_1.default(coord, lineString, { ignoreEndVertices: true })) { - haveFoundInteriorPoint = true; - } - if (!boolean_point_on_line_1.default(coord, lineString)) { - return false; - } - } - if (haveFoundInteriorPoint) { - return true; - } - return false; -} -exports.isMultiPointOnLine = isMultiPointOnLine; -function isMultiPointInPoly(polygon, multiPoint) { - for (var _i = 0, _a = multiPoint.coordinates; _i < _a.length; _i++) { - var coord = _a[_i]; - if (!boolean_point_in_polygon_1.default(coord, polygon, { ignoreBoundary: true })) { - return false; - } - } - return true; -} -exports.isMultiPointInPoly = isMultiPointInPoly; -function isLineOnLine(lineString1, lineString2) { - var haveFoundInteriorPoint = false; - for (var _i = 0, _a = lineString2.coordinates; _i < _a.length; _i++) { - var coords = _a[_i]; - if (boolean_point_on_line_1.default({ type: "Point", coordinates: coords }, lineString1, { - ignoreEndVertices: true, - })) { - haveFoundInteriorPoint = true; - } - if (!boolean_point_on_line_1.default({ type: "Point", coordinates: coords }, lineString1, { - ignoreEndVertices: false, - })) { - return false; - } - } - return haveFoundInteriorPoint; -} -exports.isLineOnLine = isLineOnLine; -function isLineInPoly(polygon, linestring) { - var output = false; - var i = 0; - var polyBbox = bbox_1.default(polygon); - var lineBbox = bbox_1.default(linestring); - if (!doBBoxOverlap(polyBbox, lineBbox)) { - return false; - } - for (i; i < linestring.coordinates.length - 1; i++) { - var midPoint = getMidpoint(linestring.coordinates[i], linestring.coordinates[i + 1]); - if (boolean_point_in_polygon_1.default({ type: "Point", coordinates: midPoint }, polygon, { - ignoreBoundary: true, - })) { - output = true; - break; - } - } - return output; -} -exports.isLineInPoly = isLineInPoly; -/** - * Is Polygon2 in Polygon1 - * Only takes into account outer rings - * - * @private - * @param {Geometry|Feature} feature1 Polygon1 - * @param {Geometry|Feature} feature2 Polygon2 - * @returns {boolean} true/false - */ -function isPolyInPoly(feature1, feature2) { - // Handle Nulls - if (feature1.type === "Feature" && feature1.geometry === null) { - return false; - } - if (feature2.type === "Feature" && feature2.geometry === null) { - return false; - } - var poly1Bbox = bbox_1.default(feature1); - var poly2Bbox = bbox_1.default(feature2); - if (!doBBoxOverlap(poly1Bbox, poly2Bbox)) { - return false; - } - var coords = invariant_1.getGeom(feature2).coordinates; - for (var _i = 0, coords_1 = coords; _i < coords_1.length; _i++) { - var ring = coords_1[_i]; - for (var _a = 0, ring_1 = ring; _a < ring_1.length; _a++) { - var coord = ring_1[_a]; - if (!boolean_point_in_polygon_1.default(coord, feature1)) { - return false; - } - } - } - return true; -} -exports.isPolyInPoly = isPolyInPoly; -function doBBoxOverlap(bbox1, bbox2) { - if (bbox1[0] > bbox2[0]) { - return false; - } - if (bbox1[2] < bbox2[2]) { - return false; - } - if (bbox1[1] > bbox2[1]) { - return false; - } - if (bbox1[3] < bbox2[3]) { - return false; - } - return true; -} -exports.doBBoxOverlap = doBBoxOverlap; -/** - * compareCoords - * - * @private - * @param {Position} pair1 point [x,y] - * @param {Position} pair2 point [x,y] - * @returns {boolean} true/false if coord pairs match - */ -function compareCoords(pair1, pair2) { - return pair1[0] === pair2[0] && pair1[1] === pair2[1]; -} -exports.compareCoords = compareCoords; -function getMidpoint(pair1, pair2) { - return [(pair1[0] + pair2[0]) / 2, (pair1[1] + pair2[1]) / 2]; -} -exports.getMidpoint = getMidpoint; - - -/***/ }), - -/***/ 3980: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var clean_coords_1 = __importDefault(__webpack_require__(2086)); -var line_segment_1 = __importDefault(__webpack_require__(7042)); -var rhumb_bearing_1 = __importDefault(__webpack_require__(2307)); -var helpers_1 = __webpack_require__(8967); -/** - * Boolean-Parallel returns True if each segment of `line1` is parallel to the correspondent segment of `line2` - * - * @name booleanParallel - * @param {Geometry|Feature} line1 GeoJSON Feature or Geometry - * @param {Geometry|Feature} line2 GeoJSON Feature or Geometry - * @returns {boolean} true/false if the lines are parallel - * @example - * var line1 = turf.lineString([[0, 0], [0, 1]]); - * var line2 = turf.lineString([[1, 0], [1, 1]]); - * - * turf.booleanParallel(line1, line2); - * //=true - */ -function booleanParallel(line1, line2) { - // validation - if (!line1) - throw new Error("line1 is required"); - if (!line2) - throw new Error("line2 is required"); - var type1 = getType(line1, "line1"); - if (type1 !== "LineString") - throw new Error("line1 must be a LineString"); - var type2 = getType(line2, "line2"); - if (type2 !== "LineString") - throw new Error("line2 must be a LineString"); - var segments1 = line_segment_1.default(clean_coords_1.default(line1)).features; - var segments2 = line_segment_1.default(clean_coords_1.default(line2)).features; - for (var i = 0; i < segments1.length; i++) { - var segment1 = segments1[i].geometry.coordinates; - if (!segments2[i]) - break; - var segment2 = segments2[i].geometry.coordinates; - if (!isParallel(segment1, segment2)) - return false; - } - return true; -} -/** - * Compares slopes and return result - * - * @private - * @param {Geometry|Feature} segment1 Geometry or Feature - * @param {Geometry|Feature} segment2 Geometry or Feature - * @returns {boolean} if slopes are equal - */ -function isParallel(segment1, segment2) { - var slope1 = helpers_1.bearingToAzimuth(rhumb_bearing_1.default(segment1[0], segment1[1])); - var slope2 = helpers_1.bearingToAzimuth(rhumb_bearing_1.default(segment2[0], segment2[1])); - return slope1 === slope2; -} -/** - * Returns Feature's type - * - * @private - * @param {Geometry|Feature} geojson Geometry or Feature - * @param {string} name of the variable - * @returns {string} Feature's type - */ -function getType(geojson, name) { - if (geojson.geometry && geojson.geometry.type) - return geojson.geometry.type; - if (geojson.type) - return geojson.type; // if GeoJSON geometry - throw new Error("Invalid GeoJSON object for " + name); -} -exports["default"] = booleanParallel; - - -/***/ }), - -/***/ 3984: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var supportsDescriptors = (__webpack_require__(8452).supportsDescriptors); -var getPolyfill = __webpack_require__(5330); -var gOPD = Object.getOwnPropertyDescriptor; -var defineProperty = Object.defineProperty; -var TypeErr = TypeError; -var getProto = Object.getPrototypeOf; -var regex = /a/; - -module.exports = function shimFlags() { - if (!supportsDescriptors || !getProto) { - throw new TypeErr('RegExp.prototype.flags requires a true ES5 environment that supports property descriptors'); - } - var polyfill = getPolyfill(); - var proto = getProto(regex); - var descriptor = gOPD(proto, 'flags'); - if (!descriptor || descriptor.get !== polyfill) { - defineProperty(proto, 'flags', { - configurable: true, - enumerable: false, - get: polyfill - }); - } - return polyfill; -}; - - -/***/ }), - -/***/ 4035: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var callBound = __webpack_require__(8075); -var hasToStringTag = __webpack_require__(9092)(); -var has; -var $exec; -var isRegexMarker; -var badStringifier; - -if (hasToStringTag) { - has = callBound('Object.prototype.hasOwnProperty'); - $exec = callBound('RegExp.prototype.exec'); - isRegexMarker = {}; - - var throwRegexMarker = function () { - throw isRegexMarker; - }; - badStringifier = { - toString: throwRegexMarker, - valueOf: throwRegexMarker - }; - - if (typeof Symbol.toPrimitive === 'symbol') { - badStringifier[Symbol.toPrimitive] = throwRegexMarker; - } -} - -var $toString = callBound('Object.prototype.toString'); -var gOPD = Object.getOwnPropertyDescriptor; -var regexClass = '[object RegExp]'; - -module.exports = hasToStringTag - // eslint-disable-next-line consistent-return - ? function isRegex(value) { - if (!value || typeof value !== 'object') { - return false; - } - - var descriptor = gOPD(value, 'lastIndex'); - var hasLastIndexDataProperty = descriptor && has(descriptor, 'value'); - if (!hasLastIndexDataProperty) { - return false; - } - - try { - $exec(value, badStringifier); - } catch (e) { - return e === isRegexMarker; - } - } - : function isRegex(value) { - // In older browsers, typeof regex incorrectly returns 'function' - if (!value || (typeof value !== 'object' && typeof value !== 'function')) { - return false; - } - - return $toString(value) === regexClass; - }; - - -/***/ }), - -/***/ 4036: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var meta = __webpack_require__(8421); -var helpers = __webpack_require__(8967); - -/** - * Flattens any {@link GeoJSON} to a {@link FeatureCollection} inspired by [geojson-flatten](https://github.com/tmcw/geojson-flatten). - * - * @name flatten - * @param {GeoJSON} geojson any valid GeoJSON Object - * @returns {FeatureCollection} all Multi-Geometries are flattened into single Features - * @example - * var multiGeometry = turf.multiPolygon([ - * [[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]], - * [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]], - * [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]] - * ]); - * - * var flatten = turf.flatten(multiGeometry); - * - * //addToMap - * var addToMap = [flatten] - */ -function flatten(geojson) { - if (!geojson) throw new Error("geojson is required"); - - var results = []; - meta.flattenEach(geojson, function (feature) { - results.push(feature); - }); - return helpers.featureCollection(results); -} - -module.exports = flatten; -module.exports["default"] = flatten; - - -/***/ }), - -/***/ 4039: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var origSymbol = typeof Symbol !== 'undefined' && Symbol; -var hasSymbolSham = __webpack_require__(1333); - -/** @type {import('.')} */ -module.exports = function hasNativeSymbols() { - if (typeof origSymbol !== 'function') { return false; } - if (typeof Symbol !== 'function') { return false; } - if (typeof origSymbol('foo') !== 'symbol') { return false; } - if (typeof Symbol('bar') !== 'symbol') { return false; } - - return hasSymbolSham(); -}; - - -/***/ }), - -/***/ 4202: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -// http://en.wikipedia.org/wiki/Haversine_formula -// http://www.movable-type.co.uk/scripts/latlong.html -var helpers_1 = __webpack_require__(8967); -var invariant_1 = __webpack_require__(8506); -/** - * Takes a {@link Point} and calculates the location of a destination point given a distance in - * degrees, radians, miles, or kilometers; and bearing in degrees. - * This uses the [Haversine formula](http://en.wikipedia.org/wiki/Haversine_formula) to account for global curvature. - * - * @name destination - * @param {Coord} origin starting point - * @param {number} distance distance from the origin point - * @param {number} bearing ranging from -180 to 180 - * @param {Object} [options={}] Optional parameters - * @param {string} [options.units='kilometers'] miles, kilometers, degrees, or radians - * @param {Object} [options.properties={}] Translate properties to Point - * @returns {Feature} destination point - * @example - * var point = turf.point([-75.343, 39.984]); - * var distance = 50; - * var bearing = 90; - * var options = {units: 'miles'}; - * - * var destination = turf.destination(point, distance, bearing, options); - * - * //addToMap - * var addToMap = [point, destination] - * destination.properties['marker-color'] = '#f00'; - * point.properties['marker-color'] = '#0f0'; - */ -function destination(origin, distance, bearing, options) { - if (options === void 0) { options = {}; } - // Handle input - var coordinates1 = invariant_1.getCoord(origin); - var longitude1 = helpers_1.degreesToRadians(coordinates1[0]); - var latitude1 = helpers_1.degreesToRadians(coordinates1[1]); - var bearingRad = helpers_1.degreesToRadians(bearing); - var radians = helpers_1.lengthToRadians(distance, options.units); - // Main - var latitude2 = Math.asin(Math.sin(latitude1) * Math.cos(radians) + - Math.cos(latitude1) * Math.sin(radians) * Math.cos(bearingRad)); - var longitude2 = longitude1 + - Math.atan2(Math.sin(bearingRad) * Math.sin(radians) * Math.cos(latitude1), Math.cos(radians) - Math.sin(latitude1) * Math.sin(latitude2)); - var lng = helpers_1.radiansToDegrees(longitude2); - var lat = helpers_1.radiansToDegrees(latitude2); - return helpers_1.point([lng, lat], options.properties); -} -exports["default"] = destination; - - -/***/ }), - -/***/ 4262: -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (/* binding */ TinyQueue) -/* harmony export */ }); - -class TinyQueue { - constructor(data = [], compare = defaultCompare) { - this.data = data; - this.length = this.data.length; - this.compare = compare; - - if (this.length > 0) { - for (let i = (this.length >> 1) - 1; i >= 0; i--) this._down(i); - } - } - - push(item) { - this.data.push(item); - this.length++; - this._up(this.length - 1); - } - - pop() { - if (this.length === 0) return undefined; - - const top = this.data[0]; - const bottom = this.data.pop(); - this.length--; - - if (this.length > 0) { - this.data[0] = bottom; - this._down(0); - } - - return top; - } - - peek() { - return this.data[0]; - } - - _up(pos) { - const {data, compare} = this; - const item = data[pos]; - - while (pos > 0) { - const parent = (pos - 1) >> 1; - const current = data[parent]; - if (compare(item, current) >= 0) break; - data[pos] = current; - pos = parent; - } - - data[pos] = item; - } - - _down(pos) { - const {data, compare} = this; - const halfLength = this.length >> 1; - const item = data[pos]; - - while (pos < halfLength) { - let left = (pos << 1) + 1; - let best = data[left]; - const right = left + 1; - - if (right < this.length && compare(data[right], best) < 0) { - left = right; - best = data[right]; - } - if (compare(best, item) >= 0) break; - - data[pos] = best; - pos = left; - } - - data[pos] = item; - } -} - -function defaultCompare(a, b) { - return a < b ? -1 : a > b ? 1 : 0; -} - - -/***/ }), - -/***/ 4300: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var geojson_rbush_1 = __importDefault(__webpack_require__(4945)); -var line_segment_1 = __importDefault(__webpack_require__(7042)); -var nearest_point_on_line_1 = __importDefault(__webpack_require__(7696)); -var boolean_point_on_line_1 = __importDefault(__webpack_require__(5378)); -var invariant_1 = __webpack_require__(8506); -var meta_1 = __webpack_require__(8421); -var helpers_1 = __webpack_require__(8967); -var deep_equal_1 = __importDefault(__webpack_require__(4982)); -/** - * Takes any LineString or Polygon and returns the overlapping lines between both features. - * - * @name lineOverlap - * @param {Geometry|Feature} line1 any LineString or Polygon - * @param {Geometry|Feature} line2 any LineString or Polygon - * @param {Object} [options={}] Optional parameters - * @param {number} [options.tolerance=0] Tolerance distance to match overlapping line segments (in kilometers) - * @returns {FeatureCollection} lines(s) that are overlapping between both features - * @example - * var line1 = turf.lineString([[115, -35], [125, -30], [135, -30], [145, -35]]); - * var line2 = turf.lineString([[115, -25], [125, -30], [135, -30], [145, -25]]); - * - * var overlapping = turf.lineOverlap(line1, line2); - * - * //addToMap - * var addToMap = [line1, line2, overlapping] - */ -function lineOverlap(line1, line2, options) { - if (options === void 0) { options = {}; } - // Optional parameters - options = options || {}; - if (!helpers_1.isObject(options)) - throw new Error("options is invalid"); - var tolerance = options.tolerance || 0; - // Containers - var features = []; - // Create Spatial Index - var tree = geojson_rbush_1.default(); - // To-Do -- HACK way to support typescript - var line = line_segment_1.default(line1); - tree.load(line); - var overlapSegment; - // Line Intersection - // Iterate over line segments - meta_1.segmentEach(line2, function (segment) { - var doesOverlaps = false; - if (!segment) { - return; - } - // Iterate over each segments which falls within the same bounds - meta_1.featureEach(tree.search(segment), function (match) { - if (doesOverlaps === false) { - var coordsSegment = invariant_1.getCoords(segment).sort(); - var coordsMatch = invariant_1.getCoords(match).sort(); - // Segment overlaps feature - if (deep_equal_1.default(coordsSegment, coordsMatch)) { - doesOverlaps = true; - // Overlaps already exists - only append last coordinate of segment - if (overlapSegment) - overlapSegment = concatSegment(overlapSegment, segment); - else - overlapSegment = segment; - // Match segments which don't share nodes (Issue #901) - } - else if (tolerance === 0 - ? boolean_point_on_line_1.default(coordsSegment[0], match) && - boolean_point_on_line_1.default(coordsSegment[1], match) - : nearest_point_on_line_1.default(match, coordsSegment[0]).properties.dist <= - tolerance && - nearest_point_on_line_1.default(match, coordsSegment[1]).properties.dist <= - tolerance) { - doesOverlaps = true; - if (overlapSegment) - overlapSegment = concatSegment(overlapSegment, segment); - else - overlapSegment = segment; - } - else if (tolerance === 0 - ? boolean_point_on_line_1.default(coordsMatch[0], segment) && - boolean_point_on_line_1.default(coordsMatch[1], segment) - : nearest_point_on_line_1.default(segment, coordsMatch[0]).properties.dist <= - tolerance && - nearest_point_on_line_1.default(segment, coordsMatch[1]).properties.dist <= - tolerance) { - // Do not define (doesOverlap = true) since more matches can occur within the same segment - // doesOverlaps = true; - if (overlapSegment) - overlapSegment = concatSegment(overlapSegment, match); - else - overlapSegment = match; - } - } - }); - // Segment doesn't overlap - add overlaps to results & reset - if (doesOverlaps === false && overlapSegment) { - features.push(overlapSegment); - overlapSegment = undefined; - } - }); - // Add last segment if exists - if (overlapSegment) - features.push(overlapSegment); - return helpers_1.featureCollection(features); -} -/** - * Concat Segment - * - * @private - * @param {Feature} line LineString - * @param {Feature} segment 2-vertex LineString - * @returns {Feature} concat linestring - */ -function concatSegment(line, segment) { - var coords = invariant_1.getCoords(segment); - var lineCoords = invariant_1.getCoords(line); - var start = lineCoords[0]; - var end = lineCoords[lineCoords.length - 1]; - var geom = line.geometry.coordinates; - if (deep_equal_1.default(coords[0], start)) - geom.unshift(coords[1]); - else if (deep_equal_1.default(coords[0], end)) - geom.push(coords[1]); - else if (deep_equal_1.default(coords[1], start)) - geom.unshift(coords[0]); - else if (deep_equal_1.default(coords[1], end)) - geom.push(coords[0]); - return line; -} -exports["default"] = lineOverlap; - - -/***/ }), - -/***/ 4309: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var bearing_1 = __importDefault(__webpack_require__(1288)); -var helpers_1 = __webpack_require__(8967); -var rhumb_bearing_1 = __importDefault(__webpack_require__(2307)); -/** - * Finds the angle formed by two adjacent segments defined by 3 points. The result will be the (positive clockwise) - * angle with origin on the `startPoint-midPoint` segment, or its explementary angle if required. - * - * @name angle - * @param {Coord} startPoint Start Point Coordinates - * @param {Coord} midPoint Mid Point Coordinates - * @param {Coord} endPoint End Point Coordinates - * @param {Object} [options={}] Optional parameters - * @param {boolean} [options.explementary=false] Returns the explementary angle instead (360 - angle) - * @param {boolean} [options.mercator=false] if calculations should be performed over Mercator or WGS84 projection - * @returns {number} Angle between the provided points, or its explementary. - * @example - * turf.angle([5, 5], [5, 6], [3, 4]); - * //=45 - */ -function angle(startPoint, midPoint, endPoint, options) { - if (options === void 0) { options = {}; } - // Optional Parameters - if (!helpers_1.isObject(options)) { - throw new Error("options is invalid"); - } - // Validation - if (!startPoint) { - throw new Error("startPoint is required"); - } - if (!midPoint) { - throw new Error("midPoint is required"); - } - if (!endPoint) { - throw new Error("endPoint is required"); - } - // Rename to shorter variables - var A = startPoint; - var O = midPoint; - var B = endPoint; - // Main - var azimuthAO = helpers_1.bearingToAzimuth(options.mercator !== true ? bearing_1.default(A, O) : rhumb_bearing_1.default(A, O)); - var azimuthBO = helpers_1.bearingToAzimuth(options.mercator !== true ? bearing_1.default(B, O) : rhumb_bearing_1.default(B, O)); - var angleAO = Math.abs(azimuthAO - azimuthBO); - // Explementary angle - if (options.explementary === true) { - return 360 - angleAO; - } - return angleAO; -} -exports["default"] = angle; - - -/***/ }), - -/***/ 4333: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var meta = __webpack_require__(8421); -var invariant = __webpack_require__(8506); -var helpers = __webpack_require__(8967); -var centerMean = __webpack_require__(2779); -var pointsWithinPolygon = __webpack_require__(6432); -var ellipse = __webpack_require__(7420); - -function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } - -var centerMean__default = /*#__PURE__*/_interopDefaultLegacy(centerMean); -var pointsWithinPolygon__default = /*#__PURE__*/_interopDefaultLegacy(pointsWithinPolygon); -var ellipse__default = /*#__PURE__*/_interopDefaultLegacy(ellipse); - -/** - * Takes a {@link FeatureCollection} and returns a standard deviational ellipse, - * also known as a “directional distribution.” The standard deviational ellipse - * aims to show the direction and the distribution of a dataset by drawing - * an ellipse that contains about one standard deviation’s worth (~ 70%) of the - * data. - * - * This module mirrors the functionality of [Directional Distribution](http://desktop.arcgis.com/en/arcmap/10.3/tools/spatial-statistics-toolbox/directional-distribution.htm) - * in ArcGIS and the [QGIS Standard Deviational Ellipse Plugin](http://arken.nmbu.no/~havatv/gis/qgisplugins/SDEllipse/) - * - * **Bibliography** - * - * • Robert S. Yuill, “The Standard Deviational Ellipse; An Updated Tool for - * Spatial Description,” _Geografiska Annaler_ 53, no. 1 (1971): 28–39, - * doi:{@link https://doi.org/10.2307/490885|10.2307/490885}. - * - * • Paul Hanly Furfey, “A Note on Lefever’s “Standard Deviational Ellipse,” - * _American Journal of Sociology_ 33, no. 1 (1927): 94—98, - * doi:{@link https://doi.org/10.1086/214336|10.1086/214336}. - * - * - * @name standardDeviationalEllipse - * @param {FeatureCollection} points GeoJSON points - * @param {Object} [options={}] Optional parameters - * @param {string} [options.weight] the property name used to weight the center - * @param {number} [options.steps=64] number of steps for the polygon - * @param {Object} [options.properties={}] properties to pass to the resulting ellipse - * @returns {Feature} an elliptical Polygon that includes approximately 1 SD of the dataset within it. - * @example - * - * var bbox = [-74, 40.72, -73.98, 40.74]; - * var points = turf.randomPoint(400, {bbox: bbox}); - * var sdEllipse = turf.standardDeviationalEllipse(points); - * - * //addToMap - * var addToMap = [points, sdEllipse]; - * - */ -function standardDeviationalEllipse(points, options) { - // Optional params - options = options || {}; - if (!helpers.isObject(options)) throw new Error("options is invalid"); - var steps = options.steps || 64; - var weightTerm = options.weight; - var properties = options.properties || {}; - - // Validation: - if (!helpers.isNumber(steps)) throw new Error("steps must be a number"); - if (!helpers.isObject(properties)) throw new Error("properties must be a number"); - - // Calculate mean center & number of features: - var numberOfFeatures = meta.coordAll(points).length; - var meanCenter = centerMean__default['default'](points, { weight: weightTerm }); - - // Calculate angle of rotation: - // [X, Y] = mean center of all [x, y]. - // theta = arctan( (A + B) / C ) - // A = sum((x - X)^2) - sum((y - Y)^2) - // B = sqrt(A^2 + 4(sum((x - X)(y - Y))^2)) - // C = 2(sum((x - X)(y - Y))) - - var xDeviationSquaredSum = 0; - var yDeviationSquaredSum = 0; - var xyDeviationSum = 0; - - meta.featureEach(points, function (point) { - var weight = point.properties[weightTerm] || 1; - var deviation = getDeviations(invariant.getCoords(point), invariant.getCoords(meanCenter)); - xDeviationSquaredSum += Math.pow(deviation.x, 2) * weight; - yDeviationSquaredSum += Math.pow(deviation.y, 2) * weight; - xyDeviationSum += deviation.x * deviation.y * weight; - }); - - var bigA = xDeviationSquaredSum - yDeviationSquaredSum; - var bigB = Math.sqrt(Math.pow(bigA, 2) + 4 * Math.pow(xyDeviationSum, 2)); - var bigC = 2 * xyDeviationSum; - var theta = Math.atan((bigA + bigB) / bigC); - var thetaDeg = (theta * 180) / Math.PI; - - // Calculate axes: - // sigmaX = sqrt((1 / n - 2) * sum((((x - X) * cos(theta)) - ((y - Y) * sin(theta)))^2)) - // sigmaY = sqrt((1 / n - 2) * sum((((x - X) * sin(theta)) - ((y - Y) * cos(theta)))^2)) - var sigmaXsum = 0; - var sigmaYsum = 0; - var weightsum = 0; - meta.featureEach(points, function (point) { - var weight = point.properties[weightTerm] || 1; - var deviation = getDeviations(invariant.getCoords(point), invariant.getCoords(meanCenter)); - sigmaXsum += - Math.pow( - deviation.x * Math.cos(theta) - deviation.y * Math.sin(theta), - 2 - ) * weight; - sigmaYsum += - Math.pow( - deviation.x * Math.sin(theta) + deviation.y * Math.cos(theta), - 2 - ) * weight; - weightsum += weight; - }); - - var sigmaX = Math.sqrt((2 * sigmaXsum) / weightsum); - var sigmaY = Math.sqrt((2 * sigmaYsum) / weightsum); - - var theEllipse = ellipse__default['default'](meanCenter, sigmaX, sigmaY, { - units: "degrees", - angle: thetaDeg, - steps: steps, - properties: properties, - }); - var pointsWithinEllipse = pointsWithinPolygon__default['default']( - points, - helpers.featureCollection([theEllipse]) - ); - var standardDeviationalEllipseProperties = { - meanCenterCoordinates: invariant.getCoords(meanCenter), - semiMajorAxis: sigmaX, - semiMinorAxis: sigmaY, - numberOfFeatures: numberOfFeatures, - angle: thetaDeg, - percentageWithinEllipse: - (100 * meta.coordAll(pointsWithinEllipse).length) / numberOfFeatures, - }; - theEllipse.properties.standardDeviationalEllipse = standardDeviationalEllipseProperties; - - return theEllipse; -} - -/** - * Get x_i - X and y_i - Y - * - * @private - * @param {Array} coordinates Array of [x_i, y_i] - * @param {Array} center Array of [X, Y] - * @returns {Object} { x: n, y: m } - */ -function getDeviations(coordinates, center) { - return { - x: coordinates[0] - center[0], - y: coordinates[1] - center[1], - }; -} - -module.exports = standardDeviationalEllipse; -module.exports["default"] = standardDeviationalEllipse; - - -/***/ }), - -/***/ 4383: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -var meta_1 = __webpack_require__(8421); -/** - * Takes a set of features, calculates the bbox of all input features, and returns a bounding box. - * - * @name bbox - * @param {GeoJSON} geojson any GeoJSON object - * @returns {BBox} bbox extent in [minX, minY, maxX, maxY] order - * @example - * var line = turf.lineString([[-74, 40], [-78, 42], [-82, 35]]); - * var bbox = turf.bbox(line); - * var bboxPolygon = turf.bboxPolygon(bbox); - * - * //addToMap - * var addToMap = [line, bboxPolygon] - */ -function bbox(geojson) { - var result = [Infinity, Infinity, -Infinity, -Infinity]; - meta_1.coordEach(geojson, function (coord) { - if (result[0] > coord[0]) { - result[0] = coord[0]; - } - if (result[1] > coord[1]) { - result[1] = coord[1]; - } - if (result[2] < coord[0]) { - result[2] = coord[0]; - } - if (result[3] < coord[1]) { - result[3] = coord[1]; - } - }); - return result; -} -bbox["default"] = bbox; -exports["default"] = bbox; - - -/***/ }), - -/***/ 4392: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.VALID_HTML_COLORS = void 0; -exports.VALID_HTML_COLORS = { "aliceblue": "#f0f8ff", "antiquewhite": "#faebd7", "aqua": "#00ffff", "aquamarine": "#7fffd4", "azure": "#f0ffff", - "beige": "#f5f5dc", "bisque": "#ffe4c4", "black": "#000000", "blanchedalmond": "#ffebcd", "blue": "#0000ff", "blueviolet": "#8a2be2", - "brown": "#a52a2a", "burlywood": "#deb887", - "cadetblue": "#5f9ea0", "chartreuse": "#7fff00", "chocolate": "#d2691e", "coral": "#ff7f50", "cornflowerblue": "#6495ed", - "cornsilk": "#fff8dc", "crimson": "#dc143c", "cyan": "#00ffff", - "darkblue": "#00008b", "darkcyan": "#008b8b", "darkgoldenrod": "#b8860b", "darkgray": "#a9a9a9", "darkgreen": "#006400", - "darkkhaki": "#bdb76b", "darkmagenta": "#8b008b", "darkolivegreen": "#556b2f", "darkorange": "#ff8c00", "darkorchid": "#9932cc", - "darkred": "#8b0000", "darksalmon": "#e9967a", "darkseagreen": "#8fbc8f", "darkslateblue": "#483d8b", "darkslategray": "#2f4f4f", - "darkturquoise": "#00ced1", "darkviolet": "#9400d3", "deeppink": "#ff1493", "deepskyblue": "#00bfff", "dimgray": "#696969", - "dodgerblue": "#1e90ff", - "firebrick": "#b22222", "floralwhite": "#fffaf0", "forestgreen": "#228b22", "fuchsia": "#ff00ff", - "gainsboro": "#dcdcdc", "ghostwhite": "#f8f8ff", "gold": "#ffd700", "goldenrod": "#daa520", "gray": "#808080", "green": "#008000", - "greenyellow": "#adff2f", - "honeydew": "#f0fff0", "hotpink": "#ff69b4", - "indianred ": "#cd5c5c", "indigo": "#4b0082", "ivory": "#fffff0", - "khaki": "#f0e68c", - "lavender": "#e6e6fa", "lavenderblush": "#fff0f5", "lawngreen": "#7cfc00", "lemonchiffon": "#fffacd", "lightblue": "#add8e6", - "lightcoral": "#f08080", "lightcyan": "#e0ffff", "lightgoldenrodyellow": "#fafad2", "lightgrey": "#d3d3d3", "lightgreen": "#90ee90", - "lightpink": "#ffb6c1", "lightsalmon": "#ffa07a", "lightseagreen": "#20b2aa", "lightskyblue": "#87cefa", "lightslategray": "#778899", - "lightsteelblue": "#b0c4de", "lightyellow": "#ffffe0", "lime": "#00ff00", "limegreen": "#32cd32", "linen": "#faf0e6", - "magenta": "#ff00ff", "maroon": "#800000", "mediumaquamarine": "#66cdaa", "mediumblue": "#0000cd", "mediumorchid": "#ba55d3", - "mediumpurple": "#9370d8", "mediumseagreen": "#3cb371", "mediumslateblue": "#7b68ee", "mediumspringgreen": "#00fa9a", - "mediumturquoise": "#48d1cc", "mediumvioletred": "#c71585", "midnightblue": "#191970", "mintcream": "#f5fffa", "mistyrose": "#ffe4e1", - "moccasin": "#ffe4b5", - "navajowhite": "#ffdead", "navy": "#000080", - "oldlace": "#fdf5e6", "olive": "#808000", "olivedrab": "#6b8e23", "orange": "#ffa500", "orangered": "#ff4500", "orchid": "#da70d6", - "palegoldenrod": "#eee8aa", "palegreen": "#98fb98", "paleturquoise": "#afeeee", "palevioletred": "#d87093", "papayawhip": "#ffefd5", - "peachpuff": "#ffdab9", "peru": "#cd853f", "pink": "#ffc0cb", "plum": "#dda0dd", "powderblue": "#b0e0e6", "purple": "#800080", - "rebeccapurple": "#663399", "red": "#ff0000", "rosybrown": "#bc8f8f", "royalblue": "#4169e1", - "saddlebrown": "#8b4513", "salmon": "#fa8072", "sandybrown": "#f4a460", "seagreen": "#2e8b57", "seashell": "#fff5ee", "sienna": "#a0522d", - "silver": "#c0c0c0", "skyblue": "#87ceeb", "slateblue": "#6a5acd", "slategray": "#708090", "snow": "#fffafa", "springgreen": "#00ff7f", - "steelblue": "#4682b4", - "tan": "#d2b48c", "teal": "#008080", "thistle": "#d8bfd8", "tomato": "#ff6347", "turquoise": "#40e0d0", - "violet": "#ee82ee", - "wheat": "#f5deb3", "white": "#ffffff", "whitesmoke": "#f5f5f5", - "yellow": "#ffff00", "yellowgreen": "#9acd32" }; - - -/***/ }), - -/***/ 4408: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -var meta_1 = __webpack_require__(8421); -var helpers_1 = __webpack_require__(8967); -/** - * Takes one or more features and calculates the centroid using the mean of all vertices. - * This lessens the effect of small islands and artifacts when calculating the centroid of a set of polygons. - * - * @name centroid - * @param {GeoJSON} geojson GeoJSON to be centered - * @param {Object} [options={}] Optional Parameters - * @param {Object} [options.properties={}] an Object that is used as the {@link Feature}'s properties - * @returns {Feature} the centroid of the input features - * @example - * var polygon = turf.polygon([[[-81, 41], [-88, 36], [-84, 31], [-80, 33], [-77, 39], [-81, 41]]]); - * - * var centroid = turf.centroid(polygon); - * - * //addToMap - * var addToMap = [polygon, centroid] - */ -function centroid(geojson, options) { - if (options === void 0) { options = {}; } - var xSum = 0; - var ySum = 0; - var len = 0; - meta_1.coordEach(geojson, function (coord) { - xSum += coord[0]; - ySum += coord[1]; - len++; - }, true); - return helpers_1.point([xSum / len, ySum / len], options.properties); -} -exports["default"] = centroid; - - -/***/ }), - -/***/ 4459: -/***/ ((module) => { - -"use strict"; - - -/** @type {import('./isNaN')} */ -module.exports = Number.isNaN || function isNaN(a) { - return a !== a; -}; - - -/***/ }), - -/***/ 4462: -/***/ ((module) => { - -"use strict"; - - -var functionsHaveNames = function functionsHaveNames() { - return typeof function f() {}.name === 'string'; -}; - -var gOPD = Object.getOwnPropertyDescriptor; -if (gOPD) { - try { - gOPD([], 'length'); - } catch (e) { - // IE 8 has a broken gOPD - gOPD = null; - } -} - -functionsHaveNames.functionsHaveConfigurableNames = function functionsHaveConfigurableNames() { - if (!functionsHaveNames() || !gOPD) { - return false; - } - var desc = gOPD(function () {}, 'name'); - return !!desc && !!desc.configurable; -}; - -var $bind = Function.prototype.bind; - -functionsHaveNames.boundFunctionsHaveNames = function boundFunctionsHaveNames() { - return functionsHaveNames() && typeof $bind === 'function' && function f() {}.bind().name !== ''; -}; - -module.exports = functionsHaveNames; - - -/***/ }), - -/***/ 4493: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.SliderHandler = void 0; -exports.add_style_to_document = add_style_to_document; -exports.prep_window_html = prep_window_html; -exports.build_class_change_svg = build_class_change_svg; -exports.get_idd_string = get_idd_string; -exports.build_id_dialogs = build_id_dialogs; -exports.build_edit_suggestion = build_edit_suggestion; -exports.build_confidence_dialog = build_confidence_dialog; -var toolbox_1 = __webpack_require__(3045); -var version_1 = __webpack_require__(1424); -var annotation_1 = __webpack_require__(5573); -var blobs_1 = __webpack_require__(2748); -var loader_1 = __webpack_require__(3607); -var error_logging_1 = __webpack_require__(5638); -/** - * Creates a style document, populates it with the styles in get_init_style, and appends it to the page. - */ -function add_style_to_document(ulabel) { - var head = document.head || document.getElementsByTagName("head")[0]; - var style = document.createElement("style"); - head.appendChild(style); - style.appendChild(document.createTextNode((0, blobs_1.get_init_style)(ulabel.config["container_id"]))); -} -/** - * Creates a mode button that when clicked switches the current annotation type. - * - * @param md_key Key for which button is being constructed. Valid Keys: bbox, point, polygon, tbar, polyline, contour, bbox3, whole-image, global - * @param md_name Mode name which shows when selected. - * @param svg_blob svg which shows up on the button - * @param cur_md Current annotation mode - * @param subtasks ULabel's Subtasks object - * @returns html for a mode button - */ -function get_md_button(md_key, md_name, svg_blob, cur_md, subtasks) { - var sel = ""; - var href = " href=\"#\""; - if (cur_md == md_key) { - sel = " sel"; - href = ""; - } - var subtask_classes = ""; - for (var st_key in subtasks) { - if (subtasks[st_key]["allowed_modes"].includes(md_key)) { - subtask_classes += " md-en4--" + st_key; - } - } - return "
\n \n ").concat(svg_blob, "\n \n
"); -} -/** - * Loads image data from ULabel's config and returns html string for image data. - * - * @returns html for image data - */ -function get_images_html(ulabel) { - var images_html = ""; - var display; - for (var i = 0; i < ulabel.config["image_data"].frames.length; i++) { - if (i != 0) { - display = "none"; - } - else { - display = "block"; - } - images_html += "\n \n "); - } - return images_html; -} -/** - * Constructs html string for whole-image and global dialogs. - * - * @returns html for whole-image and global dialogs - */ -function get_frame_annotation_dialogs(ulabel) { - var frame_annotation_dialog = ""; - var tot = 0; - for (var st_key in ulabel.subtasks) { - if (!ulabel.subtasks[st_key].allowed_modes.includes("whole-image") && - !ulabel.subtasks[st_key].allowed_modes.includes("global")) { - continue; - } - tot += 1; - } - var ind = 0; - for (var st_key in ulabel.subtasks) { - if (!ulabel.subtasks[st_key].allowed_modes.includes("whole-image") && - !ulabel.subtasks[st_key].allowed_modes.includes("global")) { - continue; - } - frame_annotation_dialog += "\n
\n
\n
\n
\n
\n
").concat(ulabel.subtasks[st_key].display_name, "
\n
\n
\n
\n
\n
\n +\n
\n
\n
\n
\n
\n
\n "); - ind += 1; - if (ind > 4) { - throw new Error("At most 4 subtasks can have allow 'whole-image' or 'global' annotations."); - } - } - return frame_annotation_dialog; -} -function prep_window_html(ulabel, toolbox_item_order) { - // Bring image and annotation scaffolding in - // TODO multi-image with spacing etc. - if (toolbox_item_order === void 0) { toolbox_item_order = null; } - // const tabs = ULabel.get_toolbox_tabs(ul); - var images = get_images_html(ulabel); - var frame_annotation_dialogs = get_frame_annotation_dialogs(ulabel); - // const toolbox = configuration.create_toolbox(); - var toolbox = new toolbox_1.Toolbox([], toolbox_1.Toolbox.create_toolbox(ulabel, toolbox_item_order)); - var tool_html = toolbox.setup_toolbox_html(ulabel, frame_annotation_dialogs, images, version_1.ULABEL_VERSION); - // Set the container's html to the toolbox html we just created - $("#" + ulabel.config["container_id"]).html(tool_html); - var container = document.getElementById(ulabel.config["container_id"]); - loader_1.ULabelLoader.add_loader_div(container); - // Build toolbox for the current subtask only - var current_subtask = Object.keys(ulabel.subtasks)[0]; - // Initialize toolbox based on configuration - var sp_id = ulabel.config["toolbox_id"]; - var curmd = ulabel.subtasks[current_subtask]["state"]["annotation_mode"]; - var md_buttons = [ - get_md_button("bbox", "Bounding Box", blobs_1.BBOX_SVG, curmd, ulabel.subtasks), - get_md_button("point", "Point", blobs_1.POINT_SVG, curmd, ulabel.subtasks), - get_md_button("polygon", "Polygon", blobs_1.POLYGON_SVG, curmd, ulabel.subtasks), - get_md_button("tbar", "T-Bar", blobs_1.TBAR_SVG, curmd, ulabel.subtasks), - get_md_button("polyline", "Polyline", blobs_1.POLYLINE_SVG, curmd, ulabel.subtasks), - get_md_button("contour", "Contour", blobs_1.CONTOUR_SVG, curmd, ulabel.subtasks), - get_md_button("bbox3", "Bounding Cube", blobs_1.BBOX3_SVG, curmd, ulabel.subtasks), - get_md_button("whole-image", "Whole Frame", blobs_1.WHOLE_IMAGE_SVG, curmd, ulabel.subtasks), - get_md_button("global", "Global", blobs_1.GLOBAL_SVG, curmd, ulabel.subtasks), - get_md_button("delete_polygon", "Delete", blobs_1.DELETE_POLYGON_SVG, curmd, ulabel.subtasks), - get_md_button("delete_bbox", "Delete", blobs_1.DELETE_BBOX_SVG, curmd, ulabel.subtasks), - ]; - // Append but don't wait - $("#" + sp_id + " .toolbox_inner_cls .mode-selection").append(md_buttons.join("")); - // Show current mode label - ulabel.show_annotation_mode(null); - // Make sure that entire toolbox is shown - if ($("#" + ulabel.config["toolbox_id"] + " .toolbox_inner_cls").height() > $("#" + ulabel.config["container_id"]).height()) { - $("#" + ulabel.config["toolbox_id"]).css("overflow-y", "scroll"); - } - ulabel.toolbox = toolbox; - // Check an array to see if it contains a ZoomPanToolboxItem - var contains_zoom_pan = function (array) { - // check if the array is empty - if (array.length == 0) - return false; - // Loop through everything in the array and check if its the ZoomPanToolboxItem - for (var idx in array) { - if (array[idx] instanceof toolbox_1.ZoomPanToolboxItem) { - return true; - } - } - // If the ZoomPanToolboxItem wasn't found then return false - return false; - }; - // Check if initial_crop exists and has the appropriate properties - var initial_crop_is_valid = function (initial_crop) { - // If initial_crop doesn't exist, return false - if (initial_crop == null) - return false; - // If initial_crop has the appropriate properties, return true - if ("width" in initial_crop && - "height" in initial_crop && - "left" in initial_crop && - "top" in initial_crop) { - return true; - } - // If initial_crop exists but doesn't have the appropriate properties, - // then raise an error and return false - (0, error_logging_1.log_message)("initial_crop missing necessary properties. Ignoring.", error_logging_1.LogLevel.INFO); - return false; - }; - // Make sure the toolbox contains the ZoomPanToolboxItem - if (contains_zoom_pan(ulabel.toolbox.items)) { - // Make sure the initial_crop exists and contains the necessary properties - if (initial_crop_is_valid(ulabel.config.initial_crop)) { - // Grab the initial crop button and rename it - var initial_crop_button = document.getElementById("recenter-button"); - initial_crop_button.innerHTML = "Initial Crop"; - } - else { - // Grab the whole image button and set its display to none - var whole_image_button = document.getElementById("recenter-whole-image-button"); - whole_image_button.style.display = "none"; - } - } -} -/** - * Builds the svg used to change the class of an annotation. - * - * @param class_ids Array of all class ids in the subtask - * @param color_info Color info used to know which color each id is - * @param id_dialog_id id of the id dialog - * @param extra_info Optional parameters. Width - size of svg. inner_radius - size of inner black circle. opacity - opacity of unselected pie section - * @returns - */ -function build_class_change_svg(class_ids, color_info, id_dialog_id, extra_info) { - var _a, _b, _c; - if (extra_info === void 0) { extra_info = {}; } - // Use defaults if custom values aren't used - var width = (_a = extra_info.width) !== null && _a !== void 0 ? _a : 500; - var inner_radius = (_b = extra_info.inner_radius) !== null && _b !== void 0 ? _b : 0.3; - var opacity = (_c = extra_info.opacity) !== null && _c !== void 0 ? _c : 0.4; - // Define constants independent of which id is being processed - var outer_radius = 0.5 * width; - var center_coordinate = width / 2; // X and Y will always be the same, so just use a single number to store X and Y coordinate - var proportion = 1 / class_ids.length; // Proportion of the circle each section will take up - var proportion_gap = 1 - proportion; // Proportion of the circle not taken up by an individual section - var back_radius = inner_radius + (outer_radius - inner_radius) / 2; - var back_stroke = 2 * Math.PI * back_radius * proportion; - var back_stroke_width = outer_radius - inner_radius; - var back_gap = 2 * Math.PI * back_radius * proportion_gap; - var front_radius = inner_radius + proportion * (outer_radius - inner_radius) / 2; - var front_stroke = 2 * Math.PI * front_radius * proportion; - var front_stroke_width = proportion * (outer_radius - inner_radius); - var front_gap = 2 * Math.PI * front_radius * proportion_gap; - // Create the beginning of the svg where the height always equals the width - var svg = ""); - // Build each id's section of the class change pie - for (var idx = 0; idx < class_ids.length; idx++) { - // Grab the current id being used - var current_id = class_ids[idx]; - // Get the current id's color from color info - var current_color = color_info[current_id]; - // Define constants dependent on the current index - var cumulative_proportion = idx * proportion; - var back_offset = 2 * Math.PI * back_radius * cumulative_proportion; - var front_offset = 2 * Math.PI * front_radius * cumulative_proportion; - // TODO: Should names also go on the id dialog? - svg += "\n \n "); - } - // Finally close the svg - svg += ""; - return svg; -} -/** - * Builds and returns html string for the id dialog. - * - * @param idd_id id of the id dialog - * @param width Size of the id dialog - * @param class_ids Array of class ids in the subtask - * @param inner_rad Radius of the black inner circle - * @param color_info Color info used to know which color each id is - * @returns - */ -function get_idd_string(idd_id, width, class_ids, inner_rad, color_info) { - // TODO noconflict - var dialog_html = "\n
\n "); - // Build the svg html and add it to the div - dialog_html += build_class_change_svg(class_ids, color_info, idd_id, { width: width, inner_radius: inner_rad }); - var outer_radius = 0.5 * width; - // Create a centcirc div at the end and close off the div - dialog_html += "
"); - return dialog_html; -} -/** - * Builds the id dialog for each subtask and appends them to the page. - */ -function build_id_dialogs(ulabel) { - var full_toolbox_html = "
"; - var width = ulabel.config.outer_diameter; - // TODO real names here! - var inner_rad = ulabel.config.inner_prop * width / 2; - var outer_rad = 0.5 * width; - var tbid = ulabel.config.toolbox_id; - for (var st in ulabel.subtasks) { - var idd_id = ulabel.subtasks[st]["state"]["idd_id"]; - var idd_id_front = ulabel.subtasks[st]["state"]["idd_id_front"]; - var color_info = ulabel.color_info; - var subtask_dialog_container_jq = $("#dialogs__" + st); - var front_subtask_dialog_container_jq = $("#front_dialogs__" + st); - var dialog_html_v2 = get_idd_string(idd_id, width, ulabel.subtasks[st]["class_ids"], inner_rad, color_info); - var front_dialog_html_v2 = get_idd_string(idd_id_front, width, ulabel.subtasks[st]["class_ids"], inner_rad, color_info); - // TODO noconflict - var toolbox_html = "
"); - var class_ids = JSON.parse(JSON.stringify(ulabel.subtasks[st]["class_ids"])); - // Add the reserved DELETE_CLASS_ID if it is present in the class_defs - if (ulabel.subtasks[st]["class_defs"].at(-1)["id"] === annotation_1.DELETE_CLASS_ID) { - class_ids.push(annotation_1.DELETE_CLASS_ID); - } - for (var i = 0; i < class_ids.length; i++) { - var this_id = class_ids[i].toString(); - var this_color = ulabel.color_info[this_id]; - // let this_color: string = ulabel.subtasks[st]["class_defs"][i]["color"]; - var this_name = ulabel.subtasks[st]["class_defs"][i]["name"]; - var sel = ""; - var href = " href=\"#\""; - if (i == 0) { - sel = " sel"; - href = ""; - } - if (ulabel.config["allow_soft_id"]) { - var msg = "Only hard id is currently supported"; - throw new Error(msg); - } - else { - toolbox_html += "\n \n
").concat(this_name, "\n \n "); - } - } - toolbox_html += "\n
"; - // Add dialog to the document - front_subtask_dialog_container_jq.append(front_dialog_html_v2); - subtask_dialog_container_jq.append(dialog_html_v2); - // Wait to add full toolbox - full_toolbox_html += toolbox_html; - ulabel.subtasks[st]["state"]["visible_dialogs"][idd_id] = { - left: 0.0, - top: 0.0, - pin: "center", - }; - } - // Add all toolbox html at once - $("#" + ulabel.config["toolbox_id"] + " div.id-toolbox-app").html(full_toolbox_html); - // Style revisions based on the size - var idci = $("#" + ulabel.config["container_id"] + " a.id-dialog-clickable-indicator"); - idci.css({ - "height": "".concat(width, "px"), - "width": "".concat(width, "px"), - "border-radius": "".concat(outer_rad, "px"), - }); -} -function build_edit_suggestion(ulabel) { - // TODO noconflict - // DONE Migrated to subtasks - for (var stkey in ulabel.subtasks) { - var local_id = "edit_suggestion__".concat(stkey); - var global_id = "global_edit_suggestion__".concat(stkey); - var subtask_dialog_container_jq = $("#dialogs__" + stkey); - // Local edit suggestion - subtask_dialog_container_jq.append("\n \n ")); - $("#" + local_id).css({ - "height": ulabel.config["edit_handle_size"] + "px", - "width": ulabel.config["edit_handle_size"] + "px", - "border-radius": ulabel.config["edit_handle_size"] / 2 + "px", - }); - // Global edit suggestion - var id_edit = ""; - var mcm_ind = ""; - if (!ulabel.subtasks[stkey]["single_class_mode"]) { - id_edit = "-->\n ×\n \n
\n ")); - // Register these dialogs with each subtask - ulabel.subtasks[stkey]["state"]["visible_dialogs"][local_id] = { - left: 0.0, - top: 0.0, - pin: "center", - }; - ulabel.subtasks[stkey]["state"]["visible_dialogs"][global_id] = { - left: 0.0, - top: 0.0, - pin: "center", - }; - } -} -/** - * Builds the dialog that displays the annotation's confidence and appends it to the page. - */ -function build_confidence_dialog(ulabel) { - for (var stkey in ulabel.subtasks) { - var local_id = "annotation_confidence__".concat(stkey); - var global_id = "global_annotation_confidence__".concat(stkey); - var subtask_dialog_container_jq = $("#dialogs__" + stkey); - var global_edit_suggestion_jq = $("#global_edit_suggestion__" + stkey); - // Local confidence dialog - subtask_dialog_container_jq.append("\n

\n ")); - $("#" + local_id).css({ - height: ulabel.config["edit_handle_size"] + "px", - width: ulabel.config["edit_handle_size"] + "px", - }); - // Global edit suggestion - var id_edit = ""; - var mcm_ind = ""; - if (!ulabel.subtasks[stkey]["single_class_mode"]) { - // TODO (joshua-dean): Is `id_edit` actually necessary or can we yoink it? - // eslint-disable-next-line @typescript-eslint/no-unused-vars - id_edit = "-->\n
\n \u2013\n
\n \n \n \n "); - }; - return SliderHandler; -}()); -exports.SliderHandler = SliderHandler; - - -/***/ }), - -/***/ 4512: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var rectangle_grid_1 = __importDefault(__webpack_require__(7112)); -/** - * Creates a square grid from a bounding box. - * - * @name squareGrid - * @param {Array} bbox extent in [minX, minY, maxX, maxY] order - * @param {number} cellSide of each cell, in units - * @param {Object} [options={}] Optional parameters - * @param {string} [options.units='kilometers'] used in calculating cellSide, can be degrees, - * radians, miles, or kilometers - * @param {Feature} [options.mask] if passed a Polygon or MultiPolygon, - * the grid Points will be created only inside it - * @param {Object} [options.properties={}] passed to each point of the grid - * @returns {FeatureCollection} grid a grid of polygons - * @example - * var bbox = [-95, 30 ,-85, 40]; - * var cellSide = 50; - * var options = {units: 'miles'}; - * - * var squareGrid = turf.squareGrid(bbox, cellSide, options); - * - * //addToMap - * var addToMap = [squareGrid] - */ -function squareGrid(bbox, cellSide, options) { - if (options === void 0) { options = {}; } - return rectangle_grid_1.default(bbox, cellSide, cellSide, options); -} -exports["default"] = squareGrid; - - -/***/ }), - -/***/ 4527: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -var helpers_1 = __webpack_require__(8967); -var invariant_1 = __webpack_require__(8506); -/** - * Converts a {@link Polygon} to {@link LineString|(Multi)LineString} or {@link MultiPolygon} to a - * {@link FeatureCollection} of {@link LineString|(Multi)LineString}. - * - * @name polygonToLine - * @param {Feature} poly Feature to convert - * @param {Object} [options={}] Optional parameters - * @param {Object} [options.properties={}] translates GeoJSON properties to Feature - * @returns {FeatureCollection|Feature} converted (Multi)Polygon to (Multi)LineString - * @example - * var poly = turf.polygon([[[125, -30], [145, -30], [145, -20], [125, -20], [125, -30]]]); - * - * var line = turf.polygonToLine(poly); - * - * //addToMap - * var addToMap = [line]; - */ -function default_1(poly, options) { - if (options === void 0) { options = {}; } - var geom = invariant_1.getGeom(poly); - if (!options.properties && poly.type === "Feature") { - options.properties = poly.properties; - } - switch (geom.type) { - case "Polygon": - return polygonToLine(geom, options); - case "MultiPolygon": - return multiPolygonToLine(geom, options); - default: - throw new Error("invalid poly"); - } -} -exports["default"] = default_1; -/** - * @private - */ -function polygonToLine(poly, options) { - if (options === void 0) { options = {}; } - var geom = invariant_1.getGeom(poly); - var coords = geom.coordinates; - var properties = options.properties - ? options.properties - : poly.type === "Feature" - ? poly.properties - : {}; - return coordsToLine(coords, properties); -} -exports.polygonToLine = polygonToLine; -/** - * @private - */ -function multiPolygonToLine(multiPoly, options) { - if (options === void 0) { options = {}; } - var geom = invariant_1.getGeom(multiPoly); - var coords = geom.coordinates; - var properties = options.properties - ? options.properties - : multiPoly.type === "Feature" - ? multiPoly.properties - : {}; - var lines = []; - coords.forEach(function (coord) { - lines.push(coordsToLine(coord, properties)); - }); - return helpers_1.featureCollection(lines); -} -exports.multiPolygonToLine = multiPolygonToLine; -/** - * @private - */ -function coordsToLine(coords, properties) { - if (coords.length > 1) { - return helpers_1.multiLineString(coords, properties); - } - return helpers_1.lineString(coords[0], properties); -} -exports.coordsToLine = coordsToLine; - - -/***/ }), - -/***/ 4575: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -var __spreadArrays = (this && this.__spreadArrays) || function () { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var helpers_1 = __webpack_require__(8967); -/** - * Returns a random position within a {@link bounding box}. - * - * @name randomPosition - * @param {Array} [bbox=[-180, -90, 180, 90]] a bounding box inside of which positions are placed. - * @returns {Array} Position [longitude, latitude] - * @example - * var position = turf.randomPosition([-180, -90, 180, 90]) - * // => position - */ -function randomPosition(bbox) { - if (Array.isArray(bbox)) { - return coordInBBox(bbox); - } - if (bbox && bbox.bbox) { - return coordInBBox(bbox.bbox); - } - return [lon(), lat()]; -} -exports.randomPosition = randomPosition; -/** - * Returns a random {@link point}. - * - * @name randomPoint - * @param {number} [count=1] how many geometries will be generated - * @param {Object} [options={}] Optional parameters - * @param {Array} [options.bbox=[-180, -90, 180, 90]] a bounding box inside of which geometries are placed. - * @returns {FeatureCollection} GeoJSON FeatureCollection of points - * @example - * var points = turf.randomPoint(25, {bbox: [-180, -90, 180, 90]}) - * // => points - */ -function randomPoint(count, options) { - if (options === void 0) { options = {}; } - if (count === undefined || count === null) { - count = 1; - } - var features = []; - for (var i = 0; i < count; i++) { - features.push(helpers_1.point(randomPosition(options.bbox))); - } - return helpers_1.featureCollection(features); -} -exports.randomPoint = randomPoint; -/** - * Returns a random {@link polygon}. - * - * @name randomPolygon - * @param {number} [count=1] how many geometries will be generated - * @param {Object} [options={}] Optional parameters - * @param {Array} [options.bbox=[-180, -90, 180, 90]] a bounding box inside of which geometries are placed. - * @param {number} [options.num_vertices=10] is how many coordinates each LineString will contain. - * @param {number} [options.max_radial_length=10] is the maximum number of decimal degrees latitude or longitude that a - * vertex can reach out of the center of the Polygon. - * @returns {FeatureCollection} GeoJSON FeatureCollection of polygons - * @example - * var polygons = turf.randomPolygon(25, {bbox: [-180, -90, 180, 90]}) - * // => polygons - */ -function randomPolygon(count, options) { - if (options === void 0) { options = {}; } - // Default param - if (count === undefined || count === null) { - count = 1; - } - if (!helpers_1.isNumber(options.num_vertices) || options.num_vertices === undefined) { - options.num_vertices = 10; - } - if (!helpers_1.isNumber(options.max_radial_length) || - options.max_radial_length === undefined) { - options.max_radial_length = 10; - } - var features = []; - var _loop_1 = function (i) { - var vertices = []; - var circleOffsets = __spreadArrays(Array(options.num_vertices + 1)).map(Math.random); - // Sum Offsets - circleOffsets.forEach(function (cur, index, arr) { - arr[index] = index > 0 ? cur + arr[index - 1] : cur; - }); - // scaleOffsets - circleOffsets.forEach(function (cur) { - cur = (cur * 2 * Math.PI) / circleOffsets[circleOffsets.length - 1]; - var radialScaler = Math.random(); - vertices.push([ - radialScaler * (options.max_radial_length || 10) * Math.sin(cur), - radialScaler * (options.max_radial_length || 10) * Math.cos(cur), - ]); - }); - vertices[vertices.length - 1] = vertices[0]; // close the ring - // center the polygon around something - vertices = vertices.map(vertexToCoordinate(randomPosition(options.bbox))); - features.push(helpers_1.polygon([vertices])); - }; - for (var i = 0; i < count; i++) { - _loop_1(i); - } - return helpers_1.featureCollection(features); -} -exports.randomPolygon = randomPolygon; -/** - * Returns a random {@link linestring}. - * - * @name randomLineString - * @param {number} [count=1] how many geometries will be generated - * @param {Object} [options={}] Optional parameters - * @param {Array} [options.bbox=[-180, -90, 180, 90]] a bounding box inside of which geometries are placed. - * @param {number} [options.num_vertices=10] is how many coordinates each LineString will contain. - * @param {number} [options.max_length=0.0001] is the maximum number of decimal degrees that a - * vertex can be from its predecessor - * @param {number} [options.max_rotation=Math.PI / 8] is the maximum number of radians that a - * line segment can turn from the previous segment. - * @returns {FeatureCollection} GeoJSON FeatureCollection of linestrings - * @example - * var lineStrings = turf.randomLineString(25, {bbox: [-180, -90, 180, 90]}) - * // => lineStrings - */ -function randomLineString(count, options) { - if (options === void 0) { options = {}; } - // Optional parameters - options = options || {}; - if (!helpers_1.isObject(options)) { - throw new Error("options is invalid"); - } - var bbox = options.bbox; - var num_vertices = options.num_vertices; - var max_length = options.max_length; - var max_rotation = options.max_rotation; - if (count === undefined || count === null) { - count = 1; - } - // Default parameters - if (!helpers_1.isNumber(num_vertices) || - num_vertices === undefined || - num_vertices < 2) { - num_vertices = 10; - } - if (!helpers_1.isNumber(max_length) || max_length === undefined) { - max_length = 0.0001; - } - if (!helpers_1.isNumber(max_rotation) || max_rotation === undefined) { - max_rotation = Math.PI / 8; - } - var features = []; - for (var i = 0; i < count; i++) { - var startingPoint = randomPosition(bbox); - var vertices = [startingPoint]; - for (var j = 0; j < num_vertices - 1; j++) { - var priorAngle = j === 0 - ? Math.random() * 2 * Math.PI - : Math.tan((vertices[j][1] - vertices[j - 1][1]) / - (vertices[j][0] - vertices[j - 1][0])); - var angle = priorAngle + (Math.random() - 0.5) * max_rotation * 2; - var distance = Math.random() * max_length; - vertices.push([ - vertices[j][0] + distance * Math.cos(angle), - vertices[j][1] + distance * Math.sin(angle), - ]); - } - features.push(helpers_1.lineString(vertices)); - } - return helpers_1.featureCollection(features); -} -exports.randomLineString = randomLineString; -function vertexToCoordinate(hub) { - return function (cur) { - return [cur[0] + hub[0], cur[1] + hub[1]]; - }; -} -function rnd() { - return Math.random() - 0.5; -} -function lon() { - return rnd() * 360; -} -function lat() { - return rnd() * 180; -} -function coordInBBox(bbox) { - return [ - Math.random() * (bbox[2] - bbox[0]) + bbox[0], - Math.random() * (bbox[3] - bbox[1]) + bbox[1], - ]; -} - - -/***/ }), - -/***/ 4692: -/***/ (function(module, exports) { - -var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! - * jQuery JavaScript Library v3.7.1 - * https://jquery.com/ - * - * Copyright OpenJS Foundation and other contributors - * Released under the MIT license - * https://jquery.org/license - * - * Date: 2023-08-28T13:37Z - */ -( function( global, factory ) { - - "use strict"; - - if ( true && typeof module.exports === "object" ) { - - // For CommonJS and CommonJS-like environments where a proper `window` - // is present, execute the factory and get jQuery. - // For environments that do not have a `window` with a `document` - // (such as Node.js), expose a factory as module.exports. - // This accentuates the need for the creation of a real `window`. - // e.g. var jQuery = require("jquery")(window); - // See ticket trac-14549 for more info. - module.exports = global.document ? - factory( global, true ) : - function( w ) { - if ( !w.document ) { - throw new Error( "jQuery requires a window with a document" ); - } - return factory( w ); - }; - } else { - factory( global ); - } - -// Pass this if window is not defined yet -} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { - -// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 -// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode -// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common -// enough that all such attempts are guarded in a try block. -"use strict"; - -var arr = []; - -var getProto = Object.getPrototypeOf; - -var slice = arr.slice; - -var flat = arr.flat ? function( array ) { - return arr.flat.call( array ); -} : function( array ) { - return arr.concat.apply( [], array ); -}; - - -var push = arr.push; - -var indexOf = arr.indexOf; - -var class2type = {}; - -var toString = class2type.toString; - -var hasOwn = class2type.hasOwnProperty; - -var fnToString = hasOwn.toString; - -var ObjectFunctionString = fnToString.call( Object ); - -var support = {}; - -var isFunction = function isFunction( obj ) { - - // Support: Chrome <=57, Firefox <=52 - // In some browsers, typeof returns "function" for HTML elements - // (i.e., `typeof document.createElement( "object" ) === "function"`). - // We don't want to classify *any* DOM node as a function. - // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5 - // Plus for old WebKit, typeof returns "function" for HTML collections - // (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756) - return typeof obj === "function" && typeof obj.nodeType !== "number" && - typeof obj.item !== "function"; - }; - - -var isWindow = function isWindow( obj ) { - return obj != null && obj === obj.window; - }; - - -var document = window.document; - - - - var preservedScriptAttributes = { - type: true, - src: true, - nonce: true, - noModule: true - }; - - function DOMEval( code, node, doc ) { - doc = doc || document; - - var i, val, - script = doc.createElement( "script" ); - - script.text = code; - if ( node ) { - for ( i in preservedScriptAttributes ) { - - // Support: Firefox 64+, Edge 18+ - // Some browsers don't support the "nonce" property on scripts. - // On the other hand, just using `getAttribute` is not enough as - // the `nonce` attribute is reset to an empty string whenever it - // becomes browsing-context connected. - // See https://github.com/whatwg/html/issues/2369 - // See https://html.spec.whatwg.org/#nonce-attributes - // The `node.getAttribute` check was added for the sake of - // `jQuery.globalEval` so that it can fake a nonce-containing node - // via an object. - val = node[ i ] || node.getAttribute && node.getAttribute( i ); - if ( val ) { - script.setAttribute( i, val ); - } - } - } - doc.head.appendChild( script ).parentNode.removeChild( script ); - } - - -function toType( obj ) { - if ( obj == null ) { - return obj + ""; - } - - // Support: Android <=2.3 only (functionish RegExp) - return typeof obj === "object" || typeof obj === "function" ? - class2type[ toString.call( obj ) ] || "object" : - typeof obj; -} -/* global Symbol */ -// Defining this global in .eslintrc.json would create a danger of using the global -// unguarded in another place, it seems safer to define global only for this module - - - -var version = "3.7.1", - - rhtmlSuffix = /HTML$/i, - - // Define a local copy of jQuery - jQuery = function( selector, context ) { - - // The jQuery object is actually just the init constructor 'enhanced' - // Need init if jQuery is called (just allow error to be thrown if not included) - return new jQuery.fn.init( selector, context ); - }; - -jQuery.fn = jQuery.prototype = { - - // The current version of jQuery being used - jquery: version, - - constructor: jQuery, - - // The default length of a jQuery object is 0 - length: 0, - - toArray: function() { - return slice.call( this ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - - // Return all the elements in a clean array - if ( num == null ) { - return slice.call( this ); - } - - // Return just the one element from the set - return num < 0 ? this[ num + this.length ] : this[ num ]; - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems ) { - - // Build a new jQuery matched element set - var ret = jQuery.merge( this.constructor(), elems ); - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - each: function( callback ) { - return jQuery.each( this, callback ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map( this, function( elem, i ) { - return callback.call( elem, i, elem ); - } ) ); - }, - - slice: function() { - return this.pushStack( slice.apply( this, arguments ) ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - even: function() { - return this.pushStack( jQuery.grep( this, function( _elem, i ) { - return ( i + 1 ) % 2; - } ) ); - }, - - odd: function() { - return this.pushStack( jQuery.grep( this, function( _elem, i ) { - return i % 2; - } ) ); - }, - - eq: function( i ) { - var len = this.length, - j = +i + ( i < 0 ? len : 0 ); - return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); - }, - - end: function() { - return this.prevObject || this.constructor(); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: push, - sort: arr.sort, - splice: arr.splice -}; - -jQuery.extend = jQuery.fn.extend = function() { - var options, name, src, copy, copyIsArray, clone, - target = arguments[ 0 ] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - - // Skip the boolean and the target - target = arguments[ i ] || {}; - i++; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !isFunction( target ) ) { - target = {}; - } - - // Extend jQuery itself if only one argument is passed - if ( i === length ) { - target = this; - i--; - } - - for ( ; i < length; i++ ) { - - // Only deal with non-null/undefined values - if ( ( options = arguments[ i ] ) != null ) { - - // Extend the base object - for ( name in options ) { - copy = options[ name ]; - - // Prevent Object.prototype pollution - // Prevent never-ending loop - if ( name === "__proto__" || target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject( copy ) || - ( copyIsArray = Array.isArray( copy ) ) ) ) { - src = target[ name ]; - - // Ensure proper type for the source value - if ( copyIsArray && !Array.isArray( src ) ) { - clone = []; - } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) { - clone = {}; - } else { - clone = src; - } - copyIsArray = false; - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend( { - - // Unique for each copy of jQuery on the page - expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), - - // Assume jQuery is ready without the ready module - isReady: true, - - error: function( msg ) { - throw new Error( msg ); - }, - - noop: function() {}, - - isPlainObject: function( obj ) { - var proto, Ctor; - - // Detect obvious negatives - // Use toString instead of jQuery.type to catch host objects - if ( !obj || toString.call( obj ) !== "[object Object]" ) { - return false; - } - - proto = getProto( obj ); - - // Objects with no prototype (e.g., `Object.create( null )`) are plain - if ( !proto ) { - return true; - } - - // Objects with prototype are plain iff they were constructed by a global Object function - Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; - return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; - }, - - isEmptyObject: function( obj ) { - var name; - - for ( name in obj ) { - return false; - } - return true; - }, - - // Evaluates a script in a provided context; falls back to the global one - // if not specified. - globalEval: function( code, options, doc ) { - DOMEval( code, { nonce: options && options.nonce }, doc ); - }, - - each: function( obj, callback ) { - var length, i = 0; - - if ( isArrayLike( obj ) ) { - length = obj.length; - for ( ; i < length; i++ ) { - if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { - break; - } - } - } else { - for ( i in obj ) { - if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { - break; - } - } - } - - return obj; - }, - - - // Retrieve the text value of an array of DOM nodes - text: function( elem ) { - var node, - ret = "", - i = 0, - nodeType = elem.nodeType; - - if ( !nodeType ) { - - // If no nodeType, this is expected to be an array - while ( ( node = elem[ i++ ] ) ) { - - // Do not traverse comment nodes - ret += jQuery.text( node ); - } - } - if ( nodeType === 1 || nodeType === 11 ) { - return elem.textContent; - } - if ( nodeType === 9 ) { - return elem.documentElement.textContent; - } - if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - - // Do not include comment or processing instruction nodes - - return ret; - }, - - // results is for internal usage only - makeArray: function( arr, results ) { - var ret = results || []; - - if ( arr != null ) { - if ( isArrayLike( Object( arr ) ) ) { - jQuery.merge( ret, - typeof arr === "string" ? - [ arr ] : arr - ); - } else { - push.call( ret, arr ); - } - } - - return ret; - }, - - inArray: function( elem, arr, i ) { - return arr == null ? -1 : indexOf.call( arr, elem, i ); - }, - - isXMLDoc: function( elem ) { - var namespace = elem && elem.namespaceURI, - docElem = elem && ( elem.ownerDocument || elem ).documentElement; - - // Assume HTML when documentElement doesn't yet exist, such as inside - // document fragments. - return !rhtmlSuffix.test( namespace || docElem && docElem.nodeName || "HTML" ); - }, - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - merge: function( first, second ) { - var len = +second.length, - j = 0, - i = first.length; - - for ( ; j < len; j++ ) { - first[ i++ ] = second[ j ]; - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, invert ) { - var callbackInverse, - matches = [], - i = 0, - length = elems.length, - callbackExpect = !invert; - - // Go through the array, only saving the items - // that pass the validator function - for ( ; i < length; i++ ) { - callbackInverse = !callback( elems[ i ], i ); - if ( callbackInverse !== callbackExpect ) { - matches.push( elems[ i ] ); - } - } - - return matches; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var length, value, - i = 0, - ret = []; - - // Go through the array, translating each of the items to their new values - if ( isArrayLike( elems ) ) { - length = elems.length; - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret.push( value ); - } - } - - // Go through every key on the object, - } else { - for ( i in elems ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret.push( value ); - } - } - } - - // Flatten any nested arrays - return flat( ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // jQuery.support is not used in Core but other projects attach their - // properties to it so it needs to exist. - support: support -} ); - -if ( typeof Symbol === "function" ) { - jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; -} - -// Populate the class2type map -jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), - function( _i, name ) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); - } ); - -function isArrayLike( obj ) { - - // Support: real iOS 8.2 only (not reproducible in simulator) - // `in` check used to prevent JIT error (gh-2145) - // hasOwn isn't used here due to false negatives - // regarding Nodelist length in IE - var length = !!obj && "length" in obj && obj.length, - type = toType( obj ); - - if ( isFunction( obj ) || isWindow( obj ) ) { - return false; - } - - return type === "array" || length === 0 || - typeof length === "number" && length > 0 && ( length - 1 ) in obj; -} - - -function nodeName( elem, name ) { - - return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); - -} -var pop = arr.pop; - - -var sort = arr.sort; - - -var splice = arr.splice; - - -var whitespace = "[\\x20\\t\\r\\n\\f]"; - - -var rtrimCSS = new RegExp( - "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", - "g" -); - - - - -// Note: an element does not contain itself -jQuery.contains = function( a, b ) { - var bup = b && b.parentNode; - - return a === bup || !!( bup && bup.nodeType === 1 && ( - - // Support: IE 9 - 11+ - // IE doesn't have `contains` on SVG. - a.contains ? - a.contains( bup ) : - a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 - ) ); -}; - - - - -// CSS string/identifier serialization -// https://drafts.csswg.org/cssom/#common-serializing-idioms -var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g; - -function fcssescape( ch, asCodePoint ) { - if ( asCodePoint ) { - - // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER - if ( ch === "\0" ) { - return "\uFFFD"; - } - - // Control characters and (dependent upon position) numbers get escaped as code points - return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; - } - - // Other potentially-special ASCII characters get backslash-escaped - return "\\" + ch; -} - -jQuery.escapeSelector = function( sel ) { - return ( sel + "" ).replace( rcssescape, fcssescape ); -}; - - - - -var preferredDoc = document, - pushNative = push; - -( function() { - -var i, - Expr, - outermostContext, - sortInput, - hasDuplicate, - push = pushNative, - - // Local document vars - document, - documentElement, - documentIsHTML, - rbuggyQSA, - matches, - - // Instance-specific data - expando = jQuery.expando, - dirruns = 0, - done = 0, - classCache = createCache(), - tokenCache = createCache(), - compilerCache = createCache(), - nonnativeSelectorCache = createCache(), - sortOrder = function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - } - return 0; - }, - - booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|" + - "loop|multiple|open|readonly|required|scoped", - - // Regular expressions - - // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram - identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + - "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", - - // Attribute selectors: https://www.w3.org/TR/selectors/#attribute-selectors - attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + - - // Operator (capture 2) - "*([*^$|!~]?=)" + whitespace + - - // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" - "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + - whitespace + "*\\]", - - pseudos = ":(" + identifier + ")(?:\\((" + - - // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: - // 1. quoted (capture 3; capture 4 or capture 5) - "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + - - // 2. simple (capture 6) - "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + - - // 3. anything else (capture 2) - ".*" + - ")\\)|)", - - // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter - rwhitespace = new RegExp( whitespace + "+", "g" ), - - rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), - rleadingCombinator = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + - whitespace + "*" ), - rdescend = new RegExp( whitespace + "|>" ), - - rpseudo = new RegExp( pseudos ), - ridentifier = new RegExp( "^" + identifier + "$" ), - - matchExpr = { - ID: new RegExp( "^#(" + identifier + ")" ), - CLASS: new RegExp( "^\\.(" + identifier + ")" ), - TAG: new RegExp( "^(" + identifier + "|[*])" ), - ATTR: new RegExp( "^" + attributes ), - PSEUDO: new RegExp( "^" + pseudos ), - CHILD: new RegExp( - "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + - whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + - whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), - bool: new RegExp( "^(?:" + booleans + ")$", "i" ), - - // For use in libraries implementing .is() - // We use this for POS matching in `select` - needsContext: new RegExp( "^" + whitespace + - "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + - "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) - }, - - rinputs = /^(?:input|select|textarea|button)$/i, - rheader = /^h\d$/i, - - // Easily-parseable/retrievable ID or TAG or CLASS selectors - rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, - - rsibling = /[+~]/, - - // CSS escapes - // https://www.w3.org/TR/CSS21/syndata.html#escaped-characters - runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + - "?|\\\\([^\\r\\n\\f])", "g" ), - funescape = function( escape, nonHex ) { - var high = "0x" + escape.slice( 1 ) - 0x10000; - - if ( nonHex ) { - - // Strip the backslash prefix from a non-hex escape sequence - return nonHex; - } - - // Replace a hexadecimal escape sequence with the encoded Unicode code point - // Support: IE <=11+ - // For values outside the Basic Multilingual Plane (BMP), manually construct a - // surrogate pair - return high < 0 ? - String.fromCharCode( high + 0x10000 ) : - String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); - }, - - // Used for iframes; see `setDocument`. - // Support: IE 9 - 11+, Edge 12 - 18+ - // Removing the function wrapper causes a "Permission Denied" - // error in IE/Edge. - unloadHandler = function() { - setDocument(); - }, - - inDisabledFieldset = addCombinator( - function( elem ) { - return elem.disabled === true && nodeName( elem, "fieldset" ); - }, - { dir: "parentNode", next: "legend" } - ); - -// Support: IE <=9 only -// Accessing document.activeElement can throw unexpectedly -// https://bugs.jquery.com/ticket/13393 -function safeActiveElement() { - try { - return document.activeElement; - } catch ( err ) { } -} - -// Optimize for push.apply( _, NodeList ) -try { - push.apply( - ( arr = slice.call( preferredDoc.childNodes ) ), - preferredDoc.childNodes - ); - - // Support: Android <=4.0 - // Detect silently failing push.apply - // eslint-disable-next-line no-unused-expressions - arr[ preferredDoc.childNodes.length ].nodeType; -} catch ( e ) { - push = { - apply: function( target, els ) { - pushNative.apply( target, slice.call( els ) ); - }, - call: function( target ) { - pushNative.apply( target, slice.call( arguments, 1 ) ); - } - }; -} - -function find( selector, context, results, seed ) { - var m, i, elem, nid, match, groups, newSelector, - newContext = context && context.ownerDocument, - - // nodeType defaults to 9, since context defaults to document - nodeType = context ? context.nodeType : 9; - - results = results || []; - - // Return early from calls with invalid selector or context - if ( typeof selector !== "string" || !selector || - nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { - - return results; - } - - // Try to shortcut find operations (as opposed to filters) in HTML documents - if ( !seed ) { - setDocument( context ); - context = context || document; - - if ( documentIsHTML ) { - - // If the selector is sufficiently simple, try using a "get*By*" DOM method - // (excepting DocumentFragment context, where the methods don't exist) - if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) { - - // ID selector - if ( ( m = match[ 1 ] ) ) { - - // Document context - if ( nodeType === 9 ) { - if ( ( elem = context.getElementById( m ) ) ) { - - // Support: IE 9 only - // getElementById can match elements by name instead of ID - if ( elem.id === m ) { - push.call( results, elem ); - return results; - } - } else { - return results; - } - - // Element context - } else { - - // Support: IE 9 only - // getElementById can match elements by name instead of ID - if ( newContext && ( elem = newContext.getElementById( m ) ) && - find.contains( context, elem ) && - elem.id === m ) { - - push.call( results, elem ); - return results; - } - } - - // Type selector - } else if ( match[ 2 ] ) { - push.apply( results, context.getElementsByTagName( selector ) ); - return results; - - // Class selector - } else if ( ( m = match[ 3 ] ) && context.getElementsByClassName ) { - push.apply( results, context.getElementsByClassName( m ) ); - return results; - } - } - - // Take advantage of querySelectorAll - if ( !nonnativeSelectorCache[ selector + " " ] && - ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) ) { - - newSelector = selector; - newContext = context; - - // qSA considers elements outside a scoping root when evaluating child or - // descendant combinators, which is not what we want. - // In such cases, we work around the behavior by prefixing every selector in the - // list with an ID selector referencing the scope context. - // The technique has to be used as well when a leading combinator is used - // as such selectors are not recognized by querySelectorAll. - // Thanks to Andrew Dupont for this technique. - if ( nodeType === 1 && - ( rdescend.test( selector ) || rleadingCombinator.test( selector ) ) ) { - - // Expand context for sibling selectors - newContext = rsibling.test( selector ) && testContext( context.parentNode ) || - context; - - // We can use :scope instead of the ID hack if the browser - // supports it & if we're not changing the context. - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when - // strict-comparing two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( newContext != context || !support.scope ) { - - // Capture the context ID, setting it first if necessary - if ( ( nid = context.getAttribute( "id" ) ) ) { - nid = jQuery.escapeSelector( nid ); - } else { - context.setAttribute( "id", ( nid = expando ) ); - } - } - - // Prefix every selector in the list - groups = tokenize( selector ); - i = groups.length; - while ( i-- ) { - groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " + - toSelector( groups[ i ] ); - } - newSelector = groups.join( "," ); - } - - try { - push.apply( results, - newContext.querySelectorAll( newSelector ) - ); - return results; - } catch ( qsaError ) { - nonnativeSelectorCache( selector, true ); - } finally { - if ( nid === expando ) { - context.removeAttribute( "id" ); - } - } - } - } - } - - // All others - return select( selector.replace( rtrimCSS, "$1" ), context, results, seed ); -} - -/** - * Create key-value caches of limited size - * @returns {function(string, object)} Returns the Object data after storing it on itself with - * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) - * deleting the oldest entry - */ -function createCache() { - var keys = []; - - function cache( key, value ) { - - // Use (key + " ") to avoid collision with native prototype properties - // (see https://github.com/jquery/sizzle/issues/157) - if ( keys.push( key + " " ) > Expr.cacheLength ) { - - // Only keep the most recent entries - delete cache[ keys.shift() ]; - } - return ( cache[ key + " " ] = value ); - } - return cache; -} - -/** - * Mark a function for special use by jQuery selector module - * @param {Function} fn The function to mark - */ -function markFunction( fn ) { - fn[ expando ] = true; - return fn; -} - -/** - * Support testing using an element - * @param {Function} fn Passed the created element and returns a boolean result - */ -function assert( fn ) { - var el = document.createElement( "fieldset" ); - - try { - return !!fn( el ); - } catch ( e ) { - return false; - } finally { - - // Remove from its parent by default - if ( el.parentNode ) { - el.parentNode.removeChild( el ); - } - - // release memory in IE - el = null; - } -} - -/** - * Returns a function to use in pseudos for input types - * @param {String} type - */ -function createInputPseudo( type ) { - return function( elem ) { - return nodeName( elem, "input" ) && elem.type === type; - }; -} - -/** - * Returns a function to use in pseudos for buttons - * @param {String} type - */ -function createButtonPseudo( type ) { - return function( elem ) { - return ( nodeName( elem, "input" ) || nodeName( elem, "button" ) ) && - elem.type === type; - }; -} - -/** - * Returns a function to use in pseudos for :enabled/:disabled - * @param {Boolean} disabled true for :disabled; false for :enabled - */ -function createDisabledPseudo( disabled ) { - - // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable - return function( elem ) { - - // Only certain elements can match :enabled or :disabled - // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled - // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled - if ( "form" in elem ) { - - // Check for inherited disabledness on relevant non-disabled elements: - // * listed form-associated elements in a disabled fieldset - // https://html.spec.whatwg.org/multipage/forms.html#category-listed - // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled - // * option elements in a disabled optgroup - // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled - // All such elements have a "form" property. - if ( elem.parentNode && elem.disabled === false ) { - - // Option elements defer to a parent optgroup if present - if ( "label" in elem ) { - if ( "label" in elem.parentNode ) { - return elem.parentNode.disabled === disabled; - } else { - return elem.disabled === disabled; - } - } - - // Support: IE 6 - 11+ - // Use the isDisabled shortcut property to check for disabled fieldset ancestors - return elem.isDisabled === disabled || - - // Where there is no isDisabled, check manually - elem.isDisabled !== !disabled && - inDisabledFieldset( elem ) === disabled; - } - - return elem.disabled === disabled; - - // Try to winnow out elements that can't be disabled before trusting the disabled property. - // Some victims get caught in our net (label, legend, menu, track), but it shouldn't - // even exist on them, let alone have a boolean value. - } else if ( "label" in elem ) { - return elem.disabled === disabled; - } - - // Remaining elements are neither :enabled nor :disabled - return false; - }; -} - -/** - * Returns a function to use in pseudos for positionals - * @param {Function} fn - */ -function createPositionalPseudo( fn ) { - return markFunction( function( argument ) { - argument = +argument; - return markFunction( function( seed, matches ) { - var j, - matchIndexes = fn( [], seed.length, argument ), - i = matchIndexes.length; - - // Match elements found at the specified indexes - while ( i-- ) { - if ( seed[ ( j = matchIndexes[ i ] ) ] ) { - seed[ j ] = !( matches[ j ] = seed[ j ] ); - } - } - } ); - } ); -} - -/** - * Checks a node for validity as a jQuery selector context - * @param {Element|Object=} context - * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value - */ -function testContext( context ) { - return context && typeof context.getElementsByTagName !== "undefined" && context; -} - -/** - * Sets document-related variables once based on the current document - * @param {Element|Object} [node] An element or document object to use to set the document - * @returns {Object} Returns the current document - */ -function setDocument( node ) { - var subWindow, - doc = node ? node.ownerDocument || node : preferredDoc; - - // Return early if doc is invalid or already selected - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) { - return document; - } - - // Update global variables - document = doc; - documentElement = document.documentElement; - documentIsHTML = !jQuery.isXMLDoc( document ); - - // Support: iOS 7 only, IE 9 - 11+ - // Older browsers didn't support unprefixed `matches`. - matches = documentElement.matches || - documentElement.webkitMatchesSelector || - documentElement.msMatchesSelector; - - // Support: IE 9 - 11+, Edge 12 - 18+ - // Accessing iframe documents after unload throws "permission denied" errors - // (see trac-13936). - // Limit the fix to IE & Edge Legacy; despite Edge 15+ implementing `matches`, - // all IE 9+ and Edge Legacy versions implement `msMatchesSelector` as well. - if ( documentElement.msMatchesSelector && - - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - preferredDoc != document && - ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { - - // Support: IE 9 - 11+, Edge 12 - 18+ - subWindow.addEventListener( "unload", unloadHandler ); - } - - // Support: IE <10 - // Check if getElementById returns elements by name - // The broken getElementById methods don't pick up programmatically-set names, - // so use a roundabout getElementsByName test - support.getById = assert( function( el ) { - documentElement.appendChild( el ).id = jQuery.expando; - return !document.getElementsByName || - !document.getElementsByName( jQuery.expando ).length; - } ); - - // Support: IE 9 only - // Check to see if it's possible to do matchesSelector - // on a disconnected node. - support.disconnectedMatch = assert( function( el ) { - return matches.call( el, "*" ); - } ); - - // Support: IE 9 - 11+, Edge 12 - 18+ - // IE/Edge don't support the :scope pseudo-class. - support.scope = assert( function() { - return document.querySelectorAll( ":scope" ); - } ); - - // Support: Chrome 105 - 111 only, Safari 15.4 - 16.3 only - // Make sure the `:has()` argument is parsed unforgivingly. - // We include `*` in the test to detect buggy implementations that are - // _selectively_ forgiving (specifically when the list includes at least - // one valid selector). - // Note that we treat complete lack of support for `:has()` as if it were - // spec-compliant support, which is fine because use of `:has()` in such - // environments will fail in the qSA path and fall back to jQuery traversal - // anyway. - support.cssHas = assert( function() { - try { - document.querySelector( ":has(*,:jqfake)" ); - return false; - } catch ( e ) { - return true; - } - } ); - - // ID filter and find - if ( support.getById ) { - Expr.filter.ID = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - return elem.getAttribute( "id" ) === attrId; - }; - }; - Expr.find.ID = function( id, context ) { - if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { - var elem = context.getElementById( id ); - return elem ? [ elem ] : []; - } - }; - } else { - Expr.filter.ID = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - var node = typeof elem.getAttributeNode !== "undefined" && - elem.getAttributeNode( "id" ); - return node && node.value === attrId; - }; - }; - - // Support: IE 6 - 7 only - // getElementById is not reliable as a find shortcut - Expr.find.ID = function( id, context ) { - if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { - var node, i, elems, - elem = context.getElementById( id ); - - if ( elem ) { - - // Verify the id attribute - node = elem.getAttributeNode( "id" ); - if ( node && node.value === id ) { - return [ elem ]; - } - - // Fall back on getElementsByName - elems = context.getElementsByName( id ); - i = 0; - while ( ( elem = elems[ i++ ] ) ) { - node = elem.getAttributeNode( "id" ); - if ( node && node.value === id ) { - return [ elem ]; - } - } - } - - return []; - } - }; - } - - // Tag - Expr.find.TAG = function( tag, context ) { - if ( typeof context.getElementsByTagName !== "undefined" ) { - return context.getElementsByTagName( tag ); - - // DocumentFragment nodes don't have gEBTN - } else { - return context.querySelectorAll( tag ); - } - }; - - // Class - Expr.find.CLASS = function( className, context ) { - if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { - return context.getElementsByClassName( className ); - } - }; - - /* QSA/matchesSelector - ---------------------------------------------------------------------- */ - - // QSA and matchesSelector support - - rbuggyQSA = []; - - // Build QSA regex - // Regex strategy adopted from Diego Perini - assert( function( el ) { - - var input; - - documentElement.appendChild( el ).innerHTML = - "" + - ""; - - // Support: iOS <=7 - 8 only - // Boolean attributes and "value" are not treated correctly in some XML documents - if ( !el.querySelectorAll( "[selected]" ).length ) { - rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); - } - - // Support: iOS <=7 - 8 only - if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { - rbuggyQSA.push( "~=" ); - } - - // Support: iOS 8 only - // https://bugs.webkit.org/show_bug.cgi?id=136851 - // In-page `selector#id sibling-combinator selector` fails - if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { - rbuggyQSA.push( ".#.+[+~]" ); - } - - // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+ - // In some of the document kinds, these selectors wouldn't work natively. - // This is probably OK but for backwards compatibility we want to maintain - // handling them through jQuery traversal in jQuery 3.x. - if ( !el.querySelectorAll( ":checked" ).length ) { - rbuggyQSA.push( ":checked" ); - } - - // Support: Windows 8 Native Apps - // The type and name attributes are restricted during .innerHTML assignment - input = document.createElement( "input" ); - input.setAttribute( "type", "hidden" ); - el.appendChild( input ).setAttribute( "name", "D" ); - - // Support: IE 9 - 11+ - // IE's :disabled selector does not pick up the children of disabled fieldsets - // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+ - // In some of the document kinds, these selectors wouldn't work natively. - // This is probably OK but for backwards compatibility we want to maintain - // handling them through jQuery traversal in jQuery 3.x. - documentElement.appendChild( el ).disabled = true; - if ( el.querySelectorAll( ":disabled" ).length !== 2 ) { - rbuggyQSA.push( ":enabled", ":disabled" ); - } - - // Support: IE 11+, Edge 15 - 18+ - // IE 11/Edge don't find elements on a `[name='']` query in some cases. - // Adding a temporary attribute to the document before the selection works - // around the issue. - // Interestingly, IE 10 & older don't seem to have the issue. - input = document.createElement( "input" ); - input.setAttribute( "name", "" ); - el.appendChild( input ); - if ( !el.querySelectorAll( "[name='']" ).length ) { - rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" + - whitespace + "*(?:''|\"\")" ); - } - } ); - - if ( !support.cssHas ) { - - // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+ - // Our regular `try-catch` mechanism fails to detect natively-unsupported - // pseudo-classes inside `:has()` (such as `:has(:contains("Foo"))`) - // in browsers that parse the `:has()` argument as a forgiving selector list. - // https://drafts.csswg.org/selectors/#relational now requires the argument - // to be parsed unforgivingly, but browsers have not yet fully adjusted. - rbuggyQSA.push( ":has" ); - } - - rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); - - /* Sorting - ---------------------------------------------------------------------- */ - - // Document order sorting - sortOrder = function( a, b ) { - - // Flag for duplicate removal - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - // Sort on method existence if only one input has compareDocumentPosition - var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; - if ( compare ) { - return compare; - } - - // Calculate position if both inputs belong to the same document - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ? - a.compareDocumentPosition( b ) : - - // Otherwise we know they are disconnected - 1; - - // Disconnected nodes - if ( compare & 1 || - ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) { - - // Choose the first element that is related to our preferred document - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( a === document || a.ownerDocument == preferredDoc && - find.contains( preferredDoc, a ) ) { - return -1; - } - - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( b === document || b.ownerDocument == preferredDoc && - find.contains( preferredDoc, b ) ) { - return 1; - } - - // Maintain original order - return sortInput ? - ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : - 0; - } - - return compare & 4 ? -1 : 1; - }; - - return document; -} - -find.matches = function( expr, elements ) { - return find( expr, null, null, elements ); -}; - -find.matchesSelector = function( elem, expr ) { - setDocument( elem ); - - if ( documentIsHTML && - !nonnativeSelectorCache[ expr + " " ] && - ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { - - try { - var ret = matches.call( elem, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || support.disconnectedMatch || - - // As well, disconnected nodes are said to be in a document - // fragment in IE 9 - elem.document && elem.document.nodeType !== 11 ) { - return ret; - } - } catch ( e ) { - nonnativeSelectorCache( expr, true ); - } - } - - return find( expr, document, null, [ elem ] ).length > 0; -}; - -find.contains = function( context, elem ) { - - // Set document vars if needed - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( ( context.ownerDocument || context ) != document ) { - setDocument( context ); - } - return jQuery.contains( context, elem ); -}; - - -find.attr = function( elem, name ) { - - // Set document vars if needed - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( ( elem.ownerDocument || elem ) != document ) { - setDocument( elem ); - } - - var fn = Expr.attrHandle[ name.toLowerCase() ], - - // Don't get fooled by Object.prototype properties (see trac-13807) - val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? - fn( elem, name, !documentIsHTML ) : - undefined; - - if ( val !== undefined ) { - return val; - } - - return elem.getAttribute( name ); -}; - -find.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -/** - * Document sorting and removing duplicates - * @param {ArrayLike} results - */ -jQuery.uniqueSort = function( results ) { - var elem, - duplicates = [], - j = 0, - i = 0; - - // Unless we *know* we can detect duplicates, assume their presence - // - // Support: Android <=4.0+ - // Testing for detecting duplicates is unpredictable so instead assume we can't - // depend on duplicate detection in all browsers without a stable sort. - hasDuplicate = !support.sortStable; - sortInput = !support.sortStable && slice.call( results, 0 ); - sort.call( results, sortOrder ); - - if ( hasDuplicate ) { - while ( ( elem = results[ i++ ] ) ) { - if ( elem === results[ i ] ) { - j = duplicates.push( i ); - } - } - while ( j-- ) { - splice.call( results, duplicates[ j ], 1 ); - } - } - - // Clear input after sorting to release objects - // See https://github.com/jquery/sizzle/pull/225 - sortInput = null; - - return results; -}; - -jQuery.fn.uniqueSort = function() { - return this.pushStack( jQuery.uniqueSort( slice.apply( this ) ) ); -}; - -Expr = jQuery.expr = { - - // Can be adjusted by the user - cacheLength: 50, - - createPseudo: markFunction, - - match: matchExpr, - - attrHandle: {}, - - find: {}, - - relative: { - ">": { dir: "parentNode", first: true }, - " ": { dir: "parentNode" }, - "+": { dir: "previousSibling", first: true }, - "~": { dir: "previousSibling" } - }, - - preFilter: { - ATTR: function( match ) { - match[ 1 ] = match[ 1 ].replace( runescape, funescape ); - - // Move the given value to match[3] whether quoted or unquoted - match[ 3 ] = ( match[ 3 ] || match[ 4 ] || match[ 5 ] || "" ) - .replace( runescape, funescape ); - - if ( match[ 2 ] === "~=" ) { - match[ 3 ] = " " + match[ 3 ] + " "; - } - - return match.slice( 0, 4 ); - }, - - CHILD: function( match ) { - - /* matches from matchExpr["CHILD"] - 1 type (only|nth|...) - 2 what (child|of-type) - 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) - 4 xn-component of xn+y argument ([+-]?\d*n|) - 5 sign of xn-component - 6 x of xn-component - 7 sign of y-component - 8 y of y-component - */ - match[ 1 ] = match[ 1 ].toLowerCase(); - - if ( match[ 1 ].slice( 0, 3 ) === "nth" ) { - - // nth-* requires argument - if ( !match[ 3 ] ) { - find.error( match[ 0 ] ); - } - - // numeric x and y parameters for Expr.filter.CHILD - // remember that false/true cast respectively to 0/1 - match[ 4 ] = +( match[ 4 ] ? - match[ 5 ] + ( match[ 6 ] || 1 ) : - 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) - ); - match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" ); - - // other types prohibit arguments - } else if ( match[ 3 ] ) { - find.error( match[ 0 ] ); - } - - return match; - }, - - PSEUDO: function( match ) { - var excess, - unquoted = !match[ 6 ] && match[ 2 ]; - - if ( matchExpr.CHILD.test( match[ 0 ] ) ) { - return null; - } - - // Accept quoted arguments as-is - if ( match[ 3 ] ) { - match[ 2 ] = match[ 4 ] || match[ 5 ] || ""; - - // Strip excess characters from unquoted arguments - } else if ( unquoted && rpseudo.test( unquoted ) && - - // Get excess from tokenize (recursively) - ( excess = tokenize( unquoted, true ) ) && - - // advance to the next closing parenthesis - ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) { - - // excess is a negative index - match[ 0 ] = match[ 0 ].slice( 0, excess ); - match[ 2 ] = unquoted.slice( 0, excess ); - } - - // Return only captures needed by the pseudo filter method (type and argument) - return match.slice( 0, 3 ); - } - }, - - filter: { - - TAG: function( nodeNameSelector ) { - var expectedNodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); - return nodeNameSelector === "*" ? - function() { - return true; - } : - function( elem ) { - return nodeName( elem, expectedNodeName ); - }; - }, - - CLASS: function( className ) { - var pattern = classCache[ className + " " ]; - - return pattern || - ( pattern = new RegExp( "(^|" + whitespace + ")" + className + - "(" + whitespace + "|$)" ) ) && - classCache( className, function( elem ) { - return pattern.test( - typeof elem.className === "string" && elem.className || - typeof elem.getAttribute !== "undefined" && - elem.getAttribute( "class" ) || - "" - ); - } ); - }, - - ATTR: function( name, operator, check ) { - return function( elem ) { - var result = find.attr( elem, name ); - - if ( result == null ) { - return operator === "!="; - } - if ( !operator ) { - return true; - } - - result += ""; - - if ( operator === "=" ) { - return result === check; - } - if ( operator === "!=" ) { - return result !== check; - } - if ( operator === "^=" ) { - return check && result.indexOf( check ) === 0; - } - if ( operator === "*=" ) { - return check && result.indexOf( check ) > -1; - } - if ( operator === "$=" ) { - return check && result.slice( -check.length ) === check; - } - if ( operator === "~=" ) { - return ( " " + result.replace( rwhitespace, " " ) + " " ) - .indexOf( check ) > -1; - } - if ( operator === "|=" ) { - return result === check || result.slice( 0, check.length + 1 ) === check + "-"; - } - - return false; - }; - }, - - CHILD: function( type, what, _argument, first, last ) { - var simple = type.slice( 0, 3 ) !== "nth", - forward = type.slice( -4 ) !== "last", - ofType = what === "of-type"; - - return first === 1 && last === 0 ? - - // Shortcut for :nth-*(n) - function( elem ) { - return !!elem.parentNode; - } : - - function( elem, _context, xml ) { - var cache, outerCache, node, nodeIndex, start, - dir = simple !== forward ? "nextSibling" : "previousSibling", - parent = elem.parentNode, - name = ofType && elem.nodeName.toLowerCase(), - useCache = !xml && !ofType, - diff = false; - - if ( parent ) { - - // :(first|last|only)-(child|of-type) - if ( simple ) { - while ( dir ) { - node = elem; - while ( ( node = node[ dir ] ) ) { - if ( ofType ? - nodeName( node, name ) : - node.nodeType === 1 ) { - - return false; - } - } - - // Reverse direction for :only-* (if we haven't yet done so) - start = dir = type === "only" && !start && "nextSibling"; - } - return true; - } - - start = [ forward ? parent.firstChild : parent.lastChild ]; - - // non-xml :nth-child(...) stores cache data on `parent` - if ( forward && useCache ) { - - // Seek `elem` from a previously-cached index - outerCache = parent[ expando ] || ( parent[ expando ] = {} ); - cache = outerCache[ type ] || []; - nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; - diff = nodeIndex && cache[ 2 ]; - node = nodeIndex && parent.childNodes[ nodeIndex ]; - - while ( ( node = ++nodeIndex && node && node[ dir ] || - - // Fallback to seeking `elem` from the start - ( diff = nodeIndex = 0 ) || start.pop() ) ) { - - // When found, cache indexes on `parent` and break - if ( node.nodeType === 1 && ++diff && node === elem ) { - outerCache[ type ] = [ dirruns, nodeIndex, diff ]; - break; - } - } - - } else { - - // Use previously-cached element index if available - if ( useCache ) { - outerCache = elem[ expando ] || ( elem[ expando ] = {} ); - cache = outerCache[ type ] || []; - nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; - diff = nodeIndex; - } - - // xml :nth-child(...) - // or :nth-last-child(...) or :nth(-last)?-of-type(...) - if ( diff === false ) { - - // Use the same loop as above to seek `elem` from the start - while ( ( node = ++nodeIndex && node && node[ dir ] || - ( diff = nodeIndex = 0 ) || start.pop() ) ) { - - if ( ( ofType ? - nodeName( node, name ) : - node.nodeType === 1 ) && - ++diff ) { - - // Cache the index of each encountered element - if ( useCache ) { - outerCache = node[ expando ] || - ( node[ expando ] = {} ); - outerCache[ type ] = [ dirruns, diff ]; - } - - if ( node === elem ) { - break; - } - } - } - } - } - - // Incorporate the offset, then check against cycle size - diff -= last; - return diff === first || ( diff % first === 0 && diff / first >= 0 ); - } - }; - }, - - PSEUDO: function( pseudo, argument ) { - - // pseudo-class names are case-insensitive - // https://www.w3.org/TR/selectors/#pseudo-classes - // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters - // Remember that setFilters inherits from pseudos - var args, - fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || - find.error( "unsupported pseudo: " + pseudo ); - - // The user may use createPseudo to indicate that - // arguments are needed to create the filter function - // just as jQuery does - if ( fn[ expando ] ) { - return fn( argument ); - } - - // But maintain support for old signatures - if ( fn.length > 1 ) { - args = [ pseudo, pseudo, "", argument ]; - return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? - markFunction( function( seed, matches ) { - var idx, - matched = fn( seed, argument ), - i = matched.length; - while ( i-- ) { - idx = indexOf.call( seed, matched[ i ] ); - seed[ idx ] = !( matches[ idx ] = matched[ i ] ); - } - } ) : - function( elem ) { - return fn( elem, 0, args ); - }; - } - - return fn; - } - }, - - pseudos: { - - // Potentially complex pseudos - not: markFunction( function( selector ) { - - // Trim the selector passed to compile - // to avoid treating leading and trailing - // spaces as combinators - var input = [], - results = [], - matcher = compile( selector.replace( rtrimCSS, "$1" ) ); - - return matcher[ expando ] ? - markFunction( function( seed, matches, _context, xml ) { - var elem, - unmatched = matcher( seed, null, xml, [] ), - i = seed.length; - - // Match elements unmatched by `matcher` - while ( i-- ) { - if ( ( elem = unmatched[ i ] ) ) { - seed[ i ] = !( matches[ i ] = elem ); - } - } - } ) : - function( elem, _context, xml ) { - input[ 0 ] = elem; - matcher( input, null, xml, results ); - - // Don't keep the element - // (see https://github.com/jquery/sizzle/issues/299) - input[ 0 ] = null; - return !results.pop(); - }; - } ), - - has: markFunction( function( selector ) { - return function( elem ) { - return find( selector, elem ).length > 0; - }; - } ), - - contains: markFunction( function( text ) { - text = text.replace( runescape, funescape ); - return function( elem ) { - return ( elem.textContent || jQuery.text( elem ) ).indexOf( text ) > -1; - }; - } ), - - // "Whether an element is represented by a :lang() selector - // is based solely on the element's language value - // being equal to the identifier C, - // or beginning with the identifier C immediately followed by "-". - // The matching of C against the element's language value is performed case-insensitively. - // The identifier C does not have to be a valid language name." - // https://www.w3.org/TR/selectors/#lang-pseudo - lang: markFunction( function( lang ) { - - // lang value must be a valid identifier - if ( !ridentifier.test( lang || "" ) ) { - find.error( "unsupported lang: " + lang ); - } - lang = lang.replace( runescape, funescape ).toLowerCase(); - return function( elem ) { - var elemLang; - do { - if ( ( elemLang = documentIsHTML ? - elem.lang : - elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) { - - elemLang = elemLang.toLowerCase(); - return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; - } - } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 ); - return false; - }; - } ), - - // Miscellaneous - target: function( elem ) { - var hash = window.location && window.location.hash; - return hash && hash.slice( 1 ) === elem.id; - }, - - root: function( elem ) { - return elem === documentElement; - }, - - focus: function( elem ) { - return elem === safeActiveElement() && - document.hasFocus() && - !!( elem.type || elem.href || ~elem.tabIndex ); - }, - - // Boolean properties - enabled: createDisabledPseudo( false ), - disabled: createDisabledPseudo( true ), - - checked: function( elem ) { - - // In CSS3, :checked should return both checked and selected elements - // https://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - return ( nodeName( elem, "input" ) && !!elem.checked ) || - ( nodeName( elem, "option" ) && !!elem.selected ); - }, - - selected: function( elem ) { - - // Support: IE <=11+ - // Accessing the selectedIndex property - // forces the browser to treat the default option as - // selected when in an optgroup. - if ( elem.parentNode ) { - // eslint-disable-next-line no-unused-expressions - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - // Contents - empty: function( elem ) { - - // https://www.w3.org/TR/selectors/#empty-pseudo - // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), - // but not by others (comment: 8; processing instruction: 7; etc.) - // nodeType < 6 works because attributes (2) do not appear as children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - if ( elem.nodeType < 6 ) { - return false; - } - } - return true; - }, - - parent: function( elem ) { - return !Expr.pseudos.empty( elem ); - }, - - // Element/input types - header: function( elem ) { - return rheader.test( elem.nodeName ); - }, - - input: function( elem ) { - return rinputs.test( elem.nodeName ); - }, - - button: function( elem ) { - return nodeName( elem, "input" ) && elem.type === "button" || - nodeName( elem, "button" ); - }, - - text: function( elem ) { - var attr; - return nodeName( elem, "input" ) && elem.type === "text" && - - // Support: IE <10 only - // New HTML5 attribute values (e.g., "search") appear - // with elem.type === "text" - ( ( attr = elem.getAttribute( "type" ) ) == null || - attr.toLowerCase() === "text" ); - }, - - // Position-in-collection - first: createPositionalPseudo( function() { - return [ 0 ]; - } ), - - last: createPositionalPseudo( function( _matchIndexes, length ) { - return [ length - 1 ]; - } ), - - eq: createPositionalPseudo( function( _matchIndexes, length, argument ) { - return [ argument < 0 ? argument + length : argument ]; - } ), - - even: createPositionalPseudo( function( matchIndexes, length ) { - var i = 0; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - } ), - - odd: createPositionalPseudo( function( matchIndexes, length ) { - var i = 1; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - } ), - - lt: createPositionalPseudo( function( matchIndexes, length, argument ) { - var i; - - if ( argument < 0 ) { - i = argument + length; - } else if ( argument > length ) { - i = length; - } else { - i = argument; - } - - for ( ; --i >= 0; ) { - matchIndexes.push( i ); - } - return matchIndexes; - } ), - - gt: createPositionalPseudo( function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; ++i < length; ) { - matchIndexes.push( i ); - } - return matchIndexes; - } ) - } -}; - -Expr.pseudos.nth = Expr.pseudos.eq; - -// Add button/input type pseudos -for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { - Expr.pseudos[ i ] = createInputPseudo( i ); -} -for ( i in { submit: true, reset: true } ) { - Expr.pseudos[ i ] = createButtonPseudo( i ); -} - -// Easy API for creating new setFilters -function setFilters() {} -setFilters.prototype = Expr.filters = Expr.pseudos; -Expr.setFilters = new setFilters(); - -function tokenize( selector, parseOnly ) { - var matched, match, tokens, type, - soFar, groups, preFilters, - cached = tokenCache[ selector + " " ]; - - if ( cached ) { - return parseOnly ? 0 : cached.slice( 0 ); - } - - soFar = selector; - groups = []; - preFilters = Expr.preFilter; - - while ( soFar ) { - - // Comma and first run - if ( !matched || ( match = rcomma.exec( soFar ) ) ) { - if ( match ) { - - // Don't consume trailing commas as valid - soFar = soFar.slice( match[ 0 ].length ) || soFar; - } - groups.push( ( tokens = [] ) ); - } - - matched = false; - - // Combinators - if ( ( match = rleadingCombinator.exec( soFar ) ) ) { - matched = match.shift(); - tokens.push( { - value: matched, - - // Cast descendant combinators to space - type: match[ 0 ].replace( rtrimCSS, " " ) - } ); - soFar = soFar.slice( matched.length ); - } - - // Filters - for ( type in Expr.filter ) { - if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] || - ( match = preFilters[ type ]( match ) ) ) ) { - matched = match.shift(); - tokens.push( { - value: matched, - type: type, - matches: match - } ); - soFar = soFar.slice( matched.length ); - } - } - - if ( !matched ) { - break; - } - } - - // Return the length of the invalid excess - // if we're just parsing - // Otherwise, throw an error or return tokens - if ( parseOnly ) { - return soFar.length; - } - - return soFar ? - find.error( selector ) : - - // Cache the tokens - tokenCache( selector, groups ).slice( 0 ); -} - -function toSelector( tokens ) { - var i = 0, - len = tokens.length, - selector = ""; - for ( ; i < len; i++ ) { - selector += tokens[ i ].value; - } - return selector; -} - -function addCombinator( matcher, combinator, base ) { - var dir = combinator.dir, - skip = combinator.next, - key = skip || dir, - checkNonElements = base && key === "parentNode", - doneName = done++; - - return combinator.first ? - - // Check against closest ancestor/preceding element - function( elem, context, xml ) { - while ( ( elem = elem[ dir ] ) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - return matcher( elem, context, xml ); - } - } - return false; - } : - - // Check against all ancestor/preceding elements - function( elem, context, xml ) { - var oldCache, outerCache, - newCache = [ dirruns, doneName ]; - - // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching - if ( xml ) { - while ( ( elem = elem[ dir ] ) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - if ( matcher( elem, context, xml ) ) { - return true; - } - } - } - } else { - while ( ( elem = elem[ dir ] ) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - outerCache = elem[ expando ] || ( elem[ expando ] = {} ); - - if ( skip && nodeName( elem, skip ) ) { - elem = elem[ dir ] || elem; - } else if ( ( oldCache = outerCache[ key ] ) && - oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { - - // Assign to newCache so results back-propagate to previous elements - return ( newCache[ 2 ] = oldCache[ 2 ] ); - } else { - - // Reuse newcache so results back-propagate to previous elements - outerCache[ key ] = newCache; - - // A match means we're done; a fail means we have to keep checking - if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) { - return true; - } - } - } - } - } - return false; - }; -} - -function elementMatcher( matchers ) { - return matchers.length > 1 ? - function( elem, context, xml ) { - var i = matchers.length; - while ( i-- ) { - if ( !matchers[ i ]( elem, context, xml ) ) { - return false; - } - } - return true; - } : - matchers[ 0 ]; -} - -function multipleContexts( selector, contexts, results ) { - var i = 0, - len = contexts.length; - for ( ; i < len; i++ ) { - find( selector, contexts[ i ], results ); - } - return results; -} - -function condense( unmatched, map, filter, context, xml ) { - var elem, - newUnmatched = [], - i = 0, - len = unmatched.length, - mapped = map != null; - - for ( ; i < len; i++ ) { - if ( ( elem = unmatched[ i ] ) ) { - if ( !filter || filter( elem, context, xml ) ) { - newUnmatched.push( elem ); - if ( mapped ) { - map.push( i ); - } - } - } - } - - return newUnmatched; -} - -function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { - if ( postFilter && !postFilter[ expando ] ) { - postFilter = setMatcher( postFilter ); - } - if ( postFinder && !postFinder[ expando ] ) { - postFinder = setMatcher( postFinder, postSelector ); - } - return markFunction( function( seed, results, context, xml ) { - var temp, i, elem, matcherOut, - preMap = [], - postMap = [], - preexisting = results.length, - - // Get initial elements from seed or context - elems = seed || - multipleContexts( selector || "*", - context.nodeType ? [ context ] : context, [] ), - - // Prefilter to get matcher input, preserving a map for seed-results synchronization - matcherIn = preFilter && ( seed || !selector ) ? - condense( elems, preMap, preFilter, context, xml ) : - elems; - - if ( matcher ) { - - // If we have a postFinder, or filtered seed, or non-seed postFilter - // or preexisting results, - matcherOut = postFinder || ( seed ? preFilter : preexisting || postFilter ) ? - - // ...intermediate processing is necessary - [] : - - // ...otherwise use results directly - results; - - // Find primary matches - matcher( matcherIn, matcherOut, context, xml ); - } else { - matcherOut = matcherIn; - } - - // Apply postFilter - if ( postFilter ) { - temp = condense( matcherOut, postMap ); - postFilter( temp, [], context, xml ); - - // Un-match failing elements by moving them back to matcherIn - i = temp.length; - while ( i-- ) { - if ( ( elem = temp[ i ] ) ) { - matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem ); - } - } - } - - if ( seed ) { - if ( postFinder || preFilter ) { - if ( postFinder ) { - - // Get the final matcherOut by condensing this intermediate into postFinder contexts - temp = []; - i = matcherOut.length; - while ( i-- ) { - if ( ( elem = matcherOut[ i ] ) ) { - - // Restore matcherIn since elem is not yet a final match - temp.push( ( matcherIn[ i ] = elem ) ); - } - } - postFinder( null, ( matcherOut = [] ), temp, xml ); - } - - // Move matched elements from seed to results to keep them synchronized - i = matcherOut.length; - while ( i-- ) { - if ( ( elem = matcherOut[ i ] ) && - ( temp = postFinder ? indexOf.call( seed, elem ) : preMap[ i ] ) > -1 ) { - - seed[ temp ] = !( results[ temp ] = elem ); - } - } - } - - // Add elements to results, through postFinder if defined - } else { - matcherOut = condense( - matcherOut === results ? - matcherOut.splice( preexisting, matcherOut.length ) : - matcherOut - ); - if ( postFinder ) { - postFinder( null, results, matcherOut, xml ); - } else { - push.apply( results, matcherOut ); - } - } - } ); -} - -function matcherFromTokens( tokens ) { - var checkContext, matcher, j, - len = tokens.length, - leadingRelative = Expr.relative[ tokens[ 0 ].type ], - implicitRelative = leadingRelative || Expr.relative[ " " ], - i = leadingRelative ? 1 : 0, - - // The foundational matcher ensures that elements are reachable from top-level context(s) - matchContext = addCombinator( function( elem ) { - return elem === checkContext; - }, implicitRelative, true ), - matchAnyContext = addCombinator( function( elem ) { - return indexOf.call( checkContext, elem ) > -1; - }, implicitRelative, true ), - matchers = [ function( elem, context, xml ) { - - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - var ret = ( !leadingRelative && ( xml || context != outermostContext ) ) || ( - ( checkContext = context ).nodeType ? - matchContext( elem, context, xml ) : - matchAnyContext( elem, context, xml ) ); - - // Avoid hanging onto element - // (see https://github.com/jquery/sizzle/issues/299) - checkContext = null; - return ret; - } ]; - - for ( ; i < len; i++ ) { - if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) { - matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; - } else { - matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches ); - - // Return special upon seeing a positional matcher - if ( matcher[ expando ] ) { - - // Find the next relative operator (if any) for proper handling - j = ++i; - for ( ; j < len; j++ ) { - if ( Expr.relative[ tokens[ j ].type ] ) { - break; - } - } - return setMatcher( - i > 1 && elementMatcher( matchers ), - i > 1 && toSelector( - - // If the preceding token was a descendant combinator, insert an implicit any-element `*` - tokens.slice( 0, i - 1 ) - .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } ) - ).replace( rtrimCSS, "$1" ), - matcher, - i < j && matcherFromTokens( tokens.slice( i, j ) ), - j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ), - j < len && toSelector( tokens ) - ); - } - matchers.push( matcher ); - } - } - - return elementMatcher( matchers ); -} - -function matcherFromGroupMatchers( elementMatchers, setMatchers ) { - var bySet = setMatchers.length > 0, - byElement = elementMatchers.length > 0, - superMatcher = function( seed, context, xml, results, outermost ) { - var elem, j, matcher, - matchedCount = 0, - i = "0", - unmatched = seed && [], - setMatched = [], - contextBackup = outermostContext, - - // We must always have either seed elements or outermost context - elems = seed || byElement && Expr.find.TAG( "*", outermost ), - - // Use integer dirruns iff this is the outermost matcher - dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ), - len = elems.length; - - if ( outermost ) { - - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - outermostContext = context == document || context || outermost; - } - - // Add elements passing elementMatchers directly to results - // Support: iOS <=7 - 9 only - // Tolerate NodeList properties (IE: "length"; Safari: ) matching - // elements by id. (see trac-14142) - for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) { - if ( byElement && elem ) { - j = 0; - - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( !context && elem.ownerDocument != document ) { - setDocument( elem ); - xml = !documentIsHTML; - } - while ( ( matcher = elementMatchers[ j++ ] ) ) { - if ( matcher( elem, context || document, xml ) ) { - push.call( results, elem ); - break; - } - } - if ( outermost ) { - dirruns = dirrunsUnique; - } - } - - // Track unmatched elements for set filters - if ( bySet ) { - - // They will have gone through all possible matchers - if ( ( elem = !matcher && elem ) ) { - matchedCount--; - } - - // Lengthen the array for every element, matched or not - if ( seed ) { - unmatched.push( elem ); - } - } - } - - // `i` is now the count of elements visited above, and adding it to `matchedCount` - // makes the latter nonnegative. - matchedCount += i; - - // Apply set filters to unmatched elements - // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` - // equals `i`), unless we didn't visit _any_ elements in the above loop because we have - // no element matchers and no seed. - // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that - // case, which will result in a "00" `matchedCount` that differs from `i` but is also - // numerically zero. - if ( bySet && i !== matchedCount ) { - j = 0; - while ( ( matcher = setMatchers[ j++ ] ) ) { - matcher( unmatched, setMatched, context, xml ); - } - - if ( seed ) { - - // Reintegrate element matches to eliminate the need for sorting - if ( matchedCount > 0 ) { - while ( i-- ) { - if ( !( unmatched[ i ] || setMatched[ i ] ) ) { - setMatched[ i ] = pop.call( results ); - } - } - } - - // Discard index placeholder values to get only actual matches - setMatched = condense( setMatched ); - } - - // Add matches to results - push.apply( results, setMatched ); - - // Seedless set matches succeeding multiple successful matchers stipulate sorting - if ( outermost && !seed && setMatched.length > 0 && - ( matchedCount + setMatchers.length ) > 1 ) { - - jQuery.uniqueSort( results ); - } - } - - // Override manipulation of globals by nested matchers - if ( outermost ) { - dirruns = dirrunsUnique; - outermostContext = contextBackup; - } - - return unmatched; - }; - - return bySet ? - markFunction( superMatcher ) : - superMatcher; -} - -function compile( selector, match /* Internal Use Only */ ) { - var i, - setMatchers = [], - elementMatchers = [], - cached = compilerCache[ selector + " " ]; - - if ( !cached ) { - - // Generate a function of recursive functions that can be used to check each element - if ( !match ) { - match = tokenize( selector ); - } - i = match.length; - while ( i-- ) { - cached = matcherFromTokens( match[ i ] ); - if ( cached[ expando ] ) { - setMatchers.push( cached ); - } else { - elementMatchers.push( cached ); - } - } - - // Cache the compiled function - cached = compilerCache( selector, - matcherFromGroupMatchers( elementMatchers, setMatchers ) ); - - // Save selector and tokenization - cached.selector = selector; - } - return cached; -} - -/** - * A low-level selection function that works with jQuery's compiled - * selector functions - * @param {String|Function} selector A selector or a pre-compiled - * selector function built with jQuery selector compile - * @param {Element} context - * @param {Array} [results] - * @param {Array} [seed] A set of elements to match against - */ -function select( selector, context, results, seed ) { - var i, tokens, token, type, find, - compiled = typeof selector === "function" && selector, - match = !seed && tokenize( ( selector = compiled.selector || selector ) ); - - results = results || []; - - // Try to minimize operations if there is only one selector in the list and no seed - // (the latter of which guarantees us context) - if ( match.length === 1 ) { - - // Reduce context if the leading compound selector is an ID - tokens = match[ 0 ] = match[ 0 ].slice( 0 ); - if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" && - context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) { - - context = ( Expr.find.ID( - token.matches[ 0 ].replace( runescape, funescape ), - context - ) || [] )[ 0 ]; - if ( !context ) { - return results; - - // Precompiled matchers will still verify ancestry, so step up a level - } else if ( compiled ) { - context = context.parentNode; - } - - selector = selector.slice( tokens.shift().value.length ); - } - - // Fetch a seed set for right-to-left matching - i = matchExpr.needsContext.test( selector ) ? 0 : tokens.length; - while ( i-- ) { - token = tokens[ i ]; - - // Abort if we hit a combinator - if ( Expr.relative[ ( type = token.type ) ] ) { - break; - } - if ( ( find = Expr.find[ type ] ) ) { - - // Search, expanding context for leading sibling combinators - if ( ( seed = find( - token.matches[ 0 ].replace( runescape, funescape ), - rsibling.test( tokens[ 0 ].type ) && - testContext( context.parentNode ) || context - ) ) ) { - - // If seed is empty or no tokens remain, we can return early - tokens.splice( i, 1 ); - selector = seed.length && toSelector( tokens ); - if ( !selector ) { - push.apply( results, seed ); - return results; - } - - break; - } - } - } - } - - // Compile and execute a filtering function if one is not provided - // Provide `match` to avoid retokenization if we modified the selector above - ( compiled || compile( selector, match ) )( - seed, - context, - !documentIsHTML, - results, - !context || rsibling.test( selector ) && testContext( context.parentNode ) || context - ); - return results; -} - -// One-time assignments - -// Support: Android <=4.0 - 4.1+ -// Sort stability -support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando; - -// Initialize against the default document -setDocument(); - -// Support: Android <=4.0 - 4.1+ -// Detached nodes confoundingly follow *each other* -support.sortDetached = assert( function( el ) { - - // Should return 1, but returns 4 (following) - return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1; -} ); - -jQuery.find = find; - -// Deprecated -jQuery.expr[ ":" ] = jQuery.expr.pseudos; -jQuery.unique = jQuery.uniqueSort; - -// These have always been private, but they used to be documented as part of -// Sizzle so let's maintain them for now for backwards compatibility purposes. -find.compile = compile; -find.select = select; -find.setDocument = setDocument; -find.tokenize = tokenize; - -find.escape = jQuery.escapeSelector; -find.getText = jQuery.text; -find.isXML = jQuery.isXMLDoc; -find.selectors = jQuery.expr; -find.support = jQuery.support; -find.uniqueSort = jQuery.uniqueSort; - - /* eslint-enable */ - -} )(); - - -var dir = function( elem, dir, until ) { - var matched = [], - truncate = until !== undefined; - - while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { - if ( elem.nodeType === 1 ) { - if ( truncate && jQuery( elem ).is( until ) ) { - break; - } - matched.push( elem ); - } - } - return matched; -}; - - -var siblings = function( n, elem ) { - var matched = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - matched.push( n ); - } - } - - return matched; -}; - - -var rneedsContext = jQuery.expr.match.needsContext; - -var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); - - - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, not ) { - if ( isFunction( qualifier ) ) { - return jQuery.grep( elements, function( elem, i ) { - return !!qualifier.call( elem, i, elem ) !== not; - } ); - } - - // Single element - if ( qualifier.nodeType ) { - return jQuery.grep( elements, function( elem ) { - return ( elem === qualifier ) !== not; - } ); - } - - // Arraylike of elements (jQuery, arguments, Array) - if ( typeof qualifier !== "string" ) { - return jQuery.grep( elements, function( elem ) { - return ( indexOf.call( qualifier, elem ) > -1 ) !== not; - } ); - } - - // Filtered directly for both simple and complex selectors - return jQuery.filter( qualifier, elements, not ); -} - -jQuery.filter = function( expr, elems, not ) { - var elem = elems[ 0 ]; - - if ( not ) { - expr = ":not(" + expr + ")"; - } - - if ( elems.length === 1 && elem.nodeType === 1 ) { - return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; - } - - return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { - return elem.nodeType === 1; - } ) ); -}; - -jQuery.fn.extend( { - find: function( selector ) { - var i, ret, - len = this.length, - self = this; - - if ( typeof selector !== "string" ) { - return this.pushStack( jQuery( selector ).filter( function() { - for ( i = 0; i < len; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - } ) ); - } - - ret = this.pushStack( [] ); - - for ( i = 0; i < len; i++ ) { - jQuery.find( selector, self[ i ], ret ); - } - - return len > 1 ? jQuery.uniqueSort( ret ) : ret; - }, - filter: function( selector ) { - return this.pushStack( winnow( this, selector || [], false ) ); - }, - not: function( selector ) { - return this.pushStack( winnow( this, selector || [], true ) ); - }, - is: function( selector ) { - return !!winnow( - this, - - // If this is a positional/relative selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - typeof selector === "string" && rneedsContext.test( selector ) ? - jQuery( selector ) : - selector || [], - false - ).length; - } -} ); - - -// Initialize a jQuery object - - -// A central reference to the root jQuery(document) -var rootjQuery, - - // A simple way to check for HTML strings - // Prioritize #id over to avoid XSS via location.hash (trac-9521) - // Strict HTML recognition (trac-11290: must start with <) - // Shortcut simple #id case for speed - rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, - - init = jQuery.fn.init = function( selector, context, root ) { - var match, elem; - - // HANDLE: $(""), $(null), $(undefined), $(false) - if ( !selector ) { - return this; - } - - // Method init() accepts an alternate rootjQuery - // so migrate can support jQuery.sub (gh-2101) - root = root || rootjQuery; - - // Handle HTML strings - if ( typeof selector === "string" ) { - if ( selector[ 0 ] === "<" && - selector[ selector.length - 1 ] === ">" && - selector.length >= 3 ) { - - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = rquickExpr.exec( selector ); - } - - // Match html or make sure no context is specified for #id - if ( match && ( match[ 1 ] || !context ) ) { - - // HANDLE: $(html) -> $(array) - if ( match[ 1 ] ) { - context = context instanceof jQuery ? context[ 0 ] : context; - - // Option to run scripts is true for back-compat - // Intentionally let the error be thrown if parseHTML is not present - jQuery.merge( this, jQuery.parseHTML( - match[ 1 ], - context && context.nodeType ? context.ownerDocument || context : document, - true - ) ); - - // HANDLE: $(html, props) - if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { - for ( match in context ) { - - // Properties of context are called as methods if possible - if ( isFunction( this[ match ] ) ) { - this[ match ]( context[ match ] ); - - // ...and otherwise set as attributes - } else { - this.attr( match, context[ match ] ); - } - } - } - - return this; - - // HANDLE: $(#id) - } else { - elem = document.getElementById( match[ 2 ] ); - - if ( elem ) { - - // Inject the element directly into the jQuery object - this[ 0 ] = elem; - this.length = 1; - } - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || root ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(DOMElement) - } else if ( selector.nodeType ) { - this[ 0 ] = selector; - this.length = 1; - return this; - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( isFunction( selector ) ) { - return root.ready !== undefined ? - root.ready( selector ) : - - // Execute immediately if ready is not present - selector( jQuery ); - } - - return jQuery.makeArray( selector, this ); - }; - -// Give the init function the jQuery prototype for later instantiation -init.prototype = jQuery.fn; - -// Initialize central reference -rootjQuery = jQuery( document ); - - -var rparentsprev = /^(?:parents|prev(?:Until|All))/, - - // Methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.fn.extend( { - has: function( target ) { - var targets = jQuery( target, this ), - l = targets.length; - - return this.filter( function() { - var i = 0; - for ( ; i < l; i++ ) { - if ( jQuery.contains( this, targets[ i ] ) ) { - return true; - } - } - } ); - }, - - closest: function( selectors, context ) { - var cur, - i = 0, - l = this.length, - matched = [], - targets = typeof selectors !== "string" && jQuery( selectors ); - - // Positional selectors never match, since there's no _selection_ context - if ( !rneedsContext.test( selectors ) ) { - for ( ; i < l; i++ ) { - for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { - - // Always skip document fragments - if ( cur.nodeType < 11 && ( targets ? - targets.index( cur ) > -1 : - - // Don't pass non-elements to jQuery#find - cur.nodeType === 1 && - jQuery.find.matchesSelector( cur, selectors ) ) ) { - - matched.push( cur ); - break; - } - } - } - } - - return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); - }, - - // Determine the position of an element within the set - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; - } - - // Index in selector - if ( typeof elem === "string" ) { - return indexOf.call( jQuery( elem ), this[ 0 ] ); - } - - // Locate the position of the desired element - return indexOf.call( this, - - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[ 0 ] : elem - ); - }, - - add: function( selector, context ) { - return this.pushStack( - jQuery.uniqueSort( - jQuery.merge( this.get(), jQuery( selector, context ) ) - ) - ); - }, - - addBack: function( selector ) { - return this.add( selector == null ? - this.prevObject : this.prevObject.filter( selector ) - ); - } -} ); - -function sibling( cur, dir ) { - while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} - return cur; -} - -jQuery.each( { - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, _i, until ) { - return dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return sibling( elem, "nextSibling" ); - }, - prev: function( elem ) { - return sibling( elem, "previousSibling" ); - }, - nextAll: function( elem ) { - return dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, _i, until ) { - return dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, _i, until ) { - return dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return siblings( ( elem.parentNode || {} ).firstChild, elem ); - }, - children: function( elem ) { - return siblings( elem.firstChild ); - }, - contents: function( elem ) { - if ( elem.contentDocument != null && - - // Support: IE 11+ - // elements with no `data` attribute has an object - // `contentDocument` with a `null` prototype. - getProto( elem.contentDocument ) ) { - - return elem.contentDocument; - } - - // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only - // Treat the template element as a regular one in browsers that - // don't support it. - if ( nodeName( elem, "template" ) ) { - elem = elem.content || elem; - } - - return jQuery.merge( [], elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var matched = jQuery.map( this, fn, until ); - - if ( name.slice( -5 ) !== "Until" ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - matched = jQuery.filter( selector, matched ); - } - - if ( this.length > 1 ) { - - // Remove duplicates - if ( !guaranteedUnique[ name ] ) { - jQuery.uniqueSort( matched ); - } - - // Reverse order for parents* and prev-derivatives - if ( rparentsprev.test( name ) ) { - matched.reverse(); - } - } - - return this.pushStack( matched ); - }; -} ); -var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); - - - -// Convert String-formatted options into Object-formatted ones -function createOptions( options ) { - var object = {}; - jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { - object[ flag ] = true; - } ); - return object; -} - -/* - * Create a callback list using the following parameters: - * - * options: an optional list of space-separated options that will change how - * the callback list behaves or a more traditional option object - * - * By default a callback list will act like an event callback list and can be - * "fired" multiple times. - * - * Possible options: - * - * once: will ensure the callback list can only be fired once (like a Deferred) - * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) - * - * unique: will ensure a callback can only be added once (no duplicate in the list) - * - * stopOnFalse: interrupt callings when a callback returns false - * - */ -jQuery.Callbacks = function( options ) { - - // Convert options from String-formatted to Object-formatted if needed - // (we check in cache first) - options = typeof options === "string" ? - createOptions( options ) : - jQuery.extend( {}, options ); - - var // Flag to know if list is currently firing - firing, - - // Last fire value for non-forgettable lists - memory, - - // Flag to know if list was already fired - fired, - - // Flag to prevent firing - locked, - - // Actual callback list - list = [], - - // Queue of execution data for repeatable lists - queue = [], - - // Index of currently firing callback (modified by add/remove as needed) - firingIndex = -1, - - // Fire callbacks - fire = function() { - - // Enforce single-firing - locked = locked || options.once; - - // Execute callbacks for all pending executions, - // respecting firingIndex overrides and runtime changes - fired = firing = true; - for ( ; queue.length; firingIndex = -1 ) { - memory = queue.shift(); - while ( ++firingIndex < list.length ) { - - // Run callback and check for early termination - if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && - options.stopOnFalse ) { - - // Jump to end and forget the data so .add doesn't re-fire - firingIndex = list.length; - memory = false; - } - } - } - - // Forget the data if we're done with it - if ( !options.memory ) { - memory = false; - } - - firing = false; - - // Clean up if we're done firing for good - if ( locked ) { - - // Keep an empty list if we have data for future add calls - if ( memory ) { - list = []; - - // Otherwise, this object is spent - } else { - list = ""; - } - } - }, - - // Actual Callbacks object - self = { - - // Add a callback or a collection of callbacks to the list - add: function() { - if ( list ) { - - // If we have memory from a past run, we should fire after adding - if ( memory && !firing ) { - firingIndex = list.length - 1; - queue.push( memory ); - } - - ( function add( args ) { - jQuery.each( args, function( _, arg ) { - if ( isFunction( arg ) ) { - if ( !options.unique || !self.has( arg ) ) { - list.push( arg ); - } - } else if ( arg && arg.length && toType( arg ) !== "string" ) { - - // Inspect recursively - add( arg ); - } - } ); - } )( arguments ); - - if ( memory && !firing ) { - fire(); - } - } - return this; - }, - - // Remove a callback from the list - remove: function() { - jQuery.each( arguments, function( _, arg ) { - var index; - while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { - list.splice( index, 1 ); - - // Handle firing indexes - if ( index <= firingIndex ) { - firingIndex--; - } - } - } ); - return this; - }, - - // Check if a given callback is in the list. - // If no argument is given, return whether or not list has callbacks attached. - has: function( fn ) { - return fn ? - jQuery.inArray( fn, list ) > -1 : - list.length > 0; - }, - - // Remove all callbacks from the list - empty: function() { - if ( list ) { - list = []; - } - return this; - }, - - // Disable .fire and .add - // Abort any current/pending executions - // Clear all callbacks and values - disable: function() { - locked = queue = []; - list = memory = ""; - return this; - }, - disabled: function() { - return !list; - }, - - // Disable .fire - // Also disable .add unless we have memory (since it would have no effect) - // Abort any pending executions - lock: function() { - locked = queue = []; - if ( !memory && !firing ) { - list = memory = ""; - } - return this; - }, - locked: function() { - return !!locked; - }, - - // Call all callbacks with the given context and arguments - fireWith: function( context, args ) { - if ( !locked ) { - args = args || []; - args = [ context, args.slice ? args.slice() : args ]; - queue.push( args ); - if ( !firing ) { - fire(); - } - } - return this; - }, - - // Call all the callbacks with the given arguments - fire: function() { - self.fireWith( this, arguments ); - return this; - }, - - // To know if the callbacks have already been called at least once - fired: function() { - return !!fired; - } - }; - - return self; -}; - - -function Identity( v ) { - return v; -} -function Thrower( ex ) { - throw ex; -} - -function adoptValue( value, resolve, reject, noValue ) { - var method; - - try { - - // Check for promise aspect first to privilege synchronous behavior - if ( value && isFunction( ( method = value.promise ) ) ) { - method.call( value ).done( resolve ).fail( reject ); - - // Other thenables - } else if ( value && isFunction( ( method = value.then ) ) ) { - method.call( value, resolve, reject ); - - // Other non-thenables - } else { - - // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: - // * false: [ value ].slice( 0 ) => resolve( value ) - // * true: [ value ].slice( 1 ) => resolve() - resolve.apply( undefined, [ value ].slice( noValue ) ); - } - - // For Promises/A+, convert exceptions into rejections - // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in - // Deferred#then to conditionally suppress rejection. - } catch ( value ) { - - // Support: Android 4.0 only - // Strict mode functions invoked without .call/.apply get global-object context - reject.apply( undefined, [ value ] ); - } -} - -jQuery.extend( { - - Deferred: function( func ) { - var tuples = [ - - // action, add listener, callbacks, - // ... .then handlers, argument index, [final state] - [ "notify", "progress", jQuery.Callbacks( "memory" ), - jQuery.Callbacks( "memory" ), 2 ], - [ "resolve", "done", jQuery.Callbacks( "once memory" ), - jQuery.Callbacks( "once memory" ), 0, "resolved" ], - [ "reject", "fail", jQuery.Callbacks( "once memory" ), - jQuery.Callbacks( "once memory" ), 1, "rejected" ] - ], - state = "pending", - promise = { - state: function() { - return state; - }, - always: function() { - deferred.done( arguments ).fail( arguments ); - return this; - }, - "catch": function( fn ) { - return promise.then( null, fn ); - }, - - // Keep pipe for back-compat - pipe: function( /* fnDone, fnFail, fnProgress */ ) { - var fns = arguments; - - return jQuery.Deferred( function( newDefer ) { - jQuery.each( tuples, function( _i, tuple ) { - - // Map tuples (progress, done, fail) to arguments (done, fail, progress) - var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; - - // deferred.progress(function() { bind to newDefer or newDefer.notify }) - // deferred.done(function() { bind to newDefer or newDefer.resolve }) - // deferred.fail(function() { bind to newDefer or newDefer.reject }) - deferred[ tuple[ 1 ] ]( function() { - var returned = fn && fn.apply( this, arguments ); - if ( returned && isFunction( returned.promise ) ) { - returned.promise() - .progress( newDefer.notify ) - .done( newDefer.resolve ) - .fail( newDefer.reject ); - } else { - newDefer[ tuple[ 0 ] + "With" ]( - this, - fn ? [ returned ] : arguments - ); - } - } ); - } ); - fns = null; - } ).promise(); - }, - then: function( onFulfilled, onRejected, onProgress ) { - var maxDepth = 0; - function resolve( depth, deferred, handler, special ) { - return function() { - var that = this, - args = arguments, - mightThrow = function() { - var returned, then; - - // Support: Promises/A+ section 2.3.3.3.3 - // https://promisesaplus.com/#point-59 - // Ignore double-resolution attempts - if ( depth < maxDepth ) { - return; - } - - returned = handler.apply( that, args ); - - // Support: Promises/A+ section 2.3.1 - // https://promisesaplus.com/#point-48 - if ( returned === deferred.promise() ) { - throw new TypeError( "Thenable self-resolution" ); - } - - // Support: Promises/A+ sections 2.3.3.1, 3.5 - // https://promisesaplus.com/#point-54 - // https://promisesaplus.com/#point-75 - // Retrieve `then` only once - then = returned && - - // Support: Promises/A+ section 2.3.4 - // https://promisesaplus.com/#point-64 - // Only check objects and functions for thenability - ( typeof returned === "object" || - typeof returned === "function" ) && - returned.then; - - // Handle a returned thenable - if ( isFunction( then ) ) { - - // Special processors (notify) just wait for resolution - if ( special ) { - then.call( - returned, - resolve( maxDepth, deferred, Identity, special ), - resolve( maxDepth, deferred, Thrower, special ) - ); - - // Normal processors (resolve) also hook into progress - } else { - - // ...and disregard older resolution values - maxDepth++; - - then.call( - returned, - resolve( maxDepth, deferred, Identity, special ), - resolve( maxDepth, deferred, Thrower, special ), - resolve( maxDepth, deferred, Identity, - deferred.notifyWith ) - ); - } - - // Handle all other returned values - } else { - - // Only substitute handlers pass on context - // and multiple values (non-spec behavior) - if ( handler !== Identity ) { - that = undefined; - args = [ returned ]; - } - - // Process the value(s) - // Default process is resolve - ( special || deferred.resolveWith )( that, args ); - } - }, - - // Only normal processors (resolve) catch and reject exceptions - process = special ? - mightThrow : - function() { - try { - mightThrow(); - } catch ( e ) { - - if ( jQuery.Deferred.exceptionHook ) { - jQuery.Deferred.exceptionHook( e, - process.error ); - } - - // Support: Promises/A+ section 2.3.3.3.4.1 - // https://promisesaplus.com/#point-61 - // Ignore post-resolution exceptions - if ( depth + 1 >= maxDepth ) { - - // Only substitute handlers pass on context - // and multiple values (non-spec behavior) - if ( handler !== Thrower ) { - that = undefined; - args = [ e ]; - } - - deferred.rejectWith( that, args ); - } - } - }; - - // Support: Promises/A+ section 2.3.3.3.1 - // https://promisesaplus.com/#point-57 - // Re-resolve promises immediately to dodge false rejection from - // subsequent errors - if ( depth ) { - process(); - } else { - - // Call an optional hook to record the error, in case of exception - // since it's otherwise lost when execution goes async - if ( jQuery.Deferred.getErrorHook ) { - process.error = jQuery.Deferred.getErrorHook(); - - // The deprecated alias of the above. While the name suggests - // returning the stack, not an error instance, jQuery just passes - // it directly to `console.warn` so both will work; an instance - // just better cooperates with source maps. - } else if ( jQuery.Deferred.getStackHook ) { - process.error = jQuery.Deferred.getStackHook(); - } - window.setTimeout( process ); - } - }; - } - - return jQuery.Deferred( function( newDefer ) { - - // progress_handlers.add( ... ) - tuples[ 0 ][ 3 ].add( - resolve( - 0, - newDefer, - isFunction( onProgress ) ? - onProgress : - Identity, - newDefer.notifyWith - ) - ); - - // fulfilled_handlers.add( ... ) - tuples[ 1 ][ 3 ].add( - resolve( - 0, - newDefer, - isFunction( onFulfilled ) ? - onFulfilled : - Identity - ) - ); - - // rejected_handlers.add( ... ) - tuples[ 2 ][ 3 ].add( - resolve( - 0, - newDefer, - isFunction( onRejected ) ? - onRejected : - Thrower - ) - ); - } ).promise(); - }, - - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - return obj != null ? jQuery.extend( obj, promise ) : promise; - } - }, - deferred = {}; - - // Add list-specific methods - jQuery.each( tuples, function( i, tuple ) { - var list = tuple[ 2 ], - stateString = tuple[ 5 ]; - - // promise.progress = list.add - // promise.done = list.add - // promise.fail = list.add - promise[ tuple[ 1 ] ] = list.add; - - // Handle state - if ( stateString ) { - list.add( - function() { - - // state = "resolved" (i.e., fulfilled) - // state = "rejected" - state = stateString; - }, - - // rejected_callbacks.disable - // fulfilled_callbacks.disable - tuples[ 3 - i ][ 2 ].disable, - - // rejected_handlers.disable - // fulfilled_handlers.disable - tuples[ 3 - i ][ 3 ].disable, - - // progress_callbacks.lock - tuples[ 0 ][ 2 ].lock, - - // progress_handlers.lock - tuples[ 0 ][ 3 ].lock - ); - } - - // progress_handlers.fire - // fulfilled_handlers.fire - // rejected_handlers.fire - list.add( tuple[ 3 ].fire ); - - // deferred.notify = function() { deferred.notifyWith(...) } - // deferred.resolve = function() { deferred.resolveWith(...) } - // deferred.reject = function() { deferred.rejectWith(...) } - deferred[ tuple[ 0 ] ] = function() { - deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); - return this; - }; - - // deferred.notifyWith = list.fireWith - // deferred.resolveWith = list.fireWith - // deferred.rejectWith = list.fireWith - deferred[ tuple[ 0 ] + "With" ] = list.fireWith; - } ); - - // Make the deferred a promise - promise.promise( deferred ); - - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } - - // All done! - return deferred; - }, - - // Deferred helper - when: function( singleValue ) { - var - - // count of uncompleted subordinates - remaining = arguments.length, - - // count of unprocessed arguments - i = remaining, - - // subordinate fulfillment data - resolveContexts = Array( i ), - resolveValues = slice.call( arguments ), - - // the primary Deferred - primary = jQuery.Deferred(), - - // subordinate callback factory - updateFunc = function( i ) { - return function( value ) { - resolveContexts[ i ] = this; - resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; - if ( !( --remaining ) ) { - primary.resolveWith( resolveContexts, resolveValues ); - } - }; - }; - - // Single- and empty arguments are adopted like Promise.resolve - if ( remaining <= 1 ) { - adoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject, - !remaining ); - - // Use .then() to unwrap secondary thenables (cf. gh-3000) - if ( primary.state() === "pending" || - isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { - - return primary.then(); - } - } - - // Multiple arguments are aggregated like Promise.all array elements - while ( i-- ) { - adoptValue( resolveValues[ i ], updateFunc( i ), primary.reject ); - } - - return primary.promise(); - } -} ); - - -// These usually indicate a programmer mistake during development, -// warn about them ASAP rather than swallowing them by default. -var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; - -// If `jQuery.Deferred.getErrorHook` is defined, `asyncError` is an error -// captured before the async barrier to get the original error cause -// which may otherwise be hidden. -jQuery.Deferred.exceptionHook = function( error, asyncError ) { - - // Support: IE 8 - 9 only - // Console exists when dev tools are open, which can happen at any time - if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { - window.console.warn( "jQuery.Deferred exception: " + error.message, - error.stack, asyncError ); - } -}; - - - - -jQuery.readyException = function( error ) { - window.setTimeout( function() { - throw error; - } ); -}; - - - - -// The deferred used on DOM ready -var readyList = jQuery.Deferred(); - -jQuery.fn.ready = function( fn ) { - - readyList - .then( fn ) - - // Wrap jQuery.readyException in a function so that the lookup - // happens at the time of error handling instead of callback - // registration. - .catch( function( error ) { - jQuery.readyException( error ); - } ); - - return this; -}; - -jQuery.extend( { - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See trac-6781 - readyWait: 1, - - // Handle when the DOM is ready - ready: function( wait ) { - - // Abort if there are pending holds or we're already ready - if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { - return; - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.resolveWith( document, [ jQuery ] ); - } -} ); - -jQuery.ready.then = readyList.then; - -// The ready event handler and self cleanup method -function completed() { - document.removeEventListener( "DOMContentLoaded", completed ); - window.removeEventListener( "load", completed ); - jQuery.ready(); -} - -// Catch cases where $(document).ready() is called -// after the browser event has already occurred. -// Support: IE <=9 - 10 only -// Older IE sometimes signals "interactive" too soon -if ( document.readyState === "complete" || - ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { - - // Handle it asynchronously to allow scripts the opportunity to delay ready - window.setTimeout( jQuery.ready ); - -} else { - - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", completed ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", completed ); -} - - - - -// Multifunctional method to get and set values of a collection -// The value/s can optionally be executed if it's a function -var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { - var i = 0, - len = elems.length, - bulk = key == null; - - // Sets many values - if ( toType( key ) === "object" ) { - chainable = true; - for ( i in key ) { - access( elems, fn, i, key[ i ], true, emptyGet, raw ); - } - - // Sets one value - } else if ( value !== undefined ) { - chainable = true; - - if ( !isFunction( value ) ) { - raw = true; - } - - if ( bulk ) { - - // Bulk operations run against the entire set - if ( raw ) { - fn.call( elems, value ); - fn = null; - - // ...except when executing function values - } else { - bulk = fn; - fn = function( elem, _key, value ) { - return bulk.call( jQuery( elem ), value ); - }; - } - } - - if ( fn ) { - for ( ; i < len; i++ ) { - fn( - elems[ i ], key, raw ? - value : - value.call( elems[ i ], i, fn( elems[ i ], key ) ) - ); - } - } - } - - if ( chainable ) { - return elems; - } - - // Gets - if ( bulk ) { - return fn.call( elems ); - } - - return len ? fn( elems[ 0 ], key ) : emptyGet; -}; - - -// Matches dashed string for camelizing -var rmsPrefix = /^-ms-/, - rdashAlpha = /-([a-z])/g; - -// Used by camelCase as callback to replace() -function fcamelCase( _all, letter ) { - return letter.toUpperCase(); -} - -// Convert dashed to camelCase; used by the css and data modules -// Support: IE <=9 - 11, Edge 12 - 15 -// Microsoft forgot to hump their vendor prefix (trac-9572) -function camelCase( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); -} -var acceptData = function( owner ) { - - // Accepts only: - // - Node - // - Node.ELEMENT_NODE - // - Node.DOCUMENT_NODE - // - Object - // - Any - return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); -}; - - - - -function Data() { - this.expando = jQuery.expando + Data.uid++; -} - -Data.uid = 1; - -Data.prototype = { - - cache: function( owner ) { - - // Check if the owner object already has a cache - var value = owner[ this.expando ]; - - // If not, create one - if ( !value ) { - value = {}; - - // We can accept data for non-element nodes in modern browsers, - // but we should not, see trac-8335. - // Always return an empty object. - if ( acceptData( owner ) ) { - - // If it is a node unlikely to be stringify-ed or looped over - // use plain assignment - if ( owner.nodeType ) { - owner[ this.expando ] = value; - - // Otherwise secure it in a non-enumerable property - // configurable must be true to allow the property to be - // deleted when data is removed - } else { - Object.defineProperty( owner, this.expando, { - value: value, - configurable: true - } ); - } - } - } - - return value; - }, - set: function( owner, data, value ) { - var prop, - cache = this.cache( owner ); - - // Handle: [ owner, key, value ] args - // Always use camelCase key (gh-2257) - if ( typeof data === "string" ) { - cache[ camelCase( data ) ] = value; - - // Handle: [ owner, { properties } ] args - } else { - - // Copy the properties one-by-one to the cache object - for ( prop in data ) { - cache[ camelCase( prop ) ] = data[ prop ]; - } - } - return cache; - }, - get: function( owner, key ) { - return key === undefined ? - this.cache( owner ) : - - // Always use camelCase key (gh-2257) - owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; - }, - access: function( owner, key, value ) { - - // In cases where either: - // - // 1. No key was specified - // 2. A string key was specified, but no value provided - // - // Take the "read" path and allow the get method to determine - // which value to return, respectively either: - // - // 1. The entire cache object - // 2. The data stored at the key - // - if ( key === undefined || - ( ( key && typeof key === "string" ) && value === undefined ) ) { - - return this.get( owner, key ); - } - - // When the key is not a string, or both a key and value - // are specified, set or extend (existing objects) with either: - // - // 1. An object of properties - // 2. A key and value - // - this.set( owner, key, value ); - - // Since the "set" path can have two possible entry points - // return the expected data based on which path was taken[*] - return value !== undefined ? value : key; - }, - remove: function( owner, key ) { - var i, - cache = owner[ this.expando ]; - - if ( cache === undefined ) { - return; - } - - if ( key !== undefined ) { - - // Support array or space separated string of keys - if ( Array.isArray( key ) ) { - - // If key is an array of keys... - // We always set camelCase keys, so remove that. - key = key.map( camelCase ); - } else { - key = camelCase( key ); - - // If a key with the spaces exists, use it. - // Otherwise, create an array by matching non-whitespace - key = key in cache ? - [ key ] : - ( key.match( rnothtmlwhite ) || [] ); - } - - i = key.length; - - while ( i-- ) { - delete cache[ key[ i ] ]; - } - } - - // Remove the expando if there's no more data - if ( key === undefined || jQuery.isEmptyObject( cache ) ) { - - // Support: Chrome <=35 - 45 - // Webkit & Blink performance suffers when deleting properties - // from DOM nodes, so set to undefined instead - // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) - if ( owner.nodeType ) { - owner[ this.expando ] = undefined; - } else { - delete owner[ this.expando ]; - } - } - }, - hasData: function( owner ) { - var cache = owner[ this.expando ]; - return cache !== undefined && !jQuery.isEmptyObject( cache ); - } -}; -var dataPriv = new Data(); - -var dataUser = new Data(); - - - -// Implementation Summary -// -// 1. Enforce API surface and semantic compatibility with 1.9.x branch -// 2. Improve the module's maintainability by reducing the storage -// paths to a single mechanism. -// 3. Use the same single mechanism to support "private" and "user" data. -// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) -// 5. Avoid exposing implementation details on user objects (eg. expando properties) -// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 - -var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, - rmultiDash = /[A-Z]/g; - -function getData( data ) { - if ( data === "true" ) { - return true; - } - - if ( data === "false" ) { - return false; - } - - if ( data === "null" ) { - return null; - } - - // Only convert to a number if it doesn't change the string - if ( data === +data + "" ) { - return +data; - } - - if ( rbrace.test( data ) ) { - return JSON.parse( data ); - } - - return data; -} - -function dataAttr( elem, key, data ) { - var name; - - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = getData( data ); - } catch ( e ) {} - - // Make sure we set the data so it isn't changed later - dataUser.set( elem, key, data ); - } else { - data = undefined; - } - } - return data; -} - -jQuery.extend( { - hasData: function( elem ) { - return dataUser.hasData( elem ) || dataPriv.hasData( elem ); - }, - - data: function( elem, name, data ) { - return dataUser.access( elem, name, data ); - }, - - removeData: function( elem, name ) { - dataUser.remove( elem, name ); - }, - - // TODO: Now that all calls to _data and _removeData have been replaced - // with direct calls to dataPriv methods, these can be deprecated. - _data: function( elem, name, data ) { - return dataPriv.access( elem, name, data ); - }, - - _removeData: function( elem, name ) { - dataPriv.remove( elem, name ); - } -} ); - -jQuery.fn.extend( { - data: function( key, value ) { - var i, name, data, - elem = this[ 0 ], - attrs = elem && elem.attributes; - - // Gets all values - if ( key === undefined ) { - if ( this.length ) { - data = dataUser.get( elem ); - - if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { - i = attrs.length; - while ( i-- ) { - - // Support: IE 11 only - // The attrs elements can be null (trac-14894) - if ( attrs[ i ] ) { - name = attrs[ i ].name; - if ( name.indexOf( "data-" ) === 0 ) { - name = camelCase( name.slice( 5 ) ); - dataAttr( elem, name, data[ name ] ); - } - } - } - dataPriv.set( elem, "hasDataAttrs", true ); - } - } - - return data; - } - - // Sets multiple values - if ( typeof key === "object" ) { - return this.each( function() { - dataUser.set( this, key ); - } ); - } - - return access( this, function( value ) { - var data; - - // The calling jQuery object (element matches) is not empty - // (and therefore has an element appears at this[ 0 ]) and the - // `value` parameter was not undefined. An empty jQuery object - // will result in `undefined` for elem = this[ 0 ] which will - // throw an exception if an attempt to read a data cache is made. - if ( elem && value === undefined ) { - - // Attempt to get data from the cache - // The key will always be camelCased in Data - data = dataUser.get( elem, key ); - if ( data !== undefined ) { - return data; - } - - // Attempt to "discover" the data in - // HTML5 custom data-* attrs - data = dataAttr( elem, key ); - if ( data !== undefined ) { - return data; - } - - // We tried really hard, but the data doesn't exist. - return; - } - - // Set the data... - this.each( function() { - - // We always store the camelCased key - dataUser.set( this, key, value ); - } ); - }, null, value, arguments.length > 1, null, true ); - }, - - removeData: function( key ) { - return this.each( function() { - dataUser.remove( this, key ); - } ); - } -} ); - - -jQuery.extend( { - queue: function( elem, type, data ) { - var queue; - - if ( elem ) { - type = ( type || "fx" ) + "queue"; - queue = dataPriv.get( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !queue || Array.isArray( data ) ) { - queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); - } else { - queue.push( data ); - } - } - return queue || []; - } - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), - startLength = queue.length, - fn = queue.shift(), - hooks = jQuery._queueHooks( elem, type ), - next = function() { - jQuery.dequeue( elem, type ); - }; - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - startLength--; - } - - if ( fn ) { - - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift( "inprogress" ); - } - - // Clear up the last queue stop function - delete hooks.stop; - fn.call( elem, next, hooks ); - } - - if ( !startLength && hooks ) { - hooks.empty.fire(); - } - }, - - // Not public - generate a queueHooks object, or return the current one - _queueHooks: function( elem, type ) { - var key = type + "queueHooks"; - return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { - empty: jQuery.Callbacks( "once memory" ).add( function() { - dataPriv.remove( elem, [ type + "queue", key ] ); - } ) - } ); - } -} ); - -jQuery.fn.extend( { - queue: function( type, data ) { - var setter = 2; - - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - setter--; - } - - if ( arguments.length < setter ) { - return jQuery.queue( this[ 0 ], type ); - } - - return data === undefined ? - this : - this.each( function() { - var queue = jQuery.queue( this, type, data ); - - // Ensure a hooks for this queue - jQuery._queueHooks( this, type ); - - if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - } ); - }, - dequeue: function( type ) { - return this.each( function() { - jQuery.dequeue( this, type ); - } ); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, obj ) { - var tmp, - count = 1, - defer = jQuery.Deferred(), - elements = this, - i = this.length, - resolve = function() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - }; - - if ( typeof type !== "string" ) { - obj = type; - type = undefined; - } - type = type || "fx"; - - while ( i-- ) { - tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); - if ( tmp && tmp.empty ) { - count++; - tmp.empty.add( resolve ); - } - } - resolve(); - return defer.promise( obj ); - } -} ); -var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; - -var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); - - -var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; - -var documentElement = document.documentElement; - - - - var isAttached = function( elem ) { - return jQuery.contains( elem.ownerDocument, elem ); - }, - composed = { composed: true }; - - // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only - // Check attachment across shadow DOM boundaries when possible (gh-3504) - // Support: iOS 10.0-10.2 only - // Early iOS 10 versions support `attachShadow` but not `getRootNode`, - // leading to errors. We need to check for `getRootNode`. - if ( documentElement.getRootNode ) { - isAttached = function( elem ) { - return jQuery.contains( elem.ownerDocument, elem ) || - elem.getRootNode( composed ) === elem.ownerDocument; - }; - } -var isHiddenWithinTree = function( elem, el ) { - - // isHiddenWithinTree might be called from jQuery#filter function; - // in that case, element will be second argument - elem = el || elem; - - // Inline style trumps all - return elem.style.display === "none" || - elem.style.display === "" && - - // Otherwise, check computed style - // Support: Firefox <=43 - 45 - // Disconnected elements can have computed display: none, so first confirm that elem is - // in the document. - isAttached( elem ) && - - jQuery.css( elem, "display" ) === "none"; - }; - - - -function adjustCSS( elem, prop, valueParts, tween ) { - var adjusted, scale, - maxIterations = 20, - currentValue = tween ? - function() { - return tween.cur(); - } : - function() { - return jQuery.css( elem, prop, "" ); - }, - initial = currentValue(), - unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), - - // Starting value computation is required for potential unit mismatches - initialInUnit = elem.nodeType && - ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && - rcssNum.exec( jQuery.css( elem, prop ) ); - - if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { - - // Support: Firefox <=54 - // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) - initial = initial / 2; - - // Trust units reported by jQuery.css - unit = unit || initialInUnit[ 3 ]; - - // Iteratively approximate from a nonzero starting point - initialInUnit = +initial || 1; - - while ( maxIterations-- ) { - - // Evaluate and update our best guess (doubling guesses that zero out). - // Finish if the scale equals or crosses 1 (making the old*new product non-positive). - jQuery.style( elem, prop, initialInUnit + unit ); - if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { - maxIterations = 0; - } - initialInUnit = initialInUnit / scale; - - } - - initialInUnit = initialInUnit * 2; - jQuery.style( elem, prop, initialInUnit + unit ); - - // Make sure we update the tween properties later on - valueParts = valueParts || []; - } - - if ( valueParts ) { - initialInUnit = +initialInUnit || +initial || 0; - - // Apply relative offset (+=/-=) if specified - adjusted = valueParts[ 1 ] ? - initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : - +valueParts[ 2 ]; - if ( tween ) { - tween.unit = unit; - tween.start = initialInUnit; - tween.end = adjusted; - } - } - return adjusted; -} - - -var defaultDisplayMap = {}; - -function getDefaultDisplay( elem ) { - var temp, - doc = elem.ownerDocument, - nodeName = elem.nodeName, - display = defaultDisplayMap[ nodeName ]; - - if ( display ) { - return display; - } - - temp = doc.body.appendChild( doc.createElement( nodeName ) ); - display = jQuery.css( temp, "display" ); - - temp.parentNode.removeChild( temp ); - - if ( display === "none" ) { - display = "block"; - } - defaultDisplayMap[ nodeName ] = display; - - return display; -} - -function showHide( elements, show ) { - var display, elem, - values = [], - index = 0, - length = elements.length; - - // Determine new display value for elements that need to change - for ( ; index < length; index++ ) { - elem = elements[ index ]; - if ( !elem.style ) { - continue; - } - - display = elem.style.display; - if ( show ) { - - // Since we force visibility upon cascade-hidden elements, an immediate (and slow) - // check is required in this first loop unless we have a nonempty display value (either - // inline or about-to-be-restored) - if ( display === "none" ) { - values[ index ] = dataPriv.get( elem, "display" ) || null; - if ( !values[ index ] ) { - elem.style.display = ""; - } - } - if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { - values[ index ] = getDefaultDisplay( elem ); - } - } else { - if ( display !== "none" ) { - values[ index ] = "none"; - - // Remember what we're overwriting - dataPriv.set( elem, "display", display ); - } - } - } - - // Set the display of the elements in a second loop to avoid constant reflow - for ( index = 0; index < length; index++ ) { - if ( values[ index ] != null ) { - elements[ index ].style.display = values[ index ]; - } - } - - return elements; -} - -jQuery.fn.extend( { - show: function() { - return showHide( this, true ); - }, - hide: function() { - return showHide( this ); - }, - toggle: function( state ) { - if ( typeof state === "boolean" ) { - return state ? this.show() : this.hide(); - } - - return this.each( function() { - if ( isHiddenWithinTree( this ) ) { - jQuery( this ).show(); - } else { - jQuery( this ).hide(); - } - } ); - } -} ); -var rcheckableType = ( /^(?:checkbox|radio)$/i ); - -var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i ); - -var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); - - - -( function() { - var fragment = document.createDocumentFragment(), - div = fragment.appendChild( document.createElement( "div" ) ), - input = document.createElement( "input" ); - - // Support: Android 4.0 - 4.3 only - // Check state lost if the name is set (trac-11217) - // Support: Windows Web Apps (WWA) - // `name` and `type` must use .setAttribute for WWA (trac-14901) - input.setAttribute( "type", "radio" ); - input.setAttribute( "checked", "checked" ); - input.setAttribute( "name", "t" ); - - div.appendChild( input ); - - // Support: Android <=4.1 only - // Older WebKit doesn't clone checked state correctly in fragments - support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Support: IE <=11 only - // Make sure textarea (and checkbox) defaultValue is properly cloned - div.innerHTML = ""; - support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; - - // Support: IE <=9 only - // IE <=9 replaces "; - support.option = !!div.lastChild; -} )(); - - -// We have to close these tags to support XHTML (trac-13200) -var wrapMap = { - - // XHTML parsers do not magically insert elements in the - // same way that tag soup parsers do. So we cannot shorten - // this by omitting or other required elements. - thead: [ 1, "", "
" ], - col: [ 2, "", "
" ], - tr: [ 2, "", "
" ], - td: [ 3, "", "
" ], - - _default: [ 0, "", "" ] -}; - -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -// Support: IE <=9 only -if ( !support.option ) { - wrapMap.optgroup = wrapMap.option = [ 1, "" ]; -} - - -function getAll( context, tag ) { - - // Support: IE <=9 - 11 only - // Use typeof to avoid zero-argument method invocation on host objects (trac-15151) - var ret; - - if ( typeof context.getElementsByTagName !== "undefined" ) { - ret = context.getElementsByTagName( tag || "*" ); - - } else if ( typeof context.querySelectorAll !== "undefined" ) { - ret = context.querySelectorAll( tag || "*" ); - - } else { - ret = []; - } - - if ( tag === undefined || tag && nodeName( context, tag ) ) { - return jQuery.merge( [ context ], ret ); - } - - return ret; -} - - -// Mark scripts as having already been evaluated -function setGlobalEval( elems, refElements ) { - var i = 0, - l = elems.length; - - for ( ; i < l; i++ ) { - dataPriv.set( - elems[ i ], - "globalEval", - !refElements || dataPriv.get( refElements[ i ], "globalEval" ) - ); - } -} - - -var rhtml = /<|&#?\w+;/; - -function buildFragment( elems, context, scripts, selection, ignored ) { - var elem, tmp, tag, wrap, attached, j, - fragment = context.createDocumentFragment(), - nodes = [], - i = 0, - l = elems.length; - - for ( ; i < l; i++ ) { - elem = elems[ i ]; - - if ( elem || elem === 0 ) { - - // Add nodes directly - if ( toType( elem ) === "object" ) { - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); - - // Convert non-html into a text node - } else if ( !rhtml.test( elem ) ) { - nodes.push( context.createTextNode( elem ) ); - - // Convert html into DOM nodes - } else { - tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); - - // Deserialize a standard representation - tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); - wrap = wrapMap[ tag ] || wrapMap._default; - tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; - - // Descend through wrappers to the right content - j = wrap[ 0 ]; - while ( j-- ) { - tmp = tmp.lastChild; - } - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - jQuery.merge( nodes, tmp.childNodes ); - - // Remember the top-level container - tmp = fragment.firstChild; - - // Ensure the created nodes are orphaned (trac-12392) - tmp.textContent = ""; - } - } - } - - // Remove wrapper from fragment - fragment.textContent = ""; - - i = 0; - while ( ( elem = nodes[ i++ ] ) ) { - - // Skip elements already in the context collection (trac-4087) - if ( selection && jQuery.inArray( elem, selection ) > -1 ) { - if ( ignored ) { - ignored.push( elem ); - } - continue; - } - - attached = isAttached( elem ); - - // Append to fragment - tmp = getAll( fragment.appendChild( elem ), "script" ); - - // Preserve script evaluation history - if ( attached ) { - setGlobalEval( tmp ); - } - - // Capture executables - if ( scripts ) { - j = 0; - while ( ( elem = tmp[ j++ ] ) ) { - if ( rscriptType.test( elem.type || "" ) ) { - scripts.push( elem ); - } - } - } - } - - return fragment; -} - - -var rtypenamespace = /^([^.]*)(?:\.(.+)|)/; - -function returnTrue() { - return true; -} - -function returnFalse() { - return false; -} - -function on( elem, types, selector, data, fn, one ) { - var origFn, type; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { - - // ( types-Object, data ) - data = data || selector; - selector = undefined; - } - for ( type in types ) { - on( elem, type, selector, data, types[ type ], one ); - } - return elem; - } - - if ( data == null && fn == null ) { - - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return elem; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return elem.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - } ); -} - -/* - * Helper functions for managing events -- not part of the public interface. - * Props to Dean Edwards' addEvent library for many of the ideas. - */ -jQuery.event = { - - global: {}, - - add: function( elem, types, handler, data, selector ) { - - var handleObjIn, eventHandle, tmp, - events, t, handleObj, - special, handlers, type, namespaces, origType, - elemData = dataPriv.get( elem ); - - // Only attach events to objects that accept data - if ( !acceptData( elem ) ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - selector = handleObjIn.selector; - } - - // Ensure that invalid selectors throw exceptions at attach time - // Evaluate against documentElement in case elem is a non-element node (e.g., document) - if ( selector ) { - jQuery.find.matchesSelector( documentElement, selector ); - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - if ( !( events = elemData.events ) ) { - events = elemData.events = Object.create( null ); - } - if ( !( eventHandle = elemData.handle ) ) { - eventHandle = elemData.handle = function( e ) { - - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? - jQuery.event.dispatch.apply( elem, arguments ) : undefined; - }; - } - - // Handle multiple events separated by a space - types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[ t ] ) || []; - type = origType = tmp[ 1 ]; - namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); - - // There *must* be a type, no attaching namespace-only handlers - if ( !type ) { - continue; - } - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend( { - type: type, - origType: origType, - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - needsContext: selector && jQuery.expr.match.needsContext.test( selector ), - namespace: namespaces.join( "." ) - }, handleObjIn ); - - // Init the event handler queue if we're the first - if ( !( handlers = events[ type ] ) ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener if the special events handler returns false - if ( !special.setup || - special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - }, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - - var j, origCount, tmp, - events, t, handleObj, - special, handlers, type, namespaces, origType, - elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); - - if ( !elemData || !( events = elemData.events ) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[ t ] ) || []; - type = origType = tmp[ 1 ]; - namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector ? special.delegateType : special.bindType ) || type; - handlers = events[ type ] || []; - tmp = tmp[ 2 ] && - new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); - - // Remove matching events - origCount = j = handlers.length; - while ( j-- ) { - handleObj = handlers[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !tmp || tmp.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || - selector === "**" && handleObj.selector ) ) { - handlers.splice( j, 1 ); - - if ( handleObj.selector ) { - handlers.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( origCount && !handlers.length ) { - if ( !special.teardown || - special.teardown.call( elem, namespaces, elemData.handle ) === false ) { - - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove data and the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - dataPriv.remove( elem, "handle events" ); - } - }, - - dispatch: function( nativeEvent ) { - - var i, j, ret, matched, handleObj, handlerQueue, - args = new Array( arguments.length ), - - // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( nativeEvent ), - - handlers = ( - dataPriv.get( this, "events" ) || Object.create( null ) - )[ event.type ] || [], - special = jQuery.event.special[ event.type ] || {}; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[ 0 ] = event; - - for ( i = 1; i < arguments.length; i++ ) { - args[ i ] = arguments[ i ]; - } - - event.delegateTarget = this; - - // Call the preDispatch hook for the mapped type, and let it bail if desired - if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { - return; - } - - // Determine handlers - handlerQueue = jQuery.event.handlers.call( this, event, handlers ); - - // Run delegates first; they may want to stop propagation beneath us - i = 0; - while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { - event.currentTarget = matched.elem; - - j = 0; - while ( ( handleObj = matched.handlers[ j++ ] ) && - !event.isImmediatePropagationStopped() ) { - - // If the event is namespaced, then each handler is only invoked if it is - // specially universal or its namespaces are a superset of the event's. - if ( !event.rnamespace || handleObj.namespace === false || - event.rnamespace.test( handleObj.namespace ) ) { - - event.handleObj = handleObj; - event.data = handleObj.data; - - ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || - handleObj.handler ).apply( matched.elem, args ); - - if ( ret !== undefined ) { - if ( ( event.result = ret ) === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - // Call the postDispatch hook for the mapped type - if ( special.postDispatch ) { - special.postDispatch.call( this, event ); - } - - return event.result; - }, - - handlers: function( event, handlers ) { - var i, handleObj, sel, matchedHandlers, matchedSelectors, - handlerQueue = [], - delegateCount = handlers.delegateCount, - cur = event.target; - - // Find delegate handlers - if ( delegateCount && - - // Support: IE <=9 - // Black-hole SVG instance trees (trac-13180) - cur.nodeType && - - // Support: Firefox <=42 - // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) - // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click - // Support: IE 11 only - // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) - !( event.type === "click" && event.button >= 1 ) ) { - - for ( ; cur !== this; cur = cur.parentNode || this ) { - - // Don't check non-elements (trac-13208) - // Don't process clicks on disabled elements (trac-6911, trac-8165, trac-11382, trac-11764) - if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { - matchedHandlers = []; - matchedSelectors = {}; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - - // Don't conflict with Object.prototype properties (trac-13203) - sel = handleObj.selector + " "; - - if ( matchedSelectors[ sel ] === undefined ) { - matchedSelectors[ sel ] = handleObj.needsContext ? - jQuery( sel, this ).index( cur ) > -1 : - jQuery.find( sel, this, null, [ cur ] ).length; - } - if ( matchedSelectors[ sel ] ) { - matchedHandlers.push( handleObj ); - } - } - if ( matchedHandlers.length ) { - handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); - } - } - } - } - - // Add the remaining (directly-bound) handlers - cur = this; - if ( delegateCount < handlers.length ) { - handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); - } - - return handlerQueue; - }, - - addProp: function( name, hook ) { - Object.defineProperty( jQuery.Event.prototype, name, { - enumerable: true, - configurable: true, - - get: isFunction( hook ) ? - function() { - if ( this.originalEvent ) { - return hook( this.originalEvent ); - } - } : - function() { - if ( this.originalEvent ) { - return this.originalEvent[ name ]; - } - }, - - set: function( value ) { - Object.defineProperty( this, name, { - enumerable: true, - configurable: true, - writable: true, - value: value - } ); - } - } ); - }, - - fix: function( originalEvent ) { - return originalEvent[ jQuery.expando ] ? - originalEvent : - new jQuery.Event( originalEvent ); - }, - - special: { - load: { - - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - click: { - - // Utilize native event to ensure correct state for checkable inputs - setup: function( data ) { - - // For mutual compressibility with _default, replace `this` access with a local var. - // `|| data` is dead code meant only to preserve the variable through minification. - var el = this || data; - - // Claim the first handler - if ( rcheckableType.test( el.type ) && - el.click && nodeName( el, "input" ) ) { - - // dataPriv.set( el, "click", ... ) - leverageNative( el, "click", true ); - } - - // Return false to allow normal processing in the caller - return false; - }, - trigger: function( data ) { - - // For mutual compressibility with _default, replace `this` access with a local var. - // `|| data` is dead code meant only to preserve the variable through minification. - var el = this || data; - - // Force setup before triggering a click - if ( rcheckableType.test( el.type ) && - el.click && nodeName( el, "input" ) ) { - - leverageNative( el, "click" ); - } - - // Return non-false to allow normal event-path propagation - return true; - }, - - // For cross-browser consistency, suppress native .click() on links - // Also prevent it if we're currently inside a leveraged native-event stack - _default: function( event ) { - var target = event.target; - return rcheckableType.test( target.type ) && - target.click && nodeName( target, "input" ) && - dataPriv.get( target, "click" ) || - nodeName( target, "a" ); - } - }, - - beforeunload: { - postDispatch: function( event ) { - - // Support: Firefox 20+ - // Firefox doesn't alert if the returnValue field is not set. - if ( event.result !== undefined && event.originalEvent ) { - event.originalEvent.returnValue = event.result; - } - } - } - } -}; - -// Ensure the presence of an event listener that handles manually-triggered -// synthetic events by interrupting progress until reinvoked in response to -// *native* events that it fires directly, ensuring that state changes have -// already occurred before other listeners are invoked. -function leverageNative( el, type, isSetup ) { - - // Missing `isSetup` indicates a trigger call, which must force setup through jQuery.event.add - if ( !isSetup ) { - if ( dataPriv.get( el, type ) === undefined ) { - jQuery.event.add( el, type, returnTrue ); - } - return; - } - - // Register the controller as a special universal handler for all event namespaces - dataPriv.set( el, type, false ); - jQuery.event.add( el, type, { - namespace: false, - handler: function( event ) { - var result, - saved = dataPriv.get( this, type ); - - if ( ( event.isTrigger & 1 ) && this[ type ] ) { - - // Interrupt processing of the outer synthetic .trigger()ed event - if ( !saved ) { - - // Store arguments for use when handling the inner native event - // There will always be at least one argument (an event object), so this array - // will not be confused with a leftover capture object. - saved = slice.call( arguments ); - dataPriv.set( this, type, saved ); - - // Trigger the native event and capture its result - this[ type ](); - result = dataPriv.get( this, type ); - dataPriv.set( this, type, false ); - - if ( saved !== result ) { - - // Cancel the outer synthetic event - event.stopImmediatePropagation(); - event.preventDefault(); - - return result; - } - - // If this is an inner synthetic event for an event with a bubbling surrogate - // (focus or blur), assume that the surrogate already propagated from triggering - // the native event and prevent that from happening again here. - // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the - // bubbling surrogate propagates *after* the non-bubbling base), but that seems - // less bad than duplication. - } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) { - event.stopPropagation(); - } - - // If this is a native event triggered above, everything is now in order - // Fire an inner synthetic event with the original arguments - } else if ( saved ) { - - // ...and capture the result - dataPriv.set( this, type, jQuery.event.trigger( - saved[ 0 ], - saved.slice( 1 ), - this - ) ); - - // Abort handling of the native event by all jQuery handlers while allowing - // native handlers on the same element to run. On target, this is achieved - // by stopping immediate propagation just on the jQuery event. However, - // the native event is re-wrapped by a jQuery one on each level of the - // propagation so the only way to stop it for jQuery is to stop it for - // everyone via native `stopPropagation()`. This is not a problem for - // focus/blur which don't bubble, but it does also stop click on checkboxes - // and radios. We accept this limitation. - event.stopPropagation(); - event.isImmediatePropagationStopped = returnTrue; - } - } - } ); -} - -jQuery.removeEvent = function( elem, type, handle ) { - - // This "if" is needed for plain objects - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle ); - } -}; - -jQuery.Event = function( src, props ) { - - // Allow instantiation without the 'new' keyword - if ( !( this instanceof jQuery.Event ) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = src.defaultPrevented || - src.defaultPrevented === undefined && - - // Support: Android <=2.3 only - src.returnValue === false ? - returnTrue : - returnFalse; - - // Create target properties - // Support: Safari <=6 - 7 only - // Target should not be a text node (trac-504, trac-13143) - this.target = ( src.target && src.target.nodeType === 3 ) ? - src.target.parentNode : - src.target; - - this.currentTarget = src.currentTarget; - this.relatedTarget = src.relatedTarget; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || Date.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - constructor: jQuery.Event, - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse, - isSimulated: false, - - preventDefault: function() { - var e = this.originalEvent; - - this.isDefaultPrevented = returnTrue; - - if ( e && !this.isSimulated ) { - e.preventDefault(); - } - }, - stopPropagation: function() { - var e = this.originalEvent; - - this.isPropagationStopped = returnTrue; - - if ( e && !this.isSimulated ) { - e.stopPropagation(); - } - }, - stopImmediatePropagation: function() { - var e = this.originalEvent; - - this.isImmediatePropagationStopped = returnTrue; - - if ( e && !this.isSimulated ) { - e.stopImmediatePropagation(); - } - - this.stopPropagation(); - } -}; - -// Includes all common event props including KeyEvent and MouseEvent specific props -jQuery.each( { - altKey: true, - bubbles: true, - cancelable: true, - changedTouches: true, - ctrlKey: true, - detail: true, - eventPhase: true, - metaKey: true, - pageX: true, - pageY: true, - shiftKey: true, - view: true, - "char": true, - code: true, - charCode: true, - key: true, - keyCode: true, - button: true, - buttons: true, - clientX: true, - clientY: true, - offsetX: true, - offsetY: true, - pointerId: true, - pointerType: true, - screenX: true, - screenY: true, - targetTouches: true, - toElement: true, - touches: true, - which: true -}, jQuery.event.addProp ); - -jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { - - function focusMappedHandler( nativeEvent ) { - if ( document.documentMode ) { - - // Support: IE 11+ - // Attach a single focusin/focusout handler on the document while someone wants - // focus/blur. This is because the former are synchronous in IE while the latter - // are async. In other browsers, all those handlers are invoked synchronously. - - // `handle` from private data would already wrap the event, but we need - // to change the `type` here. - var handle = dataPriv.get( this, "handle" ), - event = jQuery.event.fix( nativeEvent ); - event.type = nativeEvent.type === "focusin" ? "focus" : "blur"; - event.isSimulated = true; - - // First, handle focusin/focusout - handle( nativeEvent ); - - // ...then, handle focus/blur - // - // focus/blur don't bubble while focusin/focusout do; simulate the former by only - // invoking the handler at the lower level. - if ( event.target === event.currentTarget ) { - - // The setup part calls `leverageNative`, which, in turn, calls - // `jQuery.event.add`, so event handle will already have been set - // by this point. - handle( event ); - } - } else { - - // For non-IE browsers, attach a single capturing handler on the document - // while someone wants focusin/focusout. - jQuery.event.simulate( delegateType, nativeEvent.target, - jQuery.event.fix( nativeEvent ) ); - } - } - - jQuery.event.special[ type ] = { - - // Utilize native event if possible so blur/focus sequence is correct - setup: function() { - - var attaches; - - // Claim the first handler - // dataPriv.set( this, "focus", ... ) - // dataPriv.set( this, "blur", ... ) - leverageNative( this, type, true ); - - if ( document.documentMode ) { - - // Support: IE 9 - 11+ - // We use the same native handler for focusin & focus (and focusout & blur) - // so we need to coordinate setup & teardown parts between those events. - // Use `delegateType` as the key as `type` is already used by `leverageNative`. - attaches = dataPriv.get( this, delegateType ); - if ( !attaches ) { - this.addEventListener( delegateType, focusMappedHandler ); - } - dataPriv.set( this, delegateType, ( attaches || 0 ) + 1 ); - } else { - - // Return false to allow normal processing in the caller - return false; - } - }, - trigger: function() { - - // Force setup before trigger - leverageNative( this, type ); - - // Return non-false to allow normal event-path propagation - return true; - }, - - teardown: function() { - var attaches; - - if ( document.documentMode ) { - attaches = dataPriv.get( this, delegateType ) - 1; - if ( !attaches ) { - this.removeEventListener( delegateType, focusMappedHandler ); - dataPriv.remove( this, delegateType ); - } else { - dataPriv.set( this, delegateType, attaches ); - } - } else { - - // Return false to indicate standard teardown should be applied - return false; - } - }, - - // Suppress native focus or blur if we're currently inside - // a leveraged native-event stack - _default: function( event ) { - return dataPriv.get( event.target, type ); - }, - - delegateType: delegateType - }; - - // Support: Firefox <=44 - // Firefox doesn't have focus(in | out) events - // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 - // - // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 - // focus(in | out) events fire after focus & blur events, - // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order - // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 - // - // Support: IE 9 - 11+ - // To preserve relative focusin/focus & focusout/blur event order guaranteed on the 3.x branch, - // attach a single handler for both events in IE. - jQuery.event.special[ delegateType ] = { - setup: function() { - - // Handle: regular nodes (via `this.ownerDocument`), window - // (via `this.document`) & document (via `this`). - var doc = this.ownerDocument || this.document || this, - dataHolder = document.documentMode ? this : doc, - attaches = dataPriv.get( dataHolder, delegateType ); - - // Support: IE 9 - 11+ - // We use the same native handler for focusin & focus (and focusout & blur) - // so we need to coordinate setup & teardown parts between those events. - // Use `delegateType` as the key as `type` is already used by `leverageNative`. - if ( !attaches ) { - if ( document.documentMode ) { - this.addEventListener( delegateType, focusMappedHandler ); - } else { - doc.addEventListener( type, focusMappedHandler, true ); - } - } - dataPriv.set( dataHolder, delegateType, ( attaches || 0 ) + 1 ); - }, - teardown: function() { - var doc = this.ownerDocument || this.document || this, - dataHolder = document.documentMode ? this : doc, - attaches = dataPriv.get( dataHolder, delegateType ) - 1; - - if ( !attaches ) { - if ( document.documentMode ) { - this.removeEventListener( delegateType, focusMappedHandler ); - } else { - doc.removeEventListener( type, focusMappedHandler, true ); - } - dataPriv.remove( dataHolder, delegateType ); - } else { - dataPriv.set( dataHolder, delegateType, attaches ); - } - } - }; -} ); - -// Create mouseenter/leave events using mouseover/out and event-time checks -// so that event delegation works in jQuery. -// Do the same for pointerenter/pointerleave and pointerover/pointerout -// -// Support: Safari 7 only -// Safari sends mouseenter too often; see: -// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 -// for the description of the bug (it existed in older Chrome versions as well). -jQuery.each( { - mouseenter: "mouseover", - mouseleave: "mouseout", - pointerenter: "pointerover", - pointerleave: "pointerout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var ret, - target = this, - related = event.relatedTarget, - handleObj = event.handleObj; - - // For mouseenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -} ); - -jQuery.fn.extend( { - - on: function( types, selector, data, fn ) { - return on( this, types, selector, data, fn ); - }, - one: function( types, selector, data, fn ) { - return on( this, types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - var handleObj, type; - if ( types && types.preventDefault && types.handleObj ) { - - // ( event ) dispatched jQuery.Event - handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace ? - handleObj.origType + "." + handleObj.namespace : - handleObj.origType, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - - // ( types-object [, selector] ) - for ( type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each( function() { - jQuery.event.remove( this, types, fn, selector ); - } ); - } -} ); - - -var - - // Support: IE <=10 - 11, Edge 12 - 13 only - // In IE/Edge using regex groups here causes severe slowdowns. - // See https://connect.microsoft.com/IE/feedback/details/1736512/ - rnoInnerhtml = /\s*$/g; - -// Prefer a tbody over its parent table for containing new rows -function manipulationTarget( elem, content ) { - if ( nodeName( elem, "table" ) && - nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { - - return jQuery( elem ).children( "tbody" )[ 0 ] || elem; - } - - return elem; -} - -// Replace/restore the type attribute of script elements for safe DOM manipulation -function disableScript( elem ) { - elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; - return elem; -} -function restoreScript( elem ) { - if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { - elem.type = elem.type.slice( 5 ); - } else { - elem.removeAttribute( "type" ); - } - - return elem; -} - -function cloneCopyEvent( src, dest ) { - var i, l, type, pdataOld, udataOld, udataCur, events; - - if ( dest.nodeType !== 1 ) { - return; - } - - // 1. Copy private data: events, handlers, etc. - if ( dataPriv.hasData( src ) ) { - pdataOld = dataPriv.get( src ); - events = pdataOld.events; - - if ( events ) { - dataPriv.remove( dest, "handle events" ); - - for ( type in events ) { - for ( i = 0, l = events[ type ].length; i < l; i++ ) { - jQuery.event.add( dest, type, events[ type ][ i ] ); - } - } - } - } - - // 2. Copy user data - if ( dataUser.hasData( src ) ) { - udataOld = dataUser.access( src ); - udataCur = jQuery.extend( {}, udataOld ); - - dataUser.set( dest, udataCur ); - } -} - -// Fix IE bugs, see support tests -function fixInput( src, dest ) { - var nodeName = dest.nodeName.toLowerCase(); - - // Fails to persist the checked state of a cloned checkbox or radio button. - if ( nodeName === "input" && rcheckableType.test( src.type ) ) { - dest.checked = src.checked; - - // Fails to return the selected option to the default selected state when cloning options - } else if ( nodeName === "input" || nodeName === "textarea" ) { - dest.defaultValue = src.defaultValue; - } -} - -function domManip( collection, args, callback, ignored ) { - - // Flatten any nested arrays - args = flat( args ); - - var fragment, first, scripts, hasScripts, node, doc, - i = 0, - l = collection.length, - iNoClone = l - 1, - value = args[ 0 ], - valueIsFunction = isFunction( value ); - - // We can't cloneNode fragments that contain checked, in WebKit - if ( valueIsFunction || - ( l > 1 && typeof value === "string" && - !support.checkClone && rchecked.test( value ) ) ) { - return collection.each( function( index ) { - var self = collection.eq( index ); - if ( valueIsFunction ) { - args[ 0 ] = value.call( this, index, self.html() ); - } - domManip( self, args, callback, ignored ); - } ); - } - - if ( l ) { - fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); - first = fragment.firstChild; - - if ( fragment.childNodes.length === 1 ) { - fragment = first; - } - - // Require either new content or an interest in ignored elements to invoke the callback - if ( first || ignored ) { - scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); - hasScripts = scripts.length; - - // Use the original fragment for the last item - // instead of the first because it can end up - // being emptied incorrectly in certain situations (trac-8070). - for ( ; i < l; i++ ) { - node = fragment; - - if ( i !== iNoClone ) { - node = jQuery.clone( node, true, true ); - - // Keep references to cloned scripts for later restoration - if ( hasScripts ) { - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - jQuery.merge( scripts, getAll( node, "script" ) ); - } - } - - callback.call( collection[ i ], node, i ); - } - - if ( hasScripts ) { - doc = scripts[ scripts.length - 1 ].ownerDocument; - - // Re-enable scripts - jQuery.map( scripts, restoreScript ); - - // Evaluate executable scripts on first document insertion - for ( i = 0; i < hasScripts; i++ ) { - node = scripts[ i ]; - if ( rscriptType.test( node.type || "" ) && - !dataPriv.access( node, "globalEval" ) && - jQuery.contains( doc, node ) ) { - - if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { - - // Optional AJAX dependency, but won't run scripts if not present - if ( jQuery._evalUrl && !node.noModule ) { - jQuery._evalUrl( node.src, { - nonce: node.nonce || node.getAttribute( "nonce" ) - }, doc ); - } - } else { - - // Unwrap a CDATA section containing script contents. This shouldn't be - // needed as in XML documents they're already not visible when - // inspecting element contents and in HTML documents they have no - // meaning but we're preserving that logic for backwards compatibility. - // This will be removed completely in 4.0. See gh-4904. - DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc ); - } - } - } - } - } - } - - return collection; -} - -function remove( elem, selector, keepData ) { - var node, - nodes = selector ? jQuery.filter( selector, elem ) : elem, - i = 0; - - for ( ; ( node = nodes[ i ] ) != null; i++ ) { - if ( !keepData && node.nodeType === 1 ) { - jQuery.cleanData( getAll( node ) ); - } - - if ( node.parentNode ) { - if ( keepData && isAttached( node ) ) { - setGlobalEval( getAll( node, "script" ) ); - } - node.parentNode.removeChild( node ); - } - } - - return elem; -} - -jQuery.extend( { - htmlPrefilter: function( html ) { - return html; - }, - - clone: function( elem, dataAndEvents, deepDataAndEvents ) { - var i, l, srcElements, destElements, - clone = elem.cloneNode( true ), - inPage = isAttached( elem ); - - // Fix IE cloning issues - if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && - !jQuery.isXMLDoc( elem ) ) { - - // We eschew jQuery#find here for performance reasons: - // https://jsperf.com/getall-vs-sizzle/2 - destElements = getAll( clone ); - srcElements = getAll( elem ); - - for ( i = 0, l = srcElements.length; i < l; i++ ) { - fixInput( srcElements[ i ], destElements[ i ] ); - } - } - - // Copy the events from the original to the clone - if ( dataAndEvents ) { - if ( deepDataAndEvents ) { - srcElements = srcElements || getAll( elem ); - destElements = destElements || getAll( clone ); - - for ( i = 0, l = srcElements.length; i < l; i++ ) { - cloneCopyEvent( srcElements[ i ], destElements[ i ] ); - } - } else { - cloneCopyEvent( elem, clone ); - } - } - - // Preserve script evaluation history - destElements = getAll( clone, "script" ); - if ( destElements.length > 0 ) { - setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); - } - - // Return the cloned set - return clone; - }, - - cleanData: function( elems ) { - var data, elem, type, - special = jQuery.event.special, - i = 0; - - for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { - if ( acceptData( elem ) ) { - if ( ( data = elem[ dataPriv.expando ] ) ) { - if ( data.events ) { - for ( type in data.events ) { - if ( special[ type ] ) { - jQuery.event.remove( elem, type ); - - // This is a shortcut to avoid jQuery.event.remove's overhead - } else { - jQuery.removeEvent( elem, type, data.handle ); - } - } - } - - // Support: Chrome <=35 - 45+ - // Assign undefined instead of using delete, see Data#remove - elem[ dataPriv.expando ] = undefined; - } - if ( elem[ dataUser.expando ] ) { - - // Support: Chrome <=35 - 45+ - // Assign undefined instead of using delete, see Data#remove - elem[ dataUser.expando ] = undefined; - } - } - } - } -} ); - -jQuery.fn.extend( { - detach: function( selector ) { - return remove( this, selector, true ); - }, - - remove: function( selector ) { - return remove( this, selector ); - }, - - text: function( value ) { - return access( this, function( value ) { - return value === undefined ? - jQuery.text( this ) : - this.empty().each( function() { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - this.textContent = value; - } - } ); - }, null, value, arguments.length ); - }, - - append: function() { - return domManip( this, arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.appendChild( elem ); - } - } ); - }, - - prepend: function() { - return domManip( this, arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.insertBefore( elem, target.firstChild ); - } - } ); - }, - - before: function() { - return domManip( this, arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this ); - } - } ); - }, - - after: function() { - return domManip( this, arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this.nextSibling ); - } - } ); - }, - - empty: function() { - var elem, - i = 0; - - for ( ; ( elem = this[ i ] ) != null; i++ ) { - if ( elem.nodeType === 1 ) { - - // Prevent memory leaks - jQuery.cleanData( getAll( elem, false ) ); - - // Remove any remaining nodes - elem.textContent = ""; - } - } - - return this; - }, - - clone: function( dataAndEvents, deepDataAndEvents ) { - dataAndEvents = dataAndEvents == null ? false : dataAndEvents; - deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; - - return this.map( function() { - return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); - } ); - }, - - html: function( value ) { - return access( this, function( value ) { - var elem = this[ 0 ] || {}, - i = 0, - l = this.length; - - if ( value === undefined && elem.nodeType === 1 ) { - return elem.innerHTML; - } - - // See if we can take a shortcut and just use innerHTML - if ( typeof value === "string" && !rnoInnerhtml.test( value ) && - !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { - - value = jQuery.htmlPrefilter( value ); - - try { - for ( ; i < l; i++ ) { - elem = this[ i ] || {}; - - // Remove element nodes and prevent memory leaks - if ( elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem, false ) ); - elem.innerHTML = value; - } - } - - elem = 0; - - // If using innerHTML throws an exception, use the fallback method - } catch ( e ) {} - } - - if ( elem ) { - this.empty().append( value ); - } - }, null, value, arguments.length ); - }, - - replaceWith: function() { - var ignored = []; - - // Make the changes, replacing each non-ignored context element with the new content - return domManip( this, arguments, function( elem ) { - var parent = this.parentNode; - - if ( jQuery.inArray( this, ignored ) < 0 ) { - jQuery.cleanData( getAll( this ) ); - if ( parent ) { - parent.replaceChild( elem, this ); - } - } - - // Force callback invocation - }, ignored ); - } -} ); - -jQuery.each( { - appendTo: "append", - prependTo: "prepend", - insertBefore: "before", - insertAfter: "after", - replaceAll: "replaceWith" -}, function( name, original ) { - jQuery.fn[ name ] = function( selector ) { - var elems, - ret = [], - insert = jQuery( selector ), - last = insert.length - 1, - i = 0; - - for ( ; i <= last; i++ ) { - elems = i === last ? this : this.clone( true ); - jQuery( insert[ i ] )[ original ]( elems ); - - // Support: Android <=4.0 only, PhantomJS 1 only - // .get() because push.apply(_, arraylike) throws on ancient WebKit - push.apply( ret, elems.get() ); - } - - return this.pushStack( ret ); - }; -} ); -var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); - -var rcustomProp = /^--/; - - -var getStyles = function( elem ) { - - // Support: IE <=11 only, Firefox <=30 (trac-15098, trac-14150) - // IE throws on elements created in popups - // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" - var view = elem.ownerDocument.defaultView; - - if ( !view || !view.opener ) { - view = window; - } - - return view.getComputedStyle( elem ); - }; - -var swap = function( elem, options, callback ) { - var ret, name, - old = {}; - - // Remember the old values, and insert the new ones - for ( name in options ) { - old[ name ] = elem.style[ name ]; - elem.style[ name ] = options[ name ]; - } - - ret = callback.call( elem ); - - // Revert the old values - for ( name in options ) { - elem.style[ name ] = old[ name ]; - } - - return ret; -}; - - -var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); - - - -( function() { - - // Executing both pixelPosition & boxSizingReliable tests require only one layout - // so they're executed at the same time to save the second computation. - function computeStyleTests() { - - // This is a singleton, we need to execute it only once - if ( !div ) { - return; - } - - container.style.cssText = "position:absolute;left:-11111px;width:60px;" + - "margin-top:1px;padding:0;border:0"; - div.style.cssText = - "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + - "margin:auto;border:1px;padding:1px;" + - "width:60%;top:1%"; - documentElement.appendChild( container ).appendChild( div ); - - var divStyle = window.getComputedStyle( div ); - pixelPositionVal = divStyle.top !== "1%"; - - // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 - reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; - - // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 - // Some styles come back with percentage values, even though they shouldn't - div.style.right = "60%"; - pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; - - // Support: IE 9 - 11 only - // Detect misreporting of content dimensions for box-sizing:border-box elements - boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; - - // Support: IE 9 only - // Detect overflow:scroll screwiness (gh-3699) - // Support: Chrome <=64 - // Don't get tricked when zoom affects offsetWidth (gh-4029) - div.style.position = "absolute"; - scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12; - - documentElement.removeChild( container ); - - // Nullify the div so it wouldn't be stored in the memory and - // it will also be a sign that checks already performed - div = null; - } - - function roundPixelMeasures( measure ) { - return Math.round( parseFloat( measure ) ); - } - - var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, - reliableTrDimensionsVal, reliableMarginLeftVal, - container = document.createElement( "div" ), - div = document.createElement( "div" ); - - // Finish early in limited (non-browser) environments - if ( !div.style ) { - return; - } - - // Support: IE <=9 - 11 only - // Style of cloned element affects source element cloned (trac-8908) - div.style.backgroundClip = "content-box"; - div.cloneNode( true ).style.backgroundClip = ""; - support.clearCloneStyle = div.style.backgroundClip === "content-box"; - - jQuery.extend( support, { - boxSizingReliable: function() { - computeStyleTests(); - return boxSizingReliableVal; - }, - pixelBoxStyles: function() { - computeStyleTests(); - return pixelBoxStylesVal; - }, - pixelPosition: function() { - computeStyleTests(); - return pixelPositionVal; - }, - reliableMarginLeft: function() { - computeStyleTests(); - return reliableMarginLeftVal; - }, - scrollboxSize: function() { - computeStyleTests(); - return scrollboxSizeVal; - }, - - // Support: IE 9 - 11+, Edge 15 - 18+ - // IE/Edge misreport `getComputedStyle` of table rows with width/height - // set in CSS while `offset*` properties report correct values. - // Behavior in IE 9 is more subtle than in newer versions & it passes - // some versions of this test; make sure not to make it pass there! - // - // Support: Firefox 70+ - // Only Firefox includes border widths - // in computed dimensions. (gh-4529) - reliableTrDimensions: function() { - var table, tr, trChild, trStyle; - if ( reliableTrDimensionsVal == null ) { - table = document.createElement( "table" ); - tr = document.createElement( "tr" ); - trChild = document.createElement( "div" ); - - table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate"; - tr.style.cssText = "box-sizing:content-box;border:1px solid"; - - // Support: Chrome 86+ - // Height set through cssText does not get applied. - // Computed height then comes back as 0. - tr.style.height = "1px"; - trChild.style.height = "9px"; - - // Support: Android 8 Chrome 86+ - // In our bodyBackground.html iframe, - // display for all div elements is set to "inline", - // which causes a problem only in Android 8 Chrome 86. - // Ensuring the div is `display: block` - // gets around this issue. - trChild.style.display = "block"; - - documentElement - .appendChild( table ) - .appendChild( tr ) - .appendChild( trChild ); - - trStyle = window.getComputedStyle( tr ); - reliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) + - parseInt( trStyle.borderTopWidth, 10 ) + - parseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight; - - documentElement.removeChild( table ); - } - return reliableTrDimensionsVal; - } - } ); -} )(); - - -function curCSS( elem, name, computed ) { - var width, minWidth, maxWidth, ret, - isCustomProp = rcustomProp.test( name ), - - // Support: Firefox 51+ - // Retrieving style before computed somehow - // fixes an issue with getting wrong values - // on detached elements - style = elem.style; - - computed = computed || getStyles( elem ); - - // getPropertyValue is needed for: - // .css('filter') (IE 9 only, trac-12537) - // .css('--customProperty) (gh-3144) - if ( computed ) { - - // Support: IE <=9 - 11+ - // IE only supports `"float"` in `getPropertyValue`; in computed styles - // it's only available as `"cssFloat"`. We no longer modify properties - // sent to `.css()` apart from camelCasing, so we need to check both. - // Normally, this would create difference in behavior: if - // `getPropertyValue` returns an empty string, the value returned - // by `.css()` would be `undefined`. This is usually the case for - // disconnected elements. However, in IE even disconnected elements - // with no styles return `"none"` for `getPropertyValue( "float" )` - ret = computed.getPropertyValue( name ) || computed[ name ]; - - if ( isCustomProp && ret ) { - - // Support: Firefox 105+, Chrome <=105+ - // Spec requires trimming whitespace for custom properties (gh-4926). - // Firefox only trims leading whitespace. Chrome just collapses - // both leading & trailing whitespace to a single space. - // - // Fall back to `undefined` if empty string returned. - // This collapses a missing definition with property defined - // and set to an empty string but there's no standard API - // allowing us to differentiate them without a performance penalty - // and returning `undefined` aligns with older jQuery. - // - // rtrimCSS treats U+000D CARRIAGE RETURN and U+000C FORM FEED - // as whitespace while CSS does not, but this is not a problem - // because CSS preprocessing replaces them with U+000A LINE FEED - // (which *is* CSS whitespace) - // https://www.w3.org/TR/css-syntax-3/#input-preprocessing - ret = ret.replace( rtrimCSS, "$1" ) || undefined; - } - - if ( ret === "" && !isAttached( elem ) ) { - ret = jQuery.style( elem, name ); - } - - // A tribute to the "awesome hack by Dean Edwards" - // Android Browser returns percentage for some values, - // but width seems to be reliably pixels. - // This is against the CSSOM draft spec: - // https://drafts.csswg.org/cssom/#resolved-values - if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { - - // Remember the original values - width = style.width; - minWidth = style.minWidth; - maxWidth = style.maxWidth; - - // Put in the new values to get a computed value out - style.minWidth = style.maxWidth = style.width = ret; - ret = computed.width; - - // Revert the changed values - style.width = width; - style.minWidth = minWidth; - style.maxWidth = maxWidth; - } - } - - return ret !== undefined ? - - // Support: IE <=9 - 11 only - // IE returns zIndex value as an integer. - ret + "" : - ret; -} - - -function addGetHookIf( conditionFn, hookFn ) { - - // Define the hook, we'll check on the first run if it's really needed. - return { - get: function() { - if ( conditionFn() ) { - - // Hook not needed (or it's not possible to use it due - // to missing dependency), remove it. - delete this.get; - return; - } - - // Hook needed; redefine it so that the support test is not executed again. - return ( this.get = hookFn ).apply( this, arguments ); - } - }; -} - - -var cssPrefixes = [ "Webkit", "Moz", "ms" ], - emptyStyle = document.createElement( "div" ).style, - vendorProps = {}; - -// Return a vendor-prefixed property or undefined -function vendorPropName( name ) { - - // Check for vendor prefixed names - var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), - i = cssPrefixes.length; - - while ( i-- ) { - name = cssPrefixes[ i ] + capName; - if ( name in emptyStyle ) { - return name; - } - } -} - -// Return a potentially-mapped jQuery.cssProps or vendor prefixed property -function finalPropName( name ) { - var final = jQuery.cssProps[ name ] || vendorProps[ name ]; - - if ( final ) { - return final; - } - if ( name in emptyStyle ) { - return name; - } - return vendorProps[ name ] = vendorPropName( name ) || name; -} - - -var - - // Swappable if display is none or starts with table - // except "table", "table-cell", or "table-caption" - // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display - rdisplayswap = /^(none|table(?!-c[ea]).+)/, - cssShow = { position: "absolute", visibility: "hidden", display: "block" }, - cssNormalTransform = { - letterSpacing: "0", - fontWeight: "400" - }; - -function setPositiveNumber( _elem, value, subtract ) { - - // Any relative (+/-) values have already been - // normalized at this point - var matches = rcssNum.exec( value ); - return matches ? - - // Guard against undefined "subtract", e.g., when used as in cssHooks - Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : - value; -} - -function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { - var i = dimension === "width" ? 1 : 0, - extra = 0, - delta = 0, - marginDelta = 0; - - // Adjustment may not be necessary - if ( box === ( isBorderBox ? "border" : "content" ) ) { - return 0; - } - - for ( ; i < 4; i += 2 ) { - - // Both box models exclude margin - // Count margin delta separately to only add it after scroll gutter adjustment. - // This is needed to make negative margins work with `outerHeight( true )` (gh-3982). - if ( box === "margin" ) { - marginDelta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); - } - - // If we get here with a content-box, we're seeking "padding" or "border" or "margin" - if ( !isBorderBox ) { - - // Add padding - delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - - // For "border" or "margin", add border - if ( box !== "padding" ) { - delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - - // But still keep track of it otherwise - } else { - extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - - // If we get here with a border-box (content + padding + border), we're seeking "content" or - // "padding" or "margin" - } else { - - // For "content", subtract padding - if ( box === "content" ) { - delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - } - - // For "content" or "padding", subtract border - if ( box !== "margin" ) { - delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - } - } - - // Account for positive content-box scroll gutter when requested by providing computedVal - if ( !isBorderBox && computedVal >= 0 ) { - - // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border - // Assuming integer scroll gutter, subtract the rest and round down - delta += Math.max( 0, Math.ceil( - elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - - computedVal - - delta - - extra - - 0.5 - - // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter - // Use an explicit zero to avoid NaN (gh-3964) - ) ) || 0; - } - - return delta + marginDelta; -} - -function getWidthOrHeight( elem, dimension, extra ) { - - // Start with computed style - var styles = getStyles( elem ), - - // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322). - // Fake content-box until we know it's needed to know the true value. - boxSizingNeeded = !support.boxSizingReliable() || extra, - isBorderBox = boxSizingNeeded && - jQuery.css( elem, "boxSizing", false, styles ) === "border-box", - valueIsBorderBox = isBorderBox, - - val = curCSS( elem, dimension, styles ), - offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ); - - // Support: Firefox <=54 - // Return a confounding non-pixel value or feign ignorance, as appropriate. - if ( rnumnonpx.test( val ) ) { - if ( !extra ) { - return val; - } - val = "auto"; - } - - - // Support: IE 9 - 11 only - // Use offsetWidth/offsetHeight for when box sizing is unreliable. - // In those cases, the computed value can be trusted to be border-box. - if ( ( !support.boxSizingReliable() && isBorderBox || - - // Support: IE 10 - 11+, Edge 15 - 18+ - // IE/Edge misreport `getComputedStyle` of table rows with width/height - // set in CSS while `offset*` properties report correct values. - // Interestingly, in some cases IE 9 doesn't suffer from this issue. - !support.reliableTrDimensions() && nodeName( elem, "tr" ) || - - // Fall back to offsetWidth/offsetHeight when value is "auto" - // This happens for inline elements with no explicit setting (gh-3571) - val === "auto" || - - // Support: Android <=4.1 - 4.3 only - // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) - !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) && - - // Make sure the element is visible & connected - elem.getClientRects().length ) { - - isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; - - // Where available, offsetWidth/offsetHeight approximate border box dimensions. - // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the - // retrieved value as a content box dimension. - valueIsBorderBox = offsetProp in elem; - if ( valueIsBorderBox ) { - val = elem[ offsetProp ]; - } - } - - // Normalize "" and auto - val = parseFloat( val ) || 0; - - // Adjust for the element's box model - return ( val + - boxModelAdjustment( - elem, - dimension, - extra || ( isBorderBox ? "border" : "content" ), - valueIsBorderBox, - styles, - - // Provide the current computed size to request scroll gutter calculation (gh-3589) - val - ) - ) + "px"; -} - -jQuery.extend( { - - // Add in style property hooks for overriding the default - // behavior of getting and setting a style property - cssHooks: { - opacity: { - get: function( elem, computed ) { - if ( computed ) { - - // We should always get a number back from opacity - var ret = curCSS( elem, "opacity" ); - return ret === "" ? "1" : ret; - } - } - } - }, - - // Don't automatically add "px" to these possibly-unitless properties - cssNumber: { - animationIterationCount: true, - aspectRatio: true, - borderImageSlice: true, - columnCount: true, - flexGrow: true, - flexShrink: true, - fontWeight: true, - gridArea: true, - gridColumn: true, - gridColumnEnd: true, - gridColumnStart: true, - gridRow: true, - gridRowEnd: true, - gridRowStart: true, - lineHeight: true, - opacity: true, - order: true, - orphans: true, - scale: true, - widows: true, - zIndex: true, - zoom: true, - - // SVG-related - fillOpacity: true, - floodOpacity: true, - stopOpacity: true, - strokeMiterlimit: true, - strokeOpacity: true - }, - - // Add in properties whose names you wish to fix before - // setting or getting the value - cssProps: {}, - - // Get and set the style property on a DOM Node - style: function( elem, name, value, extra ) { - - // Don't set styles on text and comment nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { - return; - } - - // Make sure that we're working with the right name - var ret, type, hooks, - origName = camelCase( name ), - isCustomProp = rcustomProp.test( name ), - style = elem.style; - - // Make sure that we're working with the right name. We don't - // want to query the value if it is a CSS custom property - // since they are user-defined. - if ( !isCustomProp ) { - name = finalPropName( origName ); - } - - // Gets hook for the prefixed version, then unprefixed version - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // Check if we're setting a value - if ( value !== undefined ) { - type = typeof value; - - // Convert "+=" or "-=" to relative numbers (trac-7345) - if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { - value = adjustCSS( elem, name, ret ); - - // Fixes bug trac-9237 - type = "number"; - } - - // Make sure that null and NaN values aren't set (trac-7116) - if ( value == null || value !== value ) { - return; - } - - // If a number was passed in, add the unit (except for certain CSS properties) - // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append - // "px" to a few hardcoded values. - if ( type === "number" && !isCustomProp ) { - value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); - } - - // background-* props affect original clone's values - if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { - style[ name ] = "inherit"; - } - - // If a hook was provided, use that value, otherwise just set the specified value - if ( !hooks || !( "set" in hooks ) || - ( value = hooks.set( elem, value, extra ) ) !== undefined ) { - - if ( isCustomProp ) { - style.setProperty( name, value ); - } else { - style[ name ] = value; - } - } - - } else { - - // If a hook was provided get the non-computed value from there - if ( hooks && "get" in hooks && - ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { - - return ret; - } - - // Otherwise just get the value from the style object - return style[ name ]; - } - }, - - css: function( elem, name, extra, styles ) { - var val, num, hooks, - origName = camelCase( name ), - isCustomProp = rcustomProp.test( name ); - - // Make sure that we're working with the right name. We don't - // want to modify the value if it is a CSS custom property - // since they are user-defined. - if ( !isCustomProp ) { - name = finalPropName( origName ); - } - - // Try prefixed name followed by the unprefixed name - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // If a hook was provided get the computed value from there - if ( hooks && "get" in hooks ) { - val = hooks.get( elem, true, extra ); - } - - // Otherwise, if a way to get the computed value exists, use that - if ( val === undefined ) { - val = curCSS( elem, name, styles ); - } - - // Convert "normal" to computed value - if ( val === "normal" && name in cssNormalTransform ) { - val = cssNormalTransform[ name ]; - } - - // Make numeric if forced or a qualifier was provided and val looks numeric - if ( extra === "" || extra ) { - num = parseFloat( val ); - return extra === true || isFinite( num ) ? num || 0 : val; - } - - return val; - } -} ); - -jQuery.each( [ "height", "width" ], function( _i, dimension ) { - jQuery.cssHooks[ dimension ] = { - get: function( elem, computed, extra ) { - if ( computed ) { - - // Certain elements can have dimension info if we invisibly show them - // but it must have a current display style that would benefit - return rdisplayswap.test( jQuery.css( elem, "display" ) ) && - - // Support: Safari 8+ - // Table columns in Safari have non-zero offsetWidth & zero - // getBoundingClientRect().width unless display is changed. - // Support: IE <=11 only - // Running getBoundingClientRect on a disconnected node - // in IE throws an error. - ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? - swap( elem, cssShow, function() { - return getWidthOrHeight( elem, dimension, extra ); - } ) : - getWidthOrHeight( elem, dimension, extra ); - } - }, - - set: function( elem, value, extra ) { - var matches, - styles = getStyles( elem ), - - // Only read styles.position if the test has a chance to fail - // to avoid forcing a reflow. - scrollboxSizeBuggy = !support.scrollboxSize() && - styles.position === "absolute", - - // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991) - boxSizingNeeded = scrollboxSizeBuggy || extra, - isBorderBox = boxSizingNeeded && - jQuery.css( elem, "boxSizing", false, styles ) === "border-box", - subtract = extra ? - boxModelAdjustment( - elem, - dimension, - extra, - isBorderBox, - styles - ) : - 0; - - // Account for unreliable border-box dimensions by comparing offset* to computed and - // faking a content-box to get border and padding (gh-3699) - if ( isBorderBox && scrollboxSizeBuggy ) { - subtract -= Math.ceil( - elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - - parseFloat( styles[ dimension ] ) - - boxModelAdjustment( elem, dimension, "border", false, styles ) - - 0.5 - ); - } - - // Convert to pixels if value adjustment is needed - if ( subtract && ( matches = rcssNum.exec( value ) ) && - ( matches[ 3 ] || "px" ) !== "px" ) { - - elem.style[ dimension ] = value; - value = jQuery.css( elem, dimension ); - } - - return setPositiveNumber( elem, value, subtract ); - } - }; -} ); - -jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, - function( elem, computed ) { - if ( computed ) { - return ( parseFloat( curCSS( elem, "marginLeft" ) ) || - elem.getBoundingClientRect().left - - swap( elem, { marginLeft: 0 }, function() { - return elem.getBoundingClientRect().left; - } ) - ) + "px"; - } - } -); - -// These hooks are used by animate to expand properties -jQuery.each( { - margin: "", - padding: "", - border: "Width" -}, function( prefix, suffix ) { - jQuery.cssHooks[ prefix + suffix ] = { - expand: function( value ) { - var i = 0, - expanded = {}, - - // Assumes a single number if not a string - parts = typeof value === "string" ? value.split( " " ) : [ value ]; - - for ( ; i < 4; i++ ) { - expanded[ prefix + cssExpand[ i ] + suffix ] = - parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; - } - - return expanded; - } - }; - - if ( prefix !== "margin" ) { - jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; - } -} ); - -jQuery.fn.extend( { - css: function( name, value ) { - return access( this, function( elem, name, value ) { - var styles, len, - map = {}, - i = 0; - - if ( Array.isArray( name ) ) { - styles = getStyles( elem ); - len = name.length; - - for ( ; i < len; i++ ) { - map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); - } - - return map; - } - - return value !== undefined ? - jQuery.style( elem, name, value ) : - jQuery.css( elem, name ); - }, name, value, arguments.length > 1 ); - } -} ); - - -function Tween( elem, options, prop, end, easing ) { - return new Tween.prototype.init( elem, options, prop, end, easing ); -} -jQuery.Tween = Tween; - -Tween.prototype = { - constructor: Tween, - init: function( elem, options, prop, end, easing, unit ) { - this.elem = elem; - this.prop = prop; - this.easing = easing || jQuery.easing._default; - this.options = options; - this.start = this.now = this.cur(); - this.end = end; - this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); - }, - cur: function() { - var hooks = Tween.propHooks[ this.prop ]; - - return hooks && hooks.get ? - hooks.get( this ) : - Tween.propHooks._default.get( this ); - }, - run: function( percent ) { - var eased, - hooks = Tween.propHooks[ this.prop ]; - - if ( this.options.duration ) { - this.pos = eased = jQuery.easing[ this.easing ]( - percent, this.options.duration * percent, 0, 1, this.options.duration - ); - } else { - this.pos = eased = percent; - } - this.now = ( this.end - this.start ) * eased + this.start; - - if ( this.options.step ) { - this.options.step.call( this.elem, this.now, this ); - } - - if ( hooks && hooks.set ) { - hooks.set( this ); - } else { - Tween.propHooks._default.set( this ); - } - return this; - } -}; - -Tween.prototype.init.prototype = Tween.prototype; - -Tween.propHooks = { - _default: { - get: function( tween ) { - var result; - - // Use a property on the element directly when it is not a DOM element, - // or when there is no matching style property that exists. - if ( tween.elem.nodeType !== 1 || - tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { - return tween.elem[ tween.prop ]; - } - - // Passing an empty string as a 3rd parameter to .css will automatically - // attempt a parseFloat and fallback to a string if the parse fails. - // Simple values such as "10px" are parsed to Float; - // complex values such as "rotate(1rad)" are returned as-is. - result = jQuery.css( tween.elem, tween.prop, "" ); - - // Empty strings, null, undefined and "auto" are converted to 0. - return !result || result === "auto" ? 0 : result; - }, - set: function( tween ) { - - // Use step hook for back compat. - // Use cssHook if its there. - // Use .style if available and use plain properties where available. - if ( jQuery.fx.step[ tween.prop ] ) { - jQuery.fx.step[ tween.prop ]( tween ); - } else if ( tween.elem.nodeType === 1 && ( - jQuery.cssHooks[ tween.prop ] || - tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) { - jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); - } else { - tween.elem[ tween.prop ] = tween.now; - } - } - } -}; - -// Support: IE <=9 only -// Panic based approach to setting things on disconnected nodes -Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { - set: function( tween ) { - if ( tween.elem.nodeType && tween.elem.parentNode ) { - tween.elem[ tween.prop ] = tween.now; - } - } -}; - -jQuery.easing = { - linear: function( p ) { - return p; - }, - swing: function( p ) { - return 0.5 - Math.cos( p * Math.PI ) / 2; - }, - _default: "swing" -}; - -jQuery.fx = Tween.prototype.init; - -// Back compat <1.8 extension point -jQuery.fx.step = {}; - - - - -var - fxNow, inProgress, - rfxtypes = /^(?:toggle|show|hide)$/, - rrun = /queueHooks$/; - -function schedule() { - if ( inProgress ) { - if ( document.hidden === false && window.requestAnimationFrame ) { - window.requestAnimationFrame( schedule ); - } else { - window.setTimeout( schedule, jQuery.fx.interval ); - } - - jQuery.fx.tick(); - } -} - -// Animations created synchronously will run synchronously -function createFxNow() { - window.setTimeout( function() { - fxNow = undefined; - } ); - return ( fxNow = Date.now() ); -} - -// Generate parameters to create a standard animation -function genFx( type, includeWidth ) { - var which, - i = 0, - attrs = { height: type }; - - // If we include width, step value is 1 to do all cssExpand values, - // otherwise step value is 2 to skip over Left and Right - includeWidth = includeWidth ? 1 : 0; - for ( ; i < 4; i += 2 - includeWidth ) { - which = cssExpand[ i ]; - attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; - } - - if ( includeWidth ) { - attrs.opacity = attrs.width = type; - } - - return attrs; -} - -function createTween( value, prop, animation ) { - var tween, - collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), - index = 0, - length = collection.length; - for ( ; index < length; index++ ) { - if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { - - // We're done with this property - return tween; - } - } -} - -function defaultPrefilter( elem, props, opts ) { - var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, - isBox = "width" in props || "height" in props, - anim = this, - orig = {}, - style = elem.style, - hidden = elem.nodeType && isHiddenWithinTree( elem ), - dataShow = dataPriv.get( elem, "fxshow" ); - - // Queue-skipping animations hijack the fx hooks - if ( !opts.queue ) { - hooks = jQuery._queueHooks( elem, "fx" ); - if ( hooks.unqueued == null ) { - hooks.unqueued = 0; - oldfire = hooks.empty.fire; - hooks.empty.fire = function() { - if ( !hooks.unqueued ) { - oldfire(); - } - }; - } - hooks.unqueued++; - - anim.always( function() { - - // Ensure the complete handler is called before this completes - anim.always( function() { - hooks.unqueued--; - if ( !jQuery.queue( elem, "fx" ).length ) { - hooks.empty.fire(); - } - } ); - } ); - } - - // Detect show/hide animations - for ( prop in props ) { - value = props[ prop ]; - if ( rfxtypes.test( value ) ) { - delete props[ prop ]; - toggle = toggle || value === "toggle"; - if ( value === ( hidden ? "hide" : "show" ) ) { - - // Pretend to be hidden if this is a "show" and - // there is still data from a stopped show/hide - if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { - hidden = true; - - // Ignore all other no-op show/hide data - } else { - continue; - } - } - orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); - } - } - - // Bail out if this is a no-op like .hide().hide() - propTween = !jQuery.isEmptyObject( props ); - if ( !propTween && jQuery.isEmptyObject( orig ) ) { - return; - } - - // Restrict "overflow" and "display" styles during box animations - if ( isBox && elem.nodeType === 1 ) { - - // Support: IE <=9 - 11, Edge 12 - 15 - // Record all 3 overflow attributes because IE does not infer the shorthand - // from identically-valued overflowX and overflowY and Edge just mirrors - // the overflowX value there. - opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; - - // Identify a display type, preferring old show/hide data over the CSS cascade - restoreDisplay = dataShow && dataShow.display; - if ( restoreDisplay == null ) { - restoreDisplay = dataPriv.get( elem, "display" ); - } - display = jQuery.css( elem, "display" ); - if ( display === "none" ) { - if ( restoreDisplay ) { - display = restoreDisplay; - } else { - - // Get nonempty value(s) by temporarily forcing visibility - showHide( [ elem ], true ); - restoreDisplay = elem.style.display || restoreDisplay; - display = jQuery.css( elem, "display" ); - showHide( [ elem ] ); - } - } - - // Animate inline elements as inline-block - if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { - if ( jQuery.css( elem, "float" ) === "none" ) { - - // Restore the original display value at the end of pure show/hide animations - if ( !propTween ) { - anim.done( function() { - style.display = restoreDisplay; - } ); - if ( restoreDisplay == null ) { - display = style.display; - restoreDisplay = display === "none" ? "" : display; - } - } - style.display = "inline-block"; - } - } - } - - if ( opts.overflow ) { - style.overflow = "hidden"; - anim.always( function() { - style.overflow = opts.overflow[ 0 ]; - style.overflowX = opts.overflow[ 1 ]; - style.overflowY = opts.overflow[ 2 ]; - } ); - } - - // Implement show/hide animations - propTween = false; - for ( prop in orig ) { - - // General show/hide setup for this element animation - if ( !propTween ) { - if ( dataShow ) { - if ( "hidden" in dataShow ) { - hidden = dataShow.hidden; - } - } else { - dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); - } - - // Store hidden/visible for toggle so `.stop().toggle()` "reverses" - if ( toggle ) { - dataShow.hidden = !hidden; - } - - // Show elements before animating them - if ( hidden ) { - showHide( [ elem ], true ); - } - - /* eslint-disable no-loop-func */ - - anim.done( function() { - - /* eslint-enable no-loop-func */ - - // The final step of a "hide" animation is actually hiding the element - if ( !hidden ) { - showHide( [ elem ] ); - } - dataPriv.remove( elem, "fxshow" ); - for ( prop in orig ) { - jQuery.style( elem, prop, orig[ prop ] ); - } - } ); - } - - // Per-property setup - propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); - if ( !( prop in dataShow ) ) { - dataShow[ prop ] = propTween.start; - if ( hidden ) { - propTween.end = propTween.start; - propTween.start = 0; - } - } - } -} - -function propFilter( props, specialEasing ) { - var index, name, easing, value, hooks; - - // camelCase, specialEasing and expand cssHook pass - for ( index in props ) { - name = camelCase( index ); - easing = specialEasing[ name ]; - value = props[ index ]; - if ( Array.isArray( value ) ) { - easing = value[ 1 ]; - value = props[ index ] = value[ 0 ]; - } - - if ( index !== name ) { - props[ name ] = value; - delete props[ index ]; - } - - hooks = jQuery.cssHooks[ name ]; - if ( hooks && "expand" in hooks ) { - value = hooks.expand( value ); - delete props[ name ]; - - // Not quite $.extend, this won't overwrite existing keys. - // Reusing 'index' because we have the correct "name" - for ( index in value ) { - if ( !( index in props ) ) { - props[ index ] = value[ index ]; - specialEasing[ index ] = easing; - } - } - } else { - specialEasing[ name ] = easing; - } - } -} - -function Animation( elem, properties, options ) { - var result, - stopped, - index = 0, - length = Animation.prefilters.length, - deferred = jQuery.Deferred().always( function() { - - // Don't match elem in the :animated selector - delete tick.elem; - } ), - tick = function() { - if ( stopped ) { - return false; - } - var currentTime = fxNow || createFxNow(), - remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), - - // Support: Android 2.3 only - // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (trac-12497) - temp = remaining / animation.duration || 0, - percent = 1 - temp, - index = 0, - length = animation.tweens.length; - - for ( ; index < length; index++ ) { - animation.tweens[ index ].run( percent ); - } - - deferred.notifyWith( elem, [ animation, percent, remaining ] ); - - // If there's more to do, yield - if ( percent < 1 && length ) { - return remaining; - } - - // If this was an empty animation, synthesize a final progress notification - if ( !length ) { - deferred.notifyWith( elem, [ animation, 1, 0 ] ); - } - - // Resolve the animation and report its conclusion - deferred.resolveWith( elem, [ animation ] ); - return false; - }, - animation = deferred.promise( { - elem: elem, - props: jQuery.extend( {}, properties ), - opts: jQuery.extend( true, { - specialEasing: {}, - easing: jQuery.easing._default - }, options ), - originalProperties: properties, - originalOptions: options, - startTime: fxNow || createFxNow(), - duration: options.duration, - tweens: [], - createTween: function( prop, end ) { - var tween = jQuery.Tween( elem, animation.opts, prop, end, - animation.opts.specialEasing[ prop ] || animation.opts.easing ); - animation.tweens.push( tween ); - return tween; - }, - stop: function( gotoEnd ) { - var index = 0, - - // If we are going to the end, we want to run all the tweens - // otherwise we skip this part - length = gotoEnd ? animation.tweens.length : 0; - if ( stopped ) { - return this; - } - stopped = true; - for ( ; index < length; index++ ) { - animation.tweens[ index ].run( 1 ); - } - - // Resolve when we played the last frame; otherwise, reject - if ( gotoEnd ) { - deferred.notifyWith( elem, [ animation, 1, 0 ] ); - deferred.resolveWith( elem, [ animation, gotoEnd ] ); - } else { - deferred.rejectWith( elem, [ animation, gotoEnd ] ); - } - return this; - } - } ), - props = animation.props; - - propFilter( props, animation.opts.specialEasing ); - - for ( ; index < length; index++ ) { - result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); - if ( result ) { - if ( isFunction( result.stop ) ) { - jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = - result.stop.bind( result ); - } - return result; - } - } - - jQuery.map( props, createTween, animation ); - - if ( isFunction( animation.opts.start ) ) { - animation.opts.start.call( elem, animation ); - } - - // Attach callbacks from options - animation - .progress( animation.opts.progress ) - .done( animation.opts.done, animation.opts.complete ) - .fail( animation.opts.fail ) - .always( animation.opts.always ); - - jQuery.fx.timer( - jQuery.extend( tick, { - elem: elem, - anim: animation, - queue: animation.opts.queue - } ) - ); - - return animation; -} - -jQuery.Animation = jQuery.extend( Animation, { - - tweeners: { - "*": [ function( prop, value ) { - var tween = this.createTween( prop, value ); - adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); - return tween; - } ] - }, - - tweener: function( props, callback ) { - if ( isFunction( props ) ) { - callback = props; - props = [ "*" ]; - } else { - props = props.match( rnothtmlwhite ); - } - - var prop, - index = 0, - length = props.length; - - for ( ; index < length; index++ ) { - prop = props[ index ]; - Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; - Animation.tweeners[ prop ].unshift( callback ); - } - }, - - prefilters: [ defaultPrefilter ], - - prefilter: function( callback, prepend ) { - if ( prepend ) { - Animation.prefilters.unshift( callback ); - } else { - Animation.prefilters.push( callback ); - } - } -} ); - -jQuery.speed = function( speed, easing, fn ) { - var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { - complete: fn || !fn && easing || - isFunction( speed ) && speed, - duration: speed, - easing: fn && easing || easing && !isFunction( easing ) && easing - }; - - // Go to the end state if fx are off - if ( jQuery.fx.off ) { - opt.duration = 0; - - } else { - if ( typeof opt.duration !== "number" ) { - if ( opt.duration in jQuery.fx.speeds ) { - opt.duration = jQuery.fx.speeds[ opt.duration ]; - - } else { - opt.duration = jQuery.fx.speeds._default; - } - } - } - - // Normalize opt.queue - true/undefined/null -> "fx" - if ( opt.queue == null || opt.queue === true ) { - opt.queue = "fx"; - } - - // Queueing - opt.old = opt.complete; - - opt.complete = function() { - if ( isFunction( opt.old ) ) { - opt.old.call( this ); - } - - if ( opt.queue ) { - jQuery.dequeue( this, opt.queue ); - } - }; - - return opt; -}; - -jQuery.fn.extend( { - fadeTo: function( speed, to, easing, callback ) { - - // Show any hidden elements after setting opacity to 0 - return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() - - // Animate to the value specified - .end().animate( { opacity: to }, speed, easing, callback ); - }, - animate: function( prop, speed, easing, callback ) { - var empty = jQuery.isEmptyObject( prop ), - optall = jQuery.speed( speed, easing, callback ), - doAnimation = function() { - - // Operate on a copy of prop so per-property easing won't be lost - var anim = Animation( this, jQuery.extend( {}, prop ), optall ); - - // Empty animations, or finishing resolves immediately - if ( empty || dataPriv.get( this, "finish" ) ) { - anim.stop( true ); - } - }; - - doAnimation.finish = doAnimation; - - return empty || optall.queue === false ? - this.each( doAnimation ) : - this.queue( optall.queue, doAnimation ); - }, - stop: function( type, clearQueue, gotoEnd ) { - var stopQueue = function( hooks ) { - var stop = hooks.stop; - delete hooks.stop; - stop( gotoEnd ); - }; - - if ( typeof type !== "string" ) { - gotoEnd = clearQueue; - clearQueue = type; - type = undefined; - } - if ( clearQueue ) { - this.queue( type || "fx", [] ); - } - - return this.each( function() { - var dequeue = true, - index = type != null && type + "queueHooks", - timers = jQuery.timers, - data = dataPriv.get( this ); - - if ( index ) { - if ( data[ index ] && data[ index ].stop ) { - stopQueue( data[ index ] ); - } - } else { - for ( index in data ) { - if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { - stopQueue( data[ index ] ); - } - } - } - - for ( index = timers.length; index--; ) { - if ( timers[ index ].elem === this && - ( type == null || timers[ index ].queue === type ) ) { - - timers[ index ].anim.stop( gotoEnd ); - dequeue = false; - timers.splice( index, 1 ); - } - } - - // Start the next in the queue if the last step wasn't forced. - // Timers currently will call their complete callbacks, which - // will dequeue but only if they were gotoEnd. - if ( dequeue || !gotoEnd ) { - jQuery.dequeue( this, type ); - } - } ); - }, - finish: function( type ) { - if ( type !== false ) { - type = type || "fx"; - } - return this.each( function() { - var index, - data = dataPriv.get( this ), - queue = data[ type + "queue" ], - hooks = data[ type + "queueHooks" ], - timers = jQuery.timers, - length = queue ? queue.length : 0; - - // Enable finishing flag on private data - data.finish = true; - - // Empty the queue first - jQuery.queue( this, type, [] ); - - if ( hooks && hooks.stop ) { - hooks.stop.call( this, true ); - } - - // Look for any active animations, and finish them - for ( index = timers.length; index--; ) { - if ( timers[ index ].elem === this && timers[ index ].queue === type ) { - timers[ index ].anim.stop( true ); - timers.splice( index, 1 ); - } - } - - // Look for any animations in the old queue and finish them - for ( index = 0; index < length; index++ ) { - if ( queue[ index ] && queue[ index ].finish ) { - queue[ index ].finish.call( this ); - } - } - - // Turn off finishing flag - delete data.finish; - } ); - } -} ); - -jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) { - var cssFn = jQuery.fn[ name ]; - jQuery.fn[ name ] = function( speed, easing, callback ) { - return speed == null || typeof speed === "boolean" ? - cssFn.apply( this, arguments ) : - this.animate( genFx( name, true ), speed, easing, callback ); - }; -} ); - -// Generate shortcuts for custom animations -jQuery.each( { - slideDown: genFx( "show" ), - slideUp: genFx( "hide" ), - slideToggle: genFx( "toggle" ), - fadeIn: { opacity: "show" }, - fadeOut: { opacity: "hide" }, - fadeToggle: { opacity: "toggle" } -}, function( name, props ) { - jQuery.fn[ name ] = function( speed, easing, callback ) { - return this.animate( props, speed, easing, callback ); - }; -} ); - -jQuery.timers = []; -jQuery.fx.tick = function() { - var timer, - i = 0, - timers = jQuery.timers; - - fxNow = Date.now(); - - for ( ; i < timers.length; i++ ) { - timer = timers[ i ]; - - // Run the timer and safely remove it when done (allowing for external removal) - if ( !timer() && timers[ i ] === timer ) { - timers.splice( i--, 1 ); - } - } - - if ( !timers.length ) { - jQuery.fx.stop(); - } - fxNow = undefined; -}; - -jQuery.fx.timer = function( timer ) { - jQuery.timers.push( timer ); - jQuery.fx.start(); -}; - -jQuery.fx.interval = 13; -jQuery.fx.start = function() { - if ( inProgress ) { - return; - } - - inProgress = true; - schedule(); -}; - -jQuery.fx.stop = function() { - inProgress = null; -}; - -jQuery.fx.speeds = { - slow: 600, - fast: 200, - - // Default speed - _default: 400 -}; - - -// Based off of the plugin by Clint Helfers, with permission. -jQuery.fn.delay = function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; - type = type || "fx"; - - return this.queue( type, function( next, hooks ) { - var timeout = window.setTimeout( next, time ); - hooks.stop = function() { - window.clearTimeout( timeout ); - }; - } ); -}; - - -( function() { - var input = document.createElement( "input" ), - select = document.createElement( "select" ), - opt = select.appendChild( document.createElement( "option" ) ); - - input.type = "checkbox"; - - // Support: Android <=4.3 only - // Default value for a checkbox should be "on" - support.checkOn = input.value !== ""; - - // Support: IE <=11 only - // Must access selectedIndex to make default options select - support.optSelected = opt.selected; - - // Support: IE <=11 only - // An input loses its value after becoming a radio - input = document.createElement( "input" ); - input.value = "t"; - input.type = "radio"; - support.radioValue = input.value === "t"; -} )(); - - -var boolHook, - attrHandle = jQuery.expr.attrHandle; - -jQuery.fn.extend( { - attr: function( name, value ) { - return access( this, jQuery.attr, name, value, arguments.length > 1 ); - }, - - removeAttr: function( name ) { - return this.each( function() { - jQuery.removeAttr( this, name ); - } ); - } -} ); - -jQuery.extend( { - attr: function( elem, name, value ) { - var ret, hooks, - nType = elem.nodeType; - - // Don't get/set attributes on text, comment and attribute nodes - if ( nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === "undefined" ) { - return jQuery.prop( elem, name, value ); - } - - // Attribute hooks are determined by the lowercase version - // Grab necessary hook if one is defined - if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { - hooks = jQuery.attrHooks[ name.toLowerCase() ] || - ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); - } - - if ( value !== undefined ) { - if ( value === null ) { - jQuery.removeAttr( elem, name ); - return; - } - - if ( hooks && "set" in hooks && - ( ret = hooks.set( elem, value, name ) ) !== undefined ) { - return ret; - } - - elem.setAttribute( name, value + "" ); - return value; - } - - if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { - return ret; - } - - ret = jQuery.find.attr( elem, name ); - - // Non-existent attributes return null, we normalize to undefined - return ret == null ? undefined : ret; - }, - - attrHooks: { - type: { - set: function( elem, value ) { - if ( !support.radioValue && value === "radio" && - nodeName( elem, "input" ) ) { - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - } - }, - - removeAttr: function( elem, value ) { - var name, - i = 0, - - // Attribute names can contain non-HTML whitespace characters - // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 - attrNames = value && value.match( rnothtmlwhite ); - - if ( attrNames && elem.nodeType === 1 ) { - while ( ( name = attrNames[ i++ ] ) ) { - elem.removeAttribute( name ); - } - } - } -} ); - -// Hooks for boolean attributes -boolHook = { - set: function( elem, value, name ) { - if ( value === false ) { - - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else { - elem.setAttribute( name, name ); - } - return name; - } -}; - -jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) { - var getter = attrHandle[ name ] || jQuery.find.attr; - - attrHandle[ name ] = function( elem, name, isXML ) { - var ret, handle, - lowercaseName = name.toLowerCase(); - - if ( !isXML ) { - - // Avoid an infinite loop by temporarily removing this function from the getter - handle = attrHandle[ lowercaseName ]; - attrHandle[ lowercaseName ] = ret; - ret = getter( elem, name, isXML ) != null ? - lowercaseName : - null; - attrHandle[ lowercaseName ] = handle; - } - return ret; - }; -} ); - - - - -var rfocusable = /^(?:input|select|textarea|button)$/i, - rclickable = /^(?:a|area)$/i; - -jQuery.fn.extend( { - prop: function( name, value ) { - return access( this, jQuery.prop, name, value, arguments.length > 1 ); - }, - - removeProp: function( name ) { - return this.each( function() { - delete this[ jQuery.propFix[ name ] || name ]; - } ); - } -} ); - -jQuery.extend( { - prop: function( elem, name, value ) { - var ret, hooks, - nType = elem.nodeType; - - // Don't get/set properties on text, comment and attribute nodes - if ( nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { - - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - if ( hooks && "set" in hooks && - ( ret = hooks.set( elem, value, name ) ) !== undefined ) { - return ret; - } - - return ( elem[ name ] = value ); - } - - if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { - return ret; - } - - return elem[ name ]; - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - - // Support: IE <=9 - 11 only - // elem.tabIndex doesn't always return the - // correct value when it hasn't been explicitly set - // Use proper attribute retrieval (trac-12072) - var tabindex = jQuery.find.attr( elem, "tabindex" ); - - if ( tabindex ) { - return parseInt( tabindex, 10 ); - } - - if ( - rfocusable.test( elem.nodeName ) || - rclickable.test( elem.nodeName ) && - elem.href - ) { - return 0; - } - - return -1; - } - } - }, - - propFix: { - "for": "htmlFor", - "class": "className" - } -} ); - -// Support: IE <=11 only -// Accessing the selectedIndex property -// forces the browser to respect setting selected -// on the option -// The getter ensures a default option is selected -// when in an optgroup -// eslint rule "no-unused-expressions" is disabled for this code -// since it considers such accessions noop -if ( !support.optSelected ) { - jQuery.propHooks.selected = { - get: function( elem ) { - - /* eslint no-unused-expressions: "off" */ - - var parent = elem.parentNode; - if ( parent && parent.parentNode ) { - parent.parentNode.selectedIndex; - } - return null; - }, - set: function( elem ) { - - /* eslint no-unused-expressions: "off" */ - - var parent = elem.parentNode; - if ( parent ) { - parent.selectedIndex; - - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - } - }; -} - -jQuery.each( [ - "tabIndex", - "readOnly", - "maxLength", - "cellSpacing", - "cellPadding", - "rowSpan", - "colSpan", - "useMap", - "frameBorder", - "contentEditable" -], function() { - jQuery.propFix[ this.toLowerCase() ] = this; -} ); - - - - - // Strip and collapse whitespace according to HTML spec - // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace - function stripAndCollapse( value ) { - var tokens = value.match( rnothtmlwhite ) || []; - return tokens.join( " " ); - } - - -function getClass( elem ) { - return elem.getAttribute && elem.getAttribute( "class" ) || ""; -} - -function classesToArray( value ) { - if ( Array.isArray( value ) ) { - return value; - } - if ( typeof value === "string" ) { - return value.match( rnothtmlwhite ) || []; - } - return []; -} - -jQuery.fn.extend( { - addClass: function( value ) { - var classNames, cur, curValue, className, i, finalValue; - - if ( isFunction( value ) ) { - return this.each( function( j ) { - jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); - } ); - } - - classNames = classesToArray( value ); - - if ( classNames.length ) { - return this.each( function() { - curValue = getClass( this ); - cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); - - if ( cur ) { - for ( i = 0; i < classNames.length; i++ ) { - className = classNames[ i ]; - if ( cur.indexOf( " " + className + " " ) < 0 ) { - cur += className + " "; - } - } - - // Only assign if different to avoid unneeded rendering. - finalValue = stripAndCollapse( cur ); - if ( curValue !== finalValue ) { - this.setAttribute( "class", finalValue ); - } - } - } ); - } - - return this; - }, - - removeClass: function( value ) { - var classNames, cur, curValue, className, i, finalValue; - - if ( isFunction( value ) ) { - return this.each( function( j ) { - jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); - } ); - } - - if ( !arguments.length ) { - return this.attr( "class", "" ); - } - - classNames = classesToArray( value ); - - if ( classNames.length ) { - return this.each( function() { - curValue = getClass( this ); - - // This expression is here for better compressibility (see addClass) - cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); - - if ( cur ) { - for ( i = 0; i < classNames.length; i++ ) { - className = classNames[ i ]; - - // Remove *all* instances - while ( cur.indexOf( " " + className + " " ) > -1 ) { - cur = cur.replace( " " + className + " ", " " ); - } - } - - // Only assign if different to avoid unneeded rendering. - finalValue = stripAndCollapse( cur ); - if ( curValue !== finalValue ) { - this.setAttribute( "class", finalValue ); - } - } - } ); - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var classNames, className, i, self, - type = typeof value, - isValidValue = type === "string" || Array.isArray( value ); - - if ( isFunction( value ) ) { - return this.each( function( i ) { - jQuery( this ).toggleClass( - value.call( this, i, getClass( this ), stateVal ), - stateVal - ); - } ); - } - - if ( typeof stateVal === "boolean" && isValidValue ) { - return stateVal ? this.addClass( value ) : this.removeClass( value ); - } - - classNames = classesToArray( value ); - - return this.each( function() { - if ( isValidValue ) { - - // Toggle individual class names - self = jQuery( this ); - - for ( i = 0; i < classNames.length; i++ ) { - className = classNames[ i ]; - - // Check each className given, space separated list - if ( self.hasClass( className ) ) { - self.removeClass( className ); - } else { - self.addClass( className ); - } - } - - // Toggle whole class name - } else if ( value === undefined || type === "boolean" ) { - className = getClass( this ); - if ( className ) { - - // Store className if set - dataPriv.set( this, "__className__", className ); - } - - // If the element has a class name or if we're passed `false`, - // then remove the whole classname (if there was one, the above saved it). - // Otherwise bring back whatever was previously saved (if anything), - // falling back to the empty string if nothing was stored. - if ( this.setAttribute ) { - this.setAttribute( "class", - className || value === false ? - "" : - dataPriv.get( this, "__className__" ) || "" - ); - } - } - } ); - }, - - hasClass: function( selector ) { - var className, elem, - i = 0; - - className = " " + selector + " "; - while ( ( elem = this[ i++ ] ) ) { - if ( elem.nodeType === 1 && - ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { - return true; - } - } - - return false; - } -} ); - - - - -var rreturn = /\r/g; - -jQuery.fn.extend( { - val: function( value ) { - var hooks, ret, valueIsFunction, - elem = this[ 0 ]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.type ] || - jQuery.valHooks[ elem.nodeName.toLowerCase() ]; - - if ( hooks && - "get" in hooks && - ( ret = hooks.get( elem, "value" ) ) !== undefined - ) { - return ret; - } - - ret = elem.value; - - // Handle most common string cases - if ( typeof ret === "string" ) { - return ret.replace( rreturn, "" ); - } - - // Handle cases where value is null/undef or number - return ret == null ? "" : ret; - } - - return; - } - - valueIsFunction = isFunction( value ); - - return this.each( function( i ) { - var val; - - if ( this.nodeType !== 1 ) { - return; - } - - if ( valueIsFunction ) { - val = value.call( this, i, jQuery( this ).val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - - } else if ( typeof val === "number" ) { - val += ""; - - } else if ( Array.isArray( val ) ) { - val = jQuery.map( val, function( value ) { - return value == null ? "" : value + ""; - } ); - } - - hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - } ); - } -} ); - -jQuery.extend( { - valHooks: { - option: { - get: function( elem ) { - - var val = jQuery.find.attr( elem, "value" ); - return val != null ? - val : - - // Support: IE <=10 - 11 only - // option.text throws exceptions (trac-14686, trac-14858) - // Strip and collapse whitespace - // https://html.spec.whatwg.org/#strip-and-collapse-whitespace - stripAndCollapse( jQuery.text( elem ) ); - } - }, - select: { - get: function( elem ) { - var value, option, i, - options = elem.options, - index = elem.selectedIndex, - one = elem.type === "select-one", - values = one ? null : [], - max = one ? index + 1 : options.length; - - if ( index < 0 ) { - i = max; - - } else { - i = one ? index : 0; - } - - // Loop through all the selected options - for ( ; i < max; i++ ) { - option = options[ i ]; - - // Support: IE <=9 only - // IE8-9 doesn't update selected after form reset (trac-2551) - if ( ( option.selected || i === index ) && - - // Don't return options that are disabled or in a disabled optgroup - !option.disabled && - ( !option.parentNode.disabled || - !nodeName( option.parentNode, "optgroup" ) ) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - return values; - }, - - set: function( elem, value ) { - var optionSet, option, - options = elem.options, - values = jQuery.makeArray( value ), - i = options.length; - - while ( i-- ) { - option = options[ i ]; - - /* eslint-disable no-cond-assign */ - - if ( option.selected = - jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 - ) { - optionSet = true; - } - - /* eslint-enable no-cond-assign */ - } - - // Force browsers to behave consistently when non-matching value is set - if ( !optionSet ) { - elem.selectedIndex = -1; - } - return values; - } - } - } -} ); - -// Radios and checkboxes getter/setter -jQuery.each( [ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - set: function( elem, value ) { - if ( Array.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); - } - } - }; - if ( !support.checkOn ) { - jQuery.valHooks[ this ].get = function( elem ) { - return elem.getAttribute( "value" ) === null ? "on" : elem.value; - }; - } -} ); - - - - -// Return jQuery for attributes-only inclusion -var location = window.location; - -var nonce = { guid: Date.now() }; - -var rquery = ( /\?/ ); - - - -// Cross-browser xml parsing -jQuery.parseXML = function( data ) { - var xml, parserErrorElem; - if ( !data || typeof data !== "string" ) { - return null; - } - - // Support: IE 9 - 11 only - // IE throws on parseFromString with invalid input. - try { - xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); - } catch ( e ) {} - - parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ]; - if ( !xml || parserErrorElem ) { - jQuery.error( "Invalid XML: " + ( - parserErrorElem ? - jQuery.map( parserErrorElem.childNodes, function( el ) { - return el.textContent; - } ).join( "\n" ) : - data - ) ); - } - return xml; -}; - - -var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - stopPropagationCallback = function( e ) { - e.stopPropagation(); - }; - -jQuery.extend( jQuery.event, { - - trigger: function( event, data, elem, onlyHandlers ) { - - var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, - eventPath = [ elem || document ], - type = hasOwn.call( event, "type" ) ? event.type : event, - namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; - - cur = lastElement = tmp = elem = elem || document; - - // Don't do events on text and comment nodes - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { - return; - } - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf( "." ) > -1 ) { - - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split( "." ); - type = namespaces.shift(); - namespaces.sort(); - } - ontype = type.indexOf( ":" ) < 0 && "on" + type; - - // Caller can pass in a jQuery.Event object, Object, or just an event type string - event = event[ jQuery.expando ] ? - event : - new jQuery.Event( type, typeof event === "object" && event ); - - // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) - event.isTrigger = onlyHandlers ? 2 : 3; - event.namespace = namespaces.join( "." ); - event.rnamespace = event.namespace ? - new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : - null; - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data == null ? - [ event ] : - jQuery.makeArray( data, [ event ] ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (trac-9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (trac-9724) - if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - if ( !rfocusMorph.test( bubbleType + type ) ) { - cur = cur.parentNode; - } - for ( ; cur; cur = cur.parentNode ) { - eventPath.push( cur ); - tmp = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( tmp === ( elem.ownerDocument || document ) ) { - eventPath.push( tmp.defaultView || tmp.parentWindow || window ); - } - } - - // Fire handlers on the event path - i = 0; - while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { - lastElement = cur; - event.type = i > 1 ? - bubbleType : - special.bindType || type; - - // jQuery handler - handle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ event.type ] && - dataPriv.get( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - - // Native handler - handle = ontype && cur[ ontype ]; - if ( handle && handle.apply && acceptData( cur ) ) { - event.result = handle.apply( cur, data ); - if ( event.result === false ) { - event.preventDefault(); - } - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( ( !special._default || - special._default.apply( eventPath.pop(), data ) === false ) && - acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name as the event. - // Don't do default actions on window, that's where global variables be (trac-6170) - if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - tmp = elem[ ontype ]; - - if ( tmp ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - - if ( event.isPropagationStopped() ) { - lastElement.addEventListener( type, stopPropagationCallback ); - } - - elem[ type ](); - - if ( event.isPropagationStopped() ) { - lastElement.removeEventListener( type, stopPropagationCallback ); - } - - jQuery.event.triggered = undefined; - - if ( tmp ) { - elem[ ontype ] = tmp; - } - } - } - } - - return event.result; - }, - - // Piggyback on a donor event to simulate a different one - // Used only for `focus(in | out)` events - simulate: function( type, elem, event ) { - var e = jQuery.extend( - new jQuery.Event(), - event, - { - type: type, - isSimulated: true - } - ); - - jQuery.event.trigger( e, null, elem ); - } - -} ); - -jQuery.fn.extend( { - - trigger: function( type, data ) { - return this.each( function() { - jQuery.event.trigger( type, data, this ); - } ); - }, - triggerHandler: function( type, data ) { - var elem = this[ 0 ]; - if ( elem ) { - return jQuery.event.trigger( type, data, elem, true ); - } - } -} ); - - -var - rbracket = /\[\]$/, - rCRLF = /\r?\n/g, - rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, - rsubmittable = /^(?:input|select|textarea|keygen)/i; - -function buildParams( prefix, obj, traditional, add ) { - var name; - - if ( Array.isArray( obj ) ) { - - // Serialize array item. - jQuery.each( obj, function( i, v ) { - if ( traditional || rbracket.test( prefix ) ) { - - // Treat each array item as a scalar. - add( prefix, v ); - - } else { - - // Item is non-scalar (array or object), encode its numeric index. - buildParams( - prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", - v, - traditional, - add - ); - } - } ); - - } else if ( !traditional && toType( obj ) === "object" ) { - - // Serialize object item. - for ( name in obj ) { - buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); - } - - } else { - - // Serialize scalar item. - add( prefix, obj ); - } -} - -// Serialize an array of form elements or a set of -// key/values into a query string -jQuery.param = function( a, traditional ) { - var prefix, - s = [], - add = function( key, valueOrFunction ) { - - // If value is a function, invoke it and use its return value - var value = isFunction( valueOrFunction ) ? - valueOrFunction() : - valueOrFunction; - - s[ s.length ] = encodeURIComponent( key ) + "=" + - encodeURIComponent( value == null ? "" : value ); - }; - - if ( a == null ) { - return ""; - } - - // If an array was passed in, assume that it is an array of form elements. - if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { - - // Serialize the form elements - jQuery.each( a, function() { - add( this.name, this.value ); - } ); - - } else { - - // If traditional, encode the "old" way (the way 1.3.2 or older - // did it), otherwise encode params recursively. - for ( prefix in a ) { - buildParams( prefix, a[ prefix ], traditional, add ); - } - } - - // Return the resulting serialization - return s.join( "&" ); -}; - -jQuery.fn.extend( { - serialize: function() { - return jQuery.param( this.serializeArray() ); - }, - serializeArray: function() { - return this.map( function() { - - // Can add propHook for "elements" to filter or add form elements - var elements = jQuery.prop( this, "elements" ); - return elements ? jQuery.makeArray( elements ) : this; - } ).filter( function() { - var type = this.type; - - // Use .is( ":disabled" ) so that fieldset[disabled] works - return this.name && !jQuery( this ).is( ":disabled" ) && - rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && - ( this.checked || !rcheckableType.test( type ) ); - } ).map( function( _i, elem ) { - var val = jQuery( this ).val(); - - if ( val == null ) { - return null; - } - - if ( Array.isArray( val ) ) { - return jQuery.map( val, function( val ) { - return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; - } ); - } - - return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; - } ).get(); - } -} ); - - -var - r20 = /%20/g, - rhash = /#.*$/, - rantiCache = /([?&])_=[^&]*/, - rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, - - // trac-7653, trac-8125, trac-8152: local protocol detection - rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, - rnoContent = /^(?:GET|HEAD)$/, - rprotocol = /^\/\//, - - /* Prefilters - * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) - * 2) These are called: - * - BEFORE asking for a transport - * - AFTER param serialization (s.data is a string if s.processData is true) - * 3) key is the dataType - * 4) the catchall symbol "*" can be used - * 5) execution will start with transport dataType and THEN continue down to "*" if needed - */ - prefilters = {}, - - /* Transports bindings - * 1) key is the dataType - * 2) the catchall symbol "*" can be used - * 3) selection will start with transport dataType and THEN go to "*" if needed - */ - transports = {}, - - // Avoid comment-prolog char sequence (trac-10098); must appease lint and evade compression - allTypes = "*/".concat( "*" ), - - // Anchor tag for parsing the document origin - originAnchor = document.createElement( "a" ); - -originAnchor.href = location.href; - -// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport -function addToPrefiltersOrTransports( structure ) { - - // dataTypeExpression is optional and defaults to "*" - return function( dataTypeExpression, func ) { - - if ( typeof dataTypeExpression !== "string" ) { - func = dataTypeExpression; - dataTypeExpression = "*"; - } - - var dataType, - i = 0, - dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; - - if ( isFunction( func ) ) { - - // For each dataType in the dataTypeExpression - while ( ( dataType = dataTypes[ i++ ] ) ) { - - // Prepend if requested - if ( dataType[ 0 ] === "+" ) { - dataType = dataType.slice( 1 ) || "*"; - ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); - - // Otherwise append - } else { - ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); - } - } - } - }; -} - -// Base inspection function for prefilters and transports -function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { - - var inspected = {}, - seekingTransport = ( structure === transports ); - - function inspect( dataType ) { - var selected; - inspected[ dataType ] = true; - jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { - var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); - if ( typeof dataTypeOrTransport === "string" && - !seekingTransport && !inspected[ dataTypeOrTransport ] ) { - - options.dataTypes.unshift( dataTypeOrTransport ); - inspect( dataTypeOrTransport ); - return false; - } else if ( seekingTransport ) { - return !( selected = dataTypeOrTransport ); - } - } ); - return selected; - } - - return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); -} - -// A special extend for ajax options -// that takes "flat" options (not to be deep extended) -// Fixes trac-9887 -function ajaxExtend( target, src ) { - var key, deep, - flatOptions = jQuery.ajaxSettings.flatOptions || {}; - - for ( key in src ) { - if ( src[ key ] !== undefined ) { - ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; - } - } - if ( deep ) { - jQuery.extend( true, target, deep ); - } - - return target; -} - -/* Handles responses to an ajax request: - * - finds the right dataType (mediates between content-type and expected dataType) - * - returns the corresponding response - */ -function ajaxHandleResponses( s, jqXHR, responses ) { - - var ct, type, finalDataType, firstDataType, - contents = s.contents, - dataTypes = s.dataTypes; - - // Remove auto dataType and get content-type in the process - while ( dataTypes[ 0 ] === "*" ) { - dataTypes.shift(); - if ( ct === undefined ) { - ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); - } - } - - // Check if we're dealing with a known content-type - if ( ct ) { - for ( type in contents ) { - if ( contents[ type ] && contents[ type ].test( ct ) ) { - dataTypes.unshift( type ); - break; - } - } - } - - // Check to see if we have a response for the expected dataType - if ( dataTypes[ 0 ] in responses ) { - finalDataType = dataTypes[ 0 ]; - } else { - - // Try convertible dataTypes - for ( type in responses ) { - if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { - finalDataType = type; - break; - } - if ( !firstDataType ) { - firstDataType = type; - } - } - - // Or just use first one - finalDataType = finalDataType || firstDataType; - } - - // If we found a dataType - // We add the dataType to the list if needed - // and return the corresponding response - if ( finalDataType ) { - if ( finalDataType !== dataTypes[ 0 ] ) { - dataTypes.unshift( finalDataType ); - } - return responses[ finalDataType ]; - } -} - -/* Chain conversions given the request and the original response - * Also sets the responseXXX fields on the jqXHR instance - */ -function ajaxConvert( s, response, jqXHR, isSuccess ) { - var conv2, current, conv, tmp, prev, - converters = {}, - - // Work with a copy of dataTypes in case we need to modify it for conversion - dataTypes = s.dataTypes.slice(); - - // Create converters map with lowercased keys - if ( dataTypes[ 1 ] ) { - for ( conv in s.converters ) { - converters[ conv.toLowerCase() ] = s.converters[ conv ]; - } - } - - current = dataTypes.shift(); - - // Convert to each sequential dataType - while ( current ) { - - if ( s.responseFields[ current ] ) { - jqXHR[ s.responseFields[ current ] ] = response; - } - - // Apply the dataFilter if provided - if ( !prev && isSuccess && s.dataFilter ) { - response = s.dataFilter( response, s.dataType ); - } - - prev = current; - current = dataTypes.shift(); - - if ( current ) { - - // There's only work to do if current dataType is non-auto - if ( current === "*" ) { - - current = prev; - - // Convert response if prev dataType is non-auto and differs from current - } else if ( prev !== "*" && prev !== current ) { - - // Seek a direct converter - conv = converters[ prev + " " + current ] || converters[ "* " + current ]; - - // If none found, seek a pair - if ( !conv ) { - for ( conv2 in converters ) { - - // If conv2 outputs current - tmp = conv2.split( " " ); - if ( tmp[ 1 ] === current ) { - - // If prev can be converted to accepted input - conv = converters[ prev + " " + tmp[ 0 ] ] || - converters[ "* " + tmp[ 0 ] ]; - if ( conv ) { - - // Condense equivalence converters - if ( conv === true ) { - conv = converters[ conv2 ]; - - // Otherwise, insert the intermediate dataType - } else if ( converters[ conv2 ] !== true ) { - current = tmp[ 0 ]; - dataTypes.unshift( tmp[ 1 ] ); - } - break; - } - } - } - } - - // Apply converter (if not an equivalence) - if ( conv !== true ) { - - // Unless errors are allowed to bubble, catch and return them - if ( conv && s.throws ) { - response = conv( response ); - } else { - try { - response = conv( response ); - } catch ( e ) { - return { - state: "parsererror", - error: conv ? e : "No conversion from " + prev + " to " + current - }; - } - } - } - } - } - } - - return { state: "success", data: response }; -} - -jQuery.extend( { - - // Counter for holding the number of active queries - active: 0, - - // Last-Modified header cache for next request - lastModified: {}, - etag: {}, - - ajaxSettings: { - url: location.href, - type: "GET", - isLocal: rlocalProtocol.test( location.protocol ), - global: true, - processData: true, - async: true, - contentType: "application/x-www-form-urlencoded; charset=UTF-8", - - /* - timeout: 0, - data: null, - dataType: null, - username: null, - password: null, - cache: null, - throws: false, - traditional: false, - headers: {}, - */ - - accepts: { - "*": allTypes, - text: "text/plain", - html: "text/html", - xml: "application/xml, text/xml", - json: "application/json, text/javascript" - }, - - contents: { - xml: /\bxml\b/, - html: /\bhtml/, - json: /\bjson\b/ - }, - - responseFields: { - xml: "responseXML", - text: "responseText", - json: "responseJSON" - }, - - // Data converters - // Keys separate source (or catchall "*") and destination types with a single space - converters: { - - // Convert anything to text - "* text": String, - - // Text to html (true = no transformation) - "text html": true, - - // Evaluate text as a json expression - "text json": JSON.parse, - - // Parse text as xml - "text xml": jQuery.parseXML - }, - - // For options that shouldn't be deep extended: - // you can add your own custom options here if - // and when you create one that shouldn't be - // deep extended (see ajaxExtend) - flatOptions: { - url: true, - context: true - } - }, - - // Creates a full fledged settings object into target - // with both ajaxSettings and settings fields. - // If target is omitted, writes into ajaxSettings. - ajaxSetup: function( target, settings ) { - return settings ? - - // Building a settings object - ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : - - // Extending ajaxSettings - ajaxExtend( jQuery.ajaxSettings, target ); - }, - - ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), - ajaxTransport: addToPrefiltersOrTransports( transports ), - - // Main method - ajax: function( url, options ) { - - // If url is an object, simulate pre-1.5 signature - if ( typeof url === "object" ) { - options = url; - url = undefined; - } - - // Force options to be an object - options = options || {}; - - var transport, - - // URL without anti-cache param - cacheURL, - - // Response headers - responseHeadersString, - responseHeaders, - - // timeout handle - timeoutTimer, - - // Url cleanup var - urlAnchor, - - // Request state (becomes false upon send and true upon completion) - completed, - - // To know if global events are to be dispatched - fireGlobals, - - // Loop variable - i, - - // uncached part of the url - uncached, - - // Create the final options object - s = jQuery.ajaxSetup( {}, options ), - - // Callbacks context - callbackContext = s.context || s, - - // Context for global events is callbackContext if it is a DOM node or jQuery collection - globalEventContext = s.context && - ( callbackContext.nodeType || callbackContext.jquery ) ? - jQuery( callbackContext ) : - jQuery.event, - - // Deferreds - deferred = jQuery.Deferred(), - completeDeferred = jQuery.Callbacks( "once memory" ), - - // Status-dependent callbacks - statusCode = s.statusCode || {}, - - // Headers (they are sent all at once) - requestHeaders = {}, - requestHeadersNames = {}, - - // Default abort message - strAbort = "canceled", - - // Fake xhr - jqXHR = { - readyState: 0, - - // Builds headers hashtable if needed - getResponseHeader: function( key ) { - var match; - if ( completed ) { - if ( !responseHeaders ) { - responseHeaders = {}; - while ( ( match = rheaders.exec( responseHeadersString ) ) ) { - responseHeaders[ match[ 1 ].toLowerCase() + " " ] = - ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] ) - .concat( match[ 2 ] ); - } - } - match = responseHeaders[ key.toLowerCase() + " " ]; - } - return match == null ? null : match.join( ", " ); - }, - - // Raw string - getAllResponseHeaders: function() { - return completed ? responseHeadersString : null; - }, - - // Caches the header - setRequestHeader: function( name, value ) { - if ( completed == null ) { - name = requestHeadersNames[ name.toLowerCase() ] = - requestHeadersNames[ name.toLowerCase() ] || name; - requestHeaders[ name ] = value; - } - return this; - }, - - // Overrides response content-type header - overrideMimeType: function( type ) { - if ( completed == null ) { - s.mimeType = type; - } - return this; - }, - - // Status-dependent callbacks - statusCode: function( map ) { - var code; - if ( map ) { - if ( completed ) { - - // Execute the appropriate callbacks - jqXHR.always( map[ jqXHR.status ] ); - } else { - - // Lazy-add the new callbacks in a way that preserves old ones - for ( code in map ) { - statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; - } - } - } - return this; - }, - - // Cancel the request - abort: function( statusText ) { - var finalText = statusText || strAbort; - if ( transport ) { - transport.abort( finalText ); - } - done( 0, finalText ); - return this; - } - }; - - // Attach deferreds - deferred.promise( jqXHR ); - - // Add protocol if not provided (prefilters might expect it) - // Handle falsy url in the settings object (trac-10093: consistency with old signature) - // We also use the url parameter if available - s.url = ( ( url || s.url || location.href ) + "" ) - .replace( rprotocol, location.protocol + "//" ); - - // Alias method option to type as per ticket trac-12004 - s.type = options.method || options.type || s.method || s.type; - - // Extract dataTypes list - s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; - - // A cross-domain request is in order when the origin doesn't match the current origin. - if ( s.crossDomain == null ) { - urlAnchor = document.createElement( "a" ); - - // Support: IE <=8 - 11, Edge 12 - 15 - // IE throws exception on accessing the href property if url is malformed, - // e.g. http://example.com:80x/ - try { - urlAnchor.href = s.url; - - // Support: IE <=8 - 11 only - // Anchor's host property isn't correctly set when s.url is relative - urlAnchor.href = urlAnchor.href; - s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== - urlAnchor.protocol + "//" + urlAnchor.host; - } catch ( e ) { - - // If there is an error parsing the URL, assume it is crossDomain, - // it can be rejected by the transport if it is invalid - s.crossDomain = true; - } - } - - // Convert data if not already a string - if ( s.data && s.processData && typeof s.data !== "string" ) { - s.data = jQuery.param( s.data, s.traditional ); - } - - // Apply prefilters - inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); - - // If request was aborted inside a prefilter, stop there - if ( completed ) { - return jqXHR; - } - - // We can fire global events as of now if asked to - // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (trac-15118) - fireGlobals = jQuery.event && s.global; - - // Watch for a new set of requests - if ( fireGlobals && jQuery.active++ === 0 ) { - jQuery.event.trigger( "ajaxStart" ); - } - - // Uppercase the type - s.type = s.type.toUpperCase(); - - // Determine if request has content - s.hasContent = !rnoContent.test( s.type ); - - // Save the URL in case we're toying with the If-Modified-Since - // and/or If-None-Match header later on - // Remove hash to simplify url manipulation - cacheURL = s.url.replace( rhash, "" ); - - // More options handling for requests with no content - if ( !s.hasContent ) { - - // Remember the hash so we can put it back - uncached = s.url.slice( cacheURL.length ); - - // If data is available and should be processed, append data to url - if ( s.data && ( s.processData || typeof s.data === "string" ) ) { - cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; - - // trac-9682: remove data so that it's not used in an eventual retry - delete s.data; - } - - // Add or update anti-cache param if needed - if ( s.cache === false ) { - cacheURL = cacheURL.replace( rantiCache, "$1" ); - uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) + - uncached; - } - - // Put hash and anti-cache on the URL that will be requested (gh-1732) - s.url = cacheURL + uncached; - - // Change '%20' to '+' if this is encoded form body content (gh-2658) - } else if ( s.data && s.processData && - ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { - s.data = s.data.replace( r20, "+" ); - } - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - if ( jQuery.lastModified[ cacheURL ] ) { - jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); - } - if ( jQuery.etag[ cacheURL ] ) { - jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); - } - } - - // Set the correct header, if data is being sent - if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { - jqXHR.setRequestHeader( "Content-Type", s.contentType ); - } - - // Set the Accepts header for the server, depending on the dataType - jqXHR.setRequestHeader( - "Accept", - s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? - s.accepts[ s.dataTypes[ 0 ] ] + - ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : - s.accepts[ "*" ] - ); - - // Check for headers option - for ( i in s.headers ) { - jqXHR.setRequestHeader( i, s.headers[ i ] ); - } - - // Allow custom headers/mimetypes and early abort - if ( s.beforeSend && - ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { - - // Abort if not done already and return - return jqXHR.abort(); - } - - // Aborting is no longer a cancellation - strAbort = "abort"; - - // Install callbacks on deferreds - completeDeferred.add( s.complete ); - jqXHR.done( s.success ); - jqXHR.fail( s.error ); - - // Get transport - transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); - - // If no transport, we auto-abort - if ( !transport ) { - done( -1, "No Transport" ); - } else { - jqXHR.readyState = 1; - - // Send global event - if ( fireGlobals ) { - globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); - } - - // If request was aborted inside ajaxSend, stop there - if ( completed ) { - return jqXHR; - } - - // Timeout - if ( s.async && s.timeout > 0 ) { - timeoutTimer = window.setTimeout( function() { - jqXHR.abort( "timeout" ); - }, s.timeout ); - } - - try { - completed = false; - transport.send( requestHeaders, done ); - } catch ( e ) { - - // Rethrow post-completion exceptions - if ( completed ) { - throw e; - } - - // Propagate others as results - done( -1, e ); - } - } - - // Callback for when everything is done - function done( status, nativeStatusText, responses, headers ) { - var isSuccess, success, error, response, modified, - statusText = nativeStatusText; - - // Ignore repeat invocations - if ( completed ) { - return; - } - - completed = true; - - // Clear timeout if it exists - if ( timeoutTimer ) { - window.clearTimeout( timeoutTimer ); - } - - // Dereference transport for early garbage collection - // (no matter how long the jqXHR object will be used) - transport = undefined; - - // Cache response headers - responseHeadersString = headers || ""; - - // Set readyState - jqXHR.readyState = status > 0 ? 4 : 0; - - // Determine if successful - isSuccess = status >= 200 && status < 300 || status === 304; - - // Get response data - if ( responses ) { - response = ajaxHandleResponses( s, jqXHR, responses ); - } - - // Use a noop converter for missing script but not if jsonp - if ( !isSuccess && - jQuery.inArray( "script", s.dataTypes ) > -1 && - jQuery.inArray( "json", s.dataTypes ) < 0 ) { - s.converters[ "text script" ] = function() {}; - } - - // Convert no matter what (that way responseXXX fields are always set) - response = ajaxConvert( s, response, jqXHR, isSuccess ); - - // If successful, handle type chaining - if ( isSuccess ) { - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - modified = jqXHR.getResponseHeader( "Last-Modified" ); - if ( modified ) { - jQuery.lastModified[ cacheURL ] = modified; - } - modified = jqXHR.getResponseHeader( "etag" ); - if ( modified ) { - jQuery.etag[ cacheURL ] = modified; - } - } - - // if no content - if ( status === 204 || s.type === "HEAD" ) { - statusText = "nocontent"; - - // if not modified - } else if ( status === 304 ) { - statusText = "notmodified"; - - // If we have data, let's convert it - } else { - statusText = response.state; - success = response.data; - error = response.error; - isSuccess = !error; - } - } else { - - // Extract error from statusText and normalize for non-aborts - error = statusText; - if ( status || !statusText ) { - statusText = "error"; - if ( status < 0 ) { - status = 0; - } - } - } - - // Set data for the fake xhr object - jqXHR.status = status; - jqXHR.statusText = ( nativeStatusText || statusText ) + ""; - - // Success/Error - if ( isSuccess ) { - deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); - } else { - deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); - } - - // Status-dependent callbacks - jqXHR.statusCode( statusCode ); - statusCode = undefined; - - if ( fireGlobals ) { - globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", - [ jqXHR, s, isSuccess ? success : error ] ); - } - - // Complete - completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); - - if ( fireGlobals ) { - globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); - - // Handle the global AJAX counter - if ( !( --jQuery.active ) ) { - jQuery.event.trigger( "ajaxStop" ); - } - } - } - - return jqXHR; - }, - - getJSON: function( url, data, callback ) { - return jQuery.get( url, data, callback, "json" ); - }, - - getScript: function( url, callback ) { - return jQuery.get( url, undefined, callback, "script" ); - } -} ); - -jQuery.each( [ "get", "post" ], function( _i, method ) { - jQuery[ method ] = function( url, data, callback, type ) { - - // Shift arguments if data argument was omitted - if ( isFunction( data ) ) { - type = type || callback; - callback = data; - data = undefined; - } - - // The url can be an options object (which then must have .url) - return jQuery.ajax( jQuery.extend( { - url: url, - type: method, - dataType: type, - data: data, - success: callback - }, jQuery.isPlainObject( url ) && url ) ); - }; -} ); - -jQuery.ajaxPrefilter( function( s ) { - var i; - for ( i in s.headers ) { - if ( i.toLowerCase() === "content-type" ) { - s.contentType = s.headers[ i ] || ""; - } - } -} ); - - -jQuery._evalUrl = function( url, options, doc ) { - return jQuery.ajax( { - url: url, - - // Make this explicit, since user can override this through ajaxSetup (trac-11264) - type: "GET", - dataType: "script", - cache: true, - async: false, - global: false, - - // Only evaluate the response if it is successful (gh-4126) - // dataFilter is not invoked for failure responses, so using it instead - // of the default converter is kludgy but it works. - converters: { - "text script": function() {} - }, - dataFilter: function( response ) { - jQuery.globalEval( response, options, doc ); - } - } ); -}; - - -jQuery.fn.extend( { - wrapAll: function( html ) { - var wrap; - - if ( this[ 0 ] ) { - if ( isFunction( html ) ) { - html = html.call( this[ 0 ] ); - } - - // The elements to wrap the target around - wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); - - if ( this[ 0 ].parentNode ) { - wrap.insertBefore( this[ 0 ] ); - } - - wrap.map( function() { - var elem = this; - - while ( elem.firstElementChild ) { - elem = elem.firstElementChild; - } - - return elem; - } ).append( this ); - } - - return this; - }, - - wrapInner: function( html ) { - if ( isFunction( html ) ) { - return this.each( function( i ) { - jQuery( this ).wrapInner( html.call( this, i ) ); - } ); - } - - return this.each( function() { - var self = jQuery( this ), - contents = self.contents(); - - if ( contents.length ) { - contents.wrapAll( html ); - - } else { - self.append( html ); - } - } ); - }, - - wrap: function( html ) { - var htmlIsFunction = isFunction( html ); - - return this.each( function( i ) { - jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); - } ); - }, - - unwrap: function( selector ) { - this.parent( selector ).not( "body" ).each( function() { - jQuery( this ).replaceWith( this.childNodes ); - } ); - return this; - } -} ); - - -jQuery.expr.pseudos.hidden = function( elem ) { - return !jQuery.expr.pseudos.visible( elem ); -}; -jQuery.expr.pseudos.visible = function( elem ) { - return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); -}; - - - - -jQuery.ajaxSettings.xhr = function() { - try { - return new window.XMLHttpRequest(); - } catch ( e ) {} -}; - -var xhrSuccessStatus = { - - // File protocol always yields status code 0, assume 200 - 0: 200, - - // Support: IE <=9 only - // trac-1450: sometimes IE returns 1223 when it should be 204 - 1223: 204 - }, - xhrSupported = jQuery.ajaxSettings.xhr(); - -support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); -support.ajax = xhrSupported = !!xhrSupported; - -jQuery.ajaxTransport( function( options ) { - var callback, errorCallback; - - // Cross domain only allowed if supported through XMLHttpRequest - if ( support.cors || xhrSupported && !options.crossDomain ) { - return { - send: function( headers, complete ) { - var i, - xhr = options.xhr(); - - xhr.open( - options.type, - options.url, - options.async, - options.username, - options.password - ); - - // Apply custom fields if provided - if ( options.xhrFields ) { - for ( i in options.xhrFields ) { - xhr[ i ] = options.xhrFields[ i ]; - } - } - - // Override mime type if needed - if ( options.mimeType && xhr.overrideMimeType ) { - xhr.overrideMimeType( options.mimeType ); - } - - // X-Requested-With header - // For cross-domain requests, seeing as conditions for a preflight are - // akin to a jigsaw puzzle, we simply never set it to be sure. - // (it can always be set on a per-request basis or even using ajaxSetup) - // For same-domain requests, won't change header if already provided. - if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { - headers[ "X-Requested-With" ] = "XMLHttpRequest"; - } - - // Set headers - for ( i in headers ) { - xhr.setRequestHeader( i, headers[ i ] ); - } - - // Callback - callback = function( type ) { - return function() { - if ( callback ) { - callback = errorCallback = xhr.onload = - xhr.onerror = xhr.onabort = xhr.ontimeout = - xhr.onreadystatechange = null; - - if ( type === "abort" ) { - xhr.abort(); - } else if ( type === "error" ) { - - // Support: IE <=9 only - // On a manual native abort, IE9 throws - // errors on any property access that is not readyState - if ( typeof xhr.status !== "number" ) { - complete( 0, "error" ); - } else { - complete( - - // File: protocol always yields status 0; see trac-8605, trac-14207 - xhr.status, - xhr.statusText - ); - } - } else { - complete( - xhrSuccessStatus[ xhr.status ] || xhr.status, - xhr.statusText, - - // Support: IE <=9 only - // IE9 has no XHR2 but throws on binary (trac-11426) - // For XHR2 non-text, let the caller handle it (gh-2498) - ( xhr.responseType || "text" ) !== "text" || - typeof xhr.responseText !== "string" ? - { binary: xhr.response } : - { text: xhr.responseText }, - xhr.getAllResponseHeaders() - ); - } - } - }; - }; - - // Listen to events - xhr.onload = callback(); - errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); - - // Support: IE 9 only - // Use onreadystatechange to replace onabort - // to handle uncaught aborts - if ( xhr.onabort !== undefined ) { - xhr.onabort = errorCallback; - } else { - xhr.onreadystatechange = function() { - - // Check readyState before timeout as it changes - if ( xhr.readyState === 4 ) { - - // Allow onerror to be called first, - // but that will not handle a native abort - // Also, save errorCallback to a variable - // as xhr.onerror cannot be accessed - window.setTimeout( function() { - if ( callback ) { - errorCallback(); - } - } ); - } - }; - } - - // Create the abort callback - callback = callback( "abort" ); - - try { - - // Do send the request (this may raise an exception) - xhr.send( options.hasContent && options.data || null ); - } catch ( e ) { - - // trac-14683: Only rethrow if this hasn't been notified as an error yet - if ( callback ) { - throw e; - } - } - }, - - abort: function() { - if ( callback ) { - callback(); - } - } - }; - } -} ); - - - - -// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) -jQuery.ajaxPrefilter( function( s ) { - if ( s.crossDomain ) { - s.contents.script = false; - } -} ); - -// Install script dataType -jQuery.ajaxSetup( { - accepts: { - script: "text/javascript, application/javascript, " + - "application/ecmascript, application/x-ecmascript" - }, - contents: { - script: /\b(?:java|ecma)script\b/ - }, - converters: { - "text script": function( text ) { - jQuery.globalEval( text ); - return text; - } - } -} ); - -// Handle cache's special case and crossDomain -jQuery.ajaxPrefilter( "script", function( s ) { - if ( s.cache === undefined ) { - s.cache = false; - } - if ( s.crossDomain ) { - s.type = "GET"; - } -} ); - -// Bind script tag hack transport -jQuery.ajaxTransport( "script", function( s ) { - - // This transport only deals with cross domain or forced-by-attrs requests - if ( s.crossDomain || s.scriptAttrs ) { - var script, callback; - return { - send: function( _, complete ) { - script = jQuery( "