@atlas-viewer/atlas 1.6.6 → 2.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +2562 -1353
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +2571 -1349
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +73 -381
- package/dist/index.umd.js.map +1 -1
- package/dist/standalone.umd.js +17 -190
- package/dist/standalone.umd.js.map +1 -1
- package/dist/types/clean-objects/base.object.d.ts +31 -0
- package/dist/types/clean-objects/box.object.d.ts +17 -0
- package/dist/types/clean-objects/composite.object.d.ts +4 -0
- package/dist/types/clean-objects/container.object.d.ts +11 -0
- package/dist/types/clean-objects/image.object.d.ts +20 -0
- package/dist/types/clean-objects/texture.object.d.ts +0 -0
- package/dist/types/clean-objects/tiles.object.d.ts +0 -0
- package/dist/types/clean-objects/traits/container.d.ts +5 -0
- package/dist/types/clean-objects/traits/evented.d.ts +312 -0
- package/dist/types/clean-objects/traits/generic-object.d.ts +61 -0
- package/dist/types/clean-objects/traits/has-styles.d.ts +60 -0
- package/dist/types/clean-objects/traits/hosts.d.ts +59 -0
- package/dist/types/clean-objects/traits/layout.d.ts +61 -0
- package/dist/types/clean-objects/traits/paintable.d.ts +16 -0
- package/dist/types/clean-objects/traits/revision.d.ts +7 -0
- package/dist/types/clean-objects/traits/scheduled-updates.d.ts +9 -0
- package/dist/types/clean-objects/world.object.d.ts +15 -0
- package/dist/types/clean-objects/zone.object.d.ts +0 -0
- package/dist/types/events.d.ts +29 -29
- package/dist/types/index.d.ts +5 -0
- package/dist/types/modules/browser-event-manager/browser-event-manager.d.ts +6 -1
- package/dist/types/modules/canvas-renderer/canvas-renderer.d.ts +11 -1
- package/dist/types/modules/composite-renderer/composite-renderer.d.ts +9 -1
- package/dist/types/modules/debug-renderer/debug-renderer.d.ts +1 -0
- package/dist/types/modules/overlay-renderer/overlay-renderer.d.ts +21 -13
- package/dist/types/modules/react-reconciler/Atlas.d.ts +17 -7
- package/dist/types/modules/react-reconciler/components/AtlasAuto.d.ts +4 -8
- package/dist/types/modules/react-reconciler/components/AtlasContext.d.ts +4 -26
- package/dist/types/modules/react-reconciler/components/AtlasWithReconciler.d.ts +13 -0
- package/dist/types/modules/react-reconciler/components/RegionHighlight.d.ts +2 -2
- package/dist/types/modules/react-reconciler/hooks/use-atlas-image.d.ts +2 -2
- package/dist/types/modules/react-reconciler/hooks/use-atlas.d.ts +1 -1
- package/dist/types/modules/react-reconciler/hooks/use-canvas-position.d.ts +1 -0
- package/dist/types/modules/react-reconciler/hooks/use-classname.d.ts +1 -0
- package/dist/types/modules/react-reconciler/hooks/use-controlled-annotation-list.d.ts +0 -1
- package/dist/types/modules/react-reconciler/hooks/use-preset.d.ts +17 -0
- package/dist/types/modules/react-reconciler/hooks/use-resize-world-item.d.ts +0 -1
- package/dist/types/modules/react-reconciler/presets/_types.d.ts +23 -0
- package/dist/types/modules/react-reconciler/presets/default-preset.d.ts +10 -0
- package/dist/types/modules/react-reconciler/presets/index.d.ts +8 -0
- package/dist/types/modules/react-reconciler/presets/static-preset.d.ts +7 -0
- package/dist/types/modules/react-reconciler/reconciler.d.ts +4 -0
- package/dist/types/modules/react-reconciler/types.d.ts +11 -173
- package/dist/types/modules/static-renderer/static-renderer.d.ts +16 -1
- package/dist/types/modules/transition-manager/transition-manager.d.ts +63 -0
- package/dist/types/modules/webgl-renderer/webgl-renderer.d.ts +7 -1
- package/dist/types/objects/base-object.d.ts +2 -1
- package/dist/types/objects/box.d.ts +49 -1
- package/dist/types/objects/text.d.ts +8 -0
- package/dist/types/renderer/renderer.d.ts +11 -2
- package/dist/types/renderer/runtime.d.ts +44 -10
- package/dist/types/spacial-content/composite-resource.d.ts +13 -1
- package/dist/types/spacial-content/index.d.ts +1 -0
- package/dist/types/spacial-content/single-image.d.ts +6 -0
- package/dist/types/spacial-content/spacial-content.d.ts +4 -0
- package/dist/types/spacial-content/tiled-image.d.ts +6 -1
- package/dist/types/types.d.ts +17 -16
- package/dist/types/utility/are-inputs-equal.d.ts +1 -0
- package/dist/types/utility/easing-functions.d.ts +6 -0
- package/dist/types/utility/go-to-clamped.d.ts +1 -0
- package/dist/types/utility/hash.d.ts +1 -0
- package/dist/types/utility/merge-styles.d.ts +2 -0
- package/dist/types/utility/stylesheet.d.ts +17 -0
- package/dist/types/utility/to-box.d.ts +2 -0
- package/dist/types/utils.d.ts +1 -1
- package/dist/types/world-objects/world-object.d.ts +1 -1
- package/dist/types/world.d.ts +2 -1
- package/package.json +19 -27
- package/dist/types/modules/vanilla-controller/vanilla-controller.d.ts +0 -4
package/dist/standalone.umd.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*****************************************************************************
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).Atlas={})}(this,(function(t){"use strict";
|
|
2
|
+
/*! *****************************************************************************
|
|
4
3
|
Copyright (c) Microsoft Corporation.
|
|
5
4
|
|
|
6
5
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -13,191 +12,19 @@
|
|
|
13
12
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
13
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
16
|
-
**************************************************************************** *****************************************************************************
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
'use strict';!function(y,F){"object"==typeof exports&&"undefined"!=typeof module?F(exports):"function"==typeof define&&define.amd?define(["exports"],F):F((y=y||self).Atlas={})}(this,function(y){function F(b,a){function c(){this.constructor=b}hb(b,a);b.prototype=null===a?Object.create(a):(c.prototype=a.prototype,new c)}function qa(b,a){var c={},d;for(d in b)Object.prototype.hasOwnProperty.call(b,d)&&0>a.indexOf(d)&&(c[d]=b[d]);if(null!=b&&"function"==typeof Object.getOwnPropertySymbols){var e=0;for(d=
|
|
31
|
-
Object.getOwnPropertySymbols(b);e<d.length;e++)0>a.indexOf(d[e])&&Object.prototype.propertyIsEnumerable.call(b,d[e])&&(c[d[e]]=b[d[e]])}return c}function Da(b,a){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(b,a)}function ib(b,a,c,d){return new (c||(c=Promise))(function(e,f){function g(a){try{k(d.next(a))}catch(m){f(m)}}function h(a){try{k(d.throw(a))}catch(m){f(m)}}function k(a){a.done?e(a.value):function(a){return a instanceof c?a:new c(function(c){c(a)})}(a.value).then(g,
|
|
32
|
-
h)}k((d=d.apply(b,a||[])).next())})}function jb(b,a){function c(c){return function(g){return function(c){if(d)throw new TypeError("Generator is already executing.");for(;h;)try{if(d=1,e&&(f=2&c[0]?e.return:c[0]?e.throw||((f=e.return)&&f.call(e),0):e.next)&&!(f=f.call(e,c[1])).done)return f;switch(e=0,f&&(c=[2&c[0],f.value]),c[0]){case 0:case 1:f=c;break;case 4:return h.label++,{value:c[1],done:!1};case 5:h.label++;e=c[1];c=[0];continue;case 7:c=h.ops.pop();h.trys.pop();continue;default:if(!(f=h.trys,
|
|
33
|
-
(f=0<f.length&&f[f.length-1])||6!==c[0]&&2!==c[0])){h=0;continue}if(3===c[0]&&(!f||c[1]>f[0]&&c[1]<f[3]))h.label=c[1];else if(6===c[0]&&h.label<f[1])h.label=f[1],f=c;else if(f&&h.label<f[2])h.label=f[2],h.ops.push(c);else{f[2]&&h.ops.pop();h.trys.pop();continue}}c=a.call(b,h)}catch(x){c=[6,x],e=0}finally{d=f=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,g])}}var d,e,f,g,h={label:0,sent:function(){if(1&f[0])throw f[1];return f[1]},trys:[],ops:[]};return g={next:c(0),throw:c(1),
|
|
34
|
-
return:c(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g}function G(b){var a="function"==typeof Symbol&&Symbol.iterator,c=a&&b[a],d=0;if(c)return c.call(b);if(b&&"number"==typeof b.length)return{next:function(){return b&&d>=b.length&&(b=void 0),{value:b&&b[d++],done:!b}}};throw new TypeError(a?"Object is not iterable.":"Symbol.iterator is not defined.");}function kb(b,a){var c="function"==typeof Symbol&&b[Symbol.iterator];if(!c)return b;var d;b=c.call(b);var e=[];try{for(;(void 0===
|
|
35
|
-
a||0<a--)&&!(d=b.next()).done;)e.push(d.value)}catch(g){var f={error:g}}finally{try{d&&!d.done&&(c=b.return)&&c.call(b)}finally{if(f)throw f.error;}}return e}function D(){for(var b=[],a=0;a<arguments.length;a++)b=b.concat(kb(arguments[a]));return b}function lb(){for(var b=0,a=0,c=arguments.length;a<c;a++)b+=arguments[a].length;b=Array(b);var d=0;for(a=0;a<c;a++)for(var e=arguments[a],f=0,g=e.length;f<g;f++,d++)b[d]=e[f];return b}function n(b,a,c){return new Float32Array(b,a,c)}function mb(b,a,c){return b(c=
|
|
36
|
-
{path:a,exports:{},require:function(a,c){throw Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs");}},c.exports),c.exports}function Ea(b,a){return b.startsWith(a)&&nb.test(b)}function ob(b){b=ca.parse(b);for(var a=b.length,c=0,d=0,e=0,f=0;f<a;f++)c||"number"==typeof b[f]?c++:void 0!==b[f].hue?e++:d++;return{parsed:b,numNumbers:c,numRGB:d,numHSL:e}}function E(){if(!pb){pb=!0;var b=navigator.userAgent,a=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(b),
|
|
37
|
-
c=/(Mac OS X)|(Windows)|(Linux)/.exec(b);if(Fa=/\b(iPhone|iP[ao]d)/.exec(b),Ga=/\b(iP[ao]d)/.exec(b),Ha=/Android/i.exec(b),qb=/FBAN\/\w+;/i.exec(b),rb=/Mobile/i.exec(b),sb=!!/Win64/.exec(b),a){(V=a[1]?parseFloat(a[1]):a[5]?parseFloat(a[5]):NaN)&&document&&document.documentMode&&(V=document.documentMode);var d=/(?:Trident\/(\d+.\d+))/.exec(b);tb=d?parseFloat(d[1])+4:V;Ia=a[2]?parseFloat(a[2]):NaN;Ja=a[3]?parseFloat(a[3]):NaN;(Ka=a[4]?parseFloat(a[4]):NaN)?(a=/(?:Chrome\/(\d+\.\d+))/.exec(b),ra=a&&
|
|
38
|
-
a[1]?parseFloat(a[1]):NaN):ra=NaN}else V=Ia=Ja=ra=Ka=NaN;c?(c[1]?(b=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(b),sa=!b||parseFloat(b[1].replace("_","."))):sa=!1,La=!!c[2],Ma=!!c[3]):sa=La=Ma=!1}}function ub(b){var a=0,c=0,d=0,e=0;return"detail"in b&&(c=b.detail),"wheelDelta"in b&&(c=-b.wheelDelta/120),"wheelDeltaY"in b&&(c=-b.wheelDeltaY/120),"wheelDeltaX"in b&&(a=-b.wheelDeltaX/120),"axis"in b&&b.axis===b.HORIZONTAL_AXIS&&(a=c,c=0),d=10*a,e=10*c,"deltaY"in b&&(e=b.deltaY),"deltaX"in b&&(d=b.deltaX),
|
|
39
|
-
(d||e)&&b.deltaMode&&(1==b.deltaMode?(d*=40,e*=40):(d*=800,e*=800)),d&&!a&&(a=1>d?-1:1),e&&!c&&(c=1>e?-1:1),{spinX:a,spinY:c,pixelX:d,pixelY:e}}function W(b){return b.endsWith("info.json")?b:b.endsWith("/")?b+"info.json":b+"/info.json"}function v(b){return b["@id"]?b["@id"]:b.id?b.id:void 0}function Na(b){if(!b||!b.profile||!v(b))return!1;b=Array.isArray(b.profile)?b.profile:[b.profile];for(let a of b)if("string"==typeof a&&-1!==nc.indexOf(a))return!0;return!1}function oc(b){if(!function(a){if(!Na(a))return!1;
|
|
40
|
-
a=Array.isArray(a.profile)?a.profile:[a.profile];for(let c of a)if("string"==typeof c){if(-1!==pc.indexOf(c))return!0}else if(a=c.supports||[],-1!==a.indexOf("regionByPx")&&(-1!==a.indexOf("sizeByW")||-1!==a.indexOf("sizeByWh")))return!0;return!1}(b))return[];let a=[];var c=Array.isArray(b.profile)?b.profile:[b.profile],d=c.length;for(var e=0;e<d;e++){let a=c[e];if("string"!=typeof a&&(a.maxHeight||a.maxWidth))return[{id:v(b),type:"variable",minWidth:0,minHeight:0,maxHeight:a.maxHeight||a.maxWidth,
|
|
41
|
-
maxWidth:a.maxWidth||a.maxHeight}]}if(b.tiles)for(c=b.tiles.length,d=0;d<c;d++)e=b.tiles[d],(e.height||e.width)&&a.push({id:v(b),type:"variable",minHeight:0,minWidth:0,maxHeight:e.height||e.width,maxWidth:e.width});return a}function vb(b){var a=b.match(/^.*\/(full)\/(((\d+),(\d+)?)|max)\/(\d+)\/default\.(jpg|png|jpeg)$/);if(a){let c=a[1],d=parseInt(a[4],10),e=parseInt(a[5],10);a=a[7];if(("max"===c||"full"===c)&&d&&e&&a)return{type:"fixed",id:b,height:e,width:d}}return{type:"unknown",id:b}}function qc(b){return Na(b)?
|
|
42
|
-
(b&&b.sizes?b.sizes:[]).map(a=>({id:v(b),type:"fixed-service",height:a.height,width:a.width})):[]}function wb(b){let a=[],c=b.length;for(let e=0;e<c;e++){var d=qc(b[e]);d.length&&a.push(...d);d=oc(b[e]);d.length&&a.push(...d)}return a}function xb(b){let a=b.service?Array.isArray(b.service)?b.service:[b.service]:[],c=a.length,d=[];for(let e=0;e<c;e++)Na(a[e])&&b.width&&b.height&&d.push(a[e]);return d}function rc(b,a=!0,c){let d=[];if("string"==typeof b)var e=vb(b);else{e=(f=b)["@type"]?f["@type"]:
|
|
43
|
-
f.type?f.type:void 0;var f;e="Image"!==e&&"sc:Image"!==e?null:(e=v(b))?e&&b.width&&b.height?{id:e,type:"fixed",width:b.width,height:b.height,unsafe:!0}:vb(e):null}if(null===e)return d;if(d.push(e),a&&b.width&&b.height){a=[];e=xb(b);for(let d of e)e={id:v(d),width:b.width,height:b.height},c.canLoadSync(e)&&(e=c.loadServiceSync(e))&&(e.height||(e.height=b.height),e.width||(e.width=b.width),a.push(...wb([e])));if(a.length)return d.push(...a),d}return b.service&&d.push(...wb(b.service)),d}function Oa(b,
|
|
44
|
-
a,c){return{id:[W(v(b)).slice(0,-10),"full",[a,c||""].join(),0,"default.jpg"].join("/"),type:"fixed",width:a,height:c||b.height/b.width*a,unsafe:b.width>a}}function X(b){b=b.replace(/(https?:\/\/)?(www.)?/i,"");return-1!==b.indexOf("/")?b.split("/")[0]:b}function sc(b,a){let c=[],d=Object.assign({unsafeImageService:!1,atAnyCost:!0,fallback:!0,minHeight:64,minWidth:64,maxHeight:1/0,maxWidth:1/0,returnAllOptions:!1,preferFixedSize:!1,allowUnsafe:!1,explain:!1,height:0,width:0},b);b=[];let e=[],f=null,
|
|
45
|
-
g=(a,c)=>{var b=d.width?d.width:d.maxWidth;if(b=a.height<=d.maxHeight&&a.width<=d.maxWidth&&a.height>=d.minHeight&&a.width>=d.minWidth&&(!c||Math.abs(a.width-b)<Math.abs(c.width-b))){if(d.preferFixedSize&&a.unsafe)return void e.push(a);d.returnAllOptions&&c&&e.push(c);f=a}else d.returnAllOptions&&e.push(a)},h=a.length;for(let c=0;c<h;c++){let e=a[c](),h=e.length;for(let a=0;a<h;a++){let c=e[a];if("unknown"===c.type&&d.atAnyCost&&b.push(c),"fixed"===c.type&&(c.unsafe?b.push(c):g(c,f)),"fixed-service"===
|
|
46
|
-
c.type)d.unsafeImageService?g(Oa(c,d.width,d.height),f):g(Oa(c,c.width,c.height),f);"variable"===c.type&&c.maxWidth&&g(Oa({id:c.id,type:"fixed-service",width:c.maxWidth,height:c.maxWidth},c.maxWidth),f)}if(f&&!d.returnAllOptions&&!f.unsafe&&!d.allowUnsafe)break}return d.atAnyCost&&0===e.length?{best:f||b[0],fallback:b.slice(1),log:c}:d.returnAllOptions?{best:d.atAnyCost?f||e[0]||b[0]:f||e[0],fallback:[...e,...b],log:c}:{best:f||e[0]||null,fallback:f?e:e.slice(1),log:c}}function Y(b,a,c,d){return new (c||
|
|
47
|
-
(c=Promise))(function(e,f){function g(a){try{k(d.next(a))}catch(m){f(m)}}function h(a){try{k(d.throw(a))}catch(m){f(m)}}function k(a){a.done?e(a.value):function(a){return a instanceof c?a:new c(function(c){c(a)})}(a.value).then(g,h)}k((d=d.apply(b,a||[])).next())})}var hb=function(b,a){return(hb=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])})(b,a)},A=function(){return(A=Object.assign||function(b){for(var a,
|
|
48
|
-
c=1,d=arguments.length;c<d;c++)for(var e in a=arguments[c])Object.prototype.hasOwnProperty.call(a,e)&&(b[e]=a[e]);return b}).apply(this,arguments)};let ta=(b,a,c)=>{const d=b.length;c=c||n(d);for(let e=0;e<d;e++)c[e]=0==e%5?b[e+1]<a[3]&&b[e+3]>a[1]&&b[e+2]<a[4]&&b[e+4]>a[2]?1:0:b[e];return c},P=(b,a,c)=>{c=c||n(9);return c[0]=b[0]*a[0]+b[1]*a[3]+b[2]*a[6],c[1]=b[0]*a[1]+b[1]*a[4]+b[2]*a[7],c[2]=b[0]*a[2]+b[1]*a[5]+b[2]*a[8],c[3]=b[3]*a[0]+b[4]*a[3]+b[5]*a[6],c[4]=b[3]*a[1]+b[4]*a[4]+b[5]*a[7],c[5]=
|
|
49
|
-
b[3]*a[2]+b[4]*a[5]+b[5]*a[8],c[6]=b[6]*a[0]+b[7]*a[3]+b[8]*a[6],c[7]=b[6]*a[1]+b[7]*a[4]+b[8]*a[7],c[8]=b[6]*a[2]+b[7]*a[5]+b[8]*a[8],c};class B{constructor(b){this.index=0;this.length=b;this.points=n(this.length)}static grid(b=1,a=1){return new B(5*b*a)}static point(b,a){let c=n(5);return c[0]=1,c[1]=b,c[2]=a,c[3]=b,c[4]=a,c}static positionPair(b){let a=n(5);return a[0]=1,a[1]=b.x1,a[2]=b.y1,a[3]=b.x2,a[4]=b.y2,a}static projection(b){return B.singleBox(b.width,b.height,b.x,b.y)}static singleBox(b,
|
|
50
|
-
a,c=0,d=0){let e=n(5);return e[0]=1,e[1]=c,e[2]=d,e[3]=b+c,e[4]=a+d,e}row(b){return b(this)}addPoints(b,a,c,d){return this.points[this.index]=1,this.points[1+this.index]=b,this.points[2+this.index]=a,this.points[3+this.index]=c,this.points[4+this.index]=d,this.index+=5,this}addBox(b,a,c,d){return this.addPoints(b,a,b+c,a+d),this}build(){return this.points}}let Q=(b,a)=>{const c=b.length;for(let d=0;d<c;d++)b[d]=0==d%5?a[6]*b[d+1]+a[7]*b[d+2]+a[8]*b[d]:1==d%5%2?a[0]*b[d]+a[1]*b[d+1]+a[2]:a[3]*b[d-
|
|
51
|
-
1]+a[4]*b[d]+a[5];return b},U=b=>{const a=n(9);return a[0]=b,a[4]=b,a[8]=1,a},M=(b,a)=>{const c=n(9);return c[0]=1,c[2]=b,c[4]=1,c[5]=a,c[8]=1,c},ua=(b,a,c)=>P(M((1-b)*a,(1-b)*c),U(b)),da=(b,a,c)=>{const d=b.length;c=c&&c.length>=d?c.slice(0,d):n(d);for(let e=0;e<d;e++)c[e]=0==e%5?a[6]*b[e+1]+a[7]*b[e+2]+a[8]*b[e]:1==e%5%2?a[0]*b[e]+a[1]*b[e+1]+a[2]:a[3]*b[e-1]+a[4]*b[e]+a[5];return c};var yb="onMouseDown onMouseEnter onMouseLeave onMouseMove onMouseOut onMouseOver onMouseUp onTouchCancel onTouchEnd onTouchMove onTouchStart onPointerDown onPointerMove onPointerUp onPointerCancel onPointerEnter onPointerLeave onPointerOver onPointerOut onScroll onWheel onClick onDragStart onDragEnd onDragEnter onDragExit onDrag onDragOver".split(" "),
|
|
52
|
-
va=yb.reduce(function(b,a){return b[a.slice(2).toLowerCase()]=a,b[a]=a,b},{}),ea=function(){function b(){var a=this;this.__revision=0;this.scale=1;this.layers=[];this.time=[];this.addEventListener=function(c,b,e){c=va[c];if(!a.eventHandlers[c])throw Error("Unknown event "+c);-1===a.eventHandlers[c].indexOf(b)&&a.eventHandlers[c].push(b)};this.removeEventListener=function(c,b){c=va[c];a.eventHandlers[c]?-1!==a.eventHandlers[c].indexOf(b)&&(a.eventHandlers[c]=a.eventHandlers[c].filter(function(a){return a!==
|
|
53
|
-
b})):console.warn("Unknown event "+c)};this.id=this.__id=((a=21)=>{let c="",b=crypto.getRandomValues(new Uint8Array(a));for(;a--;){let d=63&b[a];c+=36>d?d.toString(36):62>d?(d-26).toString(36).toUpperCase():63>d?"_":"-"}return c})();this.eventHandlers=yb.reduce(function(a,b){return a[b]=[],a},{})}return b.prototype.getObjectsAt=function(a){return[]},b.prototype.getAllPointsAt=function(a,c,b){return[]},b.prototype.getScheduledUpdates=function(a,c){return null},b.prototype.dispatchEvent=function(a,
|
|
54
|
-
c){var b=(a=this.eventHandlers[a])?a.length:0;if(b)for(var e=0;e<b;e++)a[e](c)},Object.defineProperty(b.prototype,"x",{get:function(){return this.points[1]},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"y",{get:function(){return this.points[2]},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"width",{get:function(){return this.points[3]-this.points[1]},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"height",{get:function(){return this.points[4]-
|
|
55
|
-
this.points[2]},enumerable:!1,configurable:!0}),b.prototype.translate=function(a,c){Q(this.points,M(a,c))},b.prototype.atScale=function(a){Q(this.points,ua(a,this.x,this.y));this.scale*=a},b.prototype.transform=function(a){Q(this.points,a)},b.prototype.applyProps=function(a){this.__revision++},b.prototype.appendChild=function(a){},b.prototype.removeChild=function(a){},b.prototype.insertBefore=function(a,c){},b.prototype.hideInstance=function(){},b}(),wa=function(b){function a(a){var c=b.call(this)||
|
|
56
|
-
this;if(c.type="spacial-content",a){var e=a.scale||1;c.id=a.id||a.uri;c.uri=a.uri;c.points=B.singleBox(a.width,a.height,a.x,a.y);c.display={scale:e,width:a.width/e,height:a.height/e,points:1!==e?B.singleBox(a.width/e,a.height/e):c.points}}else c.id="",c.uri="",c.display={scale:1,width:0,height:0,points:n(5)},c.points=n(5);return c}return F(a,b),a.prototype.applyProps=function(a){var c=a.target.width/(a.display?a.display.width:a.target.width);this.id=a.id||a.uri;this.uri=a.uri;this.points.set(B.singleBox(a.target.width,
|
|
57
|
-
a.target.height,a.target.x,a.target.y));this.display.scale=c;this.display.width=a.target.width/c;this.display.height=a.target.height/c;this.display.points=1!==c?B.singleBox(a.target.width/c,a.target.height/c):this.points},a.prototype.getAllPointsAt=function(a,b,e){return[[this,this.crop||this.points,b]]},a.fromSvg=function(c,b,e,f){return a.fromImage("data:image/svg+xml;base64,"+btoa(c),b,e,f)},a.fromImage=function(c,b,e,f){var d=new a;return d.applyProps({uri:c,id:f,display:e,target:b}),d},a.prototype.getImageUrl=
|
|
58
|
-
function(){return this.uri},a}(ea);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var fa,tc=(fa=mb(function(b,a){var c;void 0!==(c=function(a,c){function b(a,c){var b=++d;return function(){for(var d=[],e=0;e<arguments.length;e++)d[e]=arguments[e];var f;e="__memoized_value_"+b;var g="__memoized_map_"+b;c||0<d.length?(this.hasOwnProperty(g)||Object.defineProperty(this,g,{configurable:!1,enumerable:!1,writable:!1,
|
|
59
|
-
value:new Map}),e=this[g],g=c?c.apply(this,d):d[0],e.has(g)?f=e.get(g):(f=a.apply(this,d),e.set(g,f))):this.hasOwnProperty(e)?f=this[e]:(f=a.apply(this,d),Object.defineProperty(this,e,{configurable:!1,enumerable:!1,writable:!1,value:f}));return f}}Object.defineProperty(c,"__esModule",{value:!0});c.Memoize=function(a){return function(c,d,e){if(null!=e.value)e.value=b(e.value,a);else{if(null==e.get)throw"Only put a Memoize() decorator on a method or get accessor.";e.get=b(e.get,a)}}};var d=0}(0,a))&&
|
|
60
|
-
(b.exports=c)}))&&fa.__esModule&&Object.prototype.hasOwnProperty.call(fa,"default")?fa.default:fa,Pa=function(b){function a(a){var c,e,f=b.call(this)||this;return f.type="spacial-content",f.id=(c=a.url,e=c.length,c.indexOf("/info.json")===e-10?c.slice(0,-10):c),f.points=a.displayPoints?a.displayPoints:da(a.points,U(a.scaleFactor)),f.tileWidth=a.tileWidth,f.display={width:a.width/a.scaleFactor,height:a.height/a.scaleFactor,points:a.points,scale:a.scaleFactor},f}return F(a,b),a.prototype.applyProps=
|
|
61
|
-
function(a){},a.fromTile=function(c,b,e,f){e.height=e.height?e.height:e.width;for(var d=Math.ceil(b.width/f),h=Math.ceil(b.height/f),k=Math.ceil(d/e.width),l=Math.ceil(h/e.height),m=B.grid(k,l),x=B.grid(k,l),q=0;q<l;q++)for(var p=0;p<k;p++){var w=p*e.width,r=q*e.height;x.addPoints(w*f,r*f,p===k-1?b.width:(w+e.width)*f,q===l-1?b.height:(r+e.height)*f);m.addPoints(w,r,p===k-1?d:w+e.width,q===l-1?h:r+e.height)}return new a({url:c,scaleFactor:f,points:m.build(),displayPoints:x.build(),width:b.width,height:b.height,
|
|
62
|
-
tileWidth:e.width})},a.prototype.getImageUrl=function(a){a=this.points.slice(5*a,5*a+5);var c=a[3]-a[1],b=Math.ceil(c/this.display.scale);return this.id+"/"+a[1]+","+a[2]+","+c+","+(a[4]-a[2])+"/"+(b>this.tileWidth?this.tileWidth:b)+",/0/default.jpg"},a.prototype.getAllPointsAt=function(a,b,e){return[[this,ta(this.points,a),b]]},a.prototype.transform=function(a){Q(this.points,a)},a.prototype.getScheduledUpdates=function(a,b){return null},function(a,b,e,f){var c,d=arguments.length,k=3>d?b:null===f?
|
|
63
|
-
f=Object.getOwnPropertyDescriptor(b,e):f;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)k=Reflect.decorate(a,b,e,f);else for(var l=a.length-1;0<=l;l--)(c=a[l])&&(k=(3>d?c(k):3<d?c(b,e,k):c(b,e))||k);3<d&&k&&Object.defineProperty(b,e,k)}([tc.Memoize(),Da("design:type",Function),Da("design:paramtypes",[Number]),Da("design:returntype",String)],a.prototype,"getImageUrl",null),a}(ea),uc=function(b){function a(a){var c=b.call(this)||this;return c.images=[],c.scaleFactors=[],c.aggregateBuffer=
|
|
64
|
-
n(9),c.isFullyLoaded=!1,c.maxScaleFactor=0,c.loadFullResource=function(){return ib(c,void 0,void 0,function(){var a;return jb(this,function(c){switch(c.label){case 0:return this.isFullyLoaded?[2]:this.lazyLoader?(this.isFullyLoaded=!0,[4,this.lazyLoader()]):[3,2];case 1:a=c.sent(),this.addImages(a),c.label=2;case 2:return[2]}})})},c.fallback=[c.loadFullResource],c.id=a.id,c.points=B.singleBox(a.width,a.height),c.lazyLoader=a.loadFullImages,a.loadFullImages||(c.isFullyLoaded=!0),c.display={points:B.singleBox(a.width,
|
|
65
|
-
a.height),height:a.height,width:a.width,scale:1},c.addImages(a.images),c}return F(a,b),a.prototype.applyProps=function(a){},a.prototype.appendChild=function(a){this.addImages([a])},a.prototype.removeChild=function(a){-1!==this.images.indexOf(a)&&(this.images=this.images.filter(function(c){return c!==a}),this.sortByScales())},a.prototype.insertBefore=function(a,b){this.addImages([a])},a.prototype.hideInstance=function(){console.log("hideInstance: not yet implemented")},a.prototype.addImages=function(a){var c,
|
|
66
|
-
b;try{for(var f=G(a),g=f.next();!g.done;g=f.next())g.value.__parent=this}catch(k){var h={error:k}}finally{try{g&&!g.done&&(c=f.return)&&c.call(f)}finally{if(h)throw h.error;}}(b=this.images).push.apply(b,D(a.filter(Boolean)));this.sortByScales()},a.prototype.sortByScales=function(){this.images.sort(function(a,b){return b.display.width-a.display.width});this.scaleFactors=this.images.map(function(a){return a.display.scale});this.maxScaleFactor=Math.max.apply(Math,D(this.scaleFactors))},a.prototype.getScheduledUpdates=
|
|
67
|
-
function(a,b){return this.isFullyLoaded?null:b>1/this.maxScaleFactor?this.fallback:null},a.prototype.getAllPointsAt=function(a,b,e){var c=1/(e||1);var d=this.images,h=d.length;if(0===h)throw Error("No resources passed in.");for(var k=0,l=0;l<h&&d[l]&&d[l].display;l++)k=Math.abs(d[l].display.scale-c)<Math.abs(d[k].display.scale-c)?l:k;c=k;d=this.images.length;b=b?P(b,M(this.x,this.y)):M(this.x,this.y);if(c!==this.images.length-1&&this.images[c+1]){h=[];for(--d;d>=c;d--)h.push.apply(h,D(this.images[d].getAllPointsAt(a,
|
|
68
|
-
b,e)));return h}return this.images[c].getAllPointsAt(a,b,e)},a}(function(b){function a(){var a=null!==b&&b.apply(this,arguments)||this;return a.type="spacial-content",a}return F(a,b),a.prototype.getAllPointsAt=function(a,b,e){return[[this,this.points,b]]},a}(ea)),Qa=function(b){function a(a,d){var c=b.call(this)||this;c.type="world-object";c.intersectionBuffer=n(5);c.aggregateBuffer=n(9);c.invertedBuffer=n(9);c._updatedList=[];var f=d||{};d=f.x;d=void 0===d?0:d;f=f.y;f=void 0===f?0:f;return a?(c.id=
|
|
69
|
-
a.id||"",c.scale=1,c.layers=a.layers,c.points=n([1,d,f,a.width,a.height]),c.worldPoints=n([1,d,f,a.width,a.height]),c.filteredPointsBuffer=n(5*a.layers.length)):(c.id="",c.scale=1,c.layers=[],c.points=n(5),c.worldPoints=n(5),c.filteredPointsBuffer=n(5)),c}return F(a,b),a.createWithProps=function(c){var b=new a;return b.applyProps(c),b},a.prototype.applyProps=function(a){var c=a.x||0,b=a.y||0;this.id=a.id;var f=void 0!==a.scale?a.scale:this.scale;this.points[0]=1;this.points[1]=c;this.points[2]=b;
|
|
70
|
-
this.points[3]=c+a.width;this.points[4]=b+a.height;this.worldPoints[3]=this.worldPoints[1]+a.width*f;this.worldPoints[4]=this.worldPoints[2]+a.height*f;a.scale&&1!==a.scale&&this.atScale(f);this.scale=f},a.prototype.appendChild=function(a){0===a.points[0]&&a.points.set(this.points);this.addLayers([a])},a.prototype.removeChild=function(a){this.layers=this.layers.filter(function(c){return c!==a});this.filteredPointsBuffer=n(5*this.layers.length)},a.prototype.insertBefore=function(a,b){var c=this.layers.indexOf(b);
|
|
71
|
-
-1!==c&&(b=this.layers.slice(0,c-1),c=this.layers.slice(c),this.layers=D(b,[a],c))},a.prototype.hideInstance=function(){console.warn("hideInstance: not yet implemented")},a.prototype.getObjectsAt=function(a){if(0===ta(this.points,a,this.filteredPointsBuffer)[0])return[];for(var c=this.layers.length,b=[],f=0;f<c;f++){var g=this.layers[f];0!==ta(da(g.points,M(this.x,this.y)),a,this.filteredPointsBuffer)[0]&&b.push(g)}return b},a.prototype.getAllPointsAt=function(a,b,e){var c=P(M(this.x,this.y),U(this.scale),
|
|
72
|
-
this.aggregateBuffer);{var d=this.points;var h=a[1]<=d[3]&&a[3]>=d[1]&&a[2]<=d[4]&&a[4]>=d[2];let c=this.intersectionBuffer||n(5);h=h?(c[0]=1,c[1]=Math.max(a[1],d[1]),c[2]=Math.max(a[2],d[2]),c[3]=Math.min(a[3],d[3]),c[4]=Math.min(a[4],d[4]),c):(c[0]=0,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c)}a=this.layers.length;d=[];h=da(h,P(U(1/this.scale),M(-this.x,-this.y),this.invertedBuffer));b=b?P(b,c,this.aggregateBuffer):c;e*=this.scale;for(c=0;c<a;c++)d.push.apply(d,D(this.layers[c].getAllPointsAt(h,b,e)));return d},
|
|
73
|
-
a.prototype.addLayers=function(a){var c;try{for(var b=G(a),f=b.next();!f.done;f=b.next()){var g=f.value;5===g.points.length&&(g.points[1]<this.worldPoints[1]/this.scale||g.points[2]<this.worldPoints[2]/this.scale||g.points[3]>this.worldPoints[3]/this.scale||g.points[4]>this.worldPoints[4]/this.scale)&&(g.crop=n([1,Math.max(this.worldPoints[1]/this.scale,g.points[1]),Math.max(this.worldPoints[2]/this.scale,g.points[2]),Math.min(this.worldPoints[3]/this.scale,g.points[3]),Math.min(this.worldPoints[4]/
|
|
74
|
-
this.scale,g.points[4])]))}}catch(k){var h={error:k}}finally{try{f&&!f.done&&(c=b.return)&&c.call(b)}finally{if(h)throw h.error;}}this.layers=this.layers.concat(a);this.filteredPointsBuffer=n(5*this.layers.length)},a.prototype.getScheduledUpdates=function(a,b){var c,d=this.layers.length;this._updatedList=[];b*=this.scale;for(var g=0;g<d;g++){var h=this.layers[g].getScheduledUpdates(a,b);h&&(c=this._updatedList).push.apply(c,D(h))}return this._updatedList},a}(ea),zb=function(b){function a(a,d,e,f){void 0===
|
|
75
|
-
a&&(a=0);void 0===d&&(d=0);void 0===e&&(e=100);void 0===f&&(f="left-to-right");var c=b.call(this)||this;return c.id="world",c.aggregateBuffer=n(9),c.isDirty=!1,c.zones=[],c.triggerQueue=[],c.activatedEvents=[],c._updatedList=[],c.translationBuffer=n(9),c.needsRecalculate=!0,c.emptyPaintables=[],c.objects=[],c.subscriptions=[],c._propagateEventTargets=[],c._alreadyFlushed=[],c._width=a,c._height=d,c.aspectRatio=Number.isNaN(a/d)?1:a/d,c.viewingDirection=f,c.points=n(5*e),c.filteredPointsBuffer=n(5*
|
|
76
|
-
e),c}return F(a,b),Object.defineProperty(a.prototype,"x",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"y",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"height",{get:function(){return this._height},enumerable:!1,configurable:!0}),a.withProps=function(c){var b=new a;return b.applyProps(c),b},a.prototype.applyProps=
|
|
77
|
-
function(a){void 0===a.width||void 0===a.height||a.width===this._width&&a.height===this._height||this.resize(a.width,a.height);a.viewingDirection!==this.viewingDirection&&(this.viewingDirection=a.viewingDirection,this.triggerRepaint())},a.prototype.propagateTouchEvent=function(a,b,e){var c,d=this;if(-1===this.activatedEvents.indexOf(a))return[];var h=[];try{for(var k=G(e),l=k.next();!l.done;l=k.next()){var m=l.value;if(m.x&&m.y){var x=B.singleBox(1,1,m.x,m.y);h.push(this.getObjectsAt(x,!0).reverse())}}}catch(p){var q=
|
|
78
|
-
{error:p}}finally{try{l&&!l.done&&(c=k.return)&&c.call(k)}finally{if(q)throw q.error;}}return h.map(function(c){return d.propagateEvent(a,b,c,{bubbles:!0,cancelable:!0})})},a.prototype.propagatePointerEvent=function(a,b,e,f,g){void 0===g&&(g={});e=B.singleBox(1,1,e,f);e=this.getObjectsAt(e,!0).reverse();return this.propagateEvent(a,b,e,g)},a.prototype.propagateEvent=function(a,b,e,f){f=void 0===f?{}:f;f.bubbles;f.cancelable;b.atlasTarget=this;this._propagateEventTargets.length=1;this._propagateEventTargets[0]=
|
|
79
|
-
this;var c=!1;b.stopPropagation=function(){c=!0};for(var d=e.length-1;0<=d;d--){this._propagateEventTargets.unshift(e[d][0]);var k=e[d][1].length;if(k)for(f=0;f<k;f++)this._propagateEventTargets.unshift(e[d][1][f])}e=this._propagateEventTargets.length;for(f=0;f<e&&(b.atlasTarget=this._propagateEventTargets[f],b.atlasWorld=this,this._propagateEventTargets[f].dispatchEvent(a,b),!c);f++);return this._propagateEventTargets},a.prototype.appendChild=function(a){this.appendWorldObject(a)},a.prototype.removeChild=
|
|
80
|
-
function(a){var c,b=this.objects.indexOf(a);if(-1!==b)this.objects[b]=null,this.triggerRepaint(),this.needsRecalculate=!0;else try{for(var f=G(this.objects),g=f.next();!g.done;g=f.next()){var h=g.value;if(h&&h.id===a.id)return void this.removeChild(h)}}catch(l){var k={error:l}}finally{try{g&&!g.done&&(c=f.return)&&c.call(f)}finally{if(k)throw k.error;}}},a.prototype.insertBefore=function(a,b){-1!==this.objects.indexOf(b)&&(console.warn("insertBefore: Not fully implemented"),this.appendWorldObject(a))},
|
|
81
|
-
a.prototype.hideInstance=function(){console.warn("hideInstance: Not yet implemented")},a.prototype.asWorldObject=function(){return null},a.prototype.addZone=function(a){this.zones.push(a)},a.prototype.selectZone=function(a){if("string"==typeof a)for(var c=this.zones.length,b=0;b<c;b++){if(this.zones[b].id===a)return this.selectedZone=b,void this.trigger("zone-changed")}else this.zones[a]&&(this.selectedZone=a,this.trigger("zone-changed"))},a.prototype.deselectZone=function(){this.selectedZone=void 0},
|
|
82
|
-
a.prototype.getActiveZone=function(){if(this.selectedZone)return this.zones[this.selectedZone]},a.prototype.hasActiveZone=function(){return void 0!==this.selectedZone},a.prototype.checkResizeInternalBuffer=function(){if(this.points.length/5===this.objects.length){var a=this.points,b=n(2*this.points.length);b.set(a,0);this.points=b}},a.prototype.appendWorldObject=function(a){this.checkResizeInternalBuffer();var b=a.points;a.points=this.points.subarray(5*this.objects.length,5*this.objects.length+5);
|
|
83
|
-
a.points[1]=b[1];a.points[2]=b[2];a.points[3]=b[3];a.points[4]=b[4];this.objects.push(a);this.filteredPointsBuffer=n(5*this.objects.length);this.recalculateWorldSize();this.needsRecalculate=!0;this.triggerRepaint()},a.prototype.recalculateWorldSize=function(){var a=!1;if(this.needsRecalculate){for(var b=new Int32Array(this.objects.length),e=new Int32Array(this.objects.length),f=this.objects.length,g=0;g<f;g++)this.objects[g]&&(b[g]=this.points[5*g+3],e[g]=this.points[5*g+4]);b=Math.max.apply(Math,
|
|
84
|
-
D(b));b!==this._width&&(this._width=b,a=!0);e=Math.max.apply(Math,D(e));e!==this._height&&(this._height=e,a=!0);a&&this.trigger("recalculate-world-size",{width:b,height:e});this.needsRecalculate=!1}return a},a.prototype.addObjectAt=function(a,b){b.width&&!b.height?b.height=b.width/a.width*a.height:b.height&&!b.width&&(b.width=b.height/a.height*a.width);b&&b.width&&b.height||(b.width=a.width,b.height=a.height);var c=b.x,d=b.y;b=b.width/a.width;this.checkResizeInternalBuffer();this.points.set(B.singleBox(a.width,
|
|
85
|
-
a.height,0,0),5*this.objects.length);a=new Qa(a);return a.points=this.points.subarray(5*this.objects.length,5*this.objects.length+5),this.objects.push(a),this.scaleWorldObject(this.objects.length-1,b),this.translateWorldObject(this.objects.length-1,c,d),this.filteredPointsBuffer=n(2*this.points.length),this.triggerRepaint(),this.needsRecalculate=!0,a},a.prototype.scaleWorldObject=function(a,b){Q(this.points.subarray(5*a,5*a+5),ua(b,this.points[5*a+1],this.points[5*a+2]));(a=this.objects[a])&&(a.atScale(b),
|
|
86
|
-
this.triggerRepaint())},a.prototype.translateWorldObject=function(a,b,e){Q(this.points.subarray(5*a,5*a+5),M(b,e));(a=this.objects[a])&&(a.translate(b,e),this.triggerRepaint())},a.prototype.resize=function(a,b){return this._width=a,this._height=b,this.aspectRatio=a/b,this.triggerRepaint(),this},a.prototype.getObjects=function(){return this.objects},a.prototype.getPoints=function(){return this.points},a.prototype.getPointsFromViewer=function(a,b){var c=B.singleBox(a.width,a.height,a.x,a.y);return this.getPointsAt(c,
|
|
87
|
-
b,a.scale)},a.prototype.addLayoutSubscriber=function(a){var b=this;return this.subscriptions.push(a),function(){b.subscriptions.splice(b.subscriptions.indexOf(a),1)}},a.prototype.getScheduledUpdates=function(a,b){return[]},a.prototype.getObjectsAt=function(a,b){void 0===b&&(b=!1);for(var c=this.getActiveZone(),d=ta(this.points,a,this.filteredPointsBuffer),g=this.objects.length,h=[],k=0;k<g;k++)if(0!==d[5*k]){var l=this.objects[k];!l||c&&-1===c.objects.indexOf(l)||("world-object"!==l.type?h.push([l,
|
|
88
|
-
[l]]):b?h.push([l,l.getObjectsAt(a)]):h.push([l,this.emptyPaintables]))}return h},a.prototype.getPointsAt=function(a,b,e){void 0===e&&(e=1);var c=this.getObjectsAt(a),d=P(U(e),M(-a[1],-a[2]),this.translationBuffer);b=b?P(b,d,this.aggregateBuffer):d;d=c.length;for(var h=[],k=0;k<d;k++)h.push.apply(h,D(c[k][0].getAllPointsAt(a,b,e)));return h},a.prototype.flushSubscriptions=function(){if(this.triggerQueue.length){this._alreadyFlushed=[];for(var a=this.triggerQueue.length,b=0;b<a;b++)if(-1===this._alreadyFlushed.indexOf(this.triggerQueue[b][0])){void 0===
|
|
89
|
-
this.triggerQueue[b][1]&&this._alreadyFlushed.push(this.triggerQueue[b][0]);for(var e=this.subscriptions.length,f=0;f<e;f++)this.subscriptions[f].apply(null,this.triggerQueue[b])}this.triggerQueue=[]}},a.prototype.trigger=function(a,b){this.triggerQueue.push([a,b])},a.prototype.triggerEventActivation=function(){this.trigger("event-activation")},a.prototype.triggerRepaint=function(){this.trigger("repaint")},a.prototype.gotoRegion=function(a){this.trigger("goto-region",a)},a.prototype.goHome=function(a){this.trigger("goto-region",
|
|
90
|
-
{x:0,y:0,width:this._width,height:this._height})},a.prototype.zoomTo=function(a,b,e){this.trigger("zoom-to",{point:b,factor:a,stream:e})},a.prototype.zoomIn=function(a){this.trigger("zoom-to",{point:a,factor:.5})},a.prototype.zoomOut=function(a){this.trigger("zoom-to",{point:a,factor:2})},a.prototype.constraintBounds=function(a){this.trigger("constrain-bounds",{immediate:a})},a}(ea),vc={margin:0},wc=function(){function b(a,b){void 0===b&&(b={});this.id=a.map(function(a){return a.id}).join("$$");this.config=
|
|
91
|
-
A(A({},vc),b);this.points=n(5);this.objects=a;this.recalculateBounds()}return b.prototype.recalculateBounds=function(){this.points.set([1,Math.min.apply(Math,D(this.objects.map(function(a){return a.points[1]})))-this.config.margin,Math.min.apply(Math,D(this.objects.map(function(a){return a.points[2]})))-this.config.margin,Math.max.apply(Math,D(this.objects.map(function(a){return a.points[3]})))+this.config.margin,Math.max.apply(Math,D(this.objects.map(function(a){return a.points[4]})))+this.config.margin])},
|
|
92
|
-
b.prototype.getPointsAt=function(a,b,d){return[]},b}(),xc=function(){function b(a,b,d,e){var c=this;void 0===e&&(e=[]);this.ready=!1;this.transformBuffer=n(500);this.lastTarget=n(5);this.zoomBuffer=n(5);this.pendingUpdate=this.logNextRender=!1;this.firstRender=!0;this.mode="explore";this.controllers=[];this.controllersRunning=!1;this.maxScaleFactor=1;this._viewerToWorld={x:0,y:0};this.hooks={useFrame:[],useBeforeFrame:[],useAfterPaint:[],useAfterFrame:[]};this._viewport={x:0,y:0,width:0,height:0};
|
|
93
|
-
this.setViewport=function(a){var b=void 0===a.x?c.target[1]:a.x,d=void 0===a.y?c.target[2]:a.y;a.width?c.target[3]=b+a.width:c.target[3]=c.target[3]-c.target[1]+b;a.height?c.target[4]=d+a.height:c.target[4]=c.target[4]-c.target[2]+d;.01<Math.abs(c.target[1]-b)&&(c.target[1]=b);.01<Math.abs(c.target[2]-d)&&(c.target[2]=d)};this.render=function(a){var b=a-c.lastTime;if(c.fpsLimit&&b<1E3/c.fpsLimit)c.stopId=window.requestAnimationFrame(c.render);else{c.lastTime=a;c.world.flushSubscriptions();c.stopId=
|
|
94
|
-
window.requestAnimationFrame(c.render);c.hook("useFrame",b);a=c.pendingUpdate;var d=c.renderer.pendingUpdate();if(c.firstRender||a||d||c.target[0]!==c.lastTarget[0]||c.target[1]!==c.lastTarget[1]||c.target[2]!==c.lastTarget[2]||c.target[3]!==c.lastTarget[3]||c.target[4]!==c.lastTarget[4]){c.hook("useBeforeFrame",b);c.renderer.beforeFrame(c.world,b,c.target);d=c.getScaleFactor();for(var e=c.renderer.getPointsAt(c.world,c.target,c.aggregate,d),f=e.length,g=0;g<f;g++){var q=e[g][0];a=e[g][1];var p=e[g][2];
|
|
95
|
-
c.renderer.prepareLayer(q);p=p?da(a,p,c.transformBuffer):a;var w=p.length/5;for(a=0;a<w;a++){var r=5*a;0!==p[r]&&(c.renderer.paint(q,a,p[r+1],p[r+2],p[r+3]-p[r+1],p[r+4]-p[r+2]),c.hook("useAfterPaint",q))}}c.renderer.afterFrame(c.world,b,c.target);c.hook("useAfterFrame",b);c.lastTarget[0]=c.target[0];c.lastTarget[1]=c.target[1];c.lastTarget[2]=c.target[2];c.lastTarget[3]=c.target[3];c.lastTarget[4]=c.target[4];c.firstRender=!1;c.pendingUpdate=!1;c.logNextRender=!1;c.renderer.isReady()&&(c.ready=!0,
|
|
96
|
-
c.world.trigger("ready"));c.world.flushSubscriptions();b=c.world.getScheduledUpdates(c.target,d);d=b.length;if(0<d)for(a=0;a<d;a++)(e=b[d-a]())?e.then(function(){c.pendingUpdate=!0}):c.pendingUpdate=!0}}};this.renderer=a;this.world=b;this.target=B.projection(d);this.aggregate=U(1);this.world.addLayoutSubscriber(function(a){"repaint"===a&&(c.pendingUpdate=!0)});this.lastTime=performance.now();this.controllers=e;this.render(this.lastTime);this.startControllers()}return Object.defineProperty(b.prototype,
|
|
97
|
-
"x",{get:function(){return this.target[1]},set:function(a){this.target[1]=a},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"y",{get:function(){return this.target[2]},set:function(a){this.target[2]=a},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"x2",{get:function(){return this.target[3]},set:function(a){this.target[3]=a},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"y2",{get:function(){return this.target[4]},set:function(a){this.target[4]=
|
|
98
|
-
a},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"width",{get:function(){return this.target[3]-this.target[1]},set:function(a){this.target[3]=this.target[1]+a},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"height",{get:function(){return this.target[4]-this.target[2]},set:function(a){this.target[4]=this.target[2]=a},enumerable:!1,configurable:!0}),b.prototype.startControllers=function(){var a;if(!this.controllersRunning){try{for(var b=G(this.controllers),d=
|
|
99
|
-
b.next();!d.done;d=b.next())d.value.start(this)}catch(f){var e={error:f}}finally{try{d&&!d.done&&(a=b.return)&&a.call(b)}finally{if(e)throw e.error;}}this.controllersRunning=!0}},b.prototype.stopControllers=function(){var a;if(this.controllersRunning)try{for(var b=G(this.controllers),d=b.next();!d.done;d=b.next())d.value.stop(this)}catch(f){var e={error:f}}finally{try{d&&!d.done&&(a=b.return)&&a.call(b)}finally{if(e)throw e.error;}}},b.prototype.updateControllerPosition=function(){var a;try{for(var b=
|
|
100
|
-
G(this.controllers),d=b.next();!d.done;d=b.next())d.value.updatePosition(this.x,this.y,this.width,this.height)}catch(f){var e={error:f}}finally{try{d&&!d.done&&(a=b.return)&&a.call(b)}finally{if(e)throw e.error;}}},b.prototype.triggerResize=function(){this.renderer.triggerResize&&this.renderer.triggerResize()},b.prototype.addController=function(a){this.controllers.push(a);this.controllersRunning&&a.start(this)},b.prototype.cover=function(){return this.goHome(!0)},b.prototype.goHome=function(a){if(!(0>=
|
|
101
|
-
this.world.width||0>=this.world.height)){var b=this.getScaleFactor(),d=this.width*b,e=this.height*b;b=this.world.width/d;var f=this.world.height/e;d/=e;(a?b>f:b<f)?(d*=this.world.height,a=(d-this.world.width)/2,this.target[1]=-a,this.target[2]=0,this.target[3]=d-a,this.target[4]=this.world.height):(d=this.world.width/d,a=(d-this.world.height)/2,this.target[1]=0,this.target[2]=-a,this.target[3]=this.world.width,this.target[4]=d-a);this.updateControllerPosition()}},b.prototype.resize=function(a,b,d,
|
|
102
|
-
e){this.target[3]=this.target[1]+b/a*(this.target[3]-this.target[1]);this.target[4]=this.target[2]+e/d*(this.target[4]-this.target[2]);this.goHome();this.renderer.resize(b,e)},b.prototype.getViewport=function(){return this._viewport.x=this.target[1],this._viewport.y=this.target[2],this._viewport.width=this.target[3]-this.target[1],this._viewport.height=this.target[4]-this.target[2],this._viewport},b.prototype.getBounds=function(a){if(this.world.hasActiveZone()){var b=this.world.getActiveZone();if(b){var d=
|
|
103
|
-
this.target[3]-this.target[1]<b.points[3]-b.points[1],e=this.target[4]-this.target[2]<b.points[4]-b.points[2];return{x1:d?b.points[1]-a:b.points[1]+(b.points[3]-b.points[1])/2-(this.target[3]-this.target[1])/2,y1:e?b.points[2]-a:b.points[2]+(b.points[4]-b.points[2])/2-(this.target[4]-this.target[2])/2,x2:d?b.points[3]+a:b.points[1]+(b.points[3]-b.points[1])/2-(this.target[3]-this.target[1])/2,y2:e?b.points[4]+a:b.points[2]+(b.points[4]-b.points[2])/2-(this.target[4]-this.target[2])/2}}}a=this.target[3]-
|
|
104
|
-
this.target[1];b=this.world.width;d=b<a;e=this.target[4]-this.target[2];var f=this.world.height,g=f<e;return{x1:d?b-a:0,x2:d?0:b-this.width,y1:g?f-e:0,y2:g?0:f-this.height}},b.prototype.getScaleFactor=function(){return this.renderer.getScale(this.target[3]-this.target[1],this.target[4]-this.target[2])},b.prototype.getZoomedPosition=function(a,b){b=b.origin;var c=this.getScaleFactor(),e=1/a,f=c*e;1>e?this.world.width/(this.width*c)>this.world.height/(this.height*c)?this.world.width*f<~~(this.width*
|
|
105
|
-
c)&&(a=this.world.width*c/(this.width*c)):this.world.height*f<~~(this.height*c)&&(a=this.world.height*c/(this.height*c)):1<f&&(a=c/1);return da(this.target,ua(a,b?b.x:this.target[1]+(this.target[3]-this.target[1])/2,b?b.y:this.target[2]+(this.target[4]-this.target[2])/2),this.zoomBuffer)},b.prototype.clampRegion=function(a){var b=a.width,d=a.height,e=a.padding,f=void 0===e?20:e,g=this.width,h=this.height;e=a.x-f;a=a.y-f;var k=b+2*f;f=d+2*f;if(b/g<d/h)return b=f/h*g,{x:e-(b-k)/2,y:a,width:b,height:f};
|
|
106
|
-
b=k/g*h;return{x:e,y:a-(b-f)/2,width:k,height:b}},b.prototype.viewerToWorld=function(a,b){var c=this.getScaleFactor();return this._viewerToWorld.x=this.target[1]+a/c,this._viewerToWorld.y=this.target[2]+b/c,this._viewerToWorld},b.prototype.worldToViewer=function(a,b,d,e){a=B.singleBox(d,e,a,b);return Q(a,P(U(this.getScaleFactor()),M(-this.target[1],-this.target[2]))),{x:a[1],y:a[2],width:a[3]-a[1],height:a[4]-a[2],strand:a}},b.prototype.setScale=function(a,b){Q(this.target,ua(a,b?b.x:this.target[1]+
|
|
107
|
-
(this.target[3]-this.target[1])/2,b?b.y:this.target[2]+(this.target[4]-this.target[2])/2))},b.prototype.syncTo=function(a){var b=this,d=this.target;return this.target=a.target,function(){b.target=d}},b.prototype.stop=function(){var a=this;return void 0!==this.stopId&&(window.cancelAnimationFrame(this.stopId),this.stopId=void 0),function(){a.render(performance.now())}},b.prototype.selectZone=function(a){this.world.selectZone(a);this.pendingUpdate=!0},b.prototype.deselectZone=function(){this.world.deselectZone();
|
|
108
|
-
this.pendingUpdate=!0},b.prototype.hook=function(a,b){var c=this.hooks[a].length;if(0!==c)for(var e=0;e<c;e++)this.hooks[a][e](b)},b.prototype.registerHook=function(a,b){var c=this;return this.hooks[a].push(b),function(){c.hooks[a]=c.hooks[a].filter(function(a){return a!==b})}},b.prototype.updateNextFrame=function(){this.pendingUpdate=!0},b}(),yc=mb(function(b,a){var c;b.exports=((c=function(){function a(a){return g.appendChild(a.dom),a}function b(a){for(var b=0;b<g.children.length;b++)g.children[b].style.display=
|
|
109
|
-
b===a?"block":"none";f=a}var f=0,g=document.createElement("div");g.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000";g.addEventListener("click",function(a){a.preventDefault();b(++f%g.children.length)},!1);var h=(performance||Date).now(),k=h,l=0,m=a(new c.Panel("FPS","#0ff","#002")),x=a(new c.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var q=a(new c.Panel("MB","#f08","#201"));return b(0),{REVISION:16,dom:g,addPanel:a,showPanel:b,begin:function(){h=
|
|
110
|
-
(performance||Date).now()},end:function(){l++;var a=(performance||Date).now();if(x.update(a-h,200),a>k+1E3&&(m.update(1E3*l/(a-k),100),k=a,l=0,q)){var b=performance.memory;q.update(b.usedJSHeapSize/1048576,b.jsHeapSizeLimit/1048576)}return a},update:function(){h=this.end()},domElement:g,setMode:b}}).Panel=function(a,b,c){var d=1/0,e=0,f=Math.round,l=f(window.devicePixelRatio||1),m=80*l,x=48*l,q=3*l,p=2*l,w=3*l,r=15*l,n=74*l,u=30*l,C=document.createElement("canvas");C.width=m;C.height=x;C.style.cssText=
|
|
111
|
-
"width:80px;height:48px";var t=C.getContext("2d");return t.font="bold "+9*l+"px Helvetica,Arial,sans-serif",t.textBaseline="top",t.fillStyle=c,t.fillRect(0,0,m,x),t.fillStyle=b,t.fillText(a,q,p),t.fillRect(w,r,n,u),t.fillStyle=c,t.globalAlpha=.9,t.fillRect(w,r,n,u),{dom:C,update:function(g,h){d=Math.min(d,g);e=Math.max(e,g);t.fillStyle=c;t.globalAlpha=1;t.fillRect(0,0,m,r);t.fillStyle=b;t.fillText(f(g)+" "+a+" ("+f(d)+"-"+f(e)+")",q,p);t.drawImage(C,w+l,r,n-l,u,w,r,n-l,u);t.fillRect(w+n-l,r,l,u);
|
|
112
|
-
t.fillStyle=c;t.globalAlpha=.9;t.fillRect(w+n-l,r,l,f((1-g/h)*u))}}},c)}),K=function(){return(K=Object.assign||function(b){for(var a,c=1,d=arguments.length;c<d;c++)for(var e in a=arguments[c])Object.prototype.hasOwnProperty.call(a,e)&&(b[e]=a[e]);return b}).apply(this,arguments)},Ab=function(b,a){return function(c){return Math.max(Math.min(c,a),b)}},ha=function(b){return b%1?Number(b.toFixed(5)):b},Ra=/(-)?(\d[\d\.]*)/g,xa=/(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,
|
|
113
|
-
nb=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))$/i,J={test:function(b){return"number"==typeof b},parse:parseFloat,transform:function(b){return b}},Bb=K(K({},J),{transform:Ab(0,1)}),ia=(K(K({},J),{default:1}),function(b){return{test:function(a){return"string"==typeof a&&a.endsWith(b)&&1===a.split(" ").length},parse:parseFloat,transform:function(a){return""+a+b}}}),zc=ia("deg"),Z=ia("%"),Ac=ia("px"),Bc=ia("vh"),Cc=ia("vw"),Dc=(K(K({},Z),{parse:function(b){return Z.parse(b)/
|
|
114
|
-
100},transform:function(b){return Z.transform(100*b)}}),Ab(0,255)),Cb=function(b){return function(a){if("string"!=typeof a)return a;var c={};a=a.substring(a.indexOf("(")+1,a.lastIndexOf(")")).split(/,\s*/);for(var d=0;4>d;d++)c[b[d]]=void 0!==a[d]?parseFloat(a[d]):1;return c}},Sa=K(K({},J),{transform:function(b){return Math.round(Dc(b))}}),aa,ja={test:function(b){return"string"==typeof b?Ea(b,"rgb"):void 0!==b.red},parse:Cb(["red","green","blue","alpha"]),transform:function(b){var a=b.green,c=b.blue,
|
|
115
|
-
d=b.alpha;d=void 0===d?1:d;b=Sa.transform(b.red);a=Sa.transform(a);c=Sa.transform(c);d=ha(Bb.transform(d));return"rgba("+b+", "+a+", "+c+", "+(void 0===d?1:d)+")"}},ka={test:function(b){return"string"==typeof b?Ea(b,"hsl"):void 0!==b.hue},parse:Cb(["hue","saturation","lightness","alpha"]),transform:function(b){var a=b.lightness,c=b.alpha,d=void 0===c?1:c;c=Math.round(b.hue);b=Z.transform(ha(b.saturation));a=Z.transform(ha(a));d=ha(Bb.transform(d));return"hsla("+c+", "+b+", "+a+", "+(void 0===d?1:
|
|
116
|
-
d)+")"}},Ta=K(K({},ja),{test:function(b){return"string"==typeof b&&Ea(b,"#")},parse:function(b){var a="",c="",d="";return 4<b.length?(a=b.substr(1,2),c=b.substr(3,2),d=b.substr(5,2)):(a=b.substr(1,1),c=b.substr(2,1),d=b.substr(3,1),a+=a,c+=c,d+=d),{red:parseInt(a,16),green:parseInt(c,16),blue:parseInt(d,16),alpha:1}}}),Db=function(b){return"string"==typeof b&&nb.test(b)||void 0!==b.red||void 0!==b.hue},Ec=function(b){return ja.test(b)?ja.parse(b):ka.test(b)?ka.parse(b):Ta.test(b)?Ta.parse(b):b},Fc=
|
|
117
|
-
function(b){return void 0!==b.red?ja.transform(b):void 0!==b.hue?ka.transform(b):b},Gc=function(b){return"number"==typeof b?0:b},ca={test:function(b){if("string"!=typeof b||!isNaN(b))return!1;var a=0,c=b.match(Ra);b=b.match(xa);return c&&(a+=c.length),b&&(a+=b.length),0<a},parse:function(b){var a=b;b=[];var c=a.match(xa);c&&(a=a.replace(xa,"${c}"),b.push.apply(b,c.map(Ec)));a=a.match(Ra);return a&&b.push.apply(b,a.map(J.parse)),b},createTransformer:function(b){var a=b,c=0,d=b.match(xa),e=d?d.length:
|
|
118
|
-
0;if(d)for(b=0;b<e;b++)a=a.replace(d[b],"${c}"),c++;var f=(d=a.match(Ra))?d.length:0;if(d)for(b=0;b<f;b++)a=a.replace(d[b],"${n}"),c++;return function(b){for(var d=a,f=0;f<c;f++)d=d.replace(f<e?"${c}":"${n}",f<e?Fc(b[f]):ha(b[f]));return d}},getAnimatableNone:function(b){var a=ca.parse(b);return ca.createTransformer(b)(a.map(Gc))}},Ua=0,Eb="undefined"!=typeof window&&void 0!==window.requestAnimationFrame?function(b){return window.requestAnimationFrame(b)}:function(b){var a=Date.now(),c=Math.max(0,
|
|
119
|
-
16.7-(a-Ua));Ua=a+c;setTimeout(function(){return b(Ua)},c)};!function(b){b.Read="read";b.Update="update";b.Render="render";b.PostRender="postRender";b.FixedUpdate="fixedUpdate"}(aa||(aa={}));var Va,Fb=1/60*1E3,ya=!0,la=!1,Wa=!1,ma={delta:0,timestamp:0},Gb=[aa.Read,aa.Update,aa.Render,aa.PostRender],Hc=function(b){return la=b},Xa=Gb.reduce(function(b,a){var c=function(a){var b=[],c=[],d=0,h=!1,k=0,l=new WeakSet,m=new WeakSet,x={cancel:function(a){var b=c.indexOf(a);l.add(a);-1!==b&&c.splice(b,1)},
|
|
120
|
-
process:function(e){var f;if(h=!0,b=(f=[c,b])[0],(c=f[1]).length=0,d=b.length)for(k=0;k<d;k++)(f=b[k])(e),!0!==m.has(f)||l.has(f)||(x.schedule(f),a(!0));h=!1},schedule:function(a,e,f){void 0===e&&(e=!1);void 0===f&&(f=!1);var g=(f=f&&h)?b:c;l.delete(a);e&&m.add(a);-1===g.indexOf(a)&&(g.push(a),f&&(d=b.length))}};return x}(Hc);return b.sync[a]=function(a,b,f){void 0===b&&(b=!1);void 0===f&&(f=!1);la||(ya=la=!0,Wa||Eb(Hb));return c.schedule(a,b,f),a},b.cancelSync[a]=function(a){return c.cancel(a)},
|
|
121
|
-
b.steps[a]=c,b},{steps:{},sync:{},cancelSync:{}}),Ic=Xa.steps,Jc=(Xa.sync,Xa.cancelSync,function(b){return Ic[b].process(ma)}),Hb=function(b){la=!1;ma.delta=ya?Fb:Math.max(Math.min(b-ma.timestamp,40),1);ya||(Fb=ma.delta);ma.timestamp=b;Wa=!0;Gb.forEach(Jc);Wa=!1;la&&(ya=!1,Eb(Hb))},Ib=function(b){return function(a){return 1-b(1-a)}},Kc=function(b){return b},Jb=function(b){return function(a){return Math.pow(a,b)}}(2),Kb=Ib(Jb),Lb=function(b){return function(a){return.5>=a?b(2*a)/2:(2-b(2*(1-a)))/2}}(Jb),
|
|
122
|
-
Mb={x:0,y:0,z:0},Nb=function(b,a){return void 0===a&&(a=Mb),180*Math.atan2(a.y-b.y,a.x-b.x)/Math.PI},Ob=function(b,a){var c=!0;return void 0===a&&(a=b,c=!1),function(d){return c?d-b+a:(b=d,c=!0,a)}},za=(Va=function(b,a,c){return Math.min(Math.max(c,b),a)},function(b,a,c){return void 0!==c?Va(b,a,c):function(c){return Va(b,a,c)}}),Ya=function(b){return b.hasOwnProperty("x")&&b.hasOwnProperty("y")},Pb=function(b){return Ya(b)&&b.hasOwnProperty("z")},Za=function(b,a){if(void 0===a&&(a=Mb),"number"==
|
|
123
|
-
typeof b&&"number"==typeof a)return Math.abs(b-a);if(Ya(b)&&Ya(a)){var c=Math.abs(b.x-a.x),d=Math.abs(b.y-a.y);b=Pb(b)&&Pb(a)?Math.abs(b.z-a.z):0;return Math.sqrt(Math.pow(c,2)+Math.pow(d,2)+Math.pow(b,2))}return 0},na=function(b,a,c){return-c*b+c*a+b},Qb=function(){return(Qb=Object.assign||function(b){for(var a,c=1,d=arguments.length;c<d;c++)for(var e in a=arguments[c])Object.prototype.hasOwnProperty.call(a,e)&&(b[e]=a[e]);return b}).apply(this,arguments)},Lc=function(b,a,c){b*=b;return Math.sqrt(Math.max(0,
|
|
124
|
-
c*(a*a-b)+b))},Mc=[Ta,ja,ka],Rb=function(b){return Mc.find(function(a){return a.test(b)})},Sb=function(b,a){var c=Rb(b),d=Rb(a);c.transform;d.transform;var e=c.parse(b),f=d.parse(a),g=Qb({},e),h=c===ka?na:Lc;return function(a){for(var b in g)"alpha"!==b&&(g[b]=h(e[b],f[b],a));return g.alpha=na(e.alpha,f.alpha,a),c.transform(g)}},Nc=function(b,a){return function(c){return a(b(c))}},Tb=function(){for(var b=[],a=0;a<arguments.length;a++)b[a]=arguments[a];return b.reduce(Nc)},Oc=function(b,a){var c=b.slice(),
|
|
125
|
-
d=c.length,e=b.map(function(b,c){return d=b,e=a[c],"number"==typeof d?function(a){return na(d,e,a)}:Db(d)?Sb(d,e):Ub(d,e);var d,e});return function(a){for(var b=0;b<d;b++)c[b]=e[b](a);return c}},Ub=function(b,a){var c=ca.createTransformer(a);b=ob(b);a=ob(a);return Tb(Oc(b.parsed,a.parsed),c)},Aa=function(b,a){return a?1E3/a*b:0},$a=(za(0,1),{}),Pc=function(){function b(a,b){var c=this;this.imagesLoaded=this.imagesPending=0;this.firstMeaningfulPaint=this.frameIsRendering=!1;this.parallelTasks=8;this.frameTasks=
|
|
126
|
-
3;this.isGPUBusy=!1;this.loadingQueueOrdered=!0;this.loadingQueue=[];this.currentTask=Promise.resolve();this.tasksRunning=0;this.averageJobTime=1E3;this.visible=[];this.previousVisible=[];this._worker=function(){if(c.loadingQueue.length&&c.tasksRunning<c.parallelTasks&&c.frameTasks<c.parallelTasks&&!c.isGPUBusy){var a=c.loadingQueue.pop();a&&(c.tasksRunning++,c.frameTasks++,c.currentTask=a.task().then(function(){c.tasksRunning--}).catch(function(){c.tasksRunning--}))}};this._scheduled=0;this._doWork=
|
|
127
|
-
function(){(c.frameIsRendering||0===c.loadingQueue.length&&0===c.tasksRunning&&c._scheduled)&&(clearInterval(c._scheduled),c._scheduled=0);c._worker()};this.canvas=a;this.ctx=a.getContext("2d");this.ctx.imageSmoothingEnabled=!0;this.options=b||{};this.canvas.style.opacity="0";this.canvas.style.transition="opacity .3s";this.options.debug&&(this.stats=new yc,this.stats.showPanel(0),document&&document.body&&document.body.appendChild(this.stats.dom))}return b.prototype.resize=function(){},b.prototype.isReady=
|
|
128
|
-
function(){return this.firstMeaningfulPaint},b.prototype.afterFrame=function(a){this.frameIsRendering=!1;this.imagesPending-=this.imagesLoaded;this.imagesLoaded=0;!this.loadingQueueOrdered&&this.loadingQueue.length>this.parallelTasks&&(this.loadingQueue=this.loadingQueue.sort(function(a,b){return b.distance-a.distance}),this.loadingQueueOrdered=!0);this.previousVisible=this.visible;this.doOffscreenWork();this.options.debug&&this.stats&&this.stats.end()},b.prototype.doOffscreenWork=function(){this.frameTasks=
|
|
129
|
-
0;this.isGPUBusy=!1;this.loadingQueue.length&&(this._worker(),this.loadingQueue.length&&this.tasksRunning<this.parallelTasks&&(this._scheduled||(this._scheduled=setInterval(this._doWork,6))))},b.prototype.getScale=function(a,b){a=this.canvas.width/a;b=this.canvas.height/b;return a<b?b:a},b.prototype.beforeFrame=function(a,b,d){this.options.debug&&this.stats&&this.stats.begin();this.frameIsRendering=!0;this.visible=[];this.options.beforeFrame&&this.options.beforeFrame(b);this.ctx.clearRect(0,0,this.canvas.width,
|
|
130
|
-
this.canvas.height)},b.prototype.paint=function(a,b,d,e,f,g){if(a instanceof wa||a instanceof Pa){this.visible.push(a);try{var c=a.__host.canvas;if(-1===c.indices.indexOf(b)&&this.schedulePaintToCanvas(c,a,b,Za({x:d+f/2,y:e+f/2},{x:this.canvas.width/2,y:this.canvas.height/2})),this.firstMeaningfulPaint)a.crop?a.crop[0]&&this.ctx.drawImage(c.canvas,a.crop[5*b+1],a.crop[5*b+2],a.crop[5*b+3]-a.crop[5*b+1]-1,a.crop[5*b+4]-a.crop[5*b+2]-1,d,e,f+.8,g+.8):this.ctx.drawImage(c.canvas,a.display.points[5*b+
|
|
131
|
-
1],a.display.points[5*b+2],a.display.points[5*b+3]-a.display.points[5*b+1]-1,a.display.points[5*b+4]-a.display.points[5*b+2]-1,d,e,f+.8,g+.8)}catch(k){}}},b.prototype.loadImage=function(a,b,d){if($a[a])b($a[a]);else try{var c=document.createElement("img");c.decoding="async";c.onload=function(){b(c);$a[a]=c;c.onload=null};this.options.crossOrigin&&(c.crossOrigin="anonymous");c.src=a}catch(f){d(f)}},b.prototype.schedulePaintToCanvas=function(a,b,d,e){var c=this;this.imagesPending++;a.indices.push(d);
|
|
132
|
-
b.__host.canvas.loading=!0;var g=b.id+"--"+b.display.scale;this.loadingQueueOrdered=!1;this.loadingQueue.push({id:g,distance:e,task:function(){return new Promise(function(f){if(-1===c.visible.indexOf(b))return c.imagesPending--,a.indices.splice(a.indices.indexOf(d),1),void f();var h=b.getImageUrl(d);c.loadImage(h,function(h){c.loadingQueue.push({id:g,distance:e,task:function(){return new Promise(function(e){c.imagesLoaded++;a.loaded.push(d);a.loaded.length===a.indices.length&&(a.loading=!1);var f=
|
|
133
|
-
b.display.points.slice(5*d,5*d+5);a.canvas.getContext("2d").drawImage(h,f[1],f[2],f[3]-f[1],f[4]-f[2]);c.isGPUBusy=!c.firstMeaningfulPaint&&!0;e()})}});f()},function(b){c.imagesPending--;a.indices.splice(a.indices.indexOf(d),1);console.log("Error loading image",b);f()})})}})},b.prototype.afterPaintLayer=function(a,b){},b.prototype.prepareLayer=function(a){a.__host&&a.__host.canvas||(a instanceof wa||a instanceof Pa)&&this.createImageHost(a)},b.prototype.createImageHost=function(a){var b=document.createElement("canvas");
|
|
134
|
-
b.width=a.display.width;b.height=a.display.height;a.__host=a.__host?a.__host:{};a.__host.canvas={canvas:b,indices:[],loaded:[],loading:!1}},b.prototype.getPointsAt=function(a,b,d,e){return a.getPointsAt(b,d,e)},b.prototype.getViewportBounds=function(a,b,d){if(a=a.getActiveZone()){var c=b[3]-b[1]<a.points[3]-a.points[1],f=b[4]-b[2]<a.points[4]-a.points[2];return{x1:c?a.points[1]-d:a.points[1]+(a.points[3]-a.points[1])/2-(b[3]-b[1])/2,y1:f?a.points[2]-d:a.points[2]+(a.points[4]-a.points[2])/2-(b[4]-
|
|
135
|
-
b[2])/2,x2:c?a.points[3]+d:a.points[1]+(a.points[3]-a.points[1])/2-(b[3]-b[1])/2,y2:f?a.points[4]+d:a.points[2]+(a.points[4]-a.points[2])/2-(b[4]-b[2])/2}}return null},b.prototype.pendingUpdate=function(){var a=0===this.imagesPending&&0===this.loadingQueue.length&&0===this.tasksRunning;return!this.firstMeaningfulPaint&&a?(this.canvas.style.opacity="1",this.firstMeaningfulPaint=a,!0):!!this.options.debug||!a},b}(),Qc=function(){function b(a){var b;this.renderers=[];try{for(var d=G(a),e=d.next();!e.done;e=
|
|
136
|
-
d.next()){var f=e.value;f&&this.renderers.push(f)}}catch(h){var g={error:h}}finally{try{e&&!e.done&&(b=d.return)&&b.call(d)}finally{if(g)throw g.error;}}this.length=this.renderers.length}return b.prototype.afterFrame=function(a,b,d){for(var c=0;c<this.length;c++)this.renderers[c].afterFrame(a,b,d)},b.prototype.afterPaintLayer=function(a,b){for(var c=0;c<this.length;c++)this.renderers[c].afterPaintLayer(a,b)},b.prototype.beforeFrame=function(a,b,d){for(var c=0;c<this.length;c++)this.renderers[c].beforeFrame(a,
|
|
137
|
-
b,d)},b.prototype.triggerResize=function(){for(var a=0;a<this.length;a++){var b=this.renderers[a];b.triggerResize&&b.triggerResize()}},b.prototype.getPointsAt=function(a,b,d,e){return this.renderers[0].getPointsAt(a,b,d,e)},b.prototype.getScale=function(a,b){return this.renderers[0].getScale(a,b)},b.prototype.getViewportBounds=function(a,b,d){return this.renderers[0].getViewportBounds(a,b,d)},b.prototype.isReady=function(){for(var a=0;a<this.length;a++)if(!this.renderers[a].isReady())return!1;return!0},
|
|
138
|
-
b.prototype.paint=function(a,b,d,e,f,g){for(var c=0;c<this.length;c++)this.renderers[c].paint(a,b,d,e,f,g)},b.prototype.pendingUpdate=function(){for(var a=0;a<this.length;a++)if(this.renderers[a].pendingUpdate())return!0;return!1},b.prototype.prepareLayer=function(a){for(var b=0;b<this.length;b++)this.renderers[b].prepareLayer(a)},b.prototype.resize=function(a,b){for(var c=0;c<this.length;c++)this.renderers[c].resize(a,b)},b}(),Rc=function(){function b(){this.autoWidth=!1;this.autoHeight=!0;this.content=
|
|
139
|
-
[];this.viewingDirection="left-to-right";this.columns=4;this.spacing=20;this.reversed=!1;this.padding=20;this.world=zb.withProps({width:0,height:0,viewingDirection:"left-to-right"});this.height=this.width=0}return b.prototype.setViewingDirection=function(a){this.viewingDirection=a},b.prototype.addContent=function(a){var b,d=this;(b=this.content).push.apply(b,D(a.map(function(a){return d.world.addObjectAt(a,{width:0,height:0,x:0,y:0})})))},b.prototype.setWidth=function(a){this.width=a},b.prototype.setHeight=
|
|
140
|
-
function(a){this.height=a},b.prototype.setSpacing=function(a){this.spacing=a},b.prototype.setPadding=function(a){this.padding=a},b.prototype.setRows=function(a){this.autoWidth=!0;this.rows=a},b.prototype.setColumns=function(a){this.autoHeight=!0;this.columns=a},b.prototype.recalculate=function(){if((0!==this.height||0!==this.width)&&0!==this.rows&&0!==this.columns){if(this.autoHeight&&!this.width)throw Error("Cannot set auto height without setting a width");if(this.autoWidth&&!this.height)throw Error("Cannot set auto width without setting a height");
|
|
141
|
-
"left-to-right"!==this.viewingDirection&&"top-to-bottom"!==this.viewingDirection||!this.reversed||(this.reversed=!1,this.content.reverse());"right-to-left"!==this.viewingDirection&&"bottom-to-top"!==this.viewingDirection||this.reversed||(this.reversed=!0,this.content.reverse());var a=this.content.length;if(this.autoWidth&&this.rows){var b=a>this.rows?this.rows:a;var d=Math.ceil(a/b)}else if(this.autoHeight&&this.columns)d=b=a>this.columns?this.columns:a,b=Math.ceil(a/b);else throw Error("Something went wrong.");
|
|
142
|
-
var e=this.autoWidth?-1:this.width-2*this.padding;e=this.autoWidth?-1:(e-this.spacing*(d-1))/d;if(this.autoHeight&&!this.autoWidth){for(var f=0,g=this.padding,h=0;h<b&&f!==a;h++){for(var k=0,l=[],m=0;m<d;m++){var x=this.reversed?a-f:f;if(f===a)break;var q=this.content[x],p=q.width;q=e/(q.width/q.height);l.push([f,e,q,e/p]);q>k&&(k=q);f++}for(m=0;m<d&&l[m];m++){var w=this.world.getPoints();q=l[m][0];x=(p=l[m][1],l[m][2]);var r=l[m][3];p=this.padding+m*(this.spacing+p);var n=g+(k-x)/2,u=w[5*(x=this.reversed?
|
|
143
|
-
a-q:q)+1];w=w[5*x+2];this.world.scaleWorldObject(q,r);u===p&&w===n||this.world.translateWorldObject(x,p-u,n-w)}g+=k+this.spacing}return this.height=g+this.padding,void this.world.resize(this.width,this.height)}this.autoWidth&&this.autoHeight;!this.autoWidth&&this.autoHeight}},b.prototype.getWorld=function(){return this.world},b}(),ab=0,Vb="undefined"!=typeof window&&void 0!==window.requestAnimationFrame?function(b){return window.requestAnimationFrame(b)}:function(b){var a=Date.now(),c=Math.max(0,
|
|
144
|
-
16.7-(a-ab));ab=a+c;setTimeout(function(){return b(ab)},c)},Wb=1/60*1E3,Ba=!0,oa=!1,bb=!1,R={delta:0,timestamp:0},Ca=["read","update","preRender","render","postRender"],Sc=function(b){return oa=b},cb=Ca.reduce(function(b,a){return b[a]=function(a){var b=[],c=[],f=0,g=!1,h=0,k=new WeakSet,l=new WeakSet,m={cancel:function(a){var b=c.indexOf(a);k.add(a);-1!==b&&c.splice(b,1)},process:function(d){var e;if(g=!0,b=(e=[c,b])[0],(c=e[1]).length=0,f=b.length)for(h=0;h<f;h++)(e=b[h])(d),!0!==l.has(e)||k.has(e)||
|
|
145
|
-
(m.schedule(e),a(!0));g=!1},schedule:function(a,d,e){void 0===d&&(d=!1);void 0===e&&(e=!1);var h=(e=e&&g)?b:c;k.delete(a);d&&l.add(a);-1===h.indexOf(a)&&(h.push(a),e&&(f=b.length))}};return m}(Sc),b},{}),H=Ca.reduce(function(b,a){var c=cb[a];return b[a]=function(a,b,f){void 0===b&&(b=!1);void 0===f&&(f=!1);oa||(Ba=oa=!0,bb||Vb(Xb));return c.schedule(a,b,f),a},b},{}),N=Ca.reduce(function(b,a){return b[a]=cb[a].cancel,b},{}),Tc=function(b){return cb[b].process(R)},Xb=function(b){oa=!1;R.delta=Ba?Wb:
|
|
146
|
-
Math.max(Math.min(b-R.timestamp,40),1);Ba||(Wb=R.delta);R.timestamp=b;bb=!0;Ca.forEach(Tc);bb=!1;oa&&(Ba=!1,Vb(Xb))},Yb=function(){function b(a){void 0===a&&(a={});this.props=a}return b.prototype.applyMiddleware=function(a){return this.create(A(A({},this.props),{middleware:this.props.middleware?lb([a],this.props.middleware):[a]}))},b.prototype.pipe=function(){for(var a=[],b=0;b<arguments.length;b++)a[b]=arguments[b];var d=1===a.length?a[0]:Tb.apply(void 0,a);return this.applyMiddleware(function(a){return function(b){return a(d(b))}})},
|
|
147
|
-
b.prototype.while=function(a){return this.applyMiddleware(function(b,d){return function(c){return a(c)?b(c):d()}})},b.prototype.filter=function(a){return this.applyMiddleware(function(b){return function(c){return a(c)&&b(c)}})},b}(),Uc=function(){return function(b,a){var c=this,d=b.middleware;b=b.onComplete;this.isActive=!0;this.update=function(a){c.observer.update&&c.updateObserver(a)};this.complete=function(){c.observer.complete&&c.isActive&&c.observer.complete();c.onComplete&&c.onComplete();c.isActive=
|
|
148
|
-
!1};this.error=function(a){c.observer.error&&c.isActive&&c.observer.error(a);c.isActive=!1};this.observer=a;this.updateObserver=function(b){return a.update(b)};this.onComplete=b;a.update&&d&&d.length&&d.forEach(function(a){return c.updateObserver=a(c.updateObserver,c.complete)})}}(),Zb=function(b,a,c){return new Uc({middleware:a.middleware,onComplete:c},"function"==typeof b?{update:b}:b)},Vc=function(b){function a(){return null!==b&&b.apply(this,arguments)||this}return F(a,b),a.prototype.create=function(b){return new a(b)},
|
|
149
|
-
a.prototype.start=function(a){void 0===a&&(a={});var b=!1,c={stop:function(){}},f=this.props,g=f.init;f=qa(f,["init"]);g=g(Zb(a,f,function(){b=!0;c.stop()}));return c=g?A(A({},c),g):c,a.registerParent&&a.registerParent(c),b&&c.stop(),c},a}(Yb),O=function(b){return new Vc({init:b})},Wc=function(b){function a(a){var c,e,f=b.call(this,a)||this;return f.scheduleVelocityCheck=function(){return H.postRender(f.velocityCheck)},f.velocityCheck=function(a){a.timestamp!==f.lastUpdated&&(f.prev=f.current)},f.prev=
|
|
150
|
-
f.current=a.value||0,c=f.current,"string"===(e=typeof c)||"number"===e?(f.updateCurrent=function(a){return f.current=a},f.getVelocityOfCurrent=function(){return f.getSingleVelocity(f.current,f.prev)}):Array.isArray(f.current)?(f.updateCurrent=function(a){return f.current=lb(a)},f.getVelocityOfCurrent=function(){return f.getListVelocity()}):(f.updateCurrent=function(a){for(var b in f.current={},a)a.hasOwnProperty(b)&&(f.current[b]=a[b])},f.getVelocityOfCurrent=function(){return f.getMapVelocity()}),
|
|
151
|
-
a.initialSubscription&&f.subscribe(a.initialSubscription),f}return F(a,b),a.prototype.create=function(b){return new a(b)},a.prototype.get=function(){return this.current},a.prototype.getVelocity=function(){return this.getVelocityOfCurrent()},a.prototype.update=function(a){b.prototype.update.call(this,a);this.prev=this.current;this.updateCurrent(a);a=R.timestamp;this.timeDelta=R.delta;this.lastUpdated=a;H.postRender(this.scheduleVelocityCheck)},a.prototype.subscribe=function(a){a=b.prototype.subscribe.call(this,
|
|
152
|
-
a);return this.subscribers[this.subscribers.length-1].update(this.current),a},a.prototype.getSingleVelocity=function(a,b){return"number"==typeof a&&"number"==typeof b?Aa(a-b,this.timeDelta):Aa(parseFloat(a)-parseFloat(b),this.timeDelta)||0},a.prototype.getListVelocity=function(){var a=this;return this.current.map(function(b,c){return a.getSingleVelocity(b,a.prev[c])})},a.prototype.getMapVelocity=function(){var a={},b;for(b in this.current)this.current.hasOwnProperty(b)&&(a[b]=this.getSingleVelocity(this.current[b],
|
|
153
|
-
this.prev[b]));return a},a}(function(b){function a(){var a=null!==b&&b.apply(this,arguments)||this;return a.subscribers=[],a}return F(a,b),a.prototype.complete=function(){this.subscribers.forEach(function(a){return a.complete()})},a.prototype.error=function(a){this.subscribers.forEach(function(b){return b.error(a)})},a.prototype.update=function(a){for(var b=0;b<this.subscribers.length;b++)this.subscribers[b].update(a)},a.prototype.subscribe=function(a){var b=this,c=Zb(a,this.props);return this.subscribers.push(c),
|
|
154
|
-
{unsubscribe:function(){var a=b.subscribers.indexOf(c);-1!==a&&b.subscribers.splice(a,1)}}},a.prototype.stop=function(){this.parent&&this.parent.stop()},a.prototype.registerParent=function(a){this.stop();this.parent=a},a}(Yb)),$b=function(b){var a=b.getCount,c=b.getFirst,d=b.getOutput,e=b.mapApi,f=b.setProp,g=b.startActions;return function(b){return O(function(h){var k=h.update,m=h.complete,x=h.error,q=a(b),p=d(),n=function(){return k(p)},r=0,v=g(b,function(a,b){var c=!1;return a.start({complete:function(){c||
|
|
155
|
-
(c=!0,++r===q&&H.update(m))},error:x,update:function(a){f(p,b,a);H.update(n,!1,!0)}})});return Object.keys(c(v)).reduce(function(a,b){return a[b]=e(v,b),a},{})})}},Xc=$b({getOutput:function(){return{}},getCount:function(b){return Object.keys(b).length},getFirst:function(b){return b[Object.keys(b)[0]]},mapApi:function(b,a){return function(){for(var c=[],d=0;d<arguments.length;d++)c[d]=arguments[d];return Object.keys(b).reduce(function(d,f){var e;return b[f][a]&&(c[0]&&void 0!==c[0][f]?d[f]=b[f][a](c[0][f]):
|
|
156
|
-
d[f]=(e=b[f])[a].apply(e,c)),d},{})}},setProp:function(b,a,c){return b[a]=c},startActions:function(b,a){return Object.keys(b).reduce(function(c,d){return c[d]=a(b[d],d),c},{})}}),Yc=$b({getOutput:function(){return[]},getCount:function(b){return b.length},getFirst:function(b){return b[0]},mapApi:function(b,a){return function(){for(var c=[],d=0;d<arguments.length;d++)c[d]=arguments[d];return b.map(function(b,d){if(b[a])return Array.isArray(c[0])?b[a](c[0][d]):b[a].apply(b,c)})}},setProp:function(b,
|
|
157
|
-
a,c){return b[a]=c},startActions:function(b,a){return b.map(function(b,d){return a(b,d)})}}),Zc=function(){for(var b=[],a=0;a<arguments.length;a++)b[a]=arguments[a];return Yc(b)},$c=[Ac,Z,zc,Bc,Cc],db=function(b){return $c.find(function(a){return a.test(b)})},ac=function(b,a){return b(a)},ad=function(b,a,c){var d=a[c[0]].map(function(d,f){f=c.reduce(function(a){return function(b,c){return b[c]=b[c][a],b}}(f),A({},a));return eb(d)(b,f)});return Zc.apply(void 0,d)},bd=function(b,a,c){var d=c[0],e=Object.keys(a[d]).reduce(function(e,
|
|
158
|
-
g){var f=c.reduce(function(a){return function(b,c){return b[c]=b[c][a],b}}(g),A({},a));return e[g]=eb(a[d][g])(b,f),e},{});return Xc(e)},cd=function(b,a){var c=a.from,d=a.to;a=qa(a,["from","to"]);var e=db(c)||db(d),f=e.transform;e=e.parse;return b(A(A({},a),{from:"string"==typeof c?e(c):c,to:"string"==typeof d?e(d):d})).pipe(f)},bc=function(b){return function(a,c){var d=c.from,e=c.to;c=qa(c,["from","to"]);return a(A(A({},c),{from:0,to:1})).pipe(b(d,e))}},dd=bc(Sb),ed=bc(Ub),cc=function(b,a){a=function(a){var b=
|
|
159
|
-
Object.keys(a),c=function(b,c){return void 0!==b&&!a[c](b)};return{getVectorKeys:function(a){return b.reduce(function(b,d){return c(a[d],d)&&b.push(d),b},[])},testVectorProps:function(a){return a&&b.some(function(b){return c(a[b],b)})}}}(a);var c=a.testVectorProps,d=a.getVectorKeys;return function(a){if(!c(a))return b(a);var e=d(a);return eb(a[e[0]])(b,a,e)}},eb=function(b){return"number"==typeof b?ac:Array.isArray(b)?ad:db(b)?cd:Db(b)?dd:ca.test(b)?ed:"object"==typeof b?bd:ac},gd=cc(function(b){var a=
|
|
160
|
-
b.from,c=void 0===a?0:a;a=b.velocity;var d=void 0===a?0:a,e=b.min,f=b.max;a=b.power;var g=void 0===a?.8:a;a=b.timeConstant;var h=void 0===a?700:a;a=b.bounceStiffness;var k=void 0===a?500:a;a=b.bounceDamping;var l=void 0===a?10:a;a=b.restDelta;var m=void 0===a?1:a,x=b.modifyTarget;return O(function(a){var b,q,r=a.update,n=a.complete,u=c;a=function(a){return void 0!==e&&a<e||void 0!==f&&a>f};var v=function(a,c){b&&b.stop();b=a.start({update:r,complete:function(){c?c():n()}})},t=function(a){v(function(a){return void 0===
|
|
161
|
-
a&&(a={}),O(function(b){var c=b.update,d=b.complete;b=a.velocity;var e=void 0===b?0:b;b=a.from;b=void 0===b?0:b;var f=a.to,g=void 0===f?0:f;f=a.stiffness;var h=void 0===f?100:f;f=a.damping;var k=void 0===f?10:f;f=a.mass;var l=void 0===f?1:f;f=a.restSpeed;var m=void 0===f?.01:f;f=a.restDelta;var q=void 0===f?.01:f,p=e?-e/1E3:0,x=0,r=g-b,n=b,L=n,u=H.update(function(a){a=a.delta;x+=a;var b=k/(2*Math.sqrt(h*l)),f=Math.sqrt(h/l)/1E3;if(L=n,1>b){var t=Math.exp(-b*f*x),w=f*Math.sqrt(1-b*b);n=g-t*((p+b*f*
|
|
162
|
-
r)/w*Math.sin(w*x)+r*Math.cos(w*x))}else t=Math.exp(-f*x),n=g-t*(r+(p+f*r)*x);e=Aa(n-L,a);a=Math.abs(g-n)<=q;Math.abs(e)<=m&&a?(c(n=g),N.update(u),d()):c(n)},!0);return{stop:function(){return N.update(u)}}})}(A(A({},a),{stiffness:k,damping:l,restDelta:m})))};if(a(c))t({from:c,velocity:d,to:Math.abs(e-c)<Math.abs(f-c)?e:f});else{var z=g*d+c;void 0!==x&&(z=x(z),x=void 0,d=(z-c)/g);var I=(void 0===(q={from:c,velocity:d,timeConstant:h,power:g,restDelta:m,modifyTarget:x})&&(q={}),O(function(a){var b=a.complete,
|
|
163
|
-
c=a.update;a=q.velocity;var d=q.from;d=void 0===d?0:d;var e=q.power,f=q.timeConstant,g=void 0===f?350:f;f=q.restDelta;var h=void 0===f?.5:f;f=q.modifyTarget;var k=0,l=(void 0===e?.8:e)*(void 0===a?0:a);a=d+l;var m=void 0===f?a:f(a);m!==a&&(l=m-d);var p=H.update(function(a){k+=a.delta;a=-l*Math.exp(-k/g);var d=a>h||a<-h;c(d?m+a:m);d||(N.update(p),b())},!0);return{stop:function(){return N.update(p)}}})),S=void 0;if(a(z)){var L=Math.abs(e-z)<Math.abs(f-z)?e:f,fd=L==e?-1:1;I=I.while(function(a){return d=
|
|
164
|
-
Aa(a-u,R.delta),u=a,0<L-a*fd});S=function(){return t({from:u,to:L,velocity:d})}}v(I,S)}return{stop:function(){return b&&b.stop()}}})},{from:J.test,velocity:J.test,min:J.test,max:J.test,damping:J.test,stiffness:J.test,modifyTarget:function(b){return"function"==typeof b}}),dc=cc(function(b){var a=b.from,c=void 0===a?0:a;a=b.to;var d=void 0===a?1:a;a=b.ease;a=void 0===a?Kc:a;b=b.reverseEase;return void 0!==b&&b&&(a=Ib(a)),O(function(a){var b=a.update;return{seek:function(a){return b(a)}}}).pipe(a,function(a){return na(c,
|
|
165
|
-
d,a)})},{ease:function(b){return"function"==typeof b},from:J.test,to:J.test}),hd=za(0,1),ec=function(b){return void 0===b&&(b={}),O(function(a){var c,d=a.update,e=a.complete;a=b.duration;var f=void 0===a?300:a;a=b.ease;var g=void 0===a?Kb:a;a=b.flip;var h=void 0===a?0:a;a=b.loop;var k=void 0===a?0:a;a=b.yoyo;var l=void 0===a?0:a;a=b.repeatDelay;var m=void 0===a?0:a;a=b.from;var n=void 0===a?0:a;a=b.to;var q=void 0===a?1:a;a=b.elapsed;var p=void 0===a?0:a;a=b.flipCount;var w=void 0===a?0:a;a=b.yoyoCount;
|
|
166
|
-
var r=void 0===a?0:a;a=b.loopCount;var v=void 0===a?0:a,u=dc({from:n,to:q,ease:g}).start(d),C=0,t=!1,z=function(a){var b;void 0===a&&(a=!1);u=dc({from:n=(b=[q,n])[0],to:q=b[1],ease:g,reverseEase:a}).start(d)},I=function(){var a=f-0;C=hd(0===a?1:(p-0)/a);u.seek(C)},S=function(){t=!0;c=H.update(function(a){var b;p+=a.delta;I();!(b=t&&p>f+m)||(!b||k||h||l)&&(p=f-(p-m),k&&v<k?(v++,1):h&&w<h?(w++,z(),1):l&&r<l&&(r++,z(0!=r%2),1))||(N.update(c),e&&H.update(e,!1,!0))},!0)};return S(),{isActive:function(){return t},
|
|
167
|
-
getElapsed:function(){return za(0,f,p)},getProgress:function(){return C},stop:function(){t=!1;c&&N.update(c)},pause:function(){t=!1;c&&N.update(c);return this},resume:function(){return t||S(),this},seek:function(a){return p=na(0,f,a),H.update(I,!1,!0),this},reverse:function(){return z(),this}}})},ba=function(b,a,c){return O(function(d){var e=d.update,f=a.split(" ").map(function(a){return b.addEventListener(a,e,c),a});return{stop:function(){return f.forEach(function(a){return b.removeEventListener(a,
|
|
168
|
-
e,c)})}}})},fc=function(){return{clientX:0,clientY:0,pageX:0,pageY:0,x:0,y:0}},gc=function(b,a){return void 0===a&&(a={clientX:0,clientY:0,pageX:0,pageY:0,x:0,y:0}),a.clientX=a.x=b.clientX,a.clientY=a.y=b.clientY,a.pageX=b.pageX,a.pageY=b.pageY,a},T=[fc()],fb=!1;"undefined"!=typeof document&&ba(document,"touchstart touchmove",{passive:!0,capture:!0}).start(function(b){b=b.touches;fb=!0;for(var a=b.length,c=T.length=0;c<a;c++)T.push(gc(b[c]))});var hc=fc(),ic=!1;"undefined"!=typeof document&&ba(document,
|
|
169
|
-
"mousedown mousemove",!0).start(function(b){ic=!0;gc(b,hc)});var V,Ia,Ja,Ka,ra,tb,sa,La,Ma,Ha,sb,Fa,Ga,qb,rb,id=function(b){return b[0]},jc=function(b){return void 0===b&&(b={}),fb?function(a){a=void 0===a?{}:a;var b=a.preventDefault,d=void 0===b||b;b=a.scale;var e=void 0===b?1:b;a=a.rotate;var f=void 0===a?0:a;return O(function(a){var b=a.update,c={touches:T,scale:e,rotate:f},g=0,m=0,n=1<T.length;if(n){a=T[0];var q=T[1];g=Za(a,q);m=Nb(a,q)}var p=function(){if(n){var a=T[0],d=T[1],h=Za(a,d);a=Nb(a,
|
|
170
|
-
d);c.scale=h/g*e;c.rotate=f+(a-m)}b(c)},w=ba(document,"touchmove",{passive:!d}).start(function(a){(d||1<a.touches.length)&&a.preventDefault();H.update(p)});return fb&&H.update(p),{stop:function(){N.update(p);w.stop()}}})}(b).pipe(function(a){return a.touches},id):function(a){a=(void 0===a?{}:a).preventDefault;var b=void 0===a||a;return O(function(a){var c=a.update,d=function(){return c(hc)},g=ba(document,"mousemove").start(function(a){b&&a.preventDefault();H.update(d)});return ic&&H.update(d),{stop:function(){N.update(d);
|
|
171
|
-
g.stop()}}})}(b)},pb=!1,kc,gb={ie:function(){return E()||V},ieCompatibilityMode:function(){return E()||tb>V},ie64:function(){return gb.ie()&&sb},firefox:function(){return E()||Ia},opera:function(){return E()||Ja},webkit:function(){return E()||Ka},safari:function(){return gb.webkit()},chrome:function(){return E()||ra},windows:function(){return E()||La},osx:function(){return E()||sa},linux:function(){return E()||Ma},iphone:function(){return E()||Fa},mobile:function(){return E()||Fa||Ga||Ha||rb},nativeApp:function(){return E()||
|
|
172
|
-
qb},android:function(){return E()||Ha},ipad:function(){return E()||Ga}},jd=gb,lc=!("undefined"==typeof window||!window.document||!window.document.createElement);lc&&(kc=document.implementation&&document.implementation.hasFeature&&!0!==document.implementation.hasFeature("",""));ub.getEventType=function(){if(jd.firefox())var b="DOMMouseScroll";else{if(lc){var a="onwheel"in document;a||(b=document.createElement("div"),b.setAttribute("onwheel","return;"),a="function"==typeof b.onwheel);b=(!a&&kc&&(a=
|
|
173
|
-
document.implementation.hasFeature("Events.wheel","3.0")),a)}else b=!1;b=b?"wheel":"mousewheel"}return b};var mc={zoomOutFactor:.8,zoomInFactor:1.25,maxZoomFactor:1,minZoomFactor:.05,zoomDuration:300,zoomWheelConstant:18,zoomClamp:.6,panBounceStiffness:120,panBounceDamping:15,panTimeConstant:240,panPower:.1,nudgeDistance:100,panPadding:0,devicePixelRatio:1,enableWheel:!0,enableClickToZoom:!1,onPanInSketchMode:function(){}};let pc="http://iiif.io/api/image/2/level1 http://iiif.io/api/image/2/level2 http://library.stanford.edu/iiif/image-api/compliance.html#level1 http://library.stanford.edu/iiif/image-api/compliance.html#level2 http://library.stanford.edu/iiif/image-api/conformance.html#level1 http://library.stanford.edu/iiif/image-api/conformance.html#level2 http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1 http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2 http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1 http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2 http://iiif.io/api/image/1/level1.json http://iiif.io/api/image/1/profiles/level1.json http://iiif.io/api/image/1/level2.json http://iiif.io/api/image/1/profiles/level2.json http://iiif.io/api/image/2/level1.json http://iiif.io/api/image/2/profiles/level1.json http://iiif.io/api/image/2/level2.json http://iiif.io/api/image/2/profiles/level2.json level1 level2".split(" "),
|
|
174
|
-
nc="http://iiif.io/api/image/2/level0 http://iiif.io/api/image/2/level1 http://iiif.io/api/image/2/level2 http://library.stanford.edu/iiif/image-api/compliance.html#level0 http://library.stanford.edu/iiif/image-api/compliance.html#level1 http://library.stanford.edu/iiif/image-api/compliance.html#level2 http://library.stanford.edu/iiif/image-api/conformance.html#level0 http://library.stanford.edu/iiif/image-api/conformance.html#level1 http://library.stanford.edu/iiif/image-api/conformance.html#level2 http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0 http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1 http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2 http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0 http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1 http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2 http://iiif.io/api/image/1/level0.json http://iiif.io/api/image/1/profiles/level0.json http://iiif.io/api/image/1/level1.json http://iiif.io/api/image/1/profiles/level1.json http://iiif.io/api/image/1/level2.json http://iiif.io/api/image/1/profiles/level2.json http://iiif.io/api/image/2/level0.json http://iiif.io/api/image/2/profiles/level0.json http://iiif.io/api/image/2/level1.json http://iiif.io/api/image/2/profiles/level1.json http://iiif.io/api/image/2/level2.json http://iiif.io/api/image/2/profiles/level2.json level0 level1 level2".split(" "),
|
|
175
|
-
kd=new class{constructor(){this.config={verificationsRequired:1,approximateServices:!0,enableFetching:!0,disableThrottling:!1};this.fetchingCount=0;this.imageServices={};this.knownImageServers={}}setConfig(b){Object.assign(this.config,b)}sample(b,a,c=!0){const d=X(v(b));var e=W(v(b)),f=this.knownImageServers[d];this.imageServices[e]=Object.assign(b,{real:!0});if(f)b=this.verify(b);else{e=this.knownImageServers;f=v(b);var g=b["@context"]||[],h=b.profile;a=a&&b.height?a.height/b.height:1;var k=b.sizes||
|
|
176
|
-
[];{var l=b.width;var m=b.sizes||[];let a=m.length,c=[];for(let b=0;b<a;b++)c.push(l/m[b].width);l=c}b=(e[d]={verifications:0,malformed:!1,root:d,preLoaded:c,sampledId:f,verified:!1,server:null,result:{context:g,sampledProfile:h,resourceServiceRatio:a,sampledSizes:k,sizeRatios:l,sampledTiles:b.tiles||[]}},!0)}return b}preLoad(b,a=!0){this.knownImageServers[b.root]=b;a&&(this.knownImageServers[b.root].malformed=!1,this.knownImageServers[b.root].verifications=this.config.verificationsRequired)}predict(b,
|
|
177
|
-
a,c=!1){a=X(v(b));a=this.knownImageServers[a];if(!a||!a.result||!c&&(a.malformed||a.verifications<this.config.verificationsRequired))return null;c=W(v(b));if(!this.imageServices[c]){var d=this.imageServices,e=a.result.context,f=v(b),g=v(b),h=b.width,k=b.height;var l=a.result.sampledTiles;h=h>k?h:k;k=l.length;var m=[];for(var n=0;n<k;n++){var q=l[n],p=q.scaleFactors[0],w=h/p;let a=[p];for(;w>=q.width;)p*=2,a.push(p),w/=2;m.push(Object.assign(Object.assign({},q),{scaleFactors:a}))}l=m;h=Math.floor(b.width/
|
|
178
|
-
a.result.resourceServiceRatio);k=Math.floor(b.height/a.result.resourceServiceRatio);m=a.result.sizeRatios;n=m.length;q=[];for(p=0;p<n;p++)w=m[p],q.push({width:Math.floor(h/w),height:Math.floor(k/w)});h=q;d[c]={"@context":e,"@id":f,id:g,protocol:"http://iiif.io/api/image",tiles:l,sizes:h,profile:a.result.sampledProfile,height:b.height,width:b.width,real:!1}}return this.imageServices[c]}getThumbnailFromResource(b,a,c=!0,d=[]){return Y(this,void 0,void 0,function*(){const e=yield this.getImageCandidates(b,
|
|
179
|
-
c);return sc(a,[()=>d,()=>e])})}getImageCandidates(b,a=!0){return Y(this,void 0,void 0,function*(){if(a&&b.height&&b.width){var c=xb(b);for(const a of c)c={id:v(a),width:a.width?a.width:b.width,height:a.height?a.height:b.height},yield this.loadService(c)}return rc(b,a,this)})}verify(b){return Y(this,void 0,void 0,function*(){var a=this.predict(b,!1,!0),c=yield this.fetchService(v(b));if(!a)return!1;if(a=a.height===c.height&&a.width===c.width&&a["@context"]===c["@context"]&&function(a,b){if(a.length!==
|
|
180
|
-
b.length)return!1;if(0===a.length&&0===b.length)return!0;const c=a.length;var d=!0;for(var e=0;e<c;e++){var k=a[e];const c=b[e];if(k.width!==c.width||k.height!==c.height){d=!1;break}}if(d)return!0;d=0;for(e=0;e<c;e++)for(k=0;k<c;k++)if(a[e].width===b[k].width&&a[e].height===b[k].height){d++;break}return d===c}(a.sizes||[],c.sizes||[]))c=X(v(b)),this.knownImageServers[c].verifications+=1,this.knownImageServers[c].verifications>=this.config.verificationsRequired&&(this.knownImageServers[c].verified=
|
|
181
|
-
!0);return a})}canLoadSync(b){b="string"==typeof b?b:v(b);const a=W(b);return this.imageServices[a]?!0:(b=this.knownImageServers[X(b)])&&!b.malformed&&b.verifications>=this.config.verificationsRequired}markAsMalformed(b){return Y(this,void 0,void 0,function*(){return this.knownImageServers[X(v(b))].malformed=!0,this.loadService(b,!0)})}fetchService(b,a=!1){return Y(this,void 0,void 0,function*(){const c=W(b);if(this.imageServices[c]&&(!a||this.imageServices[c].real))return this.imageServices[c];if(!this.config.enableFetching)throw Error("Fetching is not enabled");
|
|
182
|
-
const d=yield fetch(c).then(a=>a.json());return!d.id&&d["@id"]&&(d.id=d["@id"]),d.id!==b&&(d.id=b,d["@id"]&&(d["@id"]=b)),this.imageServices[c]=Object.assign(d,{real:!0}),this.imageServices[c]})}loadService(b,a=!1){return Y(this,void 0,void 0,function*(){if(!this.config.disableThrottling)for(;this.fetchingCount>=this.config.verificationsRequired;)yield new Promise(a=>setTimeout(a,500));var c=this.knownImageServers[X(v(b))];if(c&&!c.malformed&&!a&&(yield c.result,c=this.loadServiceSync(b)))return c;
|
|
183
|
-
this.fetchingCount++;c=yield this.fetchService(v(b),a);return this.fetchingCount--,c.real&&this.sample(c,b),c})}loadServiceSync(b){const a=W(v(b));return this.imageServices[a]?this.imageServices[a]:this.predict(b)}};var ld=function(){function b(a,b){var c=this;this.activatedEvents=[];this.eventHandlers=[];this.pointerMoveEvent=void 0;this.pointerEventState={isClicking:!1,isDragging:!1,isPressed:!1,mousedOver:[],itemsBeingDragged:[],mouseDownStart:{x:0,y:0},lastTouches:[]};this._realPointerMove=function(a){c.pointerMoveEvent=
|
|
184
|
-
a};this.onWheelEvent=function(a){a.preventDefault();c.onPointerEvent(a)};this.onTouchEvent=function(a){for(var b=va[a.type],d=[],e=a.touches.length,k=0;k<e;k++){var l=a.touches.item(k);if(l){var m=c.runtime.viewerToWorld(l.pageX-c.bounds.left,l.pageY-c.bounds.top);d.push({id:l.identifier,x:m.x,y:m.y})}}c.assignToEvent(a,d[0].x,d[0].y);"onTouchEnd"!==b?(c.pointerEventState.lastTouches=d,a.atlasTouches=d,c.runtime.world.propagateTouchEvent(b,a,d)):(a.atlasTouches=[],c.runtime.world.propagateTouchEvent(b,
|
|
185
|
-
a,c.pointerEventState.lastTouches),c.pointerEventState.lastTouches=[])};this.onPointerEvent=function(a){var b=va[a.type];if(b&&-1!==c.runtime.world.activatedEvents.indexOf(b)){var d=c.runtime.viewerToWorld(a.clientX-c.bounds.left,a.clientY-c.bounds.top),e=d.x;d=d.y;c.assignToEvent(a,e,d);c.runtime.world.propagatePointerEvent(b,a,e,d)}};this.onPointerDown=function(a){c.pointerEventState.isPressed=!0;c.pointerEventState.isClicking=!0;c.pointerEventState.mouseDownStart.x=a.pageX;c.pointerEventState.mouseDownStart.y=
|
|
186
|
-
a.pageY;setTimeout(function(){c.runtime&&(c.pointerEventState.isClicking=!1)},200);setTimeout(function(){if(c.runtime&&c.pointerEventState.isPressed&&!c.pointerEventState.isDragging){var b=c.runtime.viewerToWorld(c.pointerEventState.mouseDownStart.x-c.bounds.left,c.pointerEventState.mouseDownStart.y-c.bounds.top);c.pointerEventState.isDragging=!0;c.pointerEventState.itemsBeingDragged=c.runtime.world.propagatePointerEvent("onDragStart",a,b.x,b.y)}},600);c.onPointerEvent(a)};this.onPointerUp=function(a){var b;
|
|
187
|
-
if(c.pointerEventState.isClicking){var d=c.runtime.viewerToWorld(a.pageX-c.bounds.left,a.pageY-c.bounds.top),e=d.x;d=d.y;c.assignToEvent(a,e,d);c.runtime.world.propagatePointerEvent("onClick",a,e,d)}if(c.pointerEventState.isDragging){try{for(var k=G(c.pointerEventState.itemsBeingDragged),l=k.next();!l.done;l=k.next())l.value.dispatchEvent("onDragEnd",a)}catch(x){var m={error:x}}finally{try{l&&!l.done&&(b=k.return)&&b.call(k)}finally{if(m)throw m.error;}}c.pointerEventState.isDragging=!1}c.pointerEventState.isClicking=
|
|
188
|
-
!1;c.pointerEventState.isPressed=!1;c.pointerEventState.itemsBeingDragged=[];c.onPointerEvent(a)};this.onPointerMove=function(a){var b,d,e;c.pointerMoveEvent=void 0;var k=c.runtime.viewerToWorld(a.pageX-c.bounds.left,a.pageY-c.bounds.top),l=k.x;k=k.y;c.assignToEvent(a,l,k);c.runtime.world.propagatePointerEvent("onPointerMove",a,l,k);var m,n,q,p;k=c.runtime.world.propagatePointerEvent("onMouseMove",a,l,k);var w=[];l=[];try{for(var r=G(k),v=r.next();!v.done;v=r.next()){var u=v.value;w.push(u.id);l.push(u);
|
|
189
|
-
-1===c.pointerEventState.mousedOver.indexOf(u)&&(u.dispatchEvent("onMouseEnter",a),u.dispatchEvent("onPointerEnter",a),u.dispatchEvent("onMouseOver",a),u.dispatchEvent("onPointerOver",a))}}catch(pa){var C={error:pa}}finally{try{v&&!v.done&&(b=r.return)&&b.call(r)}finally{if(C)throw C.error;}}try{for(var t=G(c.pointerEventState.mousedOver),z=t.next();!z.done;z=t.next()){var I=z.value;-1===w.indexOf(I.id)&&(I.dispatchEvent("onMouseLeave",a),I.dispatchEvent("onPointerLeave",a),I.dispatchEvent("onMouseOut",
|
|
190
|
-
a),I.dispatchEvent("onPointerOut",a))}}catch(pa){var S={error:pa}}finally{try{z&&!z.done&&(d=t.return)&&d.call(t)}finally{if(S)throw S.error;}}if(c.pointerEventState.isDragging)try{for(var L=G(c.pointerEventState.itemsBeingDragged),y=L.next();!y.done;y=L.next())y.value.dispatchEvent("onDrag",a)}catch(pa){var B={error:pa}}finally{try{y&&!y.done&&(e=L.return)&&e.call(L)}finally{if(B)throw B.error;}}c.pointerEventState.isPressed&&!c.pointerEventState.isDragging&&(m=c.pointerEventState.mouseDownStart,
|
|
191
|
-
n={x:a.pageX,y:a.pageY},q=Math.abs(m.x-n.x),p=Math.abs(m.y-n.y),50<Math.sqrt(Math.pow(q,2)+Math.pow(p,2)))&&(C=c.runtime.viewerToWorld(c.pointerEventState.mouseDownStart.x-c.bounds.left,c.pointerEventState.mouseDownStart.y-c.bounds.top),c.pointerEventState.isDragging=!0,c.pointerEventState.itemsBeingDragged=c.runtime.world.propagatePointerEvent("onDragStart",A(A({},a),{atlas:{x:C.x,y:C.y}}),C.x,C.y));c.pointerEventState.mousedOver=l};this.element=a;this.runtime=b;this.unsubscribe=b.world.addLayoutSubscriber(this.layoutSubscriber.bind(this));
|
|
192
|
-
this.bounds=a.getBoundingClientRect();b.registerHook("useFrame",function(){c.pointerMoveEvent&&b.updateNextFrame()});b.registerHook("useBeforeFrame",function(){c.pointerMoveEvent&&c.onPointerMove(c.pointerMoveEvent)});this.activateEvents()}return b.prototype.updateBounds=function(){this.bounds=this.element.getBoundingClientRect()},b.prototype.layoutSubscriber=function(a){"event-activation"===a&&this.activateEvents()},b.prototype.assignToEvent=function(a,c,d){b.eventPool.atlas.x=c;b.eventPool.atlas.y=
|
|
193
|
-
d;a.atlas=b.eventPool.atlas},b.prototype.activateEvents=function(){this.element.addEventListener("pointermove",this._realPointerMove);this.element.addEventListener("pointerup",this.onPointerUp);this.element.addEventListener("pointerdown",this.onPointerDown);this.element.addEventListener("mousedown",this.onPointerEvent);this.element.addEventListener("mouseup",this.onPointerEvent);this.element.addEventListener("pointercancel",this.onPointerEvent);this.element.addEventListener("wheel",this.onWheelEvent);
|
|
194
|
-
this.element.addEventListener("touchstart",this.onTouchEvent);this.element.addEventListener("touchcancel",this.onTouchEvent);this.element.addEventListener("touchend",this.onTouchEvent);this.element.addEventListener("touchmove",this.onTouchEvent)},b.prototype.normalizeEventName=function(a){return a.startsWith("on")?a.slice(2).toLowerCase():a.toLowerCase()},b.prototype.stop=function(){var a;this.unsubscribe();try{for(var b=G(this.eventHandlers),d=b.next();!d.done;d=b.next()){var e=kb(d.value,2),f=e[1];
|
|
195
|
-
this.element.removeEventListener(this.normalizeEventName(e[0]),f)}}catch(h){var g={error:h}}finally{try{d&&!d.done&&(a=b.return)&&a.call(b)}finally{if(g)throw g.error;}}},b.eventPool={atlas:{x:0,y:0}},b}();y.BrowserEventManager=ld;y.CanvasRenderer=Pc;y.CompositeRenderer=Qc;y.CompositeResource=uc;y.GridBuilder=Rc;y.Runtime=xc;y.SingleImage=wa;y.TiledImage=Pa;y.World=zb;y.WorldObject=Qa;y.Zone=wc;y.defaultConfig=mc;y.fromImage=function(b){var a=b.src,c=b.target,d=c?c.width:b.width;c=c?c.height:b.height;
|
|
196
|
-
return new Qa({id:a,height:c,width:d,layers:[wa.fromImage(a,{height:c,width:d},{width:b.width,height:b.height})]})};y.getTileFromImageService=function(b,a,c){return ib(this,void 0,void 0,function(){var d;return jb(this,function(e){switch(e.label){case 0:return[4,kd.loadService({id:b,width:a,height:c})];case 1:return d=e.sent(),[2,{id:(f=d,f.id||f["@id"]),width:a,height:c,imageService:d,thumbnail:void 0}]}var f})})};y.popmotionController=function(b){void 0===b&&(b={});var a=void 0;return{updatePosition:function(b,
|
|
197
|
-
d,e,f){a&&(a.stop(),a.update({x:b,y:d,width:e,height:f}))},start:function(c){function d(a){void 0===a&&(a=!1);var b=c.getBounds(p),d=b.x1,e=b.x2,f=b.y1;b=b.y2;if(a)return u.stop(),void u.update({x:d,y:f});gd({min:{x:d,y:f},max:{x:e,y:b},bounceStiffness:l,bounceDamping:m,timeConstant:a?0:n,power:q,restSpeed:10,restDelta:.5,from:u.get(),velocity:u.getVelocity()}).start(u)}var e=A(A({},mc),b),f=e.zoomDuration,g=e.zoomWheelConstant,h=e.zoomClamp,k=e.minZoomFactor,l=e.panBounceStiffness,m=e.panBounceDamping,
|
|
198
|
-
n=e.panTimeConstant,q=e.panPower,p=(e.nudgeDistance,e.panPadding),w=e.enableWheel,r=(e.enableClickToZoom,e.devicePixelRatio),v=e.onPanInSketchMode,u=function(a,b){return new Wc({value:a,initialSubscription:b})}({x:c.target[1],y:c.target[2],width:c.target[3]-c.target[1],height:c.target[4]-c.target[2]},c.setViewport);a=u;c.world.activatedEvents.push("onMouseDown","onTouchStart");var y=!1;ba(c.world,"mousedown touchstart").start(function(a){var b=c.getScaleFactor();"explore"===c.mode?(a=u.get(),function(a){void 0===
|
|
199
|
-
a&&(a={});var b=a.x,c=a.y;a=qa(a,["x","y"]);if(void 0!==b||void 0!==c){var d=Ob(b||0),e=Ob(c||0),f={x:0,y:0};return jc(a).pipe(function(a){return f.x=d(a.x),f.y=e(a.y),f})}return jc(a)}({x:-a.x*b/r,y:-a.y*b/r}).pipe(function(a){return{x:a.x*r,y:a.y*r}}).pipe(function(a){return{x:-a.x/b,y:-a.y/b}}).start(u)):y||(y=!0,v())});c.world.activatedEvents.push("onMouseUp","onTouchEnd");ba(c.world,"mouseup touchend").start(function(){c.world.constraintBounds()});var t,z=!1;c.world.activatedEvents.push("onTouchStart");
|
|
200
|
-
c.world.addEventListener("touchstart",function(a){"explore"===c.mode&&(z=!0)});window.addEventListener("touchend",function(a){z&&(c.world.constraintBounds(),z=!1)});c.world.activatedEvents.push("onMouseDown");c.world.addEventListener("mousedown",function(a){z=!0});window.addEventListener("mouseup",function(a){z&&("explore"===c.mode&&c.world.constraintBounds(),z=!1)});w&&(c.world.activatedEvents.push("onWheel"),c.world.addEventListener("wheel",function(a){var b=1+ub(a).spinY/g;c.world.zoomTo(za(1-
|
|
201
|
-
h,1+h,b),a.atlas,!0)}));c.world.addLayoutSubscriber(function(a,b){"zone-changed"===a&&d(!0);if("zoom-to"===a){var e=b.factor,g=b.point,h=b.stream;void 0===h&&(h=!1);var l=c.getViewport();e=c.getZoomedPosition(e,{origin:g,minZoomFactor:k});t&&t.stop();t=ec({from:l,to:Object.create({x:e[1],y:e[2],width:e[3]-e[1],height:e[4]-e[2]}),duration:f,ease:h?Kb:Lb}).start(u)}if("goto-region"===a&&b){h=c.clampRegion(b);l=c.getViewport();if(b.immediate)return u.stop(),void u.update(h);ec({from:l,to:h,duration:b.nudge?
|
|
202
|
-
f:1E3,ease:Lb}).start(u)}"constrain-bounds"===a&&b&&d(b.immediate)})},stop:function(){}}};Object.defineProperty(y,"__esModule",{value:!0})})
|
|
15
|
+
***************************************************************************** */var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(t,i)};function i(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}var n=function(){return(n=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function r(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function o(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{h(n.next(t))}catch(t){o(t)}}function a(t){try{h(n.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}h((n=n.apply(t,e||[])).next())}))}function s(t,e){var i,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],n=0}finally{i=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function a(t){var e="function"==typeof Symbol&&Symbol.iterator,i=e&&t[e],n=0;if(i)return i.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function h(t,e){var i="function"==typeof Symbol&&t[Symbol.iterator];if(!i)return t;var n,r,o=i.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(t){r={error:t}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return s}function l(t,e,i){if(i||2===arguments.length)for(var n,r=0,o=e.length;r<o;r++)!n&&r in e||(n||(n=Array.prototype.slice.call(e,0,r)),n[r]=e[r]);return t.concat(n||Array.prototype.slice.call(e))}const u=(t,e,i)=>{const n=t.length,r=i||d(n);for(let i=0;i<n;i++)r[i]=i%5==0?t[i+1]<e[3]&&t[i+3]>e[1]&&t[i+2]<e[4]&&t[i+4]>e[2]?1:0:t[i];return r};function d(t,e,i){return new Float32Array(t,e,i)}const c=(t,e,i)=>{const n=i||d(9);return n[0]=t[0]*e[0]+t[1]*e[3]+t[2]*e[6],n[1]=t[0]*e[1]+t[1]*e[4]+t[2]*e[7],n[2]=t[0]*e[2]+t[1]*e[5]+t[2]*e[8],n[3]=t[3]*e[0]+t[4]*e[3]+t[5]*e[6],n[4]=t[3]*e[1]+t[4]*e[4]+t[5]*e[7],n[5]=t[3]*e[2]+t[4]*e[5]+t[5]*e[8],n[6]=t[6]*e[0]+t[7]*e[3]+t[8]*e[6],n[7]=t[6]*e[1]+t[7]*e[4]+t[8]*e[7],n[8]=t[6]*e[2]+t[7]*e[5]+t[8]*e[8],n};class p{constructor(t){this.index=0,this.length=t,this.points=d(this.length)}static grid(t=1,e=1){return new p(5*t*e)}static point(t,e){const i=d(5);return i[0]=1,i[1]=t,i[2]=e,i[3]=t,i[4]=e,i}static positionPair(t){const e=d(5);return e[0]=1,e[1]=t.x1,e[2]=t.y1,e[3]=t.x2,e[4]=t.y2,e}static projection(t){return p.singleBox(t.width,t.height,t.x,t.y)}static singleBox(t,e,i=0,n=0){const r=d(5);return r[0]=1,r[1]=i,r[2]=n,r[3]=t+i,r[4]=e+n,r}row(t){return t(this)}addPoints(t,e,i,n){return this.points[this.index]=1,this.points[1+this.index]=t,this.points[2+this.index]=e,this.points[3+this.index]=i,this.points[4+this.index]=n,this.index+=5,this}addBox(t,e,i,n){return this.addPoints(t,e,t+i,e+n),this}build(){return this.points}}const f=(t,e)=>{const i=t.length;for(let n=0;n<i;n++)t[n]=n%5==0?e[6]*t[n+1]+e[7]*t[n+2]+e[8]*t[n]:n%5%2==1?e[0]*t[n]+e[1]*t[n+1]+e[2]:e[3]*t[n-1]+e[4]*t[n]+e[5];return t},g=t=>{const e=d(9);return e[0]=t,e[4]=t,e[8]=1,e},v=(t,e)=>{const i=d(9);return i[0]=1,i[2]=t,i[4]=1,i[5]=e,i[8]=1,i},y=(t,e,i)=>c(v((1-t)*e,(1-t)*i),g(t)),m=(t,e,i)=>{const n=t.length,r=i&&i.length>=n?i.slice(0,n):d(n);for(let i=0;i<n;i++)r[i]=i%5==0?e[6]*t[i+1]+e[7]*t[i+2]+e[8]*t[i]:i%5%2==1?e[0]*t[i]+e[1]*t[i+1]+e[2]:e[3]*t[i-1]+e[4]*t[i]+e[5];return r};let w=(t=21)=>{let e="",i=crypto.getRandomValues(new Uint8Array(t));for(;t--;){let n=63&i[t];e+=n<36?n.toString(36):n<62?(n-26).toString(36).toUpperCase():n<63?"_":"-"}return e};var x=["onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onTouchCancel","onTouchEnd","onTouchMove","onTouchStart","onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut","onScroll","onWheel","onClick","onDragStart","onDragEnd","onDragEnter","onDragExit","onDrag","onDragOver"];var b=x.reduce((function(t,e){return t[e.slice(2).toLowerCase()]=e,t[e]=e,t}),{}),P=function(){function t(){var t=this;this.__revision=0,this.__state={},this.scale=1,this.layers=[],this.time=[],this.addEventListener=function(e,i,n){var r=b[e];if(!t.eventHandlers[r])throw new Error("Unknown event ".concat(r));-1===t.eventHandlers[r].indexOf(i)&&t.eventHandlers[r].push(i)},this.removeEventListener=function(e,i){var n=b[e];t.eventHandlers[n]?-1!==t.eventHandlers[n].indexOf(i)&&(t.eventHandlers[n]=t.eventHandlers[n].filter((function(t){return t!==i}))):console.warn("Unknown event ".concat(n))},this.id=this.__id=w(),this.eventHandlers=x.reduce((function(t,e){return t[e]=[],t}),{})}return t.prototype.getObjectsAt=function(t){return[]},t.prototype.getAllPointsAt=function(t,e,i){return[]},t.prototype.getScheduledUpdates=function(t,e){return null},t.prototype.dispatchEvent=function(t,e){var i=this.eventHandlers[t],n=i?i.length:0,r=!1;if(n)for(var o=0;o<n;o++)try{i[o](e),r=!0}catch(e){console.error(t,e)}return r},Object.defineProperty(t.prototype,"x",{get:function(){return this.points[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this.points[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this.points[3]-this.points[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.points[4]-this.points[2]},enumerable:!1,configurable:!0}),t.prototype.translate=function(t,e){f(this.points,v(t,e))},t.prototype.atScale=function(t){f(this.points,y(t,this.x,this.y)),this.scale*=t},t.prototype.transform=function(t){f(this.points,t)},t.prototype.applyProps=function(t){this.__revision++},t.prototype.appendChild=function(t){},t.prototype.removeChild=function(t){},t.prototype.insertBefore=function(t,e){},t.prototype.hideInstance=function(){},t}(),S=function(t){function e(e){var i=t.call(this)||this;if(i.type="spacial-content",i.style={opacity:1},e){var n=e.scale||1;i.id=e.id||e.uri,i.uri=e.uri,i.points=p.singleBox(e.width,e.height,e.x,e.y),i.display={scale:n,width:e.width/n,height:e.height/n,points:1!==n?p.singleBox(e.width/n,e.height/n):i.points}}else i.id="",i.uri="",i.display={scale:1,width:0,height:0,points:d(5)},i.points=d(5);return i}return i(e,t),e.prototype.applyProps=function(t){var e=t.display?t.display.width:t.target.width,i=t.target.width/e;this.id=t.id||t.uri,this.uri=t.uri,this.points.set(p.singleBox(t.target.width,t.target.height,t.target.x,t.target.y)),t.style&&void 0!==t.style.opacity&&(this.style.opacity=t.style.opacity),this.display.scale=i,this.display.width=t.target.width/i,this.display.height=t.target.height/i,this.display.points=1!==i?p.singleBox(t.target.width/i,t.target.height/i):this.points},e.prototype.getAllPointsAt=function(t,e,i){return[[this,this.crop||this.points,e]]},e.fromSvg=function(t,i,n,r){return e.fromImage("data:image/svg+xml;base64,"+btoa(t),i,n,r)},e.fromImage=function(t,i,n,r){var o=new e;return o.applyProps({uri:t,id:r,display:n,target:i}),o},e.prototype.getImageUrl=function(){return this.uri},e}(P),O=function(t){function e(e){var i=t.call(this)||this;if(i.type="spacial-content",i.getTexture=function(){return{source:void 0,hash:-1}},e){var n=e.scale||1;i.id=e.id||e.uri,i.uri=e.uri,i.points=p.singleBox(e.width,e.height),i.display={scale:n,width:e.width/n,height:e.height/n,points:1!==n?p.singleBox(e.width/n,e.height/n):i.points}}else i.id="",i.uri="",i.display={scale:1,width:0,height:0,points:d(5)},i.points=d(5);return i}return i(e,t),e.prototype.applyProps=function(t){var e=t.display?t.display.width:t.target.width,i=t.target.width/e;this.id=t.id,this.points.set(p.singleBox(t.target.width,t.target.height)),this.display.scale=i,this.display.width=t.target.width/i,this.display.height=t.target.height/i,this.getTexture=t.getTexture,this.display.points=1!==i?p.singleBox(t.target.width/i,t.target.height/i):this.points},e.prototype.getAllPointsAt=function(t,e,i){return[[this,this.points,e]]},e}(P);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function E(t,e,i){return t(i={path:e,exports:{},require:function(t,e){return _(null==e&&i.path)}},i.exports),i.exports}function _(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var M=function(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}(E((function(t,e){!function(i){var n=function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Memoize=function(t){return function(e,i,r){if(null!=r.value)r.value=n(r.value,t);else{if(null==r.get)throw"Only put a Memoize() decorator on a method or get accessor.";r.get=n(r.get,t)}}};var i=0;function n(t,e){var n=++i;return function(){for(var i=[],r=0;r<arguments.length;r++)i[r]=arguments[r];var o,s="__memoized_value_"+n,a="__memoized_map_"+n;if(e||i.length>0){this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:new Map});var h=this[a],l=void 0;l=e?e.apply(this,i):i[0],h.has(l)?o=h.get(l):(o=t.apply(this,i),h.set(l,o))}else this.hasOwnProperty(s)?o=this[s]:(o=t.apply(this,i),Object.defineProperty(this,s,{configurable:!1,enumerable:!1,writable:!1,value:o}));return o}}}(0,e);void 0!==n&&(t.exports=n)}()})));function T(t,e){return Math.abs(t-e)}var F=function(t){function e(e){var i,n,r=t.call(this)||this;return r.type="spacial-content",r.style={opacity:1},r.id=(i=e.url,n=i.length,i.indexOf("/info.json")===n-10?i.slice(0,-10):i),r.points=e.displayPoints?e.displayPoints:m(e.points,g(e.scaleFactor)),r.tileWidth=e.tileWidth,r.display={width:e.width/e.scaleFactor,height:e.height/e.scaleFactor,points:e.points,scale:e.scaleFactor},r}return i(e,t),e.prototype.applyProps=function(t){t.style&&void 0!==t.style.opacity&&(this.style.opacity=t.style.opacity),t.service!==this.service&&(this.service=t.service)},e.fromTile=function(t,i,n,r,o){n.height=n.height?n.height:n.width;for(var s=Math.ceil(i.width/r),a=Math.ceil(i.height/r),h=Math.ceil(s/n.width),l=Math.ceil(a/n.height),u=p.grid(h,l),d=p.grid(h,l),c=0;c<l;c++)for(var f=0;f<h;f++){var g=f*n.width,v=c*n.height;d.addPoints(g*r,v*r,f===h-1?i.width:(g+n.width)*r,c===l-1?i.height:(v+n.height)*r),u.addPoints(g,v,f===h-1?s:g+n.width,c===l-1?a:v+n.height)}var y=new e({url:t,scaleFactor:r,points:u.build(),displayPoints:d.build(),width:i.width,height:i.height,tileWidth:n.width});return y.applyProps({service:o}),y},e.prototype.getImageUrl=function(t){var e=this.points.slice(5*t,5*t+5),i=e[3]-e[1],n=e[4]-e[2],r=Math.ceil(i/this.display.scale);return"".concat(this.id,"/").concat(e[1],",").concat(e[2],",").concat(i,",").concat(n,"/").concat(r>this.tileWidth?this.tileWidth:r,",/0/default.jpg")},e.prototype.getAllPointsAt=function(t,e,i){return[[this,u(this.points,t),e]]},e.prototype.transform=function(t){f(this.points,t)},e.prototype.getScheduledUpdates=function(t,e){return null},function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);o>3&&s&&Object.defineProperty(e,i,s)}([M.Memoize(),r("design:type",Function),r("design:paramtypes",[Number]),r("design:returntype",String)],e.prototype,"getImageUrl",null),e}(P),j=function(t){function e(e){var i=t.call(this)||this;return i.images=[],i.allImages=[],i.scaleFactors=[],i.aggregateBuffer=d(9),i.isFullyLoaded=!1,i.maxScaleFactor=0,i._scheduleSortByScales=!1,i._sortByScales=function(){var t,e;i._scheduleSortByScales=!1,i.allImages.sort((function(t,e){return e.display.width-t.display.width})),i.images=[];var n=.1;try{for(var r=a(i.allImages),o=r.next();!o.done;o=r.next()){var s=o.value;if((!(s.display.width<i.renderOptions.minSize&&s.display.height<i.renderOptions.minSize)||s.priority)&&(!(s instanceof S&&(s.display.width>i.renderOptions.maxImageSize||s.display.height>i.renderOptions.maxImageSize))||s.priority)){if(Math.abs(s.display.scale-n)<.25||s.priority){var u=i.images.pop();u&&(u instanceof S||u.priority)?(s.priority&&i.images.push(s),i.images.push(u)):s&&i.images.push(s)}else s&&i.images.push(s);n=s.display.scale}}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}0===i.images.length&&(i.images=l([],h(i.allImages),!1)),i.scaleFactors=i.images.map((function(t){return t.display.scale})),i.maxScaleFactor=Math.max.apply(Math,l([],h(i.scaleFactors),!1))},i.loadFullResource=function(){return o(i,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return this.isFullyLoaded?[2]:this.lazyLoader?(this.isFullyLoaded=!0,[4,this.lazyLoader()]):[3,2];case 1:t=e.sent(),this.addImages(t),e.label=2;case 2:return[2]}}))}))},i.fallback=[i.loadFullResource],i.id=e.id,i.points=p.singleBox(e.width,e.height),i.lazyLoader=e.loadFullImages,e.loadFullImages||(i.isFullyLoaded=!0),i.display={points:p.singleBox(e.width,e.height),height:e.height,width:e.width,scale:1},i.renderOptions=n({renderSmallestFallback:!0,renderLayers:2,minSize:256,maxImageSize:1024,quality:1},e.renderOptions||{}),i.addImages(e.images),i}return i(e,t),e.prototype.applyProps=function(t){void 0!==t.renderSmallestFallback&&t.renderSmallestFallback!==this.renderOptions.renderSmallestFallback&&(this.renderOptions.renderSmallestFallback=t.renderSmallestFallback),void 0!==t.renderLayers&&t.renderLayers!==this.renderOptions.renderLayers&&(this.renderOptions.renderLayers=t.renderLayers),void 0!==t.minSize&&t.minSize!==this.renderOptions.minSize&&(this.renderOptions.minSize=t.minSize),void 0!==t.maxImageSize&&t.maxImageSize!==this.renderOptions.maxImageSize&&(this.renderOptions.maxImageSize=t.maxImageSize),void 0!==t.quality&&t.quality!==this.renderOptions.quality&&(this.renderOptions.quality=t.quality)},e.prototype.appendChild=function(t){this.addImages([t])},e.prototype.removeChild=function(t){-1!==this.images.indexOf(t)&&(this.images=this.images.filter((function(e){return e!==t})),this.sortByScales())},e.prototype.insertBefore=function(t,e){this.addImages([t])},e.prototype.hideInstance=function(){},e.prototype.addImages=function(t){var e,i,n;try{for(var r=a(t),o=r.next();!o.done;o=r.next()){o.value.__parent=this}}catch(t){e={error:t}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(e)throw e.error}}(n=this.allImages).push.apply(n,l([],h(t.filter(Boolean)),!1)),this.sortByScales()},e.prototype.sortByScales=function(){this._scheduleSortByScales=!0},e.prototype.getScheduledUpdates=function(t,e){return this._scheduleSortByScales&&this._sortByScales(),this.isFullyLoaded?null:e>1/this.maxScaleFactor?this.fallback:null},e.prototype.getAllPointsAt=function(t,e,i){if(0===this.images.length)return[];var n=function(t,e,i){void 0===i&&(i=1);var n=e.length;if(0===n)throw new Error("No resources passed in.");for(var r=0,o=0;o<n&&(e[o]&&e[o].display);o++)r=Math.abs(e[o].display.scale-t)*i<Math.abs(e[r].display.scale-t)?o:r;return r}(1/(i||1)/(window.devicePixelRatio||1),this.images,this.renderOptions.quality),r=this.images.length,o=e?c(e,v(this.x,this.y)):v(this.x,this.y);if(n!==this.images.length-1&&this.images[n+1]){for(var s=[],a=r-1;a>=n;a--)s.push(a);var u=s[0];this.renderOptions.renderLayers&&(s=s.slice(-this.renderOptions.renderLayers)),this.renderOptions.renderSmallestFallback&&-1===s.indexOf(u)&&s.unshift(u);var d=[];for(a=0;a<s.length;a++)d.push.apply(d,l([],h(this.images[s[a]].getAllPointsAt(t,o,i)),!1));return d}return this.images[n].getAllPointsAt(t,o,i)},e}(function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="spacial-content",e}return i(e,t),e.prototype.getAllPointsAt=function(t,e,i){return[[this,this.points,e]]},e}(P)),I=function(t){function e(e,i){var n=t.call(this)||this;n.type="world-object",n.intersectionBuffer=d(5),n.aggregateBuffer=d(9),n.invertedBuffer=d(9),n._updatedList=[];var r=i||{},o=r.x,s=void 0===o?0:o,a=r.y,h=void 0===a?0:a;return e?(n.id=e.id||"",n.scale=1,n.layers=e.layers,n.points=d([1,s,h,e.width,e.height]),n.worldPoints=d([1,s,h,e.width,e.height]),n.filteredPointsBuffer=d(5*e.layers.length)):(n.id="",n.scale=1,n.layers=[],n.points=d(5),n.worldPoints=d(5),n.filteredPointsBuffer=d(5)),n}return i(e,t),e.createWithProps=function(t){var i=new e;return i.applyProps(t),i},e.prototype.applyProps=function(t){var e=t.x||0,i=t.y||0;this.id=t.id;var n=void 0!==t.scale?t.scale:this.scale;this.points[0]=1,this.points[1]=e,this.points[2]=i,this.points[3]=e+t.width,this.points[4]=i+t.height,this.worldPoints[3]=this.worldPoints[1]+t.width*n,this.worldPoints[4]=this.worldPoints[2]+t.height*n,t.scale&&1!==t.scale&&this.atScale(n),this.scale=n},e.prototype.appendChild=function(t){0===t.points[0]&&t.points.set(this.points),this.addLayers([t])},e.prototype.removeChild=function(t){this.layers=this.layers.filter((function(e){return e!==t})),this.filteredPointsBuffer=d(5*this.layers.length)},e.prototype.insertBefore=function(t,e){var i=this.layers.indexOf(e);if(-1!==i){var n=this.layers.slice(0,i-1),r=this.layers.slice(i);this.layers=l(l(l([],h(n),!1),[t],!1),h(r),!1)}},e.prototype.hideInstance=function(){console.warn("hideInstance: not yet implemented")},e.prototype.getObjectsAt=function(t,e){if(0===u(this.points,t,this.filteredPointsBuffer)[0])return[];for(var i=this.layers.length,n=[],r=0;r<i;r++){var o=this.layers[r];if(0!==u(m(o.points,v(this.x,this.y)),t,this.filteredPointsBuffer)[0]&&n.push(o),e){var s=o;n.push.apply(n,l([],h(s.getObjectsAt(t,e)),!1))}}return n},e.prototype.getAllPointsAt=function(t,e,i){for(var n=c(v(this.x,this.y),g(this.scale),this.aggregateBuffer),r=((t,e,i)=>{const n=t[1]<=e[3]&&t[3]>=e[1]&&t[2]<=e[4]&&t[4]>=e[2],r=i||d(5);return n?(r[0]=1,r[1]=Math.max(t[1],e[1]),r[2]=Math.max(t[2],e[2]),r[3]=Math.min(t[3],e[3]),r[4]=Math.min(t[4],e[4]),r):(r[0]=0,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r)})(t,this.points,this.intersectionBuffer),o=this.layers.length,s=[],a=m(r,c(g(1/this.scale),v(-this.x,-this.y),this.invertedBuffer)),u=e?c(e,n,this.aggregateBuffer):n,p=i*this.scale,f=0;f<o;f++)s.push.apply(s,l([],h(this.layers[f].getAllPointsAt(a,u,p)),!1));return s},e.prototype.addLayers=function(t){var e,i;try{for(var n=a(t),r=n.next();!r.done;r=n.next()){var o=r.value;5===o.points.length&&(o.points[1]<this.worldPoints[1]/this.scale||o.points[2]<this.worldPoints[2]/this.scale||o.points[3]>this.worldPoints[3]/this.scale||o.points[4]>this.worldPoints[4]/this.scale)&&(o.crop=d([1,Math.max(this.worldPoints[1]/this.scale,o.points[1]),Math.max(this.worldPoints[2]/this.scale,o.points[2]),Math.min(this.worldPoints[3]/this.scale,o.points[3]),Math.min(this.worldPoints[4]/this.scale,o.points[4])]))}}catch(t){e={error:t}}finally{try{r&&!r.done&&(i=n.return)&&i.call(n)}finally{if(e)throw e.error}}this.layers=this.layers.concat(t),this.filteredPointsBuffer=d(5*this.layers.length)},e.prototype.getScheduledUpdates=function(t,e){var i,n=this.layers.length;this._updatedList=[];for(var r=e*this.scale,o=0;o<n;o++){var s=this.layers[o].getScheduledUpdates(t,r);s&&(i=this._updatedList).push.apply(i,l([],h(s),!1))}return this._updatedList},e}(P),B=function(t){function e(e,i,n,r){void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=100),void 0===r&&(r="left-to-right");var o=t.call(this)||this;return o.id="world",o.aggregateBuffer=d(9),o.isDirty=!1,o.zones=[],o.triggerQueue=[],o.activatedEvents=[],o._updatedList=[],o.translationBuffer=d(9),o.needsRecalculate=!0,o.emptyPaintables=[],o.renderOrder=[],o.objects=[],o.subscriptions=[],o._propagateEventTargets=[],o._alreadyFlushed=[],o._width=e,o._height=i,o.aspectRatio=Number.isNaN(e/i)?1:e/i,o.viewingDirection=r,o.points=d(5*n),o.filteredPointsBuffer=d(5*n),o}return i(e,t),Object.defineProperty(e.prototype,"x",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height},enumerable:!1,configurable:!0}),e.withProps=function(t){var i=new e;return i.applyProps(t),i},e.prototype.applyProps=function(t){void 0===t.width||void 0===t.height||t.width===this._width&&t.height===this._height||this.resize(t.width,t.height),t.viewingDirection!==this.viewingDirection&&(this.viewingDirection=t.viewingDirection,this.triggerRepaint())},e.prototype.propagateTouchEvent=function(t,e,i){var n,r,o=this,s=[];try{for(var h=a(i),l=h.next();!l.done;l=h.next()){var u=l.value;if(u.x&&u.y){var d=p.singleBox(1,1,u.x,u.y);s.push(this.getObjectsAt(d,!0).reverse())}}}catch(t){n={error:t}}finally{try{l&&!l.done&&(r=h.return)&&r.call(h)}finally{if(n)throw n.error}}return s.map((function(i){return o.propagateEvent(t,e,i,{bubbles:!0,cancelable:!0})}))},e.prototype.propagatePointerEvent=function(t,e,i,n,r){void 0===r&&(r={});var o=p.singleBox(1,1,i,n),s=this.getObjectsAt(o,!0).reverse();return this.propagateEvent(t,e,s,r)},e.prototype.propagateEvent=function(t,e,i,n){var r=void 0===n?{}:n;r.bubbles,r.cancelable;e.atlasTarget=this,this._propagateEventTargets.length=1,this._propagateEventTargets[0]=this;var o=!1;e.stopPropagation=function(){o=!0};for(var s=i.length-1;s>=0;s--){this._propagateEventTargets.unshift(i[s][0]);var a=i[s][1].length;if(a)for(var h=0;h<a;h++)this._propagateEventTargets.unshift(i[s][1][h])}var l=this._propagateEventTargets.length,u=!1;for(h=0;h<l&&(e.atlasTarget=this._propagateEventTargets[h],e.atlasWorld=this,u=this._propagateEventTargets[h].dispatchEvent(t,e)||u,!o);h++);return u&&this.triggerRepaint(),this._propagateEventTargets},e.prototype.appendChild=function(t){var e=this.appendWorldObject(t);this.renderOrder.push(e/5)},e.prototype.removeChild=function(t){var e,i,n=this.objects.indexOf(t);if(-1!==n)this.objects[n]=null,this.renderOrder=this.renderOrder.filter((function(t){return t!==n})),this.points[5*n]=0,this.triggerRepaint(),this.needsRecalculate=!0;else try{for(var r=a(this.objects),o=r.next();!o.done;o=r.next()){var s=o.value;if(s&&s.id===t.id)return void this.removeChild(s)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(e)throw e.error}}},e.prototype.insertBefore=function(t,e){var i=this.objects.indexOf(e);if(-1!==i){var n=this.appendWorldObject(t);this.renderOrder.splice(i,0,n/5)}},e.prototype.hideInstance=function(){},e.prototype.asWorldObject=function(){return null},e.prototype.addZone=function(t){this.zones.push(t)},e.prototype.selectZone=function(t){if("string"==typeof t){for(var e=this.zones.length,i=0;i<e;i++)if(this.zones[i].id===t)return this.selectedZone=i,void this.trigger("zone-changed")}else this.zones[t]&&(this.selectedZone=t,this.trigger("zone-changed"))},e.prototype.deselectZone=function(){this.selectedZone=void 0},e.prototype.getActiveZone=function(){if(this.selectedZone)return this.zones[this.selectedZone]},e.prototype.hasActiveZone=function(){return void 0!==this.selectedZone},e.prototype.checkResizeInternalBuffer=function(){if((t=>t.length/5)(this.points)===this.objects.length){var t=this.points,e=d(2*this.points.length);e.set(t,0),this.points=e}},e.prototype.appendWorldObject=function(t){this.checkResizeInternalBuffer();var e=5*this.objects.length,i=t.points;return t.points=this.points.subarray(5*this.objects.length,5*this.objects.length+5),t.points[1]=i[1],t.points[2]=i[2],t.points[3]=i[3],t.points[4]=i[4],this.objects.push(t),this.filteredPointsBuffer=d(5*this.objects.length),this.needsRecalculate=!0,this.triggerRepaint(),e},e.prototype.recalculateWorldSize=function(){var t=!1;if(this.needsRecalculate){for(var e=new Int32Array(this.objects.length),i=new Int32Array(this.objects.length),n=this.objects.length,r=0;r<n;r++)this.objects[r]&&(e[r]=this.points[5*r+3],i[r]=this.points[5*r+4]);var o=Math.max.apply(Math,l([],h(e),!1));o!==this._width&&(this._width=o,t=!0);var s=Math.max.apply(Math,l([],h(i),!1));s!==this._height&&(this._height=s,t=!0),t&&this.trigger("recalculate-world-size",{width:o,height:s}),this.needsRecalculate=!1}return t},e.prototype.addObjectAt=function(t,e){e.width&&!e.height?e.height=e.width/t.width*t.height:e.height&&!e.width&&(e.width=e.height/t.height*t.width),e&&e.width&&e.height||(e.width=t.width,e.height=t.height);var i=e.width,n=e.x,r=e.y,o=i/t.width;this.checkResizeInternalBuffer(),this.points.set(p.singleBox(t.width,t.height,0,0),5*this.objects.length);var s=new I(t);return s.points=this.points.subarray(5*this.objects.length,5*this.objects.length+5),this.objects.push(s),this.scaleWorldObject(this.objects.length-1,o),this.translateWorldObject(this.objects.length-1,n,r),this.filteredPointsBuffer=d(2*this.points.length),this.triggerRepaint(),this.needsRecalculate=!0,s},e.prototype.scaleWorldObject=function(t,e){f(this.points.subarray(5*t,5*t+5),y(e,this.points[5*t+1],this.points[5*t+2]));var i=this.objects[t];i&&(i.atScale(e),this.triggerRepaint())},e.prototype.translateWorldObject=function(t,e,i){f(this.points.subarray(5*t,5*t+5),v(e,i));var n=this.objects[t];n&&(n.translate(e,i),this.triggerRepaint())},e.prototype.resize=function(t,e){return this._width=t,this._height=e,this.aspectRatio=t/e,this.triggerRepaint(),this},e.prototype.getObjects=function(){return this.objects},e.prototype.getPoints=function(){return this.points},e.prototype.getPointsFromViewer=function(t,e){var i=p.singleBox(t.width,t.height,t.x,t.y);return this.getPointsAt(i,e,t.scale)},e.prototype.addLayoutSubscriber=function(t){var e=this;return this.subscriptions.push(t),function(){e.subscriptions.splice(e.subscriptions.indexOf(t),1)}},e.prototype.getScheduledUpdates=function(t,e){var i,n=u(this.points,t,this.filteredPointsBuffer),r=this.objects.length;this._updatedList=[];for(var o=0;o<r;o++)if(0!==n[5*o]){if(!this.objects[o])continue;(i=this._updatedList).push.apply(i,l([],h(this.objects[o].getScheduledUpdates(t,e)),!1))}return this._updatedList},e.prototype.getObjectsAt=function(t,e){void 0===e&&(e=!1);for(var i=this.getActiveZone(),n=u(this.points,t,this.filteredPointsBuffer),r=this.renderOrder.length,o=[],s=0;s<r;s++){var a=this.renderOrder[s];if(0!==n[5*a]){var h=this.objects[a];if(!h||i&&-1===i.objects.indexOf(h))continue;if("world-object"!==h.type){o.push([h,[h]]);continue}e?o.push([h,h.getObjectsAt(t,e)]):o.push([h,this.emptyPaintables])}}return o},e.prototype.getPointsAt=function(t,e,i){void 0===i&&(i=1);for(var n=this.getObjectsAt(t),r=c(g(i),v(-t[1],-t[2]),this.translationBuffer),o=e?c(e,r,this.aggregateBuffer):r,s=n.length,a=[],u=0;u<s;u++)a.push.apply(a,l([],h(n[u][0].getAllPointsAt(t,o,i)),!1));return a},e.prototype.flushSubscriptions=function(){if(this.triggerQueue.length){this._alreadyFlushed=[];for(var t=this.triggerQueue.length,e=0;e<t;e++)if(-1===this._alreadyFlushed.indexOf(this.triggerQueue[e][0])){void 0===this.triggerQueue[e][1]&&this._alreadyFlushed.push(this.triggerQueue[e][0]);for(var i=this.subscriptions.length,n=0;n<i;n++)this.subscriptions[n].apply(null,this.triggerQueue[e])}this.triggerQueue=[]}},e.prototype.trigger=function(t,e){this.triggerQueue.push([t,e])},e.prototype.triggerEventActivation=function(){this.trigger("event-activation")},e.prototype.triggerRepaint=function(){this.trigger("repaint")},e.prototype.gotoRegion=function(t){this.trigger("goto-region",t)},e.prototype.goHome=function(t){void 0===t&&(t=!1),this.trigger("go-home",{immediate:t})},e.prototype.zoomTo=function(t,e,i){this.trigger("zoom-to",{point:e,factor:t,stream:i})},e.prototype.zoomIn=function(t){this.trigger("zoom-to",{point:t,factor:.5})},e.prototype.zoomOut=function(t){this.trigger("zoom-to",{point:t,factor:2})},e.prototype.constraintBounds=function(t){this.trigger("constrain-bounds",{immediate:t})},e}(P);var R,k={margin:0},A=function(){function t(t,e){void 0===e&&(e={}),this.id=t.map((function(t){return t.id})).join("$$"),this.config=n(n({},k),e),this.points=d(5),this.objects=t,this.recalculateBounds()}return t.prototype.recalculateBounds=function(){this.points.set([1,Math.min.apply(Math,l([],h(this.objects.map((function(t){return t.points[1]}))),!1))-this.config.margin,Math.min.apply(Math,l([],h(this.objects.map((function(t){return t.points[2]}))),!1))-this.config.margin,Math.max.apply(Math,l([],h(this.objects.map((function(t){return t.points[3]}))),!1))+this.config.margin,Math.max.apply(Math,l([],h(this.objects.map((function(t){return t.points[4]}))),!1))+this.config.margin])},t.prototype.getPointsAt=function(t,e,i){return[]},t}(),z=Math.pow,W=Math.sqrt,L=Math.sin,C=Math.cos,D=Math.PI,U=1.70158,H=1.525*U,Q=2*D/3,N=2*D/4.5,q=function(t){var e=7.5625,i=2.75;return t<1/i?e*t*t:t<2/i?e*(t-=1.5/i)*t+.75:t<2.5/i?e*(t-=2.25/i)*t+.9375:e*(t-=2.625/i)*t+.984375},Z={linear:function(t){return t},easeInQuad:function(t){return t*t},easeOutQuad:function(t){return 1-(1-t)*(1-t)},easeInOutQuad:function(t){return t<.5?2*t*t:1-z(-2*t+2,2)/2},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return 1-z(1-t,3)},easeInOutCubic:function(t){return t<.5?4*t*t*t:1-z(-2*t+2,3)/2},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return 1-z(1-t,4)},easeInOutQuart:function(t){return t<.5?8*t*t*t*t:1-z(-2*t+2,4)/2},easeInQuint:function(t){return t*t*t*t*t},easeOutQuint:function(t){return 1-z(1-t,5)},easeInOutQuint:function(t){return t<.5?16*t*t*t*t*t:1-z(-2*t+2,5)/2},easeInSine:function(t){return 1-C(t*D/2)},easeOutSine:function(t){return L(t*D/2)},easeInOutSine:function(t){return-(C(D*t)-1)/2},easeInExpo:function(t){return 0===t?0:z(2,10*t-10)},easeOutExpo:function(t){return 1===t?1:1-z(2,-10*t)},easeInOutExpo:function(t){return 0===t?0:1===t?1:t<.5?z(2,20*t-10)/2:(2-z(2,-20*t+10))/2},easeInCirc:function(t){return 1-W(1-z(t,2))},easeOutCirc:function(t){return W(1-z(t-1,2))},easeInOutCirc:function(t){return t<.5?(1-W(1-z(2*t,2)))/2:(W(1-z(-2*t+2,2))+1)/2},easeInBack:function(t){return 2.70158*t*t*t-U*t*t},easeOutBack:function(t){return 1+2.70158*z(t-1,3)+U*z(t-1,2)},easeInOutBack:function(t){return t<.5?z(2*t,2)*(7.189819*t-H)/2:(z(2*t-2,2)*((H+1)*(2*t-2)+H)+2)/2},easeInElastic:function(t){return 0===t?0:1===t?1:-z(2,10*t-10)*L((10*t-10.75)*Q)},easeOutElastic:function(t){return 0===t?0:1===t?1:z(2,-10*t)*L((10*t-.75)*Q)+1},easeInOutElastic:function(t){return 0===t?0:1===t?1:t<.5?-z(2,20*t-10)*L((20*t-11.125)*N)/2:z(2,-20*t+10)*L((20*t-11.125)*N)/2+1},easeInBounce:function(t){return 1-q(1-t)},easeOutBounce:q,easeInOutBounce:function(t){return t<.5?(1-q(1-2*t))/2:(1+q(2*t-1))/2}},X=function(){function t(t){this.runtime=t,this.pendingTransition={from:d(5),to:d(5),elapsed_time:0,done:!0,total_time:0,timingFunction:Z.easeInOutQuad,constrain:!1}}return t.prototype.hasPending=function(){return!this.pendingTransition.done},t.prototype.getPendingTransition=function(){return this.pendingTransition},t.prototype.getPendingFrom=function(){return this.pendingTransition.from},t.prototype.customTransition=function(t){t(this.pendingTransition)},t.prototype.stopTransition=function(){this.pendingTransition.from=d(this.runtime.target),this.pendingTransition.to=d(this.runtime.target),this.pendingTransition.done=!0,this.pendingTransition.elapsed_time=0,this.pendingTransition.total_time=0},t.prototype.runTransition=function(t,e){if(!this.pendingTransition.done){var i=this.pendingTransition,n=(i.elapsed_time+e)/i.total_time,r=i.timingFunction(n>1?1:n);t[1]=i.from[1]+(i.to[1]-i.from[1])*r,t[2]=i.from[2]+(i.to[2]-i.from[2])*r,t[3]=i.from[3]+(i.to[3]-i.from[3])*r,t[4]=i.from[4]+(i.to[4]-i.from[4])*r,this.pendingTransition.elapsed_time+=e,this.pendingTransition.elapsed_time>=this.pendingTransition.total_time&&(this.pendingTransition.done=!0,this.pendingTransition.constrain&&this.constrainBounds({transition:{duration:0===this.pendingTransition.total_time?0:500,easing:Z.easeOutExpo}}))}},t.prototype.zoomTo=function(t,e){var i=void 0===e?{}:e,n=i.origin,r=(i.stream,i.transition),o=this.runtime.getZoomedPosition(t,{origin:n}),s=Math.abs(1-t);this.applyTransition(o,r,{duration:2e3*s,easing:Z.easeOutExpo,constrain:!0},{stream:!1})},t.prototype.constrainBounds=function(t){var e=void 0===t?{}:t,i=e.transition,n=e.panPadding,r=void 0===n?0:n,o=h(this.runtime.constrainBounds(this.runtime.target,{panPadding:r}),2),s=o[0],a=o[1];s&&(this.applyTransition(a,i,{duration:500,easing:Z.easeOutQuart,constrain:!1}),this.runtime.updateNextFrame())},t.prototype.applyTransition=function(t,e,i,n){var r=(void 0===n?{}:n).stream;this.pendingTransition.from=d(this.runtime.target),this.pendingTransition.to=t,r||(this.pendingTransition.elapsed_time=0),this.pendingTransition.done=!1,this.pendingTransition.total_time=void 0!==(null==e?void 0:e.duration)?e.duration:void 0!==(null==i?void 0:i.duration)?i.duration:1e3,this.pendingTransition.constrain=void 0!==(null==e?void 0:e.constrain)?e.constrain:void 0!==(null==i?void 0:i.constrain)&&i.constrain,this.pendingTransition.timingFunction=(null==e?void 0:e.easing)||(null==i?void 0:i.easing)||Z.easeInOutSine},t.prototype.goToRegion=function(t,e){var i=(void 0===e?{}:e).transition,n=this.runtime.clampRegion(t);this.applyTransition(p.singleBox(n.width,n.height,n.x,n.y),i,{duration:1e3,easing:Z.easeOutExpo,constrain:!0}),this.runtime.updateNextFrame()},t}(),Y=function(){function t(t,e,i,r,o){var s=this;void 0===r&&(r=[]),this.ready=!1,this.transformBuffer=d(500),this.lastTarget=d(5),this.zoomBuffer=d(5),this.logNextRender=!1,this.pendingUpdate=!0,this.firstRender=!0,this.mode="explore",this.controllers=[],this.controllersRunning=!1,this.controllerStopFunctions=[],this.maxScaleFactor=1,this._viewerToWorld={x:0,y:0},this.hooks={useFrame:[],useBeforeFrame:[],useAfterPaint:[],useAfterFrame:[]},this._viewport={x:0,y:0,width:0,height:0},this.setViewport=function(t){var e=void 0===t.x?s.target[1]:t.x,i=void 0===t.y?s.target[2]:t.y;t.width?s.target[3]=e+t.width:s.target[3]=s.target[3]-s.target[1]+e,t.height?s.target[4]=i+t.height:s.target[4]=s.target[4]-s.target[2]+i,Math.abs(s.target[1]-e)>.01&&(s.target[1]=e),Math.abs(s.target[2]-i)>.01&&(s.target[2]=i),s.pendingUpdate=!0},this.render=function(t){var e=t-s.lastTime;if(s.fpsLimit&&e<1e3/s.fpsLimit)s.stopId=window.requestAnimationFrame(s.render);else{s.lastTime=t,s.world.flushSubscriptions(),s.stopId=window.requestAnimationFrame(s.render),s.hook("useFrame",e);var i=s.pendingUpdate,n=s.renderer.pendingUpdate();if(s.transitionManager.hasPending()&&(s.transitionManager.runTransition(s.target,e),s.pendingUpdate=!0,s.updateControllerPosition()),s.firstRender||i||n||s.target[0]!==s.lastTarget[0]||s.target[1]!==s.lastTarget[1]||s.target[2]!==s.lastTarget[2]||s.target[3]!==s.lastTarget[3]||s.target[4]!==s.lastTarget[4]){s.hook("useBeforeFrame",e),s.renderer.beforeFrame(s.world,e,s.target);for(var r=s.getScaleFactor(),o=s.renderer.getPointsAt(s.world,s.target,s.aggregate,r),a=o.length,h=0;h<a;h++){var l=o[h][0],u=o[h][1],d=o[h][2];s.renderer.prepareLayer(l);for(var c=d?m(u,d,s.transformBuffer):u,p=c.length/5,f=0;f<p;f++){var g=5*f;0!==c[g]&&(s.renderer.paint(l,f,c[g+1],c[g+2],c[g+3]-c[g+1],c[g+4]-c[g+2]),s.hook("useAfterPaint",l))}}s.renderer.afterFrame(s.world,e,s.target),s.hook("useAfterFrame",e),s.lastTarget[0]=s.target[0],s.lastTarget[1]=s.target[1],s.lastTarget[2]=s.target[2],s.lastTarget[3]=s.target[3],s.lastTarget[4]=s.target[4],s.firstRender=!1,s.pendingUpdate=!1,s.logNextRender=!1,s.renderer.isReady()&&(s.ready=!0,s.world.trigger("ready")),s.world.flushSubscriptions();var v=s.world.getScheduledUpdates(s.target,r),y=v.length;if(y>0)for(f=0;f<y;f++){var w=v[y-f]();w?w.then((function(){s.pendingUpdate=!0})):s.pendingUpdate=!0}}}},this.renderer=t,this.world=e,this.options=n({maxOverZoom:1,maxUnderZoom:1,visibilityRatio:1},o||{}),this.target=p.projection(i),this.manualHomePosition=!1,this.pendingUpdate=!0,this.homePosition=p.projection(this.world),this.manualFocalPosition=!1,this.focalPosition=this.target,this.updateFocalPosition(),this.transitionManager=new X(this),this.aggregate=g(1),this.world.addLayoutSubscriber((function(t){"repaint"===t&&(s.pendingUpdate=!0),"recalculate-world-size"===t&&(s.manualHomePosition||(s.setHomePosition(),s.goHome()),s.updateFocalPosition())})),this.lastTime=performance.now(),this.controllers=r,this.render(this.lastTime),this.startControllers()}return Object.defineProperty(t.prototype,"x",{get:function(){return this.target[1]},set:function(t){this.target[1]=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this.target[2]},set:function(t){this.target[2]=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"x2",{get:function(){return this.target[3]},set:function(t){this.target[3]=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"y2",{get:function(){return this.target[4]},set:function(t){this.target[4]=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this.target[3]-this.target[1]},set:function(t){this.target[3]=this.target[1]+t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.target[4]-this.target[2]},set:function(t){this.target[4]=this.target[2]=t},enumerable:!1,configurable:!0}),t.prototype.setHomePosition=function(t){this.homePosition.set(p.projection(t||this.world)),this.pendingUpdate=!0},t.prototype.startControllers=function(){var t,e;if(!this.controllersRunning){try{for(var i=a(this.controllers),n=i.next();!n.done;n=i.next()){var r=n.value;this.controllerStopFunctions.push(r.start(this))}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}this.controllersRunning=!0}},t.prototype.stopControllers=function(){var t,e;if(this.controllersRunning){try{for(var i=a(this.controllerStopFunctions),n=i.next();!n.done;n=i.next()){(0,n.value)()}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}this.controllersRunning=!1,this.controllerStopFunctions=[]}},t.prototype.updateControllerPosition=function(){var t,e;try{for(var i=a(this.controllers),n=i.next();!n.done;n=i.next()){n.value.updatePosition(this.x,this.y,this.width,this.height)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}},t.prototype.triggerResize=function(){this.renderer.triggerResize&&this.renderer.triggerResize(),this.pendingUpdate=!0},t.prototype.addController=function(t){this.controllers.push(t),this.controllersRunning&&t.start(this),this.pendingUpdate=!0},t.prototype.cover=function(){return this.goHome({cover:!0})},t.prototype.getRendererScreenPosition=function(){return this.renderer.getRendererScreenPosition()},t.prototype.updateRendererScreenPosition=function(){this.pendingUpdate=!0,this.renderer.resize()},t.prototype.goHome=function(t){if(void 0===t&&(t={}),!(this.world.width<=0||this.world.height<=0)){var e=this.getScaleFactor(),i=t.position?{x:t.position[1],y:t.position[2],width:t.position[3]-t.position[1],height:t.position[4]-t.position[2]}:{x:this.homePosition[1],y:this.homePosition[2],width:this.homePosition[3]-this.homePosition[1],height:this.homePosition[4]-this.homePosition[2]},n=this.width*e,r=this.height*e,o=i.width/n,s=i.height/r,a=n/r;if(t.cover?o>s:o<s){var h=a*i.height,l=(h-i.width)/2;this.target[1]=-l+i.x,this.target[2]=i.y,this.target[3]=h-l+i.x,this.target[4]=i.height+i.y}else{var u=i.width/a;l=(u-i.height)/2;this.target[1]=i.x,this.target[2]=i.y-l,this.target[3]=i.x+i.width,this.target[4]=i.y+u-l}this.constrainBounds(this.target),this.updateControllerPosition()}},t.prototype.resize=function(t,e,i,n){this.updateFocalPosition(t-e,i-n);var r=e/t,o=n/i;this.target[3]=this.target[1]+(this.target[3]-this.target[1])*r,this.target[4]=this.target[2]+(this.target[4]-this.target[2])*o,this.goHome({position:this.focalPosition}),this.renderer.resize(e,n),this.pendingUpdate=!0},t.prototype.updateFocalPosition=function(t,e){if(!this.manualFocalPosition){var i=this.width,n=this.height,r=Math.min(i,n),o=this.x+0,s=this.y+0;if(i<n){var a=this.height-this.width;this.focalPosition=p.projection({x:o,y:s+a/2,width:r-0,height:r-0}),this.pendingUpdate=!0}else{a=this.width-this.height;this.focalPosition=p.projection({x:o+a/2,y:s,width:r-0,height:r-0}),this.pendingUpdate=!0}}},t.prototype.getViewport=function(){return this._viewport.x=this.target[1],this._viewport.y=this.target[2],this._viewport.width=this.target[3]-this.target[1],this._viewport.height=this.target[4]-this.target[2],this._viewport},t.prototype.constrainBounds=function(t,e){var i=void 0===e?{}:e,n=i.panPadding,r=void 0===n?0:n,o=i.ref,s=void 0!==o&&o,a=this.getBounds({target:t,padding:r}),h=a.minX,l=a.maxX,u=a.minY,c=a.maxY,p=!1,f=s?t:d(t),g=t[3]-t[1],v=t[4]-t[2];return h>t[1]&&(p=!0,f[1]=h,f[3]=h+g),u>t[2]&&(p=!0,f[2]=u,f[4]=u+v),l<t[1]&&(p=!0,f[1]=l,f[3]=l+g),c<t[2]&&(p=!0,f[2]=c,f[4]=c+v),[p,f]},t.prototype.getBounds=function(t){var e=t.target||this.target,i=t.padding,n=this.options.visibilityRatio,r=Math.abs(1-n);if(this.world.hasActiveZone()){var o=this.world.getActiveZone();if(o){var s=e[3]-e[1]<o.points[3]-o.points[1],a=e[4]-e[2]<o.points[4]-o.points[2];return{minX:s?o.points[1]-i:o.points[1]+(o.points[3]-o.points[1])/2-(e[3]-e[1])/2,maxX:a?o.points[2]-i:o.points[2]+(o.points[4]-o.points[2])/2-(e[4]-e[2])/2,minY:s?o.points[3]+i:o.points[1]+(o.points[3]-o.points[1])/2-(e[3]-e[1])/2,maxY:a?o.points[4]+i:o.points[2]+(o.points[4]-o.points[2])/2-(e[4]-e[2])/2}}}var h=e[3]-e[1],l=-h*r,u=this.world.width-h-l,d=e[4]-e[2],c=-d*r,p=this.world.height-d-c,f=Math.max(l,u),g=Math.min(l,u),v=Math.max(c,p);return{minX:g,maxX:f,minY:Math.min(c,p),maxY:v}},t.prototype.getScaleFactor=function(t){return void 0===t&&(t=!1),this.renderer.getScale(this.target[3]-this.target[1],this.target[4]-this.target[2],t)},t.prototype.getZoomedPosition=function(t,e){var i,n=e.origin,r=e.fromPos,o=r?{width:r[3]-r[1],height:r[4]-r[2]}:void 0,s=o?this.renderer.getScale(o.width,o.height):this.getScaleFactor(),a=o?o.width:this.width,h=o?o.height:this.height,l=null===(i=this.getRendererScreenPosition())||void 0===i?void 0:i.width,u=this.world.width,d=l?l/u:1,c=this.options.maxUnderZoom,p=Math.max(d||1,this.options.maxOverZoom),f=1/t,g=s*f;if(f<1){var v=a*s,w=h*s;if(this.world.width/v>this.world.height/w)this.world.width*g<~~(a*s)*c&&(t=this.world.width*s/(a*s*c));else this.world.height*g<~~(h*s)*c&&(t=this.world.height*s/(h*s*c))}else g>1&&(t=s/p);var x=m(this.target,y(t,n?n.x:this.target[1]+(this.target[3]-this.target[1])/2,n?n.y:this.target[2]+(this.target[4]-this.target[2])/2),this.zoomBuffer);return this.constrainBounds(x,{ref:!0,panPadding:100}),x},t.prototype.clampRegion=function(t){var e=t.x,i=t.y,n=t.width,r=t.height,o=t.padding,s=void 0===o?0:o,a=this.width,h=this.height,l=e-s,u=i-s,d=n+2*s,c=r+2*s;if(n/a<r/h){var p=c/h*a;return{x:l-(p-d)/2,y:u,width:p,height:c}}var f=d/a*h;return{x:l,y:u-(f-c)/2,width:d,height:f}},t.prototype.viewerToWorld=function(t,e){var i=this.getScaleFactor();return this._viewerToWorld.x=this.target[1]+t/i,this._viewerToWorld.y=this.target[2]+e/i,this._viewerToWorld},t.prototype.worldToViewer=function(t,e,i,n){var r=p.singleBox(i,n,t,e);return f(r,c(g(this.getScaleFactor()),v(-this.target[1],-this.target[2]))),{x:r[1],y:r[2],width:r[3]-r[1],height:r[4]-r[2],strand:r}},t.prototype.setScale=function(t,e){f(this.target,y(t,e?e.x:this.target[1]+(this.target[3]-this.target[1])/2,e?e.y:this.target[2]+(this.target[4]-this.target[2])/2)),this.pendingUpdate=!0},t.prototype.syncTo=function(t){var e=this,i=this.target;return this.target=t.target,this.pendingUpdate=!0,function(){e.target=i}},t.prototype.stop=function(){var t=this;return void 0!==this.stopId&&(window.cancelAnimationFrame(this.stopId),this.stopId=void 0),function(){t.render(performance.now())}},t.prototype.selectZone=function(t){this.world.selectZone(t),this.pendingUpdate=!0},t.prototype.deselectZone=function(){this.world.deselectZone(),this.pendingUpdate=!0},t.prototype.hook=function(t,e){var i=this.hooks[t].length;if(0!==i)for(var n=0;n<i;n++)this.hooks[t][n](e)},t.prototype.registerHook=function(t,e){var i=this;return this.hooks[t].push(e),function(){i.hooks[t]=i.hooks[t].filter((function(t){return t!==e}))}},t.prototype.updateNextFrame=function(){this.pendingUpdate=!0},t}(),V=E((function(t,e){var i;t.exports=((i=function(){function t(t){return r.appendChild(t.dom),t}function e(t){for(var e=0;e<r.children.length;e++)r.children[e].style.display=e===t?"block":"none";n=t}var n=0,r=document.createElement("div");r.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",r.addEventListener("click",(function(t){t.preventDefault(),e(++n%r.children.length)}),!1);var o=(performance||Date).now(),s=o,a=0,h=t(new i.Panel("FPS","#0ff","#002")),l=t(new i.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var u=t(new i.Panel("MB","#f08","#201"));return e(0),{REVISION:16,dom:r,addPanel:t,showPanel:e,begin:function(){o=(performance||Date).now()},end:function(){a++;var t=(performance||Date).now();if(l.update(t-o,200),t>s+1e3&&(h.update(1e3*a/(t-s),100),s=t,a=0,u)){var e=performance.memory;u.update(e.usedJSHeapSize/1048576,e.jsHeapSizeLimit/1048576)}return t},update:function(){o=this.end()},domElement:r,setMode:e}}).Panel=function(t,e,i){var n=1/0,r=0,o=Math.round,s=o(window.devicePixelRatio||1),a=80*s,h=48*s,l=3*s,u=2*s,d=3*s,c=15*s,p=74*s,f=30*s,g=document.createElement("canvas");g.width=a,g.height=h,g.style.cssText="width:80px;height:48px";var v=g.getContext("2d");return v.font="bold "+9*s+"px Helvetica,Arial,sans-serif",v.textBaseline="top",v.fillStyle=i,v.fillRect(0,0,a,h),v.fillStyle=e,v.fillText(t,l,u),v.fillRect(d,c,p,f),v.fillStyle=i,v.globalAlpha=.9,v.fillRect(d,c,p,f),{dom:g,update:function(h,y){n=Math.min(n,h),r=Math.max(r,h),v.fillStyle=i,v.globalAlpha=1,v.fillRect(0,0,a,c),v.fillStyle=e,v.fillText(o(h)+" "+t+" ("+o(n)+"-"+o(r)+")",l,u),v.drawImage(g,d+s,c,p-s,f,d,c,p-s,f),v.fillRect(d+p-s,c,s,f),v.fillStyle=i,v.globalAlpha=.9,v.fillRect(d+p-s,c,s,o((1-h/y)*f))}}},i)})),$=function(){return($=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},G=function(t,e){return function(i){return Math.max(Math.min(i,e),t)}},J=function(t){return t%1?Number(t.toFixed(5)):t},K=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))$/i,tt={test:function(t){return"number"==typeof t},parse:parseFloat,transform:function(t){return t}},et=$($({},tt),{transform:G(0,1)}),it=($($({},tt),{default:1}),R="%",{test:function(t){return"string"==typeof t&&t.endsWith(R)&&1===t.split(" ").length},parse:parseFloat,transform:function(t){return""+t+R}}),nt=($($({},it),{parse:function(t){return it.parse(t)/100},transform:function(t){return it.transform(100*t)}}),G(0,255)),rt=$($({},tt),{transform:function(t){return Math.round(nt(t))}});function ot(t,e){return t.startsWith(e)&&K.test(t)}var st,at,ht={test:function(t){return"string"==typeof t?ot(t,"rgb"):function(t){return void 0!==t.red}(t)},parse:(st=["red","green","blue","alpha"],function(t){if("string"!=typeof t)return t;for(var e,i={},n=(e=t,e.substring(e.indexOf("(")+1,e.lastIndexOf(")"))).split(/,\s*/),r=0;r<4;r++)i[st[r]]=void 0!==n[r]?parseFloat(n[r]):1;return i}),transform:function(t){var e=t.red,i=t.green,n=t.blue,r=t.alpha,o=void 0===r?1:r;return function(t){var e=t.red,i=t.green,n=t.blue,r=t.alpha;return"rgba("+e+", "+i+", "+n+", "+(void 0===r?1:r)+")"}({red:rt.transform(e),green:rt.transform(i),blue:rt.transform(n),alpha:J(et.transform(o))})}},lt=($($({},ht),{test:function(t){return"string"==typeof t&&ot(t,"#")},parse:function(t){var e="",i="",n="";return t.length>4?(e=t.substr(1,2),i=t.substr(3,2),n=t.substr(5,2)):(e=t.substr(1,1),i=t.substr(2,1),n=t.substr(3,1),e+=e,i+=i,n+=n),{red:parseInt(e,16),green:parseInt(i,16),blue:parseInt(n,16),alpha:1}}}),0),ut="undefined"!=typeof window&&void 0!==window.requestAnimationFrame?function(t){return window.requestAnimationFrame(t)}:function(t){var e=Date.now(),i=Math.max(0,16.7-(e-lt));lt=e+i,setTimeout((function(){return t(lt)}),i)};!function(t){t.Read="read",t.Update="update",t.Render="render",t.PostRender="postRender",t.FixedUpdate="fixedUpdate"}(at||(at={}));var dt,ct,pt,ft,gt,vt,yt,mt,wt,xt,bt,Pt,St,Ot,Et,_t,Mt=1/60*1e3,Tt=!0,Ft=!1,jt=!1,It={delta:0,timestamp:0},Bt=[at.Read,at.Update,at.Render,at.PostRender],Rt=function(t){return Ft=t},kt=Bt.reduce((function(t,e){var i=function(t){var e=[],i=[],n=0,r=!1,o=0,s=new WeakSet,a=new WeakSet,h={cancel:function(t){var e=i.indexOf(t);s.add(t),-1!==e&&i.splice(e,1)},process:function(l){var u,d;if(r=!0,e=(u=[i,e])[0],(i=u[1]).length=0,n=e.length)for(o=0;o<n;o++)(d=e[o])(l),!0!==a.has(d)||s.has(d)||(h.schedule(d),t(!0));r=!1},schedule:function(t,o,h){void 0===o&&(o=!1),void 0===h&&(h=!1);var l=h&&r,u=l?e:i;s.delete(t),o&&a.add(t),-1===u.indexOf(t)&&(u.push(t),l&&(n=e.length))}};return h}(Rt);return t.sync[e]=function(t,e,n){return void 0===e&&(e=!1),void 0===n&&(n=!1),Ft||Lt(),i.schedule(t,e,n),t},t.cancelSync[e]=function(t){return i.cancel(t)},t.steps[e]=i,t}),{steps:{},sync:{},cancelSync:{}}),At=kt.steps,zt=(kt.sync,kt.cancelSync,function(t){return At[t].process(It)}),Wt=function(t){Ft=!1,It.delta=Tt?Mt:Math.max(Math.min(t-It.timestamp,40),1),Tt||(Mt=It.delta),It.timestamp=t,jt=!0,Bt.forEach(zt),jt=!1,Ft&&(Tt=!1,ut(Wt))},Lt=function(){Ft=!0,Tt=!0,jt||ut(Wt)},Ct={x:0,y:0,z:0},Dt=function(t){return"number"==typeof t},Ut=(dt=function(t,e,i){return Math.min(Math.max(i,t),e)},function(t,e,i){return void 0!==i?dt(t,e,i):function(i){return dt(t,e,i)}}),Ht=function(t){return t.hasOwnProperty("x")&&t.hasOwnProperty("y")},Qt=function(t){return Ht(t)&&t.hasOwnProperty("z")},Nt=function(t,e){return Math.abs(t-e)},qt=(Ut(0,1),/([0-9]+(px|em)\s+)+(solid)\s+(.*)/g),Zt={},Xt=["backgroundColor","opacity","boxShadow","borderColor","borderWidth","borderStyle","outlineColor","outlineWidth","outlineOffset","outlineStyle"],Yt=function(t){function e(){var e=t.call(this)||this;return e.type="spacial-content",e.hoverEvents=!1,e.activeEvents=!1,e.display={scale:1,width:-1,height:-1,points:d(5)},e._parsed={border:{id:null,match:[]},outline:{id:null,match:[]}},e.props={},e.addHover=function(){e.hovering=!0,e.__revision++},e.removeHover=function(){e.hovering=!1,e.pressing=!1,e.__revision++},e.addPress=function(){e.pressing=!0,e.__revision++},e.removePress=function(){e.pressing=!1,e.__revision++},e.id=w(12),e.points=d(5),e}return i(e,t),e.prototype.getAllPointsAt=function(t,e){return[[this,this.points,e]]},e.prototype.applyProps=function(t){var e,i;void 0===t&&(t={});var n=!1;if(t.interactive!==this.props.interactive&&(n=!0,this.props.interactive=t.interactive),t.style){var r,o=t.border||t.style.border;if(o!==this._parsed.border.id)if(o)(r=Zt[o]||qt.exec(o)||qt.exec(o))&&(this._parsed.border.id=o,this._parsed.border.match=Zt[o]=r);else this._parsed.border.id=null,this._parsed.border.match=[];if(this._parsed.border.id&&(t.style.borderWidth=this._parsed.border.match[1],t.style.borderStyle="solid",t.style.borderColor=this._parsed.border.match[4]),t.style.outline!==this._parsed.outline.id)if(t.style.outline)(r=Zt[t.style.outline]||qt.exec(t.style.outline)||qt.exec(t.style.outline))&&(this._parsed.outline.id=t.style.outline,this._parsed.outline.match=Zt[t.style.outline]=r);else this._parsed.outline.id=null,this._parsed.outline.match=[];this._parsed.outline.id&&(t.style.outlineWidth=this._parsed.outline.match[1],t.style.outlineStyle="solid",t.style.outlineColor=this._parsed.outline.match[4]),this.props.style=t.style,t.backgroundColor&&!this.props.style.backgroundColor&&(this.props.style.backgroundColor=t.backgroundColor,n=!0),t.style.background&&!this.props.style.backgroundColor&&(this.props.style.backgroundColor=t.style.background,n=!0);try{for(var s=a(Xt),h=s.next();!h.done;h=s.next()){var l=h.value;if(this.props.style[l]!==t.style[l]){n=!0;break}}}catch(t){e={error:t}}finally{try{h&&!h.done&&(i=s.return)&&i.call(s)}finally{if(e)throw e.error}}t.style[":hover"]!==this.props.hoverStyles&&(this.props.hoverStyles=t.style[":hover"],this.hoverEvents||(this.hoverEvents=!0,this.addEventListener("pointerenter",this.addHover),this.addEventListener("pointerleave",this.removeHover)),n=!0),t.style[":active"]!==this.props.pressStyles&&(this.props.pressStyles=t.style[":active"],this.activeEvents||(this.activeEvents=!0,this.addEventListener("mousedown",this.addPress),this.addEventListener("mouseup",this.removePress)),n=!0)}t.className!==this.props.className&&(this.props.className=t.className,t.className&&!this.hoverEvents&&(this.hoverEvents=!0,this.addEventListener("pointerenter",this.addHover),this.addEventListener("pointerleave",this.removeHover)),t.className&&!this.activeEvents&&(this.activeEvents=!0,this.addEventListener("mousedown",this.addPress),this.addEventListener("mouseup",this.removePress)),n=!0),t.relativeSize!==this.props.relativeSize&&(this.props.relativeSize=t.relativeSize,n=!0),t.relativeStyle!==this.props.relativeStyle&&(this.props.relativeStyle=t.relativeStyle,n=!0),t.html!==this.props.html&&(this.props.html=t.html,n=!0),t.target&&(t.target.width===this.display.width&&t.target.height===this.display.height&&t.target.x===this.points[1]&&t.target.y===this.points[2]||(n=!0,this.points=p.singleBox(t.target.width,t.target.height,t.target.x,t.target.y),this.display.points=p.singleBox(t.target.width,t.target.height,t.target.x,t.target.y),this.display.width=t.target.width,this.display.height=t.target.height)),n&&this.__revision++},e}(P),Vt=/(-?[0-9]+(px|em)\s+|0\s+)(-?[0-9]+(px|em)\s+|0\s+)(-?[0-9]+(px|em)\s+|0\s+)?(-?[0-9]+(px|em)\s+|0\s+)?(.*)/g,$t={},Gt={},Jt={},Kt=function(){function t(t,e){var i=this;this.imagesPending=0,this.imagesLoaded=0,this.frameIsRendering=!1,this.firstMeaningfulPaint=!1,this.parallelTasks=16,this.frameTasks=5,this.isGPUBusy=!1,this.loadingQueueOrdered=!0,this.loadingQueue=[],this.currentTask=Promise.resolve(),this.tasksRunning=0,this.averageJobTime=1e3,this.visible=[],this.previousVisible=[],this._worker=function(){if(i.loadingQueue.length&&!i.isGPUBusy){var t=i.loadingQueue.pop();t&&(i.tasksRunning++,i.frameTasks++,i.currentTask=t.task().then((function(){i.tasksRunning--})).catch((function(){i.tasksRunning--})))}},this._scheduled=0,this._doWork=function(){(i.frameIsRendering||0===i.loadingQueue.length&&0===i.tasksRunning&&i._scheduled)&&(clearInterval(i._scheduled),i._scheduled=0),i._worker()},this.canvas=t,this.rendererPosition=t.getBoundingClientRect(),this.ctx=t.getContext("2d",{alpha:!1}),this.ctx.imageSmoothingEnabled=!0,this.options=e||{},this.canvas.style.opacity="0",this.canvas.style.transition="opacity .3s",this.dpi=(null==e?void 0:e.dpi)||1,this.options.debug&&(this.stats=new V,this.stats.showPanel(0),document&&document.body&&document.body.appendChild(this.stats.dom))}return t.prototype.getCanvasDims=function(){return{width:this.canvas.width/this.dpi,height:this.canvas.height/this.dpi}},t.prototype.resize=function(){this.rendererPosition=this.canvas.getBoundingClientRect()},t.prototype.isReady=function(){return this.firstMeaningfulPaint},t.prototype.afterFrame=function(t){this.frameIsRendering=!1,this.imagesPending=this.imagesPending-this.imagesLoaded,this.imagesLoaded=0,!this.loadingQueueOrdered&&this.loadingQueue.length>this.parallelTasks&&(this.loadingQueue=this.loadingQueue.sort((function(t,e){return t.scale-e.scale||e.distance-t.distance})),this.loadingQueueOrdered=!0),this.previousVisible=this.visible,this.doOffscreenWork(),this.options.debug&&this.stats&&this.stats.end()},t.prototype.doOffscreenWork=function(){this.frameTasks=0,this.isGPUBusy=!1,this.loadingQueue.length&&(this._worker(),this.loadingQueue.length&&this.tasksRunning<this.parallelTasks&&(this._scheduled||(this._scheduled=setInterval(this._doWork,0))))},t.prototype.getScale=function(t,e,i){var n=this.getCanvasDims(),r=n.width/t,o=n.height/e;return(r<o?o:r)*(i&&this.dpi||1)},t.prototype.beforeFrame=function(t,e,i){this.options.debug&&this.stats&&this.stats.begin(),this.frameIsRendering=!0,this.visible=[],this.options.beforeFrame&&this.options.beforeFrame(e);var n=this.getCanvasDims();this.ctx.globalAlpha=1,this.ctx.fillStyle="rgba(0, 0, 0, 1)",this.ctx.fillRect(0,0,n.width,n.height)},t.prototype.paint=function(t,e,i,n,r,o){var s,h,l=this.ctx.globalAlpha;if(t instanceof S||t instanceof F){if(this.visible.push(t),t.style,"undefined"!==t.style.opacity){if(!t.style.opacity)return;this.ctx.globalAlpha=t.style.opacity}try{var u=t.__host.canvas,d=this.getCanvasDims();if(-1===u.indices.indexOf(e)&&this.schedulePaintToCanvas(u,t,e,function(t,e){if(void 0===e&&(e=Ct),Dt(t)&&Dt(e))return Nt(t,e);if(Ht(t)&&Ht(e)){var i=Nt(t.x,e.x),n=Nt(t.y,e.y),r=Qt(t)&&Qt(e)?Nt(t.z,e.z):0;return Math.sqrt(Math.pow(i,2)+Math.pow(n,2)+Math.pow(r,2))}return 0}({x:i+r/2,y:n+r/2},{x:d.width/2,y:d.height/2})),!this.firstMeaningfulPaint)return;t.crop?t.crop[0]&&this.ctx.drawImage(u.canvas,t.crop[5*e+1],t.crop[5*e+2],t.crop[5*e+3]-t.crop[5*e+1]-1,t.crop[5*e+4]-t.crop[5*e+2]-1,i,n,r+Number.MIN_VALUE,o+Number.MIN_VALUE):this.ctx.drawImage(u.canvas,t.display.points[5*e+1],t.display.points[5*e+2],t.display.points[5*e+3]-t.display.points[5*e+1]-1,t.display.points[5*e+4]-t.display.points[5*e+2]-1,i,n,r+Number.MIN_VALUE,o+Number.MIN_VALUE)}catch(t){}}if(this.options.box&&t instanceof Yt&&!t.props.className&&!t.props.html){if(t.props.style){var c=Object.assign({},t.props.style||{},t.hovering?t.props.hoverStyles:{},t.pressing?t.props.pressStyles:{}),p=t.props.relativeStyle?1:r/t.width;void 0!==c.opacity&&(this.ctx.globalAlpha=c.opacity);var f=0;void 0!==c.borderWidth&&(f=parseInt(c.borderWidth,10)*p);var g=0;void 0!==c.outlineWidth&&(g=parseInt(c.outlineWidth,10)*p);var v=0;if(void 0!==c.outlineOffset&&(v=parseInt(c.outlineOffset,10)*p),c.borderColor&&(this.ctx.strokeStyle=c.borderColor),c.boxShadow){var y=c.boxShadow.split(/,(?![^(]*\))/);try{for(var m=a(y),w=m.next();!w.done;w=m.next()){var x=w.value,b=$t[x]||Vt.exec(x)||Vt.exec(x);$t[x]=b,b&&(this.ctx.save(),this.ctx.shadowOffsetX=parseInt(b[1])*this.dpi*p,this.ctx.shadowOffsetY=parseInt(b[3])*this.dpi*p,this.ctx.shadowBlur=parseInt(b[5])*this.dpi*p,this.ctx.shadowColor=b[9],this.ctx.fillStyle="rgba(0,0,0,1)",this.ctx.fillRect(i+f,n+f,r,o),this.ctx.restore())}}catch(t){s={error:t}}finally{try{w&&!w.done&&(h=m.return)&&h.call(m)}finally{if(s)throw s.error}}}this.ctx.fillStyle=c.backgroundColor||"transparent",this.ctx.lineWidth=f,f&&this.ctx.strokeRect(i+f/2,n+f/2,r+f,o+f),this.ctx.fillRect(i+f,n+f,r,o),g&&(c.outlineColor&&(this.ctx.strokeStyle=c.outlineColor),this.ctx.lineWidth=g,this.ctx.strokeRect(i-g/2-v,n-g/2-v,r+2*f+g+2*v,o+2*f+g+2*v))}this.ctx.globalAlpha=l}},t.prototype.loadImage=function(t,e,i){if(Gt[t]&&Gt[t].naturalWidth>0)e(Gt[t]);else try{var n=document.createElement("img");n.decoding="auto",n.onload=function(){e(n),Gt[t]=n,n.onload=null},this.options.crossOrigin&&(n.crossOrigin="anonymous"),n.src=t}catch(t){i(t)}},t.prototype.schedulePaintToCanvas=function(t,e,i,n){var r=this;this.imagesPending++,t.indices.push(i),e.__host.canvas.loading=!0;var o="".concat(e.id,"--").concat(e.display.scale);this.loadingQueueOrdered=!1,this.loadingQueue.push({id:o,scale:e.display.scale,distance:n,task:function(){return new Promise((function(s){if(-1===r.visible.indexOf(e))return r.imagesPending--,t.indices.splice(t.indices.indexOf(i),1),void s();var a=e.getImageUrl(i);r.loadImage(a,(function(a){r.loadingQueue.push({id:o,scale:e.display.scale,distance:n,task:function(){return new Promise((function(n){r.imagesLoaded++,t.loaded.push(i),t.loaded.length===t.indices.length&&(t.loading=!1);var o=e.display.points.slice(5*i,5*i+5);t.canvas.getContext("2d").drawImage(a,o[1],o[2],o[3]-o[1],o[4]-o[2]),r.isGPUBusy=!r.firstMeaningfulPaint&&!0,n()}))}}),s()}),(function(e){r.imagesPending--,t.indices.splice(t.indices.indexOf(i),1),console.log("Error loading image",e),s()}))}))}})},t.prototype.afterPaintLayer=function(t,e){},t.prototype.prepareLayer=function(t){t.__host&&t.__host.canvas||(t instanceof S||t instanceof F)&&this.createImageHost(t)},t.prototype.createImageHost=function(t){var e,i=document.createElement("canvas");i.width=t.display.width,i.height=t.display.height,null===(e=i.getContext("2d"))||void 0===e||e.clearRect(0,0,t.display.width,t.display.height),t.__host=t.__host?t.__host:{},t.__host.canvas={canvas:i,indices:[],loaded:[],loading:!1},Jt[t.id]=t.__host},t.prototype.getPointsAt=function(t,e,i,n){return t.getPointsAt(e,i,n)},t.prototype.getViewportBounds=function(t,e,i){var n=t.getActiveZone();if(n){var r=e[3]-e[1]<n.points[3]-n.points[1],o=e[4]-e[2]<n.points[4]-n.points[2];return{x1:r?n.points[1]-i:n.points[1]+(n.points[3]-n.points[1])/2-(e[3]-e[1])/2,y1:o?n.points[2]-i:n.points[2]+(n.points[4]-n.points[2])/2-(e[4]-e[2])/2,x2:r?n.points[3]+i:n.points[1]+(n.points[3]-n.points[1])/2-(e[3]-e[1])/2,y2:o?n.points[4]+i:n.points[2]+(n.points[4]-n.points[2])/2-(e[4]-e[2])/2}}return null},t.prototype.pendingUpdate=function(){var t=0===this.imagesPending&&0===this.loadingQueue.length&&0===this.tasksRunning;return!this.firstMeaningfulPaint&&t?(this.canvas.style.opacity="1",this.firstMeaningfulPaint=t,!0):!!this.options.debug||!t},t.prototype.getRendererScreenPosition=function(){return this.rendererPosition},t}(),te=function(){function t(t){var e,i;this.renderers=[];try{for(var n=a(t),r=n.next();!r.done;r=n.next()){var o=r.value;o&&this.renderers.push(o)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(i=n.return)&&i.call(n)}finally{if(e)throw e.error}}this.length=this.renderers.length}return t.prototype.afterFrame=function(t,e,i){for(var n=0;n<this.length;n++)this.renderers[n].afterFrame(t,e,i)},t.prototype.afterPaintLayer=function(t,e){for(var i=0;i<this.length;i++)this.renderers[i].afterPaintLayer(t,e)},t.prototype.beforeFrame=function(t,e,i){for(var n=0;n<this.length;n++)this.renderers[n].beforeFrame(t,e,i)},t.prototype.triggerResize=function(){for(var t=0;t<this.length;t++){var e=this.renderers[t];e.triggerResize&&e.triggerResize()}},t.prototype.getPointsAt=function(t,e,i,n){return this.renderers[0].getPointsAt(t,e,i,n)},t.prototype.getScale=function(t,e){return this.renderers[0].getScale(t,e)},t.prototype.getViewportBounds=function(t,e,i){return this.renderers[0].getViewportBounds(t,e,i)},t.prototype.getRendererScreenPosition=function(){return this.renderers[0].getRendererScreenPosition()},t.prototype.isReady=function(){for(var t=0;t<this.length;t++)if(!this.renderers[t].isReady())return!1;return!0},t.prototype.paint=function(t,e,i,n,r,o){for(var s=0;s<this.length;s++)this.renderers[s].paint(t,e,i,n,r,o)},t.prototype.pendingUpdate=function(){for(var t=0;t<this.length;t++)if(this.renderers[t].pendingUpdate())return!0;return!1},t.prototype.prepareLayer=function(t){for(var e=0;e<this.length;e++)this.renderers[e].prepareLayer(t)},t.prototype.resize=function(t,e){for(var i=0;i<this.length;i++)this.renderers[i].resize(t,e)},t}(),ee=function(){function t(){this.autoWidth=!1,this.autoHeight=!0,this.content=[],this.viewingDirection="left-to-right",this.columns=4,this.spacing=20,this.reversed=!1,this.padding=20,this.world=B.withProps({width:0,height:0,viewingDirection:"left-to-right"}),this.width=0,this.height=0}return t.prototype.setViewingDirection=function(t){this.viewingDirection=t},t.prototype.addContent=function(t){var e,i=this;(e=this.content).push.apply(e,l([],h(t.map((function(t){return i.world.addObjectAt(t,{width:0,height:0,x:0,y:0})}))),!1))},t.prototype.setWidth=function(t){this.width=t},t.prototype.setHeight=function(t){this.height=t},t.prototype.setSpacing=function(t){this.spacing=t},t.prototype.setPadding=function(t){this.padding=t},t.prototype.setRows=function(t){this.autoWidth=!0,this.rows=t},t.prototype.setColumns=function(t){this.autoHeight=!0,this.columns=t},t.prototype.recalculate=function(){var t=this;if((0!==this.height||0!==this.width)&&0!==this.rows&&0!==this.columns){if(this.autoHeight&&!this.width)throw new Error("Cannot set auto height without setting a width");if(this.autoWidth&&!this.height)throw new Error("Cannot set auto width without setting a height");"left-to-right"!==this.viewingDirection&&"top-to-bottom"!==this.viewingDirection||!this.reversed||(this.reversed=!1,this.content.reverse()),"right-to-left"!==this.viewingDirection&&"bottom-to-top"!==this.viewingDirection||this.reversed||(this.reversed=!0,this.content.reverse());var e=this.content.length,i=function(){if(t.autoWidth&&t.rows){var i=e>t.rows?t.rows:e;return{columns:Math.ceil(e/i),rows:i}}if(t.autoHeight&&t.columns){var n=e>t.columns?t.columns:e;return{columns:n,rows:Math.ceil(e/n)}}throw new Error("Something went wrong.")}(),n=i.columns,r=i.rows,o=this.autoWidth?-1:this.width-2*this.padding,s=this.autoWidth?-1:(o-this.spacing*(n-1))/n;if(this.autoHeight&&!this.autoWidth){for(var a=0,h=this.padding,l=0;l<r&&a!==e;l++){for(var u=0,d=[],c=0;c<n;c++){var p=this.reversed?e-a:a;if(a===e)break;var f=this.content[p],g=f.width,v=s/(f.width/f.height);d.push([a,s,v,s/g]),v>u&&(u=v),a++}for(c=0;c<n&&d[c];c++){var y=this.world.getPoints(),m=d[c][0],w=(g=d[c][1],d[c][2]),x=d[c][3],b=this.padding+c*(this.spacing+g),P=h+(u-w)/2,S=y[5*(p=this.reversed?e-m:m)+1],O=y[5*p+2];this.world.scaleWorldObject(m,x),S===b&&O===P||this.world.translateWorldObject(p,b-S,P-O)}h+=u+this.spacing}return this.height=h+this.padding,void this.world.resize(this.width,this.height)}this.autoWidth&&this.autoHeight,!this.autoWidth&&this.autoHeight}},t.prototype.getWorld=function(){return this.world},t}(),ie=!1;function ne(){if(!ie){ie=!0;var t=navigator.userAgent,e=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(t),i=/(Mac OS X)|(Windows)|(Linux)/.exec(t);if(St=/\b(iPhone|iP[ao]d)/.exec(t),Ot=/\b(iP[ao]d)/.exec(t),bt=/Android/i.exec(t),Et=/FBAN\/\w+;/i.exec(t),_t=/Mobile/i.exec(t),Pt=!!/Win64/.exec(t),e){(ct=e[1]?parseFloat(e[1]):e[5]?parseFloat(e[5]):NaN)&&document&&document.documentMode&&(ct=document.documentMode);var n=/(?:Trident\/(\d+.\d+))/.exec(t);yt=n?parseFloat(n[1])+4:ct,pt=e[2]?parseFloat(e[2]):NaN,ft=e[3]?parseFloat(e[3]):NaN,(gt=e[4]?parseFloat(e[4]):NaN)?(e=/(?:Chrome\/(\d+\.\d+))/.exec(t),vt=e&&e[1]?parseFloat(e[1]):NaN):vt=NaN}else ct=pt=ft=vt=gt=NaN;if(i){if(i[1]){var r=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(t);mt=!r||parseFloat(r[1].replace("_","."))}else mt=!1;wt=!!i[2],xt=!!i[3]}else mt=wt=xt=!1}}var re,oe={ie:function(){return ne()||ct},ieCompatibilityMode:function(){return ne()||yt>ct},ie64:function(){return oe.ie()&&Pt},firefox:function(){return ne()||pt},opera:function(){return ne()||ft},webkit:function(){return ne()||gt},safari:function(){return oe.webkit()},chrome:function(){return ne()||vt},windows:function(){return ne()||wt},osx:function(){return ne()||mt},linux:function(){return ne()||xt},iphone:function(){return ne()||St},mobile:function(){return ne()||St||Ot||bt||_t},nativeApp:function(){return ne()||Et},android:function(){return ne()||bt},ipad:function(){return ne()||Ot}},se=oe,ae=!("undefined"==typeof window||!window.document||!window.document.createElement),he={canUseDOM:ae,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:ae&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:ae&&!!window.screen,isInWorker:!ae};he.canUseDOM&&(re=document.implementation&&document.implementation.hasFeature&&!0!==document.implementation.hasFeature("",""))
|
|
16
|
+
/**
|
|
17
|
+
* Checks if an event is supported in the current execution environment.
|
|
18
|
+
*
|
|
19
|
+
* NOTE: This will not work correctly for non-generic events such as `change`,
|
|
20
|
+
* `reset`, `load`, `error`, and `select`.
|
|
21
|
+
*
|
|
22
|
+
* Borrows from Modernizr.
|
|
23
|
+
*
|
|
24
|
+
* @param {string} eventNameSuffix Event name, e.g. "click".
|
|
25
|
+
* @param {?boolean} capture Check if the capture phase is supported.
|
|
26
|
+
* @return {boolean} True if the event is supported.
|
|
27
|
+
* @internal
|
|
28
|
+
* @license Modernizr 3.0.0pre (Custom Build) | MIT
|
|
29
|
+
*/;var le=function(t,e){if(!he.canUseDOM||e&&!("addEventListener"in document))return!1;var i="on"+t,n=i in document;if(!n){var r=document.createElement("div");r.setAttribute(i,"return;"),n="function"==typeof r[i]}return!n&&re&&"wheel"===t&&(n=document.implementation.hasFeature("Events.wheel","3.0")),n};function ue(t){var e=0,i=0,n=0,r=0;return"detail"in t&&(i=t.detail),"wheelDelta"in t&&(i=-t.wheelDelta/120),"wheelDeltaY"in t&&(i=-t.wheelDeltaY/120),"wheelDeltaX"in t&&(e=-t.wheelDeltaX/120),"axis"in t&&t.axis===t.HORIZONTAL_AXIS&&(e=i,i=0),n=10*e,r=10*i,"deltaY"in t&&(r=t.deltaY),"deltaX"in t&&(n=t.deltaX),(n||r)&&t.deltaMode&&(1==t.deltaMode?(n*=40,r*=40):(n*=800,r*=800)),n&&!e&&(e=n<1?-1:1),r&&!i&&(i=r<1?-1:1),{spinX:e,spinY:i,pixelX:n,pixelY:r}}ue.getEventType=function(){return se.firefox()?"DOMMouseScroll":le("wheel")?"wheel":"mousewheel"};var de=ue;var ce={zoomOutFactor:.8,zoomInFactor:1.25,maxZoomFactor:1,minZoomFactor:.05,zoomDuration:300,zoomWheelConstant:20,zoomClamp:.6,panBounceStiffness:120,panBounceDamping:15,panTimeConstant:240,panPower:.1,nudgeDistance:100,panPadding:0,devicePixelRatio:1,enableWheel:!0,enableClickToZoom:!1,onPanInSketchMode:function(){}};function pe(t){return t.endsWith("info.json")?t:t.endsWith("/")?t+"info.json":t+"/info.json"}const fe="http://library.stanford.edu/iiif/image-api/compliance.html#level1",ge="http://library.stanford.edu/iiif/image-api/compliance.html#level2",ve="http://library.stanford.edu/iiif/image-api/conformance.html#level1",ye="http://library.stanford.edu/iiif/image-api/conformance.html#level2",me="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1",we="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2",xe="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1",be="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2",Pe="http://iiif.io/api/image/1/level1.json",Se="http://iiif.io/api/image/1/profiles/level1.json",Oe="http://iiif.io/api/image/1/level2.json",Ee="http://iiif.io/api/image/1/profiles/level2.json",_e="http://iiif.io/api/image/2/level1.json",Me="http://iiif.io/api/image/2/profiles/level1.json",Te="http://iiif.io/api/image/2/level2.json",Fe="http://iiif.io/api/image/2/profiles/level2.json",je="level1",Ie="level2",Be="http://iiif.io/api/image/2/level1",Re="http://iiif.io/api/image/2/level2",ke=[Re,ge,ye,we,be,Oe,Ee,Te,Fe,Ie],Ae=[...ke,Be,fe,ve,me,xe,Pe,Se,_e,Me,je],ze=["http://iiif.io/api/image/2/level0",Be,Re,"http://library.stanford.edu/iiif/image-api/compliance.html#level0",fe,ge,"http://library.stanford.edu/iiif/image-api/conformance.html#level0",ve,ye,"http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0",me,we,"http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0",xe,be,"http://iiif.io/api/image/1/level0.json","http://iiif.io/api/image/1/profiles/level0.json",Pe,Se,Oe,Ee,"http://iiif.io/api/image/2/level0.json","http://iiif.io/api/image/2/profiles/level0.json",_e,Me,Te,Fe,"level0",je,Ie],We={extraFormats:["jpg"],extraQualities:["default"],extraFeatures:["sizeByWhListed"]},Le={extraFormats:["jpg"],extraQualities:["default"],extraFeatures:["baseUriRedirect","cors","jsonldMediaType","regionByPx","regionSquare","sizeByWhListed","sizeByH","sizeByW","sizeByWh"]},Ce={extraFormats:["jpg","png"],extraQualities:["default"],extraFeatures:["baseUriRedirect","cors","jsonldMediaType","regionByPct","regionByPx","regionSquare","rotationBy90s","sizeByWhListed","sizeByConfinedWh","sizeByH","sizeByPct","sizeByW","sizeByWh"]};function De(t){return-1!==ke.indexOf(t)?Ce:-1!==Ae.indexOf(t)?Le:We}function Ue(t){try{if("full"===t)return{full:!0};if("square"===t)return{square:!0};const e=t.startsWith("pct:"),i=t.substr(e?4:0).split(",").map(t=>parseFloat(t));return{x:i[0],y:i[1],w:i[2],h:i[3],percent:e}}catch{throw new Error("Expected 'full', 'square' or 'x,y,w,h'. Found "+t)}}function He(t){const e={upscaled:!1,max:!1,confined:!1};if("^"===t[0]&&(e.upscaled=!0,t=t.slice(1)),"max"===t||"full"===t)return e.max=!0,e.serialiseAsFull="full"===t,e;if("!"===t[0]&&(e.confined=!0,t=t.slice(1)),"p"===t[0])return e.percentScale=parseFloat(t.slice(4)),e;const i=t.split(",").map(t=>t.trim());return i.length&&(""!==i[0]&&(e.width=parseInt(i[0],10)),""!==i[1]&&(e.height=parseInt(i[1],10))),e}function Qe(t){const e={angle:0};if("!"===t[0]&&(e.mirror=!0,t=t.substr(1)),e.angle=parseFloat(t)%360,Number.isNaN(e.angle))throw new Error("Invalid rotation "+t);return e}function Ne(t){const e=function(t,e=""){const i=t.match(/^(([a-zA-Z]+):\/\/([^\/]+))?((.*)+)/);if(!i)throw new Error("Invalid or unknown input "+t);const n=i[2],r=i[3];let o=i[4];if("/"===o[0]&&(o=o.substr(1)),e.length>0){if("/"===e[0]&&(e=e.substr(1)),e!==o.substr(0,e.length))throw new Error(`Path does not start with prefix (path: ${o}, prefix: ${e})`);o=o.substr(e.length)}const s=o.split("/").reverse(),[a,h,l,u,...d]=s,c=d.reverse().filter(Boolean).join("/");if(1===s.length||""===a)return{type:"base",scheme:n,server:r,prefix:e,identifier:c};if("info.json"===a){const[,...t]=s;return{type:"info",scheme:n,server:r,prefix:e,identifier:t.reverse().filter(Boolean).join("/")}}const p=a.split(".");return{type:"image",scheme:n,server:r,prefix:e,identifier:c,originalPath:o,region:Ue(u),size:He(l),rotation:Qe(h),quality:p[0],format:p[1]}}(pe(t.id));if("info"!==e.type)throw new Error("Invalid service URL");const i=function(t){const e=t?Array.isArray(t.profile)?t.profile:[t.profile]:[],i={extraQualities:[],extraFormats:[],extraFeatures:[]};for(let t of e)if("string"==typeof t&&(t=De(t)),t){if(t.formats)for(const e of t.formats)-1===i.extraFormats.indexOf(e)&&i.extraFormats.push(e);if(t.qualities)for(const e of t.qualities)-1===i.extraQualities.indexOf(e)&&i.extraQualities.push(e);if(t.supports)for(const e of t.supports)-1===i.extraFeatures.indexOf(e)&&i.extraFeatures.push(e);if(t.maxHeight&&(i.maxHeight=t.maxHeight),t.maxWidth&&(i.maxWidth=t.maxWidth),t.maxArea&&(i.maxArea=t.maxArea),t.extraFormats)for(const e of t.extraFormats)-1===i.extraFormats.indexOf(e)&&i.extraFormats.push(e);if(t.extraQualities)for(const e of t.extraQualities)-1===i.extraQualities.indexOf(e)&&i.extraQualities.push(e);if(t.extraFeatures)for(const e of t.extraFeatures)-1===i.extraFeatures.indexOf(e)&&i.extraFeatures.push(e);t.maxHeight&&(i.maxHeight=t.maxHeight),t.maxWidth&&(i.maxWidth=t.maxWidth),t.maxArea&&(i.maxArea=t.maxArea)}if(t.extraFormats)for(const e of t.extraFormats)-1===i.extraFormats.indexOf(e)&&i.extraFormats.push(e);if(t.extraFeatures)for(const e of t.extraFeatures)-1===i.extraFeatures.indexOf(e)&&i.extraFeatures.push(e);if(t.extraQualities)for(const e of t.extraQualities)-1===i.extraQualities.indexOf(e)&&i.extraQualities.push(e);return i}(t);return{identifier:e.identifier,originalPath:"",server:e.server,prefix:e.prefix,scheme:e.scheme,type:"image",quality:-1===i.extraQualities.indexOf("default")?i.extraQualities[0]:"default",region:{full:!0},size:{max:!0,upscaled:!1,confined:!1},format:"jpg",rotation:{angle:0}}}function qe(t,e,i){const n=i.length,r=[];for(let e=0;e<n;e++){const n=i[e].width;r.push(t/n)}return r}function Ze(t,e,i){const n=i.length,r=[];for(let o=0;o<n;o++){const n=i[o];r.push({width:Math.floor(t/n),height:Math.floor(e/n)})}return r}function Xe(t){return t["@id"]?t["@id"]:t.id?t.id:void 0}function Ye(t){if(!t||!t.profile||!Xe(t))return!1;const e=Array.isArray(t.profile)?t.profile:[t.profile];for(const t of e)if("string"==typeof t&&-1!==ze.indexOf(t))return!0;return!1}function Ve(t){if(!function(t){if(!Ye(t))return!1;const e=Array.isArray(t.profile)?t.profile:[t.profile];for(const t of e)if("string"==typeof t){if(-1!==Ae.indexOf(t))return!0}else{const e=[...t.supports||[],...t.extraFeatures||[]];if(-1!==e.indexOf("regionByPx")&&(-1!==e.indexOf("sizeByW")||-1!==e.indexOf("sizeByWh")))return!0}return!1}(t))return[];const e=[],i=Array.isArray(t.profile)?t.profile:[t.profile],n=i.length;for(let e=0;e<n;e++){const n=i[e];if("string"!=typeof n&&(n.maxHeight||n.maxWidth))return[{id:Xe(t),type:"variable",minWidth:0,minHeight:0,maxHeight:n.maxHeight||n.maxWidth,maxWidth:n.maxWidth||n.maxHeight}]}if(t.tiles){const i=t.tiles.length;for(let n=0;n<i;n++){const i=t.tiles[n];(i.height||i.width)&&e.push({id:Xe(t),type:"variable",minHeight:0,minWidth:0,maxHeight:i.height||i.width,maxWidth:i.width})}}return e}function $e(t){const e=t.match(/^.*\/(full)\/(((\d+),(\d+)?)|max)\/(\d+)\/default\.(jpg|png|jpeg)$/);if(e){const i=e[1],n=parseInt(e[4],10),r=parseInt(e[5],10),o=e[7];if(("max"===i||"full"===i)&&n&&r&&o)return{type:"fixed",id:t,height:r,width:n}}return{type:"unknown",id:t}}function Ge(t){return Ye(t)?(t&&t.sizes?t.sizes:[]).map(e=>({id:Xe(t),type:"fixed-service",height:e.height,width:e.width})):[]}function Je(t){const e=[],i=t.length;for(let n=0;n<i;n++){const i=Ge(t[n]);i.length&&e.push(...i);const r=Ve(t[n]);r.length&&e.push(...r)}return e}function Ke(t){const e=t.service?Array.isArray(t.service)?t.service:[t.service]:[],i=e.length,n=[];for(let t=0;t<i;t++)Ye(e[t])&&n.push(e[t]);return n}function ti(t,e=!0,i){const n=[],r=function(t){if("string"==typeof t)return $e(t);const e=function(t){return t["@type"]?t["@type"]:t.type?t.type:void 0}(t);if("Image"!==e&&"sc:Image"!==e)return null;const i=t,n=Xe(i);return n?n&&i.width&&i.height?{id:n,type:"fixed",width:i.width,height:i.height,unsafe:!0}:$e(n):null}(t);if(null===r)return n;const o=t;if(n.push(r),e&&o.width&&o.height){const t=[],e=Ke(o);for(const n of e){const e={id:Xe(n),width:o.width,height:o.height};if(i.canLoadSync(e)){const n=i.loadServiceSync(e);n&&(n.height||(n.height=o.height),n.width||(n.width=o.width),t.push(...Je([n])))}}if(t.length)return n.push(...t),n}return o.service&&n.push(...Je(o.service)),n}function ei({x:t=0,y:e=0,w:i,h:n,full:r,square:o,percent:s}){if(r)return"full";if(o)return"square";if(typeof i>"u"||typeof n>"u")throw new Error("RegionParameter: invalid region");const a=`${t},${e},${i},${n}`;return s?"pct:"+a:a}function ii({max:t,percentScale:e,upscaled:i,confined:n,width:r,height:o,serialiseAsFull:s}){const a=[];return i&&a.push("^"),t?(a.push(s?"full":"max"),a.join("")):(n&&a.push("!"),e&&a.push("pct:"+e),r&&a.push(""+r),a.push(","),o&&a.push(""+o),a.join(""))}function ni(t){return`${t.mirror?"!":""}${(t.angle||0)%360}`}var ri=Object.defineProperty,oi=Object.defineProperties,si=Object.getOwnPropertyDescriptors,ai=Object.getOwnPropertySymbols,hi=Object.prototype.hasOwnProperty,li=Object.prototype.propertyIsEnumerable,ui=(t,e,i)=>e in t?ri(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,di=(t,e)=>{for(var i in e||(e={}))hi.call(e,i)&&ui(t,i,e[i]);if(ai)for(var i of ai(e))li.call(e,i)&&ui(t,i,e[i]);return t},ci=(t,e)=>oi(t,si(e));function pi(t,e){const i=t.prefix.startsWith("/")?t.prefix.substr(1):t.prefix,n=`${t.scheme}://${t.server}/${i?i+"/":""}${t.identifier}`;if("base"===t.type)return n;if("info"===t.type)return n+"/info.json";let{region:r,size:o,rotation:s,format:a,quality:h}=t;if(e){const t=e["@context"]?Array.isArray(e["@context"])?e["@context"]:[e["@context"]]:[],i=-1!==t.indexOf("http://iiif.io/api/image/2/context.json"),n=-1!==t.indexOf("http://iiif.io/api/image/3/context.json");if((o.width===e.width&&!o.height||o.height===e.height&&!o.width||o.width===e.width&&o.height===e.height)&&(o=ci(di({},o),{max:!0})),i&&(o.max&&!o.serialiseAsFull&&(o=ci(di({},o),{serialiseAsFull:!0})),!o.max&&o.width&&o.height&&(o=ci(di({},o),{height:void 0}))),n&&(o.max&&o.serialiseAsFull&&(o=ci(di({},o),{serialiseAsFull:!1})),o.width&&!o.height&&e.width&&e.height)){const t=e.height/e.width;o=ci(di({},o),{height:Math.ceil(o.width*t)})}}return[n,ei(r),ii(o),ni(s),`${h}.${a}`].filter(Boolean).join("/")}function fi(t,e,i){const n=Ne({id:pe(Xe(t)),profile:"level2",type:"ImageService2"});if("image"!==n.type)throw new Error("Invalid service");return n.size.max=!1,n.size.width=e,n.size.height=i,{id:pi(n),type:"fixed",width:e,height:i||t.height/(t.width||1)*e,unsafe:t.width>e}}function gi(t){const e=t.replace(/(https?:\/\/)?(www.)?/i,"");return-1!==e.indexOf("/")?e.split("/")[0]:e}function vi(t,e){const i=[],n=Object.assign({unsafeImageService:!1,atAnyCost:!0,fallback:!0,minHeight:64,minWidth:64,maxHeight:1/0,maxWidth:1/0,returnAllOptions:!1,preferFixedSize:!1,allowUnsafe:!1,explain:!1,height:0,width:0},t),r=[],o=[];let s=null;const a=(t,e)=>{if(function(t,e,i){const n=t.width?t.width:t.maxWidth;return i.height<=t.maxHeight&&i.width<=t.maxWidth&&i.height>=t.minHeight&&i.width>=t.minWidth&&(!e||Math.abs(i.width-n)<Math.abs(e.width-n))}(n,e,t)){if(n.preferFixedSize&&t.unsafe)return void o.push(t);n.returnAllOptions&&e&&o.push(e),s=t}else n.returnAllOptions&&o.push(t)},h=e.length;for(let t=0;t<h;t++){const i=e[t](),o=i.length;for(let t=0;t<o;t++){const e=i[t];if("unknown"===e.type&&n.atAnyCost&&r.push(e),"fixed"===e.type&&(e.unsafe?r.push(e):a(e,s)),"fixed-service"===e.type)if(n.unsafeImageService){a(fi(e,n.width,n.height),s)}else{a(fi(e,e.width,e.height),s)}if("variable"===e.type&&e.maxWidth){a(fi({id:e.id,type:"fixed-service",width:e.maxWidth,height:e.maxWidth},e.maxWidth),s)}}if(s&&!n.returnAllOptions){if(s.unsafe||n.allowUnsafe)continue;break}}return n.atAnyCost&&0===o.length?{best:s||r[0],fallback:r.slice(1),log:i}:n.returnAllOptions?{best:n.atAnyCost?s||o[0]||r[0]:s||o[0],fallback:[...o,...r],log:i}:{best:s||o[0]||null,fallback:s?o:o.slice(1),log:i}}var yi=Object.defineProperty,mi=Object.defineProperties,wi=Object.getOwnPropertyDescriptors,xi=Object.getOwnPropertySymbols,bi=Object.prototype.hasOwnProperty,Pi=Object.prototype.propertyIsEnumerable,Si=(t,e,i)=>e in t?yi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Oi=(t,e)=>{for(var i in e||(e={}))bi.call(e,i)&&Si(t,i,e[i]);if(xi)for(var i of xi(e))Pi.call(e,i)&&Si(t,i,e[i]);return t},Ei=(t,e)=>mi(t,wi(e));function _i(t,e,i){const n=t>e?t:e,r=i.length,o=[];for(let t=0;t<r;t++){const e=i[t];let r=e.scaleFactors[0],s=n/r;const a=[r];for(;s>=e.width;)r*=2,a.push(r),s/=2;o.push(Ei(Oi({},e),{scaleFactors:a}))}return o}var Mi=(t,e,i)=>new Promise((n,r)=>{var o=t=>{try{a(i.next(t))}catch(t){r(t)}},s=t=>{try{a(i.throw(t))}catch(t){r(t)}},a=t=>t.done?n(t.value):Promise.resolve(t.value).then(o,s);a((i=i.apply(t,e)).next())});const Ti=new class{constructor(){this.config={verificationsRequired:1,approximateServices:!0,enableFetching:!0,disableThrottling:!1},this.fetchingCount=0,this.imageServices={},this.knownImageServers={}}setConfig(t){Object.assign(this.config,t)}sample(t,e,i=!0){const n=gi(Xe(t)),r=pe(Xe(t)),o=this.knownImageServers[n];return this.imageServices[r]=Object.assign(t,{real:!0}),o?this.verify(t):(this.knownImageServers[n]={verifications:0,malformed:!1,root:n,preLoaded:i,sampledId:Xe(t),verified:!1,server:null,result:{context:t["@context"]||[],sampledProfile:t.profile,resourceServiceRatio:e&&t.height?e.height/t.height:1,sampledSizes:t.sizes||[],sizeRatios:qe(t.width,t.height,t.sizes||[]),sampledTiles:t.tiles||[]}},!0)}preLoad(t,e=!0){this.knownImageServers[t.root]=t,e&&(this.knownImageServers[t.root].malformed=!1,this.knownImageServers[t.root].verifications=this.config.verificationsRequired)}predict(t,e=!1,i=!1){const n=gi(Xe(t)),r=this.knownImageServers[n];if(!r||!r.result||!i&&(r.malformed||r.verifications<this.config.verificationsRequired))return null;const o=pe(Xe(t));return this.imageServices[o]||(this.imageServices[o]={"@context":r.result.context,"@id":Xe(t),id:Xe(t),protocol:"http://iiif.io/api/image",tiles:_i(t.width,t.height,r.result.sampledTiles),sizes:Ze(Math.floor(t.width/r.result.resourceServiceRatio),Math.floor(t.height/r.result.resourceServiceRatio),r.result.sizeRatios),profile:r.result.sampledProfile,height:t.height,width:t.width,real:!1}),this.imageServices[o]}getThumbnailFromResource(t,e){return Mi(this,arguments,(function*(t,e,i=!0,n=[]){const r=yield this.getImageCandidates(t,i);return vi(e,[()=>n,()=>r])}))}getImageCandidates(t,e=!0){return Mi(this,null,(function*(){const i=t;if(e&&i.height&&i.width){const t=Ke(i);for(const e of t){const t={id:Xe(e),width:e.width?e.width:i.width,height:e.height?e.height:i.height};yield this.loadService(t)}}return ti(t,e,this)}))}verify(t){return Mi(this,null,(function*(){const e=this.predict(t,!1,!0),i=yield this.fetchService(Xe(t));if(!e)return!1;const n=e.height===i.height&&e.width===i.width&&e["@context"]===i["@context"]&&function(t,e){if(t.length!==e.length)return!1;if(0===t.length&&0===e.length)return!0;const i=t.length;let n=!0;for(let r=0;r<i;r++){const i=t[r],o=e[r];if(i.width!==o.width||i.height!==o.height){n=!1;break}}if(n)return!0;let r=0;for(let n=0;n<i;n++)for(let o=0;o<i;o++)if(t[n].width===e[o].width&&t[n].height===e[o].height){r++;break}return r===i}(e.sizes||[],i.sizes||[]);if(n){const e=gi(Xe(t));this.knownImageServers[e].verifications+=1,this.knownImageServers[e].verifications>=this.config.verificationsRequired&&(this.knownImageServers[e].verified=!0)}return n}))}canLoadSync(t){const e="string"==typeof t?t:Xe(t),i=pe(e);if(this.imageServices[i])return!0;const n=this.knownImageServers[gi(e)];return n&&!n.malformed&&n.verifications>=this.config.verificationsRequired}markAsMalformed(t){return Mi(this,null,(function*(){return this.knownImageServers[gi(Xe(t))].malformed=!0,this.loadService(t,!0)}))}fetchService(t,e=!1){return Mi(this,null,(function*(){const i=pe(t);if(this.imageServices[i]&&(!e||this.imageServices[i].real))return this.imageServices[i];if(!this.config.enableFetching)throw new Error("Fetching is not enabled");const n=yield this.fetch(i).then(t=>t.json());return!n.id&&n["@id"]&&(n.id=n["@id"]),n.id!==t&&(n.id=t,n["@id"]&&(n["@id"]=t)),this.imageServices[i]=Object.assign(n,{real:!0}),this.imageServices[i]}))}fetch(t,e){return Mi(this,null,(function*(){return fetch(t,e)}))}loadService(t,e=!1){return Mi(this,null,(function*(){if(!this.config.disableThrottling){let t=!0;for(;t;){if(!(this.fetchingCount>=this.config.verificationsRequired)){t=!1;break}yield new Promise(t=>setTimeout(t,500))}}const i=this.knownImageServers[gi(Xe(t))];if(i&&!i.malformed&&!e){yield i.result;const e=this.loadServiceSync(t);if(e)return e}this.fetchingCount++;const n=yield this.fetchService(Xe(t),e);return this.fetchingCount--,n.real&&this.sample(n,t),n}))}loadServiceSync(t){const e=pe(Xe(t));return this.imageServices[e]?this.imageServices[e]:this.predict(t)}};var Fi=function(){function t(t,e,i){var r=this;this.activatedEvents=[],this.eventHandlers=[],this.pointerMoveEvent=void 0,this.pointerEventState={isClicking:!1,isDragging:!1,isPressed:!1,mousedOver:[],itemsBeingDragged:[],mouseDownStart:{x:0,y:0},lastTouches:[]},this._realPointerMove=function(t){r.pointerMoveEvent=t},this.onWheelEvent=function(t){t.preventDefault(),r.onPointerEvent(t)},this.onTouchEvent=function(t){for(var e=b[t.type],i=[],n=t.touches.length,o=0;o<n;o++){var s=t.touches.item(o);if(s){var a=r.runtime.viewerToWorld(s.clientX-r.bounds.left,s.clientY-r.bounds.top),h=a.x,l=a.y,u={id:s.identifier,x:h,y:l};i.push(u)}}i.length&&r.assignToEvent(t,i[0].x,i[0].y),"onTouchEnd"!==e?(r.pointerEventState.lastTouches=i,t.atlasTouches=i,r.runtime.world.propagateTouchEvent(e,t,i)):(t.atlasTouches=[],r.runtime.world.propagateTouchEvent(e,t,r.pointerEventState.lastTouches),r.pointerEventState.lastTouches=[])},this.onPointerEvent=function(t){var e=b[t.type];if(e&&-1!==r.runtime.world.activatedEvents.indexOf(e)){var i=r.runtime.viewerToWorld(t.clientX-r.bounds.left,t.clientY-r.bounds.top),n=i.x,o=i.y;r.assignToEvent(t,n,o),r.runtime.world.propagatePointerEvent(e,t,n,o)}},this.onPointerDown=function(t){r.pointerEventState.isPressed=!0,r.pointerEventState.isClicking=!0,r.pointerEventState.mouseDownStart.x=t.clientX,r.pointerEventState.mouseDownStart.y=t.clientY,setTimeout((function(){r.runtime&&(r.pointerEventState.isClicking=!1)}),250),setTimeout((function(){if(r.runtime&&r.pointerEventState.isPressed&&!r.pointerEventState.isDragging){var e=r.runtime.viewerToWorld(r.pointerEventState.mouseDownStart.x-r.bounds.left,r.pointerEventState.mouseDownStart.y-r.bounds.top);r.pointerEventState.isDragging=!0,r.pointerEventState.itemsBeingDragged=r.runtime.world.propagatePointerEvent("onDragStart",t,e.x,e.y)}}),800),r.onPointerEvent(t)},this.onPointerUp=function(t){var e,i;if(r.pointerEventState.isClicking){var n=r.runtime.viewerToWorld(t.clientX-r.bounds.left,t.clientY-r.bounds.top),o=n.x,s=n.y;r.assignToEvent(t,o,s),r.runtime.world.propagatePointerEvent("onClick",t,o,s)}if(r.pointerEventState.isDragging){try{for(var h=a(r.pointerEventState.itemsBeingDragged),l=h.next();!l.done;l=h.next()){l.value.dispatchEvent("onDragEnd",t)}}catch(t){e={error:t}}finally{try{l&&!l.done&&(i=h.return)&&i.call(h)}finally{if(e)throw e.error}}r.pointerEventState.isDragging=!1}r.pointerEventState.isClicking=!1,r.pointerEventState.isPressed=!1,r.pointerEventState.itemsBeingDragged=[],r.onPointerEvent(t)},this.onPointerMove=function(t){var e,i,o,s,h,l;r.pointerMoveEvent=void 0;var u=r.runtime.viewerToWorld(t.clientX-r.bounds.left,t.clientY-r.bounds.top),d=u.x,c=u.y;r.assignToEvent(t,d,c),r.runtime.world.propagatePointerEvent("onPointerMove",t,d,c);var p=r.runtime.world.propagatePointerEvent("onMouseMove",t,d,c),f=[],g=[];try{for(var v=a(p),y=v.next();!y.done;y=v.next()){var m=y.value;f.push(m.id),g.push(m),-1===r.pointerEventState.mousedOver.indexOf(m)&&(m.dispatchEvent("onMouseEnter",t),m.dispatchEvent("onPointerEnter",t),m.dispatchEvent("onMouseOver",t),m.dispatchEvent("onPointerOver",t))}}catch(t){e={error:t}}finally{try{y&&!y.done&&(i=v.return)&&i.call(v)}finally{if(e)throw e.error}}try{for(var w=a(r.pointerEventState.mousedOver),x=w.next();!x.done;x=w.next()){var b=x.value;-1===f.indexOf(b.id)&&(b.dispatchEvent("onMouseLeave",t),b.dispatchEvent("onPointerLeave",t),b.dispatchEvent("onMouseOut",t),b.dispatchEvent("onPointerOut",t))}}catch(t){o={error:t}}finally{try{x&&!x.done&&(s=w.return)&&s.call(w)}finally{if(o)throw o.error}}if(r.pointerEventState.isDragging)try{for(var P=a(r.pointerEventState.itemsBeingDragged),S=P.next();!S.done;S=P.next()){(m=S.value).dispatchEvent("onDrag",t)}}catch(t){h={error:t}}finally{try{S&&!S.done&&(l=P.return)&&l.call(P)}finally{if(h)throw h.error}}if(r.pointerEventState.isPressed&&!r.pointerEventState.isDragging&&function(t,e){var i=T(t.x,e.x),n=T(t.y,e.y);return Math.sqrt(Math.pow(i,2)+Math.pow(n,2))}(r.pointerEventState.mouseDownStart,{x:t.clientX,y:t.clientY})>50){var O=r.runtime.viewerToWorld(r.pointerEventState.mouseDownStart.x-r.bounds.left,r.pointerEventState.mouseDownStart.y-r.bounds.top);r.pointerEventState.isDragging=!0,r.pointerEventState.itemsBeingDragged=r.runtime.world.propagatePointerEvent("onDragStart",n(n({},t),{atlas:{x:O.x,y:O.y}}),O.x,O.y)}r.pointerEventState.mousedOver=g},this.element=t,this.runtime=e,this.unsubscribe=e.world.addLayoutSubscriber(this.layoutSubscriber.bind(this)),this.bounds=t.getBoundingClientRect(),this.options=n({simulationRate:0},i||{});var o=0;e.registerHook("useFrame",(function(t){(o+=t)>r.options.simulationRate&&r.pointerMoveEvent&&(o=0,e.updateNextFrame())})),e.registerHook("useBeforeFrame",(function(){r.pointerMoveEvent&&r.onPointerMove(r.pointerMoveEvent)})),this.activateEvents()}return t.prototype.updateBounds=function(){this.bounds=this.element.getBoundingClientRect(),this.runtime.updateRendererScreenPosition()},t.prototype.layoutSubscriber=function(t){"event-activation"===t&&this.activateEvents()},t.prototype.assignToEvent=function(e,i,n){t.eventPool.atlas.x=i,t.eventPool.atlas.y=n,e.atlas=t.eventPool.atlas},t.prototype.activateEvents=function(){this.element.addEventListener("pointermove",this._realPointerMove),this.element.addEventListener("pointerup",this.onPointerUp),this.element.addEventListener("pointerdown",this.onPointerDown),this.element.addEventListener("mousedown",this.onPointerEvent),this.element.addEventListener("mouseup",this.onPointerEvent),this.element.addEventListener("pointercancel",this.onPointerEvent),this.element.addEventListener("wheel",this.onWheelEvent),this.element.addEventListener("touchstart",this.onTouchEvent),this.element.addEventListener("touchcancel",this.onTouchEvent),this.element.addEventListener("touchend",this.onTouchEvent),this.element.addEventListener("touchmove",this.onTouchEvent)},t.prototype.normalizeEventName=function(t){return t.startsWith("on")?t.slice(2).toLowerCase():t.toLowerCase()},t.prototype.stop=function(){var t,e;this.unsubscribe();try{for(var i=a(this.eventHandlers),n=i.next();!n.done;n=i.next()){var r=h(n.value,2),o=r[0],s=r[1];this.element.removeEventListener(this.normalizeEventName(o),s)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}},t.eventPool={atlas:{x:0,y:0}},t}();t.BrowserEventManager=Fi,t.CanvasRenderer=Kt,t.CompositeRenderer=te,t.CompositeResource=j,t.GridBuilder=ee,t.ImageTexture=O,t.Runtime=Y,t.SingleImage=S,t.TiledImage=F,t.World=B,t.WorldObject=I,t.Zone=A,t.defaultConfig=ce,t.fromImage=function(t){var e=t.src,i=t.target,n=i?i.width:t.width,r=i?i.height:t.height;return new I({id:e,height:r,width:n,layers:[S.fromImage(e,{height:r,width:n},{width:t.width,height:t.height})]})},t.getTileFromImageService=function(t,e,i){return o(this,void 0,void 0,(function(){var n;return s(this,(function(r){switch(r.label){case 0:return[4,Ti.loadService({id:t,width:e,height:i})];case 1:return n=r.sent(),[2,{id:(o=n,o.id||o["@id"]),width:e,height:i,imageService:n,thumbnail:void 0}]}var o}))}))},t.popmotionController=function(t){return void 0===t&&(t={}),{start:function(e){var i=n(n({},ce),t),r=i.zoomWheelConstant,o=i.enableWheel,s=i.enableClickToZoom,a={pointerStart:{x:0,y:0},isPressing:!1,mousemoveBuffer:d(5)};function h(){e.world.constraintBounds()}function l(t){"explore"===e.mode&&(t.preventDefault(),a.pointerStart.x=t.atlas.x,a.pointerStart.y=t.atlas.y,e.transitionManager.stopTransition(),a.isPressing=!0)}function u(){a.isPressing&&("explore"===e.mode&&e.world.constraintBounds(),a.isPressing=!1)}function c(t){if(a.isPressing){var i=e.getRendererScreenPosition();if(i){var n=e.viewerToWorld(t.clientX-i.x,t.clientY-i.y),r=n.x,o=n.y;e.transitionManager.customTransition((function(t){t.from=d(e.target),t.to=m(t.from,v(a.pointerStart.x-r,a.pointerStart.y-o),a.mousemoveBuffer),t.elapsed_time=0,t.total_time=0,t.timingFunction=Z.easeInOutExpo,t.done=!1}))}}}function p(t){"explore"===e.mode&&e.world.zoomIn(t.atlas)}function f(t){var i=1+de(t).spinY/r;e.world.zoomTo(i,t.atlas,!0)}e.world.activatedEvents.push("onMouseUp","onMouseDown","onMouseMove","onTouchStart","onTouchEnd","onTouchMove","onPointerUp","onPointerDown","onPointerMove"),e.world.addEventListener("mouseup",h),e.world.addEventListener("touchend",h),e.world.addEventListener("touchstart",l),e.world.addEventListener("mousedown",l),window.addEventListener("touchend",u),window.addEventListener("mouseup",u),window.addEventListener("mousemove",c),window.addEventListener("touchmove",(function(t){if(a.isPressing&&1===t.touches.length){var i=t.touches[0],n=e.getRendererScreenPosition();if(n){var r=e.viewerToWorld(i.clientX-n.x,i.clientY-n.y),o=r.x,s=r.y;e.transitionManager.customTransition((function(t){t.from=d(e.target),t.to=m(t.from,v(a.pointerStart.x-o,a.pointerStart.y-s),a.mousemoveBuffer),t.elapsed_time=0,t.total_time=0,t.timingFunction=Z.easeInOutExpo,t.done=!1}))}}})),s&&(e.world.activatedEvents.push("onClick"),e.world.addEventListener("click",p)),o&&(e.world.activatedEvents.push("onWheel"),e.world.addEventListener("wheel",f));var g=e.world.addLayoutSubscriber((function(t,i){if("zone-changed"===t&&e.transitionManager.constrainBounds({transition:{duration:0}}),"zoom-to"===t&&i&&e.transitionManager.zoomTo(i.factor,{origin:i.point,stream:i.stream}),"go-home"===t){var n=i.immediate?{duration:0}:void 0;e.transitionManager.goToRegion({x:(r=e.homePosition)[1],y:r[2],width:r[3]-r[1],height:r[4]-r[2]},{transition:n})}var r;if("goto-region"===t&&i){n=i.immediate?{duration:0}:{};e.transitionManager.goToRegion(i,{transition:n})}"constrain-bounds"===t&&e.transitionManager.constrainBounds({transition:(null==i?void 0:i.immediate)?{duration:0}:void 0})}));return function(){e.world.removeEventListener("mouseup",h),e.world.removeEventListener("touchend",h),e.world.removeEventListener("touchstart",l),e.world.removeEventListener("mousedown",l),window.removeEventListener("touchend",u),window.removeEventListener("mouseup",u),e.world.removeEventListener("mousemove",c),e.world.removeEventListener("touchmove",c),s&&e.world.removeEventListener("click",p),o&&e.world.removeEventListener("wheel",f),g()}},updatePosition:function(){}}},Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
203
30
|
//# sourceMappingURL=standalone.umd.js.map
|