Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

viewar-guide

Package Overview
Dependencies
Maintainers
2
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

viewar-guide - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

2

dist/viewar-guide.min.js

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.viewarGuide=e():t.viewarGuide=e()}(window,function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=98)}([function(t,e){t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},function(t,e,n){var i=n(16),o="object"==typeof self&&self&&self.Object===Object&&self,r=i||o||Function("return this")();t.exports=r},function(t,e){t.exports=function(t){return null!=t&&"object"==typeof t}},function(t,e,n){var i=n(33),o=n(34),r=n(35),a=n(36),s=n(37);function c(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}c.prototype.clear=i,c.prototype.delete=o,c.prototype.get=r,c.prototype.has=a,c.prototype.set=s,t.exports=c},function(t,e,n){var i=n(5);t.exports=function(t,e){for(var n=t.length;n--;)if(i(t[n][0],e))return n;return-1}},function(t,e){t.exports=function(t,e){return t===e||t!=t&&e!=e}},function(t,e,n){var i=n(15),o=n(45),r=n(46),a="[object Null]",s="[object Undefined]",c=i?i.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?s:a:c&&c in Object(t)?o(t):r(t)}},function(t,e,n){var i=n(9)(Object,"create");t.exports=i},function(t,e,n){var i=n(60);t.exports=function(t,e){var n=t.__data__;return i(e)?n["string"==typeof e?"string":"hash"]:n.map}},function(t,e,n){var i=n(43),o=n(50);t.exports=function(t,e){var n=o(t,e);return i(n)?n:void 0}},function(t,e,n){var i=n(6),o=n(0),r="[object AsyncFunction]",a="[object Function]",s="[object GeneratorFunction]",c="[object Proxy]";t.exports=function(t){if(!o(t))return!1;var e=i(t);return e==a||e==s||e==r||e==c}},function(t,e,n){var i=n(18);t.exports=function(t,e,n){"__proto__"==e&&i?i(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,n){var i=n(10),o=n(23);t.exports=function(t){return null!=t&&o(t.length)&&!i(t)}},function(t,e,n){var i=n(9)(n(1),"Map");t.exports=i},function(t,e,n){var i=n(1).Symbol;t.exports=i},function(t,e,n){(function(e){var n="object"==typeof e&&e&&e.Object===Object&&e;t.exports=n}).call(this,n(44))},function(t,e,n){var i=n(11),o=n(5);t.exports=function(t,e,n){(void 0===n||o(t[e],n))&&(void 0!==n||e in t)||i(t,e,n)}},function(t,e,n){var i=n(9),o=function(){try{var t=i(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=o},function(t,e,n){var i=n(74)(Object.getPrototypeOf,Object);t.exports=i},function(t,e){var n=Object.prototype;t.exports=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||n)}},function(t,e,n){var i=n(75),o=n(2),r=Object.prototype,a=r.hasOwnProperty,s=r.propertyIsEnumerable,c=i(function(){return arguments}())?i:function(t){return o(t)&&a.call(t,"callee")&&!s.call(t,"callee")};t.exports=c},function(t,e){var n=Array.isArray;t.exports=n},function(t,e){var n=9007199254740991;t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=n}},function(t,e,n){(function(t){var i=n(1),o=n(77),r="object"==typeof e&&e&&!e.nodeType&&e,a=r&&"object"==typeof t&&t&&!t.nodeType&&t,s=a&&a.exports===r?i.Buffer:void 0,c=(s?s.isBuffer:void 0)||o;t.exports=c}).call(this,n(12)(t))},function(t,e,n){var i=n(79),o=n(80),r=n(81),a=r&&r.isTypedArray,s=a?o(a):i;t.exports=s},function(t,e){t.exports=function(t,e){return"__proto__"==e?void 0:t[e]}},function(t,e,n){var i=n(85),o=n(87),r=n(13);t.exports=function(t){return r(t)?i(t,!0):o(t)}},function(t,e){var n=9007199254740991,i=/^(?:0|[1-9]\d*)$/;t.exports=function(t,e){var o=typeof t;return!!(e=null==e?n:e)&&("number"==o||"symbol"!=o&&i.test(t))&&t>-1&&t%1==0&&t<e}},function(t,e){t.exports=function(t){return t}},function(t,e,n){var i=n(31),o=n(89)(function(t,e,n){i(t,e,n)});t.exports=o},function(t,e,n){var i=n(32),o=n(17),r=n(64),a=n(66),s=n(0),c=n(27),u=n(26);t.exports=function t(e,n,p,l,h){e!==n&&r(n,function(r,c){if(s(r))h||(h=new i),a(e,n,c,p,t,l,h);else{var f=l?l(u(e,c),r,c+"",e,n,h):void 0;void 0===f&&(f=r),o(e,c,f)}},c)}},function(t,e,n){var i=n(3),o=n(38),r=n(39),a=n(40),s=n(41),c=n(42);function u(t){var e=this.__data__=new i(t);this.size=e.size}u.prototype.clear=o,u.prototype.delete=r,u.prototype.get=a,u.prototype.has=s,u.prototype.set=c,t.exports=u},function(t,e){t.exports=function(){this.__data__=[],this.size=0}},function(t,e,n){var i=n(4),o=Array.prototype.splice;t.exports=function(t){var e=this.__data__,n=i(e,t);return!(n<0||(n==e.length-1?e.pop():o.call(e,n,1),--this.size,0))}},function(t,e,n){var i=n(4);t.exports=function(t){var e=this.__data__,n=i(e,t);return n<0?void 0:e[n][1]}},function(t,e,n){var i=n(4);t.exports=function(t){return i(this.__data__,t)>-1}},function(t,e,n){var i=n(4);t.exports=function(t,e){var n=this.__data__,o=i(n,t);return o<0?(++this.size,n.push([t,e])):n[o][1]=e,this}},function(t,e,n){var i=n(3);t.exports=function(){this.__data__=new i,this.size=0}},function(t,e){t.exports=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}},function(t,e){t.exports=function(t){return this.__data__.get(t)}},function(t,e){t.exports=function(t){return this.__data__.has(t)}},function(t,e,n){var i=n(3),o=n(14),r=n(51),a=200;t.exports=function(t,e){var n=this.__data__;if(n instanceof i){var s=n.__data__;if(!o||s.length<a-1)return s.push([t,e]),this.size=++n.size,this;n=this.__data__=new r(s)}return n.set(t,e),this.size=n.size,this}},function(t,e,n){var i=n(10),o=n(47),r=n(0),a=n(49),s=/^\[object .+?Constructor\]$/,c=Function.prototype,u=Object.prototype,p=c.toString,l=u.hasOwnProperty,h=RegExp("^"+p.call(l).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!r(t)||o(t))&&(i(t)?h:s).test(a(t))}},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){var i=n(15),o=Object.prototype,r=o.hasOwnProperty,a=o.toString,s=i?i.toStringTag:void 0;t.exports=function(t){var e=r.call(t,s),n=t[s];try{t[s]=void 0;var i=!0}catch(t){}var o=a.call(t);return i&&(e?t[s]=n:delete t[s]),o}},function(t,e){var n=Object.prototype.toString;t.exports=function(t){return n.call(t)}},function(t,e,n){var i=n(48),o=function(){var t=/[^.]+$/.exec(i&&i.keys&&i.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();t.exports=function(t){return!!o&&o in t}},function(t,e,n){var i=n(1)["__core-js_shared__"];t.exports=i},function(t,e){var n=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return n.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},function(t,e){t.exports=function(t,e){return null==t?void 0:t[e]}},function(t,e,n){var i=n(52),o=n(59),r=n(61),a=n(62),s=n(63);function c(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}c.prototype.clear=i,c.prototype.delete=o,c.prototype.get=r,c.prototype.has=a,c.prototype.set=s,t.exports=c},function(t,e,n){var i=n(53),o=n(3),r=n(14);t.exports=function(){this.size=0,this.__data__={hash:new i,map:new(r||o),string:new i}}},function(t,e,n){var i=n(54),o=n(55),r=n(56),a=n(57),s=n(58);function c(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}c.prototype.clear=i,c.prototype.delete=o,c.prototype.get=r,c.prototype.has=a,c.prototype.set=s,t.exports=c},function(t,e,n){var i=n(7);t.exports=function(){this.__data__=i?i(null):{},this.size=0}},function(t,e){t.exports=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}},function(t,e,n){var i=n(7),o="__lodash_hash_undefined__",r=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;if(i){var n=e[t];return n===o?void 0:n}return r.call(e,t)?e[t]:void 0}},function(t,e,n){var i=n(7),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;return i?void 0!==e[t]:o.call(e,t)}},function(t,e,n){var i=n(7),o="__lodash_hash_undefined__";t.exports=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=i&&void 0===e?o:e,this}},function(t,e,n){var i=n(8);t.exports=function(t){var e=i(this,t).delete(t);return this.size-=e?1:0,e}},function(t,e){t.exports=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},function(t,e,n){var i=n(8);t.exports=function(t){return i(this,t).get(t)}},function(t,e,n){var i=n(8);t.exports=function(t){return i(this,t).has(t)}},function(t,e,n){var i=n(8);t.exports=function(t,e){var n=i(this,t),o=n.size;return n.set(t,e),this.size+=n.size==o?0:1,this}},function(t,e,n){var i=n(65)();t.exports=i},function(t,e){t.exports=function(t){return function(e,n,i){for(var o=-1,r=Object(e),a=i(e),s=a.length;s--;){var c=a[t?s:++o];if(!1===n(r[c],c,r))break}return e}}},function(t,e,n){var i=n(17),o=n(67),r=n(68),a=n(71),s=n(72),c=n(21),u=n(22),p=n(76),l=n(24),h=n(10),f=n(0),d=n(78),y=n(25),g=n(26),v=n(82);t.exports=function(t,e,n,w,m,x,b){var _=g(t,n),z=g(e,n),O=b.get(z);if(O)i(t,n,O);else{var S=x?x(_,z,n+"",t,e,b):void 0,j=void 0===S;if(j){var A=u(z),T=!A&&l(z),P=!A&&!T&&y(z);S=z,A||T||P?u(_)?S=_:p(_)?S=a(_):T?(j=!1,S=o(z,!0)):P?(j=!1,S=r(z,!0)):S=[]:d(z)||c(z)?(S=_,c(_)?S=v(_):(!f(_)||w&&h(_))&&(S=s(z))):j=!1}j&&(b.set(z,S),m(S,z,w,x,b),b.delete(z)),i(t,n,S)}}},function(t,e,n){(function(t){var i=n(1),o="object"==typeof e&&e&&!e.nodeType&&e,r=o&&"object"==typeof t&&t&&!t.nodeType&&t,a=r&&r.exports===o?i.Buffer:void 0,s=a?a.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var n=t.length,i=s?s(n):new t.constructor(n);return t.copy(i),i}}).call(this,n(12)(t))},function(t,e,n){var i=n(69);t.exports=function(t,e){var n=e?i(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}},function(t,e,n){var i=n(70);t.exports=function(t){var e=new t.constructor(t.byteLength);return new i(e).set(new i(t)),e}},function(t,e,n){var i=n(1).Uint8Array;t.exports=i},function(t,e){t.exports=function(t,e){var n=-1,i=t.length;for(e||(e=Array(i));++n<i;)e[n]=t[n];return e}},function(t,e,n){var i=n(73),o=n(19),r=n(20);t.exports=function(t){return"function"!=typeof t.constructor||r(t)?{}:i(o(t))}},function(t,e,n){var i=n(0),o=Object.create,r=function(){function t(){}return function(e){if(!i(e))return{};if(o)return o(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();t.exports=r},function(t,e){t.exports=function(t,e){return function(n){return t(e(n))}}},function(t,e,n){var i=n(6),o=n(2),r="[object Arguments]";t.exports=function(t){return o(t)&&i(t)==r}},function(t,e,n){var i=n(13),o=n(2);t.exports=function(t){return o(t)&&i(t)}},function(t,e){t.exports=function(){return!1}},function(t,e,n){var i=n(6),o=n(19),r=n(2),a="[object Object]",s=Function.prototype,c=Object.prototype,u=s.toString,p=c.hasOwnProperty,l=u.call(Object);t.exports=function(t){if(!r(t)||i(t)!=a)return!1;var e=o(t);if(null===e)return!0;var n=p.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&u.call(n)==l}},function(t,e,n){var i=n(6),o=n(23),r=n(2),a={};a["[object Float32Array]"]=a["[object Float64Array]"]=a["[object Int8Array]"]=a["[object Int16Array]"]=a["[object Int32Array]"]=a["[object Uint8Array]"]=a["[object Uint8ClampedArray]"]=a["[object Uint16Array]"]=a["[object Uint32Array]"]=!0,a["[object Arguments]"]=a["[object Array]"]=a["[object ArrayBuffer]"]=a["[object Boolean]"]=a["[object DataView]"]=a["[object Date]"]=a["[object Error]"]=a["[object Function]"]=a["[object Map]"]=a["[object Number]"]=a["[object Object]"]=a["[object RegExp]"]=a["[object Set]"]=a["[object String]"]=a["[object WeakMap]"]=!1,t.exports=function(t){return r(t)&&o(t.length)&&!!a[i(t)]}},function(t,e){t.exports=function(t){return function(e){return t(e)}}},function(t,e,n){(function(t){var i=n(16),o="object"==typeof e&&e&&!e.nodeType&&e,r=o&&"object"==typeof t&&t&&!t.nodeType&&t,a=r&&r.exports===o&&i.process,s=function(){try{var t=r&&r.require&&r.require("util").types;return t||a&&a.binding&&a.binding("util")}catch(t){}}();t.exports=s}).call(this,n(12)(t))},function(t,e,n){var i=n(83),o=n(27);t.exports=function(t){return i(t,o(t))}},function(t,e,n){var i=n(84),o=n(11);t.exports=function(t,e,n,r){var a=!n;n||(n={});for(var s=-1,c=e.length;++s<c;){var u=e[s],p=r?r(n[u],t[u],u,n,t):void 0;void 0===p&&(p=t[u]),a?o(n,u,p):i(n,u,p)}return n}},function(t,e,n){var i=n(11),o=n(5),r=Object.prototype.hasOwnProperty;t.exports=function(t,e,n){var a=t[e];r.call(t,e)&&o(a,n)&&(void 0!==n||e in t)||i(t,e,n)}},function(t,e,n){var i=n(86),o=n(21),r=n(22),a=n(24),s=n(28),c=n(25),u=Object.prototype.hasOwnProperty;t.exports=function(t,e){var n=r(t),p=!n&&o(t),l=!n&&!p&&a(t),h=!n&&!p&&!l&&c(t),f=n||p||l||h,d=f?i(t.length,String):[],y=d.length;for(var g in t)!e&&!u.call(t,g)||f&&("length"==g||l&&("offset"==g||"parent"==g)||h&&("buffer"==g||"byteLength"==g||"byteOffset"==g)||s(g,y))||d.push(g);return d}},function(t,e){t.exports=function(t,e){for(var n=-1,i=Array(t);++n<t;)i[n]=e(n);return i}},function(t,e,n){var i=n(0),o=n(20),r=n(88),a=Object.prototype.hasOwnProperty;t.exports=function(t){if(!i(t))return r(t);var e=o(t),n=[];for(var s in t)("constructor"!=s||!e&&a.call(t,s))&&n.push(s);return n}},function(t,e){t.exports=function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}},function(t,e,n){var i=n(90),o=n(97);t.exports=function(t){return i(function(e,n){var i=-1,r=n.length,a=r>1?n[r-1]:void 0,s=r>2?n[2]:void 0;for(a=t.length>3&&"function"==typeof a?(r--,a):void 0,s&&o(n[0],n[1],s)&&(a=r<3?void 0:a,r=1),e=Object(e);++i<r;){var c=n[i];c&&t(e,c,i,a)}return e})}},function(t,e,n){var i=n(29),o=n(91),r=n(93);t.exports=function(t,e){return r(o(t,e,i),t+"")}},function(t,e,n){var i=n(92),o=Math.max;t.exports=function(t,e,n){return e=o(void 0===e?t.length-1:e,0),function(){for(var r=arguments,a=-1,s=o(r.length-e,0),c=Array(s);++a<s;)c[a]=r[e+a];a=-1;for(var u=Array(e+1);++a<e;)u[a]=r[a];return u[e]=n(c),i(t,this,u)}}},function(t,e){t.exports=function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}},function(t,e,n){var i=n(94),o=n(96)(i);t.exports=o},function(t,e,n){var i=n(95),o=n(18),r=n(29),a=o?function(t,e){return o(t,"toString",{configurable:!0,enumerable:!1,value:i(e),writable:!0})}:r;t.exports=a},function(t,e){t.exports=function(t){return function(){return t}}},function(t,e){var n=800,i=16,o=Date.now;t.exports=function(t){var e=0,r=0;return function(){var a=o(),s=i-(a-r);if(r=a,s>0){if(++e>=n)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}},function(t,e,n){var i=n(5),o=n(13),r=n(28),a=n(0);t.exports=function(t,e,n){if(!a(n))return!1;var s=typeof e;return!!("number"==s?o(n)&&r(e,n.length):"string"==s&&e in n)&&i(n[e],t)}},function(t,e,n){"use strict";n.r(e);const i=2**-16;class o{static get ZERO(){return new o(0,0,0)}static get X_AXIS(){return new o(1,0,0)}static get Y_AXIS(){return new o(0,1,0)}static get Z_AXIS(){return new o(0,0,1)}static get UNIT_SCALE(){return new o(1,1,1)}constructor(...t){if(0===t.length)this.x=0,this.y=0,this.z=0;else if(1===t.length)if(t[0]&&"object"==typeof t[0]){const{x:e,y:n,z:i}=t[0];Object.assign(this,{x:e,y:n,z:i})}else{if(!(t[0]instanceof Array))throw new Error;{const[e,n,i]=t[0];Object.assign(this,{x:e,y:n,z:i})}}else{if(3!==t.length)throw new Error;{const[e,n,i]=t;Object.assign(this,{x:e,y:n,z:i})}}}set(t,e,n){return this.x=t,this.y=e,this.z=n,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}clone(){return new o(this.x,this.y,this.z)}cross(t){return Object.assign(this,{x:this.y*t.z-this.z*t.y,y:this.z*t.x-this.x*t.z,z:this.x*t.y-this.y*t.x})}scale(t){return Object.assign(this,{x:this.x*t,y:this.y*t,z:this.z*t})}add(t){return Object.assign(this,{x:this.x+t.x,y:this.y+t.y,z:this.z+t.z})}subtract(t){return Object.assign(this,{x:this.x-t.x,y:this.y-t.y,z:this.z-t.z})}length(){return Math.hypot(this.x,this.y,this.z)}lengthSq(){return this.x**2+this.y**2+this.z**2}invert(){return this.scale(-1)}normalize(){const t=this.length();return t?this.scale(1/t):this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}equals(t){return Math.abs(this.x-t.x)<i&&Math.abs(this.y-t.y)<i&&Math.abs(this.z-t.z)<i}rotate(t){const e=t.w*this.x+t.y*this.z-t.z*this.y,n=t.w*this.y+t.z*this.x-t.x*this.z,i=t.w*this.z+t.x*this.y-t.y*this.x,o=-t.x*this.x-t.y*this.y-t.z*this.z;return Object.assign(this,{x:e*t.w+o*-t.x+n*-t.z-i*-t.y,y:n*t.w+o*-t.y+i*-t.x-e*-t.z,z:i*t.w+o*-t.z+e*-t.y-n*-t.x})}rotateAroundVector(t,e){return this.subtract(t).rotate(e).add(t)}projectOntoVector(t){const e=t.dot(this)/t.lengthSq();return this.copy(t).scale(e)}projectOntoPlane(t){return this.subtract(r.copy(this).projectOntoVector(t.normal))}}const r=new o,a=2**-16;class s{static get IDENTITY(){return new s(1,0,0,0)}static fromAxisAngle({x:t,y:e,z:n},i){return(new s).set(Math.cos(i/2),t*Math.sin(i/2),e*Math.sin(i/2),n*Math.sin(i/2)).normalize()}fromAxisAngle({x:t,y:e,z:n},i){return this.set(Math.cos(i/2),t*Math.sin(i/2),e*Math.sin(i/2),n*Math.sin(i/2)).normalize()}static fromUnitVectors(t,e){const n=new s;let i=t.dot(e)+1;return i<a?(i=0,Math.abs(t.x)>Math.abs(t.z)?u.set(-t.y,t.x,0):u.set(0,-t.z,t.y)):u.copy(t).cross(e),n.set(i,u.x,u.y,u.z).normalize()}fromUnitVectors(t,e){let n=t.dot(e)+1;return n<a?(n=0,Math.abs(t.x)>Math.abs(t.z)?u.set(-t.y,t.x,0):u.set(0,-t.z,t.y)):u.copy(t).cross(e),this.set(n,u.x,u.y,u.z).normalize()}constructor(...t){if(0===t.length)this.w=1,this.x=0,this.y=0,this.z=0;else if(1===t.length)if(t[0]&&"object"==typeof t[0])this.w=t[0].w,this.x=t[0].x,this.y=t[0].y,this.z=t[0].z;else{if(!(t[0]instanceof Array))throw new Error;this.w=t[0][0],this.x=t[0][1],this.y=t[0][2],this.z=t[0][3]}else{if(4!==t.length)throw new Error;this.w=t[0],this.x=t[1],this.y=t[2],this.z=t[3]}}set(t,e,n,i){return this.w=t,this.x=e,this.y=n,this.z=i,this}copy(t){return this.w=t.w,this.x=t.x,this.y=t.y,this.z=t.z,this}clone(){return new s(this.w,this.x,this.y,this.z)}multiply(t){return Object.assign(this,{w:this.w*t.w-this.x*t.x-this.y*t.y-this.z*t.z,x:this.w*t.x+this.x*t.w+this.y*t.z-this.z*t.y,y:this.w*t.y+this.y*t.w+this.z*t.x-this.x*t.z,z:this.w*t.z+this.z*t.w+this.x*t.y-this.y*t.x})}lengthSquared(){return this.w**2+this.x**2+this.y**2+this.z**2}length(){return Math.hypot(this.w,this.x,this.y,this.z)}normalize(){const t=this.lengthSquared();if(Math.abs(t-1)<a)return this;{const e=Math.sqrt(t);return Object.assign(this,{w:this.w/e,x:this.x/e,y:this.y/e,z:this.z/e})}}invert(){return this.conjugate()}conjugate(){return Object.assign(this,{w:this.w,x:-this.x,y:-this.y,z:-this.z})}dot(t){return this.w*t.w+this.x*t.x+this.y*t.y+this.z*t.z}equals(t){return Math.abs(Math.abs(this.dot(t))-1)<a}toAxisAngle(){const{w:t,x:e,y:n,z:i}=this,r=2*Math.acos(t),s=Math.sqrt(1-t**2);return{angle:r,axis:s<a?new o(1,0,0):new o(e/s,n/s,i/s)}}toAngleAround(t){const e=0!==(t=t.clone().normalize()).y||0!==t.z?new o(0,-t.z,t.y):new o(-t.z,0,t.x),n=e.clone().rotate(this),i=n.clone().subtract(t.clone().scale(n.dot(t))).normalize();return Math.acos(e.dot(i))}toEulerAngles(){const t=this.x*this.y+this.z*this.w;if(t>.499){return{heading:2*Math.atan2(this.x,this.w),bank:0,attitude:Math.PI/2}}if(t<-.499){return{heading:-2*Math.atan2(this.x,this.w),bank:0,attitude:-Math.PI/2}}const e=this.x*this.x,n=this.y*this.y,i=this.z*this.z;let o=Math.atan2(2*this.y*this.w-2*this.x*this.z,1-2*n-2*i),r=Math.asin(2*t);return{heading:o,bank:Math.atan2(2*this.x*this.w-2*this.y*this.z,1-2*e-2*i),attitude:r}}slerp(t,e){const n=this,i=this;if(0===e)return n;if(1===e)return n.copy(t);let o=i.dot(t);if(o<0&&((t=c.copy(t)).w=-t.w,t.x=-t.x,t.y=-t.y,t.z=-t.z,o=-o),o>=1)return n;const r=Math.sqrt(1-o**2);if(Math.abs(r)<.001)return n.w=.5*(i.w+t.w),n.x=.5*(i.x+t.x),n.y=.5*(i.y+t.y),n.z=.5*(i.z+t.z),n;const a=Math.atan2(r,o),s=Math.sin((1-e)*a)/r,u=Math.sin(e*a)/r;return n.w=i.w*s+t.w*u,n.x=i.x*s+t.x*u,n.y=i.y*s+t.y*u,n.z=i.z*s+t.z*u,n}}const c=new s,u=new o,p=(new o,new o,Object.freeze({pose:{position:{x:NaN,y:NaN,z:NaN},orientation:{w:NaN,x:NaN,y:NaN,z:NaN},scale:{x:NaN,y:NaN,z:NaN}}})),l=Object.freeze({translation:!1,rotation:!1,scaling:!1}),h=(Object.freeze({translation:!0,rotation:!1,scaling:!1}),Object.freeze({pose:{position:{x:0,y:1e5,z:0},orientation:{w:1,x:0,y:0,z:0},scale:{x:1,y:1,z:1}},interaction:l,visible:!1})),f=1e3/30,d=2*Math.PI,y=d/2,g=Object.freeze({app:{admin:!1,usePoiImages:!1,userAvoidanceEnabled:!1,showTargetNotification:!1,visualizeQrCodes:!1,defaultUser:"tempuser",initialProject:null,projectId:"guidebot-978f7",language:"en-US",viewDistance:2e4},debug:{debugStateMachine:!1,showRobotHelpers:!1,exposeServices:!1,showDebugOutput:!1,showGraphDuringNavigation:!1,showReplayControls:!1},models:{qr:"guidebot_qrcode",guide:"guidebot_robot_v4",reticule:"guidebot_reticule",poi:"guidebot_poi",path:"guidebot_path",waypoint:"guidebot_waypoint"},fallbackModels:{qr:"55563",guide:"56664",reticule:"54428",poi:"54426",path:"54429",waypoint:"54383"},guideParams:{spawnDistance:2e3,nearDistance:2e3,farDistance:4e3,minProximityRadius:100,verticalCutoff:2e3,maxLinearVelocity:1e3/30,maxAngularVelocity:d/3/30,linearAcceleration:1e3/30/30}});var v=Object.assign({},g,{language:"en"});const w=(t,e=.001)=>t>-e&&t<e?0:t;function m(t,e){const n=e-t;return Math.atan2(Math.sin(n),Math.cos(n))}function x(t,e,n){return Math.min(Math.max(t,e),n)}var b=t=>new Promise(e=>setTimeout(e,t));function _(t,e=10){const n=new Array(e).fill(null).map(()=>t()),i=[];return{get:function(){0===n.length&&console.info("Object pool exhausted, populating...");const e=n.pop()||t();return i.push(e),e},release:function(){for(;i.length;)n.push(i.pop())},get usage(){return i.length}}}const{X_AXIS:z,Y_AXIS:O,Z_AXIS:S,ZERO:j}=o,{IDENTITY:A}=s;[z,O,S,j,A].forEach(Object.freeze);const T=_(()=>new o,20),P=_(()=>new s,20),I=()=>{T.release(),P.release()},M=(t=j)=>T.get().copy(t),E=(t,e)=>M(e).subtract(t),N=t=>M(S).rotate(t),V=(t=A)=>P.get().copy(t),U=t=>V().fromUnitVectors(M(S).normalize(),M(t).normalize()),R=t=>t.pose.position,D=t=>t.toEulerAngles().heading,k=({maxAngularVelocity:t},e,n,i)=>{const o=E(e.position,R(n)).setY(0),r=U(o),a=m(D(e.orientation),D(r)),s=Math.sign(w(a)),c=a*s;e.angularVelocity=s*t,e.angularDeviation=c,e.targetOrientation=r;const u=E(R(n),e.position).setY(0),p=E(R(n),R(i)).setY(0);e.curveAngle=D(((t,e)=>V().fromUnitVectors(M(t).normalize(),M(e).normalize()))(u,p))},L=({linearAcceleration:t,maxLinearVelocity:e},n,i,o)=>{n.linearVelocity<n.targetLinearVelocity?n.linearVelocity=x(n.linearVelocity+t,0,n.targetLinearVelocity):n.linearVelocity=x(n.linearVelocity-t,n.targetLinearVelocity,e)},q=({maxLinearVelocity:t},e,n,i)=>{e.targetLinearVelocity=t*x((y-e.angularDeviation)/y,0,1)};function F(t,e,[n,i]){k(t,e,n,i),q(t,e,n,i),L(t,e,n,i),I()}const G=({linearAcceleration:t,maxLinearVelocity:e},n,i)=>{const o=E(n.position,R(i)).setY(0),r=U(o),a=m(D(n.orientation),D(r)),s=a*Math.sign(w(a));n.linearVelocity=e*x(1-s/Math.PI,0,1),n.angularDeviation=s,n.targetOrientation=r,n.curveAngle=Math.PI},C=({maxAngularVelocity:t},e,n)=>{const i=E(e.position,R(n)).setY(0),o=U(i),r=m(D(e.orientation),D(o)),a=Math.sign(w(r)),s=r*a;e.angularVelocity=x(s/t,0,t)*a};function Y(t,e,[n]){G(t,e,n),C(t,e,n),I()}var $={viewarApi:{}};class X{constructor({position:t=o.ZERO,orientation:e=s.IDENTITY,scale:n=o.UNIT_SCALE}={}){this.position=o.ZERO.copy(t),this.orientation=s.IDENTITY.copy(e),this.scale=o.UNIT_SCALE.copy(n)}copy(t){this.position.copy(t.position),this.orientation.copy(t.orientation),this.scale.copy(t.scale)}}const Z={ViewARRobotVideoDisplay:"RobotFaceTalk"},W={ViewARRobotVideoDisplay:"RobotFaceNeutral"};var H=function({insertGuide:t,setAnimationState:e,addToPoseUpdateQueue:n}){let i=null,r=!1;const a={position:o.ZERO,orientation:s.IDENTITY,scale:o.UNIT_SCALE};let c=0,u=[];return{init:async()=>i=await $.queueSceneUpdate(t),showTalkingFace:()=>$.queueSceneUpdate(()=>i.setPropertyValues(Z)),showNormalFace:()=>$.queueSceneUpdate(()=>i.setPropertyValues(W)),show:()=>$.queueSceneUpdate(()=>i.setVisible(!0)),hide:()=>$.queueSceneUpdate(()=>i.setVisible(!1)),setPose:async t=>{t.position&&a.position.copy(t.position),t.orientation&&a.orientation.copy(t.orientation),t.scale&&a.scale.copy(t.scale),r||await i.setPose(a)},processTick:()=>{r&&(u.push(Object.assign(new X(a),{durationInSeconds:1/30})),(c+=1)%3==0&&(n(i.id,u),u=[]))},animate:async t=>{const n=(()=>{const t={};for(const e of Object.keys(i.animations))t[e]={enabled:!1,time:0,loop:!1}})();e({[i.id]:Object.assign({},n,t)})},startPoseUpdate:()=>{u=[],r=!0},stopPoseUpdate:()=>r=!1,get animations(){return i.animations},get model(){return i.model},get pose(){return a},get initialized(){return!!i}}}({insertGuide:async()=>{const{sceneManager:t,modelManager:e}=$.viewarApi,n=await t.insertContainer(h),i=v.models.guide,o=e.findModelById(i)||e.findModelByForeignKey(i)||await e.getModelFromRepository(v.fallbackModels.guide),r=await t.insertModel(o,{parent:n});return await async function(t){}(),Object.defineProperties(n,{model:{value:r.model,enumerable:!0},animations:{value:r.animations,enumerable:!0},setPropertyValues:{value:r.setPropertyValues,enumerable:!0},propertyValues:{get:()=>r.propertyValues,enumerable:!0}}),n.animations.FlyOut.start({time:0,loop:!1},!0),await n.setVisible(!1),n},setAnimationState:(...t)=>$.viewarApi.coreInterface.call("setAnimationStatus",...t),addToPoseUpdateQueue:(...t)=>$.viewarApi.coreInterface.call("addToPoseUpdateQueue",...t),clearPoseUpdateQueue:(...t)=>$.viewarApi.coreInterface.call("clearPoseUpdateQueue",...t)});const B=new o;var Q=()=>{const t=$.viewarApi.cameras;for(let e of Object.values(t))if(e.active)return e};var K=function({findPathToPoi:t}){let e=null,n=[];const i=()=>e&&n[0]||p;return{chooseDestination:i=>{i&&i!==e&&(n=t(e=i))},clearDestination:()=>{e=null,n=[]},update:(t,e)=>{i()&&B.copy(i().pose.position).subtract(t).setY(0).length()<=e&&n.shift()},hasCurrentWaypoint:()=>!(!e||!n[0]),hasNextWaypoint:()=>!(!e||!n[1]),get currentWaypoint(){return i()},get nextWaypoint(){return e&&n[1]||p},get path(){return n},get destination(){return e}}}({findPathToPoi:t=>$.findPath(Q(),t)});var J=(({body:t,navigation:e,getGuideParams:n})=>{const i={linearVelocity:0,targetLinearVelocity:0,angularVelocity:0,targetAngularVelocity:0,targetOrientation:s.IDENTITY,proximityRadius:0,curveAngle:0,angularDeviation:0,position:o.ZERO,orientation:s.IDENTITY,scale:o.UNIT_SCALE,forward:o.Z_AXIS},r=({maxAngularVelocity:t},e)=>{if(e.angularDeviation>t){const t=(t=>P.get().fromAxisAngle(O,t))(e.angularVelocity);e.orientation.multiply(t),e.forward.rotate(t)}else e.orientation.copy(e.targetOrientation),e.forward.copy(N(e.targetOrientation))},a=o=>async()=>{const a=n();i.position.copy(t.pose.position),i.orientation.copy(t.pose.orientation),i.scale.copy(t.pose.scale),o(a,i,e.path),r(a,i),((t,e)=>{const n=N(e.orientation).scale(e.linearVelocity);e.position.add(n)})(0,i),(({maxLinearVelocity:t,maxAngularVelocity:e},n)=>{const i=t/(2*Math.sin(e)*Math.sin(n.curveAngle/2));n.proximityRadius=Math.max(i,t)})(a,i),e.update(i.position,i.proximityRadius),t.setPose(i)};return{get state(){return i},arrive:a(Y),followPath:a(F)}})({body:H,navigation:K,getGuideParams:()=>v.guideParams});const tt=Symbol(),et=Symbol(),nt=(t,e={time:0,loop:!1},n=!1)=>Promise.all([t.start(e,n),b(1e3*t.duration)]),it=async()=>tt,ot=async({body:t,camera:e})=>{const n=(await e.getPoseInViewingDirection(v.guideParams.spawnDistance,!0)).position;n.y=e.pose.position.y-1e3;const i=new o(e.pose.position).subtract(n).setY(0).normalize(),r=s.fromUnitVectors(o.Z_AXIS,i.normalize());return await t.setPose({position:n,orientation:r}),await Promise.all([nt(t.animations.FlyIn,{time:0,loop:!1},!0),t.show()]),t.startPoseUpdate(),et},rt=async({body:t})=>(t.stopPoseUpdate(),await nt(t.animations.FlyOut,{time:0,loop:!1},!0),await t.hide(),et);let at=void 0;const st=async({body:t,camera:e})=>(await ut(t,e),tt);let ct=void 0;const ut=async(t,e,n)=>{const i=new o(e.pose.position).subtract(t.pose.position).setY(0).normalize();return await pt(t,s.fromUnitVectors(o.Z_AXIS,i),n),tt},pt=async(t,e,n)=>{const i=m(new s(t.pose.orientation).toEulerAngles().heading,e.toEulerAngles().heading);if(n=n||Math.sign(i),Math.abs(Math.abs(i)-v.guideParams.maxAngularVelocity)>v.guideParams.maxAngularVelocity){const e=s.fromAxisAngle(o.Y_AXIS,n*v.guideParams.maxAngularVelocity);t.setPose({orientation:new s(t.pose.orientation).multiply(e)})}else ct=void 0,t.setPose({orientation:e});return tt};var lt=n(30),ht=n.n(lt);const ft=new Map,dt=t=>new Promise(e=>setTimeout(e,t));const yt=t=>{ft.has(t)||ft.set(t,Promise.resolve().then(()=>(async function(t){const e=Date.now(),n={startTime:e,idealTime:e,lastTime:e,actualTime:e,difference:0,timeElapsed:0,frameNumber:0,frameLength:f};for(;ft.has(t);)n.frameNumber+=1,n.frameLength=f,n.actualTime=Date.now(),n.idealTime+=n.frameLength,n.difference=n.actualTime-n.idealTime,n.timeElapsed=n.actualTime-n.lastTime,n.lastTime=n.actualTime,t(Object.assign({},n)),await dt(n.frameLength-n.difference)})(t)))};var gt=(()=>{let t=!1,e=!1,n=()=>{};const i=async t=>{if(!e)try{e=!0,n(t)}catch(t){console.error(t)}finally{e=!1}};return{start:async(e=(()=>{}))=>{n=e,t||(t=!0,yt(i))},stop:async()=>{t&&(t=!1,await(async t=>{const e=ft.get(t)||Promise.resolve();ft.delete(t),await e})(i))}}})();function vt(){const t={},e=(e,n)=>(t[e]=t[e]||new Set).add(n),n=(e,n)=>n?t[e].delete(n):t[e].clear();return{on:e,off:n,once:(t,i)=>{const o=(...e)=>{i(...e),n(t,o)};e(t,o)},emit:(e,...n)=>(t[e]||[]).forEach(t=>t(...n))}}const wt=({initialState:t,finalStates:e=[],getNextState:n})=>{e=new Set(e);let i=t;return{get done(){return e.has(i)},get currentState(){return i},reset:()=>void(i=t),process:t=>(i.done?(i=n(i,t)).reset():i.process(t),i.output),getDebug:()=>i.getDebug()}},mt=({name:t,output:e})=>({name:t,output:e,done:!0,process:()=>{},reset:()=>{},getDebug:()=>t}),xt=({name:t,stateMachine:e})=>({name:t,get output(){return e.currentState.output},get done(){return e.done},process:t=>e.process(t),reset:()=>e.reset(),getDebug:()=>[t,e.getDebug()].join(" >> ")}),bt=mt({name:"TELEPORT_TO_USER",output:ot}),_t=mt({name:"IDLE",output:it}),zt=mt({name:"TELEPORT_AWAY",output:rt});var Ot=xt({name:"HIDDEN",stateMachine:wt({initialState:zt,finalStates:[bt],getNextState:(t,{guideRequested:e})=>{switch(t){case zt:case _t:return e?bt:_t;case bt:return bt;default:throw new Error(`Unrecognized state: ${t?t.name:t}`)}}})});const St=mt({name:"GREET_USER_STATE",output:async({body:t,chatbot:e,userInput:n})=>(e.greetUser(n.greetMessage),await b(250),await nt(t.animations.Wave,{time:0,loop:!1},!0),await b(33),t.animations.Idle.start({time:0,loop:!0},!0),n.startListening(),tt)}),jt=mt({name:"LISTEN",output:st}),At=mt({name:"DONE",output:async({body:t,userInput:e})=>(t.animate({}),e.stopListening(),et)});var Tt=xt({name:"TALKING",stateMachine:wt({initialState:St,finalStates:[At],getNextState:(t,{guideRequested:e,userAnswered:n,queryUnderstood:i,destinationChosen:o})=>{switch(t){case St:return e?jt:At;case jt:return e?o?At:i?At:jt:At;case At:return At;default:throw new Error(`Unrecognized state: ${t?t.name:t}`)}}})});const Pt=mt({name:"START_HOVERING",output:async({body:t})=>(t.animations.Idle.start({time:0,loop:!0},!0),tt)}),It=mt({name:"STOP_HOVERING",output:async({body:t})=>(t.animations.Idle.stop(),et)}),Mt=mt({name:"TURN_TO_USER",output:st});var Et=xt({name:"WAITING",stateMachine:wt({initialState:Pt,finalStates:[It],getNextState:(t,{guideRequested:e,userNear:n,destinationChanged:i})=>{switch(t){case Pt:return Mt;case Mt:return e?i?It:n?It:Mt:It;case It:return It;default:throw new Error(`Unrecognized state: ${t?t.name:t}`)}}})});const Nt=mt({name:"START_MOVING",output:async({body:t})=>(t.animations.ForwardIn.start({time:0,loop:!1},!0),tt)}),Vt=mt({name:"FOLLOW_PATH_STATE",output:()=>(J.followPath(),tt)}),Ut=mt({name:"ARRIVE_STATE",output:()=>(J.arrive(),tt)}),Rt=mt({name:"STOP_MOVING",output:async({body:t})=>(await nt(t.animations.ForwardOut,{time:0,loop:!1},!0),et)});var Dt=xt({name:"GUIDING",stateMachine:wt({initialState:Nt,finalStates:[Rt],getNextState:(t,{guideRequested:e,userFar:n,destinationChanged:i,destinationReached:o,guideShouldHalt:r})=>{switch(t){case Nt:case Vt:return e?n?Rt:r?Ut:Vt:Rt;case Ut:return e?n?Rt:o?Rt:Ut:Rt;case Rt:return Rt;default:throw new Error(`Unrecognized state: ${t?t.name:t}`)}}})});const kt=mt({name:"TURN_TO_PRESENT",output:async({body:t,camera:e,navigation:n})=>{const i=new o(o.Z_AXIS).rotate(new s(t.pose.orientation)).setY(0),r=new o(n.destination.pose.position).subtract(t.pose.position).setY(0);return ct=ct||s.fromUnitVectors(i.normalize(),r.normalize()).toEulerAngles().heading,await ut(t,e,Math.sign(ct)),tt}}),Lt=mt({name:"POINT_TOWARD_POI",output:async({body:t,camera:e,navigation:n})=>{const i=new o(n.destination.pose.position).subtract(t.pose.position),r=new o(e.pose.position).subtract(t.pose.position),a=s.fromUnitVectors(r.normalize(),i.normalize()).toEulerAngles().heading;return at||(at=a>0^["guidebot_robot_v2","guidebot_robot_v3","guidebot_robot_v4"].includes(t.model.foreignKey)?"Right":"Left"),await nt(t.animations[`Point${at}In`],{time:0,loop:!1},!0),tt}}),qt=mt({name:"START_PRESENTING_STATE",output:async({chatbot:t})=>(t.presentDestination(),tt)}),Ft=mt({name:"PRESENT_POI",output:it}),Gt=mt({name:"STOP_PRESENTING",output:async({speechModule:t,navigation:e,userInput:n})=>(e.clearDestination(),t.stopSpeaking(),n.dismissGuide(),tt)}),Ct=mt({name:"PUT_DOWN_HAND",output:async({body:t})=>(at&&(await nt(t.animations[`Point${at}Out`],{time:0,loop:!1},!0),at=void 0),await b(1e3),et)});var Yt=xt({name:"PRESENTING",stateMachine:wt({initialState:kt,finalStates:[Ct],getNextState:(t,{guideRequested:e,guideFacingUser:n,destinationChanged:i,guideSpeaking:o})=>{switch(t){case kt:return n?Lt:kt;case Lt:return e?i?Ct:qt:Ct;case qt:return e?Ft:Ct;case Ft:return e?i?Gt:o?Ft:Gt:Ct;case Gt:case Ct:return Ct;default:throw new Error(`Unrecognized state: ${t?t.name:t}`)}}})});const $t=mt({name:"TELEPORT_TO_USER",output:ot}),Xt=mt({name:"TELEPORT_AWAY",output:rt});var Zt=xt({name:"RECALIBRATE",stateMachine:wt({initialState:Xt,finalStates:[$t],getNextState:(t,{})=>{switch(t){case Xt:case $t:return $t;default:throw new Error(`Unrecognized state: ${t?t.name:t}`)}}})});var Wt=wt({initialState:Ot,finalStates:[],getNextState:(({hidden:t,talking:e,waiting:n,guiding:i,presenting:o})=>(r,a)=>{const{guideRequested:s,destinationChosen:c,userNear:u,userFar:p,destinationReached:l,guideSpeaking:h,recalibrationRequested:f}=a;switch(r){case t:return s?e:t;case e:return s?c&&l?o:c&&!l?i:e:t;case i:return s?p?n:!u&&l?n:u&&l?o:f?Zt:i:t;case n:return s?u&&l?o:u&&!l?i:f?Zt:n:t;case Zt:return i;case o:return s&&h?o:t;default:throw new Error(`Unrecognized state: ${r?r.name:r}`)}})({hidden:Ot,talking:Tt,waiting:Et,guiding:Dt,presenting:Yt})});const Ht="Hi there! How can I help you?";var Bt=function({viewarApi:t,navigation:e}){const n=vt(),{emit:i}=n,o=function(t,e){var n={};for(var i in t)e.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return n}(n,["emit"]);let r=!1,a=!1,s=!1,c=()=>{},u=Ht;const p=t=>(function(t){r&&i("userInput",{speaker:"user",sentence:t})})(t);return Object.assign({startListening:async function(){const{coreInterface:t}=$.viewarApi;"iOS"===t.platform&&(a=!1,r=!0,t.on("speechToText",p),await t.call("startVoiceInput"),await new Promise(e=>t.once("speechToText",t=>e(t))),a=!0)},stopListening:l,pickDestination:function(t){i("userInput",{destination:t})},requestGuide:function(t=(()=>{}),e=Ht){u=e,c=t,s=!0},dismissGuide:function(){s=!1,e.clearDestination(),l(),c()},get userAnswered(){return a},get guideRequested(){return s},get greetMessage(){return u}},o);async function l(){const{coreInterface:t}=$.viewarApi;r=!1,a=!1,"iOS"===t.platform&&(t.off("speechToText",p),await t.call("stopVoiceInput"))}}({navigation:K}),Qt=()=>Math.random().toString(36).slice(2);const Kt=t=>`https://dialogflow.googleapis.com/v2/projects/${v.app.projectId}/agent/sessions/${t}:detectIntent`,Jt=()=>fetch(`https://www.viewar.com/proxy.php?url=http://test2.3.viewar.com/guidebot/key.php?cache_bust=${Date.now()}`).then(t=>t.text()).then(t=>t.trim()),te=(t,e)=>({queryParams:{},queryInput:{text:{text:t,languageCode:e}}});var ee=function({navigation:t,userInput:e,sendQuery:n,findDestination:i}){const o=vt(),{emit:r}=o,a=function(t,e){var n={};for(var i in t)e.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return n}(o,["emit"]);let s=!1,c=!1,u=null;return Object.assign({init:function(){e.on("userInput",p)},greetUser:function(t){u=Qt(),s=!1,c=!1,r("guideSpeaking",{speaker:"guide",sentence:t})},presentDestination:function(){r("guideSpeaking",{speaker:"guide",sentence:t.destination?t.destination.data.description||t.destination.data.name:""})},get queryUnderstood(){return s},get userAnswered(){return c}},a);async function p({sentence:e,destination:o}){if(c=!0,o)s=!0,t.chooseDestination(o),r("guideSpeaking",{speaker:"guide",sentence:"Sure, follow me!"});else{const{fulfillmentText:o,parameters:a}=await n(u,e),c=Object.values(a)[0];if(c){const e=i(c);e&&(s=!0,t.chooseDestination(e))}r("guideSpeaking",{speaker:"guide",sentence:o})}}}({navigation:K,userInput:Bt,findDestination:t=>$.getPois().find(e=>e.data&&e.data.name.toLowerCase()===t.toLowerCase()),sendQuery:async function(t,e){const n=await Jt(),{error:i,queryResult:o}=await fetch(Kt(t),{method:"POST",headers:{Accept:"application/json",Authorization:`Bearer ${n}`,"Content-Type":"application/json"},body:JSON.stringify(te(e,v.app.language))}).then(t=>t.json());if(i)throw alert(i.message),new Error(i.message);return o}});var ne=function({getLanguageKey:t,body:e,chatbot:n}){let i=!1;const o=async(e,n="Google US English",i=t())=>{const{coreInterface:o}=$.viewarApi;"iOS"===o.platform?(await o.call("stopVoiceInput"),await(async(t,e,n)=>$.viewarApi.coreInterface.call("textToSpeech",t,{name:e,lang:n}))(e,n,i),await o.call("startVoiceInput")):"Android"===o.platform?await(async(t,e,n)=>{})():await(async(t,e,n)=>{let i=window.speechSynthesis,o=window.SpeechSynthesisUtterance;const r=i.getVoices().find(t=>t.name===e)||i.getVoices().find(t=>t.lang===n),a=Object.assign(new o,{text:t,lang:n,voice:r});return new Promise((t,e)=>{a.onend=t,a.onerror=e,i.speak(a)})})(e,n,i)},r=async t=>{i||(i=!0,await e.showTalkingFace(),o(t).then(a))},a=async()=>{i&&(i=!1,await o(""),await e.showNormalFace())},s=({sentence:t})=>r(t);return{init:()=>{n.on("guideSpeaking",s)},startSpeaking:r,stopSpeaking:a,get speaking(){return i}}}({getLanguageKey:()=>v.app.language||"en-US",body:H,chatbot:ee});e.default=(({stateMachine:t,getStateMachineInput:e,body:n,speechModule:i,navigation:o,kinematics:r,userInput:a,chatbot:s,defaultConfig:c,dependencies:u})=>{const p=vt(),{emit:l}=p,h=function(t,e){var n={};for(var i in t)e.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return n}(p,["emit"]);let f,d=!1,y=!1;const g=async c=>{if(d&&y){const u={body:n,camera:Q(),speechModule:i,navigation:o,kinematics:r,userInput:a,chatbot:s};let p=tt;const l=e(u);do{const e=t.process(l);p=await e(u)}while(p===et);n.processTick(c)}},v=async()=>{if(!d){await n.init(),i.init(),s.init();const{coreInterface:t}=u.viewarApi;"iOS"===t.platform&&(await t.call("startVoiceInput"),await t.call("stopVoiceInput")),s.on("guideSpeaking",(...t)=>l("guideSpeaking",...t)),a.on("userInput",(...t)=>l("userInput",...t)),d=!0}};return Object.assign({setup:({viewarApi:t,useExternalUpdateLoop:e=!1,queueSceneUpdate:n=(t=>t()),config:i,getPois:o=(()=>[]),modes:r=[],findPath:a=(()=>[])})=>{ht()(c,i),f=!e,Object.assign(u,{viewarApi:t,queueSceneUpdate:n,getPois:o,modes:r,findPath:a,useExternalUpdateLoop:e})},init:v,start:async()=>{d||await v(),y||(f&&gt.start(g),y=!0,t.reset(),await n.hide())},stop:async()=>{y&&(f&&gt.stop(),y=!1,await n.hide())},processTick:g,get running(){return y},runsInMode:t=>u.modes.includes(t)},h,{requestGuide:a.requestGuide,dismissGuide:a.dismissGuide,pickDestination:a.pickDestination})})({body:H,navigation:K,kinematics:J,speechModule:ne,chatbot:ee,defaultConfig:v,userInput:Bt,stateMachine:Wt,getStateMachineInput:({body:t,camera:e,navigation:n,speechModule:i,userInput:r,chatbot:a})=>{const c=new o(t.pose.position).setY(0),u=new o(e.pose.position).setY(0).clone().subtract(c),p=u.length(),l=s.fromUnitVectors(o.Z_AXIS,u.normalize()).toEulerAngles().heading,h=new s(t.pose.orientation).toEulerAngles().heading,f=Math.abs(m(h,l))<v.guideParams.maxAngularVelocity,d=p<v.guideParams.nearDistance,y=p>v.guideParams.farDistance,g=!!n.destination,w=g&&0===n.path.length,x=g&&1===n.path.length,b=i.speaking;return{destinationChosen:g,destinationReached:w,guideFacingUser:f,guideRequested:r.guideRequested,guideShouldHalt:x,guideSpeaking:b,queryUnderstood:a.queryUnderstood,userAnswered:a.userAnswered,userFar:y,userNear:d}},dependencies:$})}]).default});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.viewarGuide=e():t.viewarGuide=e()}(window,function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=98)}([function(t,e){t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},function(t,e,n){var i=n(16),o="object"==typeof self&&self&&self.Object===Object&&self,r=i||o||Function("return this")();t.exports=r},function(t,e){t.exports=function(t){return null!=t&&"object"==typeof t}},function(t,e,n){var i=n(33),o=n(34),r=n(35),a=n(36),s=n(37);function c(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}c.prototype.clear=i,c.prototype.delete=o,c.prototype.get=r,c.prototype.has=a,c.prototype.set=s,t.exports=c},function(t,e,n){var i=n(5);t.exports=function(t,e){for(var n=t.length;n--;)if(i(t[n][0],e))return n;return-1}},function(t,e){t.exports=function(t,e){return t===e||t!=t&&e!=e}},function(t,e,n){var i=n(15),o=n(45),r=n(46),a="[object Null]",s="[object Undefined]",c=i?i.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?s:a:c&&c in Object(t)?o(t):r(t)}},function(t,e,n){var i=n(9)(Object,"create");t.exports=i},function(t,e,n){var i=n(60);t.exports=function(t,e){var n=t.__data__;return i(e)?n["string"==typeof e?"string":"hash"]:n.map}},function(t,e,n){var i=n(43),o=n(50);t.exports=function(t,e){var n=o(t,e);return i(n)?n:void 0}},function(t,e,n){var i=n(6),o=n(0),r="[object AsyncFunction]",a="[object Function]",s="[object GeneratorFunction]",c="[object Proxy]";t.exports=function(t){if(!o(t))return!1;var e=i(t);return e==a||e==s||e==r||e==c}},function(t,e,n){var i=n(18);t.exports=function(t,e,n){"__proto__"==e&&i?i(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,n){var i=n(10),o=n(23);t.exports=function(t){return null!=t&&o(t.length)&&!i(t)}},function(t,e,n){var i=n(9)(n(1),"Map");t.exports=i},function(t,e,n){var i=n(1).Symbol;t.exports=i},function(t,e,n){(function(e){var n="object"==typeof e&&e&&e.Object===Object&&e;t.exports=n}).call(this,n(44))},function(t,e,n){var i=n(11),o=n(5);t.exports=function(t,e,n){(void 0===n||o(t[e],n))&&(void 0!==n||e in t)||i(t,e,n)}},function(t,e,n){var i=n(9),o=function(){try{var t=i(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=o},function(t,e,n){var i=n(74)(Object.getPrototypeOf,Object);t.exports=i},function(t,e){var n=Object.prototype;t.exports=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||n)}},function(t,e,n){var i=n(75),o=n(2),r=Object.prototype,a=r.hasOwnProperty,s=r.propertyIsEnumerable,c=i(function(){return arguments}())?i:function(t){return o(t)&&a.call(t,"callee")&&!s.call(t,"callee")};t.exports=c},function(t,e){var n=Array.isArray;t.exports=n},function(t,e){var n=9007199254740991;t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=n}},function(t,e,n){(function(t){var i=n(1),o=n(77),r="object"==typeof e&&e&&!e.nodeType&&e,a=r&&"object"==typeof t&&t&&!t.nodeType&&t,s=a&&a.exports===r?i.Buffer:void 0,c=(s?s.isBuffer:void 0)||o;t.exports=c}).call(this,n(12)(t))},function(t,e,n){var i=n(79),o=n(80),r=n(81),a=r&&r.isTypedArray,s=a?o(a):i;t.exports=s},function(t,e){t.exports=function(t,e){return"__proto__"==e?void 0:t[e]}},function(t,e,n){var i=n(85),o=n(87),r=n(13);t.exports=function(t){return r(t)?i(t,!0):o(t)}},function(t,e){var n=9007199254740991,i=/^(?:0|[1-9]\d*)$/;t.exports=function(t,e){var o=typeof t;return!!(e=null==e?n:e)&&("number"==o||"symbol"!=o&&i.test(t))&&t>-1&&t%1==0&&t<e}},function(t,e){t.exports=function(t){return t}},function(t,e,n){var i=n(31),o=n(89)(function(t,e,n){i(t,e,n)});t.exports=o},function(t,e,n){var i=n(32),o=n(17),r=n(64),a=n(66),s=n(0),c=n(27),u=n(26);t.exports=function t(e,n,p,l,h){e!==n&&r(n,function(r,c){if(s(r))h||(h=new i),a(e,n,c,p,t,l,h);else{var f=l?l(u(e,c),r,c+"",e,n,h):void 0;void 0===f&&(f=r),o(e,c,f)}},c)}},function(t,e,n){var i=n(3),o=n(38),r=n(39),a=n(40),s=n(41),c=n(42);function u(t){var e=this.__data__=new i(t);this.size=e.size}u.prototype.clear=o,u.prototype.delete=r,u.prototype.get=a,u.prototype.has=s,u.prototype.set=c,t.exports=u},function(t,e){t.exports=function(){this.__data__=[],this.size=0}},function(t,e,n){var i=n(4),o=Array.prototype.splice;t.exports=function(t){var e=this.__data__,n=i(e,t);return!(n<0||(n==e.length-1?e.pop():o.call(e,n,1),--this.size,0))}},function(t,e,n){var i=n(4);t.exports=function(t){var e=this.__data__,n=i(e,t);return n<0?void 0:e[n][1]}},function(t,e,n){var i=n(4);t.exports=function(t){return i(this.__data__,t)>-1}},function(t,e,n){var i=n(4);t.exports=function(t,e){var n=this.__data__,o=i(n,t);return o<0?(++this.size,n.push([t,e])):n[o][1]=e,this}},function(t,e,n){var i=n(3);t.exports=function(){this.__data__=new i,this.size=0}},function(t,e){t.exports=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}},function(t,e){t.exports=function(t){return this.__data__.get(t)}},function(t,e){t.exports=function(t){return this.__data__.has(t)}},function(t,e,n){var i=n(3),o=n(14),r=n(51),a=200;t.exports=function(t,e){var n=this.__data__;if(n instanceof i){var s=n.__data__;if(!o||s.length<a-1)return s.push([t,e]),this.size=++n.size,this;n=this.__data__=new r(s)}return n.set(t,e),this.size=n.size,this}},function(t,e,n){var i=n(10),o=n(47),r=n(0),a=n(49),s=/^\[object .+?Constructor\]$/,c=Function.prototype,u=Object.prototype,p=c.toString,l=u.hasOwnProperty,h=RegExp("^"+p.call(l).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!r(t)||o(t))&&(i(t)?h:s).test(a(t))}},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){var i=n(15),o=Object.prototype,r=o.hasOwnProperty,a=o.toString,s=i?i.toStringTag:void 0;t.exports=function(t){var e=r.call(t,s),n=t[s];try{t[s]=void 0;var i=!0}catch(t){}var o=a.call(t);return i&&(e?t[s]=n:delete t[s]),o}},function(t,e){var n=Object.prototype.toString;t.exports=function(t){return n.call(t)}},function(t,e,n){var i=n(48),o=function(){var t=/[^.]+$/.exec(i&&i.keys&&i.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();t.exports=function(t){return!!o&&o in t}},function(t,e,n){var i=n(1)["__core-js_shared__"];t.exports=i},function(t,e){var n=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return n.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},function(t,e){t.exports=function(t,e){return null==t?void 0:t[e]}},function(t,e,n){var i=n(52),o=n(59),r=n(61),a=n(62),s=n(63);function c(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}c.prototype.clear=i,c.prototype.delete=o,c.prototype.get=r,c.prototype.has=a,c.prototype.set=s,t.exports=c},function(t,e,n){var i=n(53),o=n(3),r=n(14);t.exports=function(){this.size=0,this.__data__={hash:new i,map:new(r||o),string:new i}}},function(t,e,n){var i=n(54),o=n(55),r=n(56),a=n(57),s=n(58);function c(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}c.prototype.clear=i,c.prototype.delete=o,c.prototype.get=r,c.prototype.has=a,c.prototype.set=s,t.exports=c},function(t,e,n){var i=n(7);t.exports=function(){this.__data__=i?i(null):{},this.size=0}},function(t,e){t.exports=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}},function(t,e,n){var i=n(7),o="__lodash_hash_undefined__",r=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;if(i){var n=e[t];return n===o?void 0:n}return r.call(e,t)?e[t]:void 0}},function(t,e,n){var i=n(7),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;return i?void 0!==e[t]:o.call(e,t)}},function(t,e,n){var i=n(7),o="__lodash_hash_undefined__";t.exports=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=i&&void 0===e?o:e,this}},function(t,e,n){var i=n(8);t.exports=function(t){var e=i(this,t).delete(t);return this.size-=e?1:0,e}},function(t,e){t.exports=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},function(t,e,n){var i=n(8);t.exports=function(t){return i(this,t).get(t)}},function(t,e,n){var i=n(8);t.exports=function(t){return i(this,t).has(t)}},function(t,e,n){var i=n(8);t.exports=function(t,e){var n=i(this,t),o=n.size;return n.set(t,e),this.size+=n.size==o?0:1,this}},function(t,e,n){var i=n(65)();t.exports=i},function(t,e){t.exports=function(t){return function(e,n,i){for(var o=-1,r=Object(e),a=i(e),s=a.length;s--;){var c=a[t?s:++o];if(!1===n(r[c],c,r))break}return e}}},function(t,e,n){var i=n(17),o=n(67),r=n(68),a=n(71),s=n(72),c=n(21),u=n(22),p=n(76),l=n(24),h=n(10),f=n(0),d=n(78),y=n(25),g=n(26),v=n(82);t.exports=function(t,e,n,w,x,m,b){var _=g(t,n),z=g(e,n),O=b.get(z);if(O)i(t,n,O);else{var S=m?m(_,z,n+"",t,e,b):void 0,j=void 0===S;if(j){var A=u(z),T=!A&&l(z),P=!A&&!T&&y(z);S=z,A||T||P?u(_)?S=_:p(_)?S=a(_):T?(j=!1,S=o(z,!0)):P?(j=!1,S=r(z,!0)):S=[]:d(z)||c(z)?(S=_,c(_)?S=v(_):(!f(_)||w&&h(_))&&(S=s(z))):j=!1}j&&(b.set(z,S),x(S,z,w,m,b),b.delete(z)),i(t,n,S)}}},function(t,e,n){(function(t){var i=n(1),o="object"==typeof e&&e&&!e.nodeType&&e,r=o&&"object"==typeof t&&t&&!t.nodeType&&t,a=r&&r.exports===o?i.Buffer:void 0,s=a?a.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var n=t.length,i=s?s(n):new t.constructor(n);return t.copy(i),i}}).call(this,n(12)(t))},function(t,e,n){var i=n(69);t.exports=function(t,e){var n=e?i(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}},function(t,e,n){var i=n(70);t.exports=function(t){var e=new t.constructor(t.byteLength);return new i(e).set(new i(t)),e}},function(t,e,n){var i=n(1).Uint8Array;t.exports=i},function(t,e){t.exports=function(t,e){var n=-1,i=t.length;for(e||(e=Array(i));++n<i;)e[n]=t[n];return e}},function(t,e,n){var i=n(73),o=n(19),r=n(20);t.exports=function(t){return"function"!=typeof t.constructor||r(t)?{}:i(o(t))}},function(t,e,n){var i=n(0),o=Object.create,r=function(){function t(){}return function(e){if(!i(e))return{};if(o)return o(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();t.exports=r},function(t,e){t.exports=function(t,e){return function(n){return t(e(n))}}},function(t,e,n){var i=n(6),o=n(2),r="[object Arguments]";t.exports=function(t){return o(t)&&i(t)==r}},function(t,e,n){var i=n(13),o=n(2);t.exports=function(t){return o(t)&&i(t)}},function(t,e){t.exports=function(){return!1}},function(t,e,n){var i=n(6),o=n(19),r=n(2),a="[object Object]",s=Function.prototype,c=Object.prototype,u=s.toString,p=c.hasOwnProperty,l=u.call(Object);t.exports=function(t){if(!r(t)||i(t)!=a)return!1;var e=o(t);if(null===e)return!0;var n=p.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&u.call(n)==l}},function(t,e,n){var i=n(6),o=n(23),r=n(2),a={};a["[object Float32Array]"]=a["[object Float64Array]"]=a["[object Int8Array]"]=a["[object Int16Array]"]=a["[object Int32Array]"]=a["[object Uint8Array]"]=a["[object Uint8ClampedArray]"]=a["[object Uint16Array]"]=a["[object Uint32Array]"]=!0,a["[object Arguments]"]=a["[object Array]"]=a["[object ArrayBuffer]"]=a["[object Boolean]"]=a["[object DataView]"]=a["[object Date]"]=a["[object Error]"]=a["[object Function]"]=a["[object Map]"]=a["[object Number]"]=a["[object Object]"]=a["[object RegExp]"]=a["[object Set]"]=a["[object String]"]=a["[object WeakMap]"]=!1,t.exports=function(t){return r(t)&&o(t.length)&&!!a[i(t)]}},function(t,e){t.exports=function(t){return function(e){return t(e)}}},function(t,e,n){(function(t){var i=n(16),o="object"==typeof e&&e&&!e.nodeType&&e,r=o&&"object"==typeof t&&t&&!t.nodeType&&t,a=r&&r.exports===o&&i.process,s=function(){try{var t=r&&r.require&&r.require("util").types;return t||a&&a.binding&&a.binding("util")}catch(t){}}();t.exports=s}).call(this,n(12)(t))},function(t,e,n){var i=n(83),o=n(27);t.exports=function(t){return i(t,o(t))}},function(t,e,n){var i=n(84),o=n(11);t.exports=function(t,e,n,r){var a=!n;n||(n={});for(var s=-1,c=e.length;++s<c;){var u=e[s],p=r?r(n[u],t[u],u,n,t):void 0;void 0===p&&(p=t[u]),a?o(n,u,p):i(n,u,p)}return n}},function(t,e,n){var i=n(11),o=n(5),r=Object.prototype.hasOwnProperty;t.exports=function(t,e,n){var a=t[e];r.call(t,e)&&o(a,n)&&(void 0!==n||e in t)||i(t,e,n)}},function(t,e,n){var i=n(86),o=n(21),r=n(22),a=n(24),s=n(28),c=n(25),u=Object.prototype.hasOwnProperty;t.exports=function(t,e){var n=r(t),p=!n&&o(t),l=!n&&!p&&a(t),h=!n&&!p&&!l&&c(t),f=n||p||l||h,d=f?i(t.length,String):[],y=d.length;for(var g in t)!e&&!u.call(t,g)||f&&("length"==g||l&&("offset"==g||"parent"==g)||h&&("buffer"==g||"byteLength"==g||"byteOffset"==g)||s(g,y))||d.push(g);return d}},function(t,e){t.exports=function(t,e){for(var n=-1,i=Array(t);++n<t;)i[n]=e(n);return i}},function(t,e,n){var i=n(0),o=n(20),r=n(88),a=Object.prototype.hasOwnProperty;t.exports=function(t){if(!i(t))return r(t);var e=o(t),n=[];for(var s in t)("constructor"!=s||!e&&a.call(t,s))&&n.push(s);return n}},function(t,e){t.exports=function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}},function(t,e,n){var i=n(90),o=n(97);t.exports=function(t){return i(function(e,n){var i=-1,r=n.length,a=r>1?n[r-1]:void 0,s=r>2?n[2]:void 0;for(a=t.length>3&&"function"==typeof a?(r--,a):void 0,s&&o(n[0],n[1],s)&&(a=r<3?void 0:a,r=1),e=Object(e);++i<r;){var c=n[i];c&&t(e,c,i,a)}return e})}},function(t,e,n){var i=n(29),o=n(91),r=n(93);t.exports=function(t,e){return r(o(t,e,i),t+"")}},function(t,e,n){var i=n(92),o=Math.max;t.exports=function(t,e,n){return e=o(void 0===e?t.length-1:e,0),function(){for(var r=arguments,a=-1,s=o(r.length-e,0),c=Array(s);++a<s;)c[a]=r[e+a];a=-1;for(var u=Array(e+1);++a<e;)u[a]=r[a];return u[e]=n(c),i(t,this,u)}}},function(t,e){t.exports=function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}},function(t,e,n){var i=n(94),o=n(96)(i);t.exports=o},function(t,e,n){var i=n(95),o=n(18),r=n(29),a=o?function(t,e){return o(t,"toString",{configurable:!0,enumerable:!1,value:i(e),writable:!0})}:r;t.exports=a},function(t,e){t.exports=function(t){return function(){return t}}},function(t,e){var n=800,i=16,o=Date.now;t.exports=function(t){var e=0,r=0;return function(){var a=o(),s=i-(a-r);if(r=a,s>0){if(++e>=n)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}},function(t,e,n){var i=n(5),o=n(13),r=n(28),a=n(0);t.exports=function(t,e,n){if(!a(n))return!1;var s=typeof e;return!!("number"==s?o(n)&&r(e,n.length):"string"==s&&e in n)&&i(n[e],t)}},function(t,e,n){"use strict";n.r(e);const i=2**-16;class o{static get ZERO(){return new o(0,0,0)}static get X_AXIS(){return new o(1,0,0)}static get Y_AXIS(){return new o(0,1,0)}static get Z_AXIS(){return new o(0,0,1)}static get UNIT_SCALE(){return new o(1,1,1)}constructor(...t){if(0===t.length)this.x=0,this.y=0,this.z=0;else if(1===t.length)if(t[0]&&"object"==typeof t[0]){const{x:e,y:n,z:i}=t[0];Object.assign(this,{x:e,y:n,z:i})}else{if(!(t[0]instanceof Array))throw new Error;{const[e,n,i]=t[0];Object.assign(this,{x:e,y:n,z:i})}}else{if(3!==t.length)throw new Error;{const[e,n,i]=t;Object.assign(this,{x:e,y:n,z:i})}}}set(t,e,n){return this.x=t,this.y=e,this.z=n,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}clone(){return new o(this.x,this.y,this.z)}cross(t){return Object.assign(this,{x:this.y*t.z-this.z*t.y,y:this.z*t.x-this.x*t.z,z:this.x*t.y-this.y*t.x})}scale(t){return Object.assign(this,{x:this.x*t,y:this.y*t,z:this.z*t})}add(t){return Object.assign(this,{x:this.x+t.x,y:this.y+t.y,z:this.z+t.z})}subtract(t){return Object.assign(this,{x:this.x-t.x,y:this.y-t.y,z:this.z-t.z})}length(){return Math.hypot(this.x,this.y,this.z)}lengthSq(){return this.x**2+this.y**2+this.z**2}invert(){return this.scale(-1)}normalize(){const t=this.length();return t?this.scale(1/t):this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}equals(t){return Math.abs(this.x-t.x)<i&&Math.abs(this.y-t.y)<i&&Math.abs(this.z-t.z)<i}rotate(t){const e=t.w*this.x+t.y*this.z-t.z*this.y,n=t.w*this.y+t.z*this.x-t.x*this.z,i=t.w*this.z+t.x*this.y-t.y*this.x,o=-t.x*this.x-t.y*this.y-t.z*this.z;return Object.assign(this,{x:e*t.w+o*-t.x+n*-t.z-i*-t.y,y:n*t.w+o*-t.y+i*-t.x-e*-t.z,z:i*t.w+o*-t.z+e*-t.y-n*-t.x})}rotateAroundVector(t,e){return this.subtract(t).rotate(e).add(t)}projectOntoVector(t){const e=t.dot(this)/t.lengthSq();return this.copy(t).scale(e)}projectOntoPlane(t){return this.subtract(r.copy(this).projectOntoVector(t.normal))}}const r=new o,a=2**-16;class s{static get IDENTITY(){return new s(1,0,0,0)}static fromAxisAngle({x:t,y:e,z:n},i){return(new s).set(Math.cos(i/2),t*Math.sin(i/2),e*Math.sin(i/2),n*Math.sin(i/2)).normalize()}fromAxisAngle({x:t,y:e,z:n},i){return this.set(Math.cos(i/2),t*Math.sin(i/2),e*Math.sin(i/2),n*Math.sin(i/2)).normalize()}static fromUnitVectors(t,e){const n=new s;let i=t.dot(e)+1;return i<a?(i=0,Math.abs(t.x)>Math.abs(t.z)?u.set(-t.y,t.x,0):u.set(0,-t.z,t.y)):u.copy(t).cross(e),n.set(i,u.x,u.y,u.z).normalize()}fromUnitVectors(t,e){let n=t.dot(e)+1;return n<a?(n=0,Math.abs(t.x)>Math.abs(t.z)?u.set(-t.y,t.x,0):u.set(0,-t.z,t.y)):u.copy(t).cross(e),this.set(n,u.x,u.y,u.z).normalize()}constructor(...t){if(0===t.length)this.w=1,this.x=0,this.y=0,this.z=0;else if(1===t.length)if(t[0]&&"object"==typeof t[0])this.w=t[0].w,this.x=t[0].x,this.y=t[0].y,this.z=t[0].z;else{if(!(t[0]instanceof Array))throw new Error;this.w=t[0][0],this.x=t[0][1],this.y=t[0][2],this.z=t[0][3]}else{if(4!==t.length)throw new Error;this.w=t[0],this.x=t[1],this.y=t[2],this.z=t[3]}}set(t,e,n,i){return this.w=t,this.x=e,this.y=n,this.z=i,this}copy(t){return this.w=t.w,this.x=t.x,this.y=t.y,this.z=t.z,this}clone(){return new s(this.w,this.x,this.y,this.z)}multiply(t){return Object.assign(this,{w:this.w*t.w-this.x*t.x-this.y*t.y-this.z*t.z,x:this.w*t.x+this.x*t.w+this.y*t.z-this.z*t.y,y:this.w*t.y+this.y*t.w+this.z*t.x-this.x*t.z,z:this.w*t.z+this.z*t.w+this.x*t.y-this.y*t.x})}lengthSquared(){return this.w**2+this.x**2+this.y**2+this.z**2}length(){return Math.hypot(this.w,this.x,this.y,this.z)}normalize(){const t=this.lengthSquared();if(Math.abs(t-1)<a)return this;{const e=Math.sqrt(t);return Object.assign(this,{w:this.w/e,x:this.x/e,y:this.y/e,z:this.z/e})}}invert(){return this.conjugate()}conjugate(){return Object.assign(this,{w:this.w,x:-this.x,y:-this.y,z:-this.z})}dot(t){return this.w*t.w+this.x*t.x+this.y*t.y+this.z*t.z}equals(t){return Math.abs(Math.abs(this.dot(t))-1)<a}toAxisAngle(){const{w:t,x:e,y:n,z:i}=this,r=2*Math.acos(t),s=Math.sqrt(1-t**2);return{angle:r,axis:s<a?new o(1,0,0):new o(e/s,n/s,i/s)}}toAngleAround(t){const e=0!==(t=t.clone().normalize()).y||0!==t.z?new o(0,-t.z,t.y):new o(-t.z,0,t.x),n=e.clone().rotate(this),i=n.clone().subtract(t.clone().scale(n.dot(t))).normalize();return Math.acos(e.dot(i))}toEulerAngles(){const t=this.x*this.y+this.z*this.w;if(t>.499){return{heading:2*Math.atan2(this.x,this.w),bank:0,attitude:Math.PI/2}}if(t<-.499){return{heading:-2*Math.atan2(this.x,this.w),bank:0,attitude:-Math.PI/2}}const e=this.x*this.x,n=this.y*this.y,i=this.z*this.z;let o=Math.atan2(2*this.y*this.w-2*this.x*this.z,1-2*n-2*i),r=Math.asin(2*t);return{heading:o,bank:Math.atan2(2*this.x*this.w-2*this.y*this.z,1-2*e-2*i),attitude:r}}slerp(t,e){const n=this,i=this;if(0===e)return n;if(1===e)return n.copy(t);let o=i.dot(t);if(o<0&&((t=c.copy(t)).w=-t.w,t.x=-t.x,t.y=-t.y,t.z=-t.z,o=-o),o>=1)return n;const r=Math.sqrt(1-o**2);if(Math.abs(r)<.001)return n.w=.5*(i.w+t.w),n.x=.5*(i.x+t.x),n.y=.5*(i.y+t.y),n.z=.5*(i.z+t.z),n;const a=Math.atan2(r,o),s=Math.sin((1-e)*a)/r,u=Math.sin(e*a)/r;return n.w=i.w*s+t.w*u,n.x=i.x*s+t.x*u,n.y=i.y*s+t.y*u,n.z=i.z*s+t.z*u,n}}const c=new s,u=new o,p=(new o,new o,Object.freeze({pose:{position:{x:NaN,y:NaN,z:NaN},orientation:{w:NaN,x:NaN,y:NaN,z:NaN},scale:{x:NaN,y:NaN,z:NaN}}})),l=Object.freeze({translation:!1,rotation:!1,scaling:!1}),h=(Object.freeze({translation:!0,rotation:!1,scaling:!1}),Object.freeze({pose:{position:{x:0,y:1e5,z:0},orientation:{w:1,x:0,y:0,z:0},scale:{x:1,y:1,z:1}},interaction:l,visible:!1})),f=1e3/30,d=2*Math.PI,y=d/2,g=Object.freeze({app:{admin:!1,usePoiImages:!1,userAvoidanceEnabled:!1,showTargetNotification:!1,visualizeQrCodes:!1,defaultUser:"tempuser",initialProject:null,projectId:"guidebot-978f7",language:"en-US",viewDistance:2e4},debug:{debugStateMachine:!1,showRobotHelpers:!1,exposeServices:!1,showDebugOutput:!1,showGraphDuringNavigation:!1,showReplayControls:!1},models:{qr:"guidebot_qrcode",guide:"guidebot_robot_v4",reticule:"guidebot_reticule",poi:"guidebot_poi",path:"guidebot_path",waypoint:"guidebot_waypoint"},fallbackModels:{qr:"55563",guide:"56664",reticule:"54428",poi:"54426",path:"54429",waypoint:"54383"},guideParams:{spawnDistance:2e3,nearDistance:2e4,farDistance:4e4,minProximityRadius:100,verticalCutoff:2e3,maxLinearVelocity:1e3/30,maxAngularVelocity:d/3/30,linearAcceleration:1e3/30/30},text:{greetUser:"Hi there! How can I help you?",followMe:"Sure, follow me!",selectPoi:"Hi there! Please select a point of interest."}});var v=Object.assign({},g);const w=(t,e=.001)=>t>-e&&t<e?0:t;function x(t,e){const n=e-t;return Math.atan2(Math.sin(n),Math.cos(n))}function m(t,e,n){return Math.min(Math.max(t,e),n)}var b=t=>new Promise(e=>setTimeout(e,t));function _(t,e=10){const n=new Array(e).fill(null).map(()=>t()),i=[];return{get:function(){0===n.length&&console.info("Object pool exhausted, populating...");const e=n.pop()||t();return i.push(e),e},release:function(){for(;i.length;)n.push(i.pop())},get usage(){return i.length}}}const{X_AXIS:z,Y_AXIS:O,Z_AXIS:S,ZERO:j}=o,{IDENTITY:A}=s;[z,O,S,j,A].forEach(Object.freeze);const T=_(()=>new o,20),P=_(()=>new s,20),I=()=>{T.release(),P.release()},M=(t=j)=>T.get().copy(t),E=(t,e)=>M(e).subtract(t),N=t=>M(S).rotate(t),V=(t=A)=>P.get().copy(t),U=t=>V().fromUnitVectors(M(S).normalize(),M(t).normalize()),R=t=>t.pose.position,D=t=>t.toEulerAngles().heading,k=({maxAngularVelocity:t},e,n,i)=>{const o=E(e.position,R(n)).setY(0),r=U(o),a=x(D(e.orientation),D(r)),s=Math.sign(w(a)),c=a*s;e.angularVelocity=s*t,e.angularDeviation=c,e.targetOrientation=r;const u=E(R(n),e.position).setY(0),p=E(R(n),R(i)).setY(0);e.curveAngle=D(((t,e)=>V().fromUnitVectors(M(t).normalize(),M(e).normalize()))(u,p))},L=({linearAcceleration:t,maxLinearVelocity:e},n,i,o)=>{n.linearVelocity<n.targetLinearVelocity?n.linearVelocity=m(n.linearVelocity+t,0,n.targetLinearVelocity):n.linearVelocity=m(n.linearVelocity-t,n.targetLinearVelocity,e)},q=({maxLinearVelocity:t},e,n,i)=>{e.targetLinearVelocity=t*m((y-e.angularDeviation)/y,0,1)};function F(t,e,[n,i]){k(t,e,n,i),q(t,e,n,i),L(t,e,n,i),I()}const G=({linearAcceleration:t,maxLinearVelocity:e},n,i)=>{const o=E(n.position,R(i)).setY(0),r=U(o),a=x(D(n.orientation),D(r)),s=a*Math.sign(w(a));n.linearVelocity=e*m(1-s/Math.PI,0,1),n.angularDeviation=s,n.targetOrientation=r,n.curveAngle=Math.PI},C=({maxAngularVelocity:t},e,n)=>{const i=E(e.position,R(n)).setY(0),o=U(i),r=x(D(e.orientation),D(o)),a=Math.sign(w(r)),s=r*a;e.angularVelocity=m(s/t,0,t)*a};function Y(t,e,[n]){G(t,e,n),C(t,e,n),I()}var $={viewarApi:{}};class X{constructor({position:t=o.ZERO,orientation:e=s.IDENTITY,scale:n=o.UNIT_SCALE}={}){this.position=o.ZERO.copy(t),this.orientation=s.IDENTITY.copy(e),this.scale=o.UNIT_SCALE.copy(n)}copy(t){this.position.copy(t.position),this.orientation.copy(t.orientation),this.scale.copy(t.scale)}}const Z={ViewARRobotVideoDisplay:"RobotFaceTalk"},W={ViewARRobotVideoDisplay:"RobotFaceNeutral"};var H=function({insertGuide:t,setAnimationState:e,addToPoseUpdateQueue:n}){let i=null,r=!1;const a={position:o.ZERO,orientation:s.IDENTITY,scale:o.UNIT_SCALE};let c=0,u=[];return{init:async()=>i=await $.queueSceneUpdate(t),showTalkingFace:()=>$.queueSceneUpdate(()=>i.setPropertyValues(Z)),showNormalFace:()=>$.queueSceneUpdate(()=>i.setPropertyValues(W)),show:()=>$.queueSceneUpdate(()=>i.setVisible(!0)),hide:()=>$.queueSceneUpdate(()=>i.setVisible(!1)),setPose:async t=>{t.position&&a.position.copy(t.position),t.orientation&&a.orientation.copy(t.orientation),t.scale&&a.scale.copy(t.scale),r||await i.setPose(a)},processTick:()=>{r&&(u.push(Object.assign(new X(a),{durationInSeconds:1/30})),(c+=1)%3==0&&(n(i.id,u),u=[]))},animate:async t=>{const n=(()=>{const t={};for(const e of Object.keys(i.animations))t[e]={enabled:!1,time:0,loop:!1}})();e({[i.id]:Object.assign({},n,t)})},startPoseUpdate:()=>{u=[],r=!0},stopPoseUpdate:()=>r=!1,get animations(){return i.animations},get model(){return i.model},get pose(){return a},get initialized(){return!!i}}}({insertGuide:async()=>{const{sceneManager:t,modelManager:e}=$.viewarApi,n=await t.insertContainer(h),i=v.models.guide,o=e.findModelById(i)||e.findModelByForeignKey(i)||await e.getModelFromRepository(v.fallbackModels.guide),r=await t.insertModel(o,{parent:n});return await async function(t){}(),Object.defineProperties(n,{model:{value:r.model,enumerable:!0},animations:{value:r.animations,enumerable:!0},setPropertyValues:{value:r.setPropertyValues,enumerable:!0},propertyValues:{get:()=>r.propertyValues,enumerable:!0}}),n.animations.FlyOut.start({time:0,loop:!1},!0),await n.setVisible(!1),n},setAnimationState:(...t)=>$.viewarApi.coreInterface.call("setAnimationStatus",...t),addToPoseUpdateQueue:(...t)=>$.viewarApi.coreInterface.call("addToPoseUpdateQueue",...t),clearPoseUpdateQueue:(...t)=>$.viewarApi.coreInterface.call("clearPoseUpdateQueue",...t)});const B=new o;var Q=()=>{const t=$.viewarApi.cameras;for(let e of Object.values(t))if(e.active)return e};var K=function({findPathToPoi:t}){let e=null,n=[];const i=()=>e&&n[0]||p;return{chooseDestination:i=>{i&&i!==e&&(n=t(e=i))},clearDestination:()=>{e=null,n=[]},update:(t,e)=>{i()&&B.copy(i().pose.position).subtract(t).setY(0).length()<=e&&n.shift()},hasCurrentWaypoint:()=>!(!e||!n[0]),hasNextWaypoint:()=>!(!e||!n[1]),get currentWaypoint(){return i()},get nextWaypoint(){return e&&n[1]||p},get path(){return n},get destination(){return e}}}({findPathToPoi:t=>$.findPath(Q(),t)});var J=(({body:t,navigation:e,getGuideParams:n})=>{const i={linearVelocity:0,targetLinearVelocity:0,angularVelocity:0,targetAngularVelocity:0,targetOrientation:s.IDENTITY,proximityRadius:0,curveAngle:0,angularDeviation:0,position:o.ZERO,orientation:s.IDENTITY,scale:o.UNIT_SCALE,forward:o.Z_AXIS},r=({maxAngularVelocity:t},e)=>{if(e.angularDeviation>t){const t=(t=>P.get().fromAxisAngle(O,t))(e.angularVelocity);e.orientation.multiply(t),e.forward.rotate(t)}else e.orientation.copy(e.targetOrientation),e.forward.copy(N(e.targetOrientation))},a=o=>async()=>{const a=n();i.position.copy(t.pose.position),i.orientation.copy(t.pose.orientation),i.scale.copy(t.pose.scale),o(a,i,e.path),r(a,i),((t,e)=>{const n=N(e.orientation).scale(e.linearVelocity);e.position.add(n)})(0,i),(({maxLinearVelocity:t,maxAngularVelocity:e},n)=>{const i=t/(2*Math.sin(e)*Math.sin(n.curveAngle/2));n.proximityRadius=Math.max(i,t)})(a,i),e.update(i.position,i.proximityRadius),t.setPose(i)};return{get state(){return i},arrive:a(Y),followPath:a(F)}})({body:H,navigation:K,getGuideParams:()=>v.guideParams});const tt=Symbol(),et=Symbol(),nt=(t,e={time:0,loop:!1},n=!1)=>Promise.all([t.start(e,n),b(1e3*t.duration)]),it=async()=>tt,ot=async({body:t,camera:e})=>{const n=(await e.getPoseInViewingDirection(v.guideParams.spawnDistance,!0)).position;n.y=e.pose.position.y-1e3;const i=new o(e.pose.position).subtract(n).setY(0).normalize(),r=s.fromUnitVectors(o.Z_AXIS,i.normalize());return await t.setPose({position:n,orientation:r}),await Promise.all([nt(t.animations.FlyIn,{time:0,loop:!1},!0),t.show()]),t.startPoseUpdate(),et},rt=async({body:t})=>(t.stopPoseUpdate(),await nt(t.animations.FlyOut,{time:0,loop:!1},!0),await t.hide(),et);let at=void 0;const st=async({body:t,camera:e})=>(await ut(t,e),tt);let ct=void 0;const ut=async(t,e,n)=>{const i=new o(e.pose.position).subtract(t.pose.position).setY(0).normalize();return await pt(t,s.fromUnitVectors(o.Z_AXIS,i),n),tt},pt=async(t,e,n)=>{const i=x(new s(t.pose.orientation).toEulerAngles().heading,e.toEulerAngles().heading);if(n=n||Math.sign(i),Math.abs(Math.abs(i)-v.guideParams.maxAngularVelocity)>v.guideParams.maxAngularVelocity){const e=s.fromAxisAngle(o.Y_AXIS,n*v.guideParams.maxAngularVelocity);t.setPose({orientation:new s(t.pose.orientation).multiply(e)})}else ct=void 0,t.setPose({orientation:e});return tt};var lt=n(30),ht=n.n(lt);const ft=new Map,dt=t=>new Promise(e=>setTimeout(e,t));const yt=t=>{ft.has(t)||ft.set(t,Promise.resolve().then(()=>(async function(t){const e=Date.now(),n={startTime:e,idealTime:e,lastTime:e,actualTime:e,difference:0,timeElapsed:0,frameNumber:0,frameLength:f};for(;ft.has(t);)n.frameNumber+=1,n.frameLength=f,n.actualTime=Date.now(),n.idealTime+=n.frameLength,n.difference=n.actualTime-n.idealTime,n.timeElapsed=n.actualTime-n.lastTime,n.lastTime=n.actualTime,t(Object.assign({},n)),await dt(n.frameLength-n.difference)})(t)))};var gt=(()=>{let t=!1,e=!1,n=()=>{};const i=async t=>{if(!e)try{e=!0,n(t)}catch(t){console.error(t)}finally{e=!1}};return{start:async(e=(()=>{}))=>{n=e,t||(t=!0,yt(i))},stop:async()=>{t&&(t=!1,await(async t=>{const e=ft.get(t)||Promise.resolve();ft.delete(t),await e})(i))}}})();function vt(){const t={},e=(e,n)=>(t[e]=t[e]||new Set).add(n),n=(e,n)=>n?t[e].delete(n):t[e].clear();return{on:e,off:n,once:(t,i)=>{const o=(...e)=>{i(...e),n(t,o)};e(t,o)},emit:(e,...n)=>(t[e]||[]).forEach(t=>t(...n))}}const wt=({initialState:t,finalStates:e=[],getNextState:n})=>{e=new Set(e);let i=t;return{get done(){return e.has(i)},get currentState(){return i},reset:()=>void(i=t),process:t=>(i.done?(i=n(i,t)).reset():i.process(t),i.output),getDebug:()=>i.getDebug()}},xt=({name:t,output:e})=>({name:t,output:e,done:!0,process:()=>{},reset:()=>{},getDebug:()=>t}),mt=({name:t,stateMachine:e})=>({name:t,get output(){return e.currentState.output},get done(){return e.done},process:t=>e.process(t),reset:()=>e.reset(),getDebug:()=>[t,e.getDebug()].join(" >> ")}),bt=xt({name:"TELEPORT_TO_USER",output:ot}),_t=xt({name:"IDLE",output:it}),zt=xt({name:"TELEPORT_AWAY",output:rt});var Ot=mt({name:"HIDDEN",stateMachine:wt({initialState:zt,finalStates:[bt],getNextState:(t,{guideRequested:e})=>{switch(t){case zt:case _t:return e?bt:_t;case bt:return bt;default:throw new Error(`Unrecognized state: ${t?t.name:t}`)}}})});const St=xt({name:"GREET_USER_STATE",output:async({body:t,chatbot:e,userInput:n})=>(e.greetUser(n.greetMessage),await b(250),await nt(t.animations.Wave,{time:0,loop:!1},!0),await b(33),t.animations.Idle.start({time:0,loop:!0},!0),n.startListening(),tt)}),jt=xt({name:"LISTEN",output:st}),At=xt({name:"DONE",output:async({body:t,userInput:e})=>(t.animate({}),e.stopListening(),et)});var Tt=mt({name:"TALKING",stateMachine:wt({initialState:St,finalStates:[At],getNextState:(t,{guideRequested:e,userAnswered:n,queryUnderstood:i,destinationChosen:o})=>{switch(t){case St:return e?jt:At;case jt:return e?o?At:i?At:jt:At;case At:return At;default:throw new Error(`Unrecognized state: ${t?t.name:t}`)}}})});const Pt=xt({name:"START_HOVERING",output:async({body:t})=>(t.animations.Idle.start({time:0,loop:!0},!0),tt)}),It=xt({name:"STOP_HOVERING",output:async({body:t})=>(t.animations.Idle.stop(),et)}),Mt=xt({name:"TURN_TO_USER",output:st});var Et=mt({name:"WAITING",stateMachine:wt({initialState:Pt,finalStates:[It],getNextState:(t,{guideRequested:e,userNear:n,destinationChanged:i})=>{switch(t){case Pt:return Mt;case Mt:return e?i?It:n?It:Mt:It;case It:return It;default:throw new Error(`Unrecognized state: ${t?t.name:t}`)}}})});const Nt=xt({name:"START_MOVING",output:async({body:t})=>(t.animations.ForwardIn.start({time:0,loop:!1},!0),tt)}),Vt=xt({name:"FOLLOW_PATH_STATE",output:()=>(J.followPath(),tt)}),Ut=xt({name:"ARRIVE_STATE",output:()=>(J.arrive(),tt)}),Rt=xt({name:"STOP_MOVING",output:async({body:t})=>(await nt(t.animations.ForwardOut,{time:0,loop:!1},!0),et)});var Dt=mt({name:"GUIDING",stateMachine:wt({initialState:Nt,finalStates:[Rt],getNextState:(t,{guideRequested:e,userFar:n,destinationChanged:i,destinationReached:o,guideShouldHalt:r})=>{switch(t){case Nt:case Vt:return e?n?Rt:r?Ut:Vt:Rt;case Ut:return e?n?Rt:o?Rt:Ut:Rt;case Rt:return Rt;default:throw new Error(`Unrecognized state: ${t?t.name:t}`)}}})});const kt=xt({name:"TURN_TO_PRESENT",output:async({body:t,camera:e,navigation:n})=>{const i=new o(o.Z_AXIS).rotate(new s(t.pose.orientation)).setY(0),r=new o(n.destination.pose.position).subtract(t.pose.position).setY(0);return ct=ct||s.fromUnitVectors(i.normalize(),r.normalize()).toEulerAngles().heading,await ut(t,e,Math.sign(ct)),tt}}),Lt=xt({name:"POINT_TOWARD_POI",output:async({body:t,camera:e,navigation:n})=>{const i=new o(n.destination.pose.position).subtract(t.pose.position),r=new o(e.pose.position).subtract(t.pose.position),a=s.fromUnitVectors(r.normalize(),i.normalize()).toEulerAngles().heading;return at||(at=a>0^["guidebot_robot_v2","guidebot_robot_v3","guidebot_robot_v4"].includes(t.model.foreignKey)?"Right":"Left"),await nt(t.animations[`Point${at}In`],{time:0,loop:!1},!0),tt}}),qt=xt({name:"START_PRESENTING_STATE",output:async({chatbot:t})=>(t.presentDestination(),tt)}),Ft=xt({name:"PRESENT_POI",output:it}),Gt=xt({name:"STOP_PRESENTING",output:async({speechModule:t,navigation:e,userInput:n})=>(e.clearDestination(),t.stopSpeaking(),n.dismissGuide(),tt)}),Ct=xt({name:"PUT_DOWN_HAND",output:async({body:t})=>(at&&(await nt(t.animations[`Point${at}Out`],{time:0,loop:!1},!0),at=void 0),await b(1e3),et)});var Yt=mt({name:"PRESENTING",stateMachine:wt({initialState:kt,finalStates:[Ct],getNextState:(t,{guideRequested:e,guideFacingUser:n,destinationChanged:i,guideSpeaking:o})=>{switch(t){case kt:return n?Lt:kt;case Lt:return e?i?Ct:qt:Ct;case qt:return e?Ft:Ct;case Ft:return e?i?Gt:o?Ft:Gt:Ct;case Gt:case Ct:return Ct;default:throw new Error(`Unrecognized state: ${t?t.name:t}`)}}})});const $t=xt({name:"TELEPORT_TO_USER",output:ot}),Xt=xt({name:"TELEPORT_AWAY",output:rt});var Zt=mt({name:"RECALIBRATE",stateMachine:wt({initialState:Xt,finalStates:[$t],getNextState:(t,{})=>{switch(t){case Xt:case $t:return $t;default:throw new Error(`Unrecognized state: ${t?t.name:t}`)}}})});var Wt=wt({initialState:Ot,finalStates:[],getNextState:(({hidden:t,talking:e,waiting:n,guiding:i,presenting:o})=>(r,a)=>{const{guideRequested:s,destinationChosen:c,userNear:u,userFar:p,destinationReached:l,guideSpeaking:h,recalibrationRequested:f}=a;switch(r){case t:return s?e:t;case e:return s?c&&l?o:c&&!l?i:e:t;case i:return s?p?n:!u&&l?n:u&&l?o:f?Zt:i:t;case n:return s?u&&l?o:u&&!l?i:f?Zt:n:t;case Zt:return i;case o:return s&&h?o:t;default:throw new Error(`Unrecognized state: ${r?r.name:r}`)}})({hidden:Ot,talking:Tt,waiting:Et,guiding:Dt,presenting:Yt})});var Ht=function({getGreetMessage:t,navigation:e}){const n=vt(),{emit:i}=n,o=function(t,e){var n={};for(var i in t)e.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return n}(n,["emit"]);let r=!1,a=!1,s=!1,c=()=>{},u=t();const p=t=>(function(t){r&&i("userInput",{speaker:"user",sentence:t})})(t);return Object.assign({startListening:async function(){if(v.app.speechDisabled)return;const{coreInterface:t}=$.viewarApi;"iOS"===t.platform&&(a=!1,r=!0,t.on("speechToText",p),await t.call("startVoiceInput"),await new Promise(e=>t.once("speechToText",t=>e(t))),a=!0)},stopListening:l,pickDestination:function(t){i("userInput",{destination:t})},requestGuide:function(e=(()=>{}),n=t()){u=n,c=e,s=!0},dismissGuide:function(){s=!1,e.clearDestination(),l(),c()},get userAnswered(){return a},get guideRequested(){return s},get greetMessage(){return u}},o);async function l(){if(v.app.speechDisabled)return;const{coreInterface:t}=$.viewarApi;r=!1,a=!1,"iOS"===t.platform&&(t.off("speechToText",p),await t.call("stopVoiceInput"))}}({navigation:K,getGreetMessage:()=>v.text.greetUser}),Bt=()=>Math.random().toString(36).slice(2);const Qt=t=>`https://dialogflow.googleapis.com/v2/projects/${v.app.projectId}/agent/sessions/${t}:detectIntent`,Kt=()=>fetch(`https://www.viewar.com/proxy.php?url=http://test2.3.viewar.com/guidebot/key.php?cache_bust=${Date.now()}`).then(t=>t.text()).then(t=>t.trim()),Jt=(t,e)=>({queryParams:{},queryInput:{text:{text:t,languageCode:e}}});var te=function({navigation:t,userInput:e,sendQuery:n,findDestination:i,getText:o}){const r=vt(),{emit:a}=r,s=function(t,e){var n={};for(var i in t)e.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return n}(r,["emit"]);let c=!1,u=!1,p=null;return Object.assign({init:function(){e.on("userInput",l)},greetUser:function(t){p=Bt(),c=!1,u=!1,a("guideSpeaking",{speaker:"guide",sentence:t})},presentDestination:function(){a("guideSpeaking",{speaker:"guide",sentence:t.destination?t.destination.data.description||t.destination.data.name:""})},get queryUnderstood(){return c},get userAnswered(){return u}},s);async function l({sentence:e,destination:r}){if(u=!0,r)c=!0,t.chooseDestination(r),a("guideSpeaking",{speaker:"guide",sentence:o("followMe")});else{const{fulfillmentText:o,parameters:r}=await n(p,e),s=Object.values(r)[0];if(s){const e=i(s);e&&(c=!0,t.chooseDestination(e))}a("guideSpeaking",{speaker:"guide",sentence:o})}}}({navigation:K,userInput:Ht,findDestination:t=>$.getPois().find(e=>e.data&&e.data.name.toLowerCase()===t.toLowerCase()),sendQuery:async function(t,e){const n=await Kt(),{error:i,queryResult:o}=await fetch(Qt(t),{method:"POST",headers:{Accept:"application/json",Authorization:`Bearer ${n}`,"Content-Type":"application/json"},body:JSON.stringify(Jt(e,v.app.language))}).then(t=>t.json());if(i)throw alert(i.message),new Error(i.message);return o},getText:t=>v.text[t]});var ee=function({getLanguageKey:t,getSpeaker:e,body:n,chatbot:i}){let o=!1;const r=async(n,i=e(),o=t())=>{const{coreInterface:r}=$.viewarApi;"iOS"===r.platform?(await r.call("stopVoiceInput"),await(async(t,e,n)=>$.viewarApi.coreInterface.call("textToSpeech",t,{name:e,lang:n}))(n,i,o),await r.call("startVoiceInput")):"Android"===r.platform?await(async(t,e,n)=>{})():await(async(t,e,n)=>{let i=window.speechSynthesis,o=window.SpeechSynthesisUtterance;const r=i.getVoices().find(t=>t.name===e)||i.getVoices().find(t=>t.lang===n),a=Object.assign(new o,{text:t,lang:n,voice:r});return new Promise((t,e)=>{a.onend=t,a.onerror=e,i.speak(a)})})(n,i,o)},a=async t=>{o||(o=!0,await n.showTalkingFace(),r(t).then(s))},s=async()=>{o&&(o=!1,await r(""),await n.showNormalFace())},c=({sentence:t})=>a(t);return{init:()=>{i.on("guideSpeaking",c)},startSpeaking:a,stopSpeaking:s,get speaking(){return o}}}({getLanguageKey:()=>v.app.language||"en-US",getSpeaker:()=>v.app.speaker||"Google US English",body:H,chatbot:te});e.default=(({stateMachine:t,getStateMachineInput:e,body:n,speechModule:i,navigation:o,kinematics:r,userInput:a,chatbot:s,defaultConfig:c,dependencies:u})=>{const p=vt(),{emit:l}=p,h=function(t,e){var n={};for(var i in t)e.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return n}(p,["emit"]);let f,d=!1,y=!1;const g=async c=>{if(d&&y){const u={body:n,camera:Q(),speechModule:i,navigation:o,kinematics:r,userInput:a,chatbot:s};let p=tt;const l=e(u);do{const e=t.process(l);p=await e(u)}while(p===et);n.processTick(c)}},v=async()=>{if(!d){await n.init(),i.init(),s.init();const{coreInterface:t}=u.viewarApi;"iOS"===t.platform&&(await t.call("startVoiceInput"),await t.call("stopVoiceInput")),s.on("guideSpeaking",(...t)=>l("guideSpeaking",...t)),a.on("userInput",(...t)=>l("userInput",...t)),d=!0}};return Object.assign({setup:({viewarApi:t,useExternalUpdateLoop:e=!1,queueSceneUpdate:n=(t=>t()),config:i,getPois:o=(()=>[]),modes:r=[],findPath:a=(()=>[])})=>{ht()(c,i),f=!e,Object.assign(u,{viewarApi:t,queueSceneUpdate:n,getPois:o,modes:r,findPath:a,useExternalUpdateLoop:e})},init:v,start:async()=>{d||await v(),y||(f&&gt.start(g),y=!0,t.reset(),await n.hide())},stop:async()=>{y&&(f&&gt.stop(),y=!1,await n.hide())},processTick:g,get running(){return y},runsInMode:t=>u.modes.includes(t)},h,{requestGuide:a.requestGuide,dismissGuide:a.dismissGuide,pickDestination:a.pickDestination})})({body:H,navigation:K,kinematics:J,speechModule:ee,chatbot:te,defaultConfig:v,userInput:Ht,stateMachine:Wt,getStateMachineInput:({body:t,camera:e,navigation:n,speechModule:i,userInput:r,chatbot:a})=>{const c=new o(t.pose.position).setY(0),u=new o(e.pose.position).setY(0).clone().subtract(c),p=u.length(),l=s.fromUnitVectors(o.Z_AXIS,u.normalize()).toEulerAngles().heading,h=new s(t.pose.orientation).toEulerAngles().heading,f=Math.abs(x(h,l))<v.guideParams.maxAngularVelocity,d=p<v.guideParams.nearDistance,y=p>v.guideParams.farDistance,g=!!n.destination,w=g&&0===n.path.length,m=g&&1===n.path.length,b=i.speaking;return{destinationChosen:g,destinationReached:w,guideFacingUser:f,guideRequested:r.guideRequested,guideShouldHalt:m,guideSpeaking:b,queryUnderstood:a.queryUnderstood,userAnswered:a.userAnswered,userFar:y,userNear:d}},dependencies:$})}]).default});
{
"name": "viewar-guide",
"version": "0.1.2",
"version": "0.1.3",
"description": "ViewAR Guide",

@@ -5,0 +5,0 @@ "main": "dist/viewar-guide.min.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc