1(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([[1914,85,138,203,241,282,308,348,393,450,468,521,571,633,685,728,789,833,872,920,968,1013,1055,1098,1141,1201,1245,1288,1347,1444,1485,1528,1572,1615,1659,1703,1771,1818,1870,1938,2015,2056],{124:function(e,t,r){"use strict";var i=r(0);Object.defineProperty(t,"__esModule",{value:true});t.default=t.LocationService=void 0;var n=i(r(17));var o=r(26);function s(e,t,r,i){var n=a();if(i){for(var o=0;o<i.length;o++){n=i[o](n)}}var s=t(function e(t){n.initializeInstanceElements(t,c.elements)},r);var c=n.decorateClass(d(s.d.map(l)),e);n.initializeClassElements(s.F,c.elements);return n.runClassFinishers(s.F,c.finishers)}function a(){a=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach(function(r){t.forEach(function(t){if(t.kind===r&&t.placement==="own"){this.defineClassElement(e,t)}},this)},this)},initializeClassElements:function(e,t){var r=e.prototype;["method","field"].forEach(function(i){t.forEach(function(t){var n=t.placement;if(t.kind===i&&(n==="static"||n==="prototype")){var o=n==="static"?e:r;this.defineClassElement(o,t)}},this)},this)},defineClassElement:function(e,t){var r=t.descriptor;if(t.kind==="field"){var i=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:i===void 0?void 0:i.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[];var i=[];var n={static:[],prototype:[],own:[]};e.forEach(function(e){this.addElementPlacement(e,n)},this);e.forEach(function(e){if(!u(e))return r.push(e);var t=this.decorateElement(e,n);r.push(t.element);r.push.apply(r,t.extras);i.push.apply(i,t.finishers)},this);if(!t){return{elements:r,finishers:i}}var o=this.decorateConstructor(r,t);i.push.apply(i,o.finishers);o.finishers=i;return o},addElementPlacement:function(e,t,r){var i=t[e.placement];if(!r&&i.indexOf(e.key)!==-1){throw new TypeError("Duplicated element ("+e.key+")")}i.push(e.key)},decorateElement:function(e,t){var r=[];var i=[];for(var n=e.decorators,o=n.length-1;o>=0;o--){var s=t[e.placement];s.splice(s.indexOf(e.key),1);var a=this.fromElementDescriptor(e);var l=this.toElementFinisherExtras((0,n[o])(a)||a);e=l.element;this.addElementPlacement(e,t);if(l.finisher){i.push(l.finisher)}var c=l.extras;if(c){for(var d=0;d<c.length;d++){this.addElementPlacement(c[d],t)}r.push.apply(r,c)}}return{element:e,finishers:i,extras:r}},decorateConstructor:function(e,t){var r=[];for(var i=t.length-1;i>=0;i--){var n=this.fromClassDescriptor(e);var o=this.toClassDescriptor((0,t[i])(n)||n);if(o.finisher!==undefined){r.push(o.finisher)}if(o.elements!==undefined){e=o.elements;for(var s=0;s<e.length-1;s++){for(var a=s+1;a<e.length;a++){if(e[s].key===e[a].key&&e[s].placement===e[a].placement){throw new TypeError("Duplicated element ("+e[s].key+")")}}}}}return{elements:e,finishers:r}},fromElementDescriptor:function(e){var t={kind:e.kind,key:e.key,placement:e.placement,descriptor:e.descriptor};var r={value:"Descriptor",configurable:true};Object.defineProperty(t,Symbol.toStringTag,r);if(e.kind==="field")t.initializer=e.initializer;return t},toElementDescriptors:function(e){if(e===undefined)return;return(0,n.default)(e).map(function(e){var t=this.toElementDescriptor(e);this.disallowProperty(e,"finisher","An element descriptor");this.disallowProperty(e,"extras","An element descriptor");return t},this)},toElementDescriptor:function(e){var t=String(e.kind);if(t!=="method"&&t!=="field"){throw new TypeError('An element descriptor\'s .kind property must be either "method" or'+' "field", but a decorator created an element descriptor with'+' .kind "'+t+'"')}var r=h(e.key);var i=String(e.placement);if(i!=="static"&&i!=="prototype"&&i!=="own"){throw new TypeError('An element descriptor\'s .placement property must be one of "static",'+' "prototype" or "own", but a decorator created an element descriptor'+' with .placement "'+i+'"')}var n=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var o={kind:t,key:r,placement:i,descriptor:Object.assign({},n)};if(t!=="field"){this.disallowProperty(e,"initializer","A method descriptor")}else{this.disallowProperty(n,"get","The property descriptor of a field descriptor");this.disallowProperty(n,"set","The property descriptor of a field descriptor");this.disallowProperty(n,"value","The property descriptor of a field descriptor");o.initializer=e.initializer}return o},toElementFinisherExtras:function(e){var t=this.toElementDescriptor(e);var r=p(e,"finisher");var i=this.toElementDescriptors(e.extras);return{element:t,finisher:r,extras:i}},fromClassDescriptor:function(e){var t={kind:"class",elements:e.map(this.fromElementDescriptor,this)};var r={value:"Descriptor",configurable:true};Object.defineProperty(t,Symbol.toStringTag,r);return t},toClassDescriptor:function(e){var t=String(e.kind);if(t!=="class"){throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator'+' created a class descriptor with .kind "'+t+'"')}this.disallowProperty(e,"key","A class descriptor");this.disallowProperty(e,"placement","A class descriptor");this.disallowProperty(e,"descriptor","A class descriptor");this.disallowProperty(e,"initializer","A class descriptor");this.disallowProperty(e,"extras","A class descriptor");var r=p(e,"finisher");var i=this.toElementDescriptors(e.elements);return{elements:i,finisher:r}},runClassFinishers:function(e,t){for(var r=0;r<t.length;r++){var i=(0,t[r])(e);
1if(i!==undefined){if(typeof i!=="function"){throw new TypeError("Finishers must return a constructor.")}e=i}}return e},disallowProperty:function(e,t,r){if(e[t]!==undefined){throw new TypeError(r+" can't have a ."+t+" property.")}}};return e}function l(e){var t=h(e.key);var r;if(e.kind==="method"){r={value:e.value,writable:true,configurable:true,enumerable:false}}else if(e.kind==="get"){r={get:e.value,configurable:true,enumerable:false}}else if(e.kind==="set"){r={set:e.value,configurable:true,enumerable:false}}else if(e.kind==="field"){r={configurable:true,writable:true,enumerable:true}}var i={kind:e.kind==="field"?"field":"method",key:t,placement:e.static?"static":e.kind==="field"?"own":"prototype",descriptor:r};if(e.decorators)i.decorators=e.decorators;if(e.kind==="field")i.initializer=e.value;return i}function c(e,t){if(e.descriptor.get!==undefined){t.descriptor.get=e.descriptor.get}else{t.descriptor.set=e.descriptor.set}}function d(e){var t=[];var r=function(e){return e.kind==="method"&&e.key===n.key&&e.placement===n.placement};for(var i=0;i<e.length;i++){var n=e[i];var o;if(n.kind==="method"&&(o=t.find(r))){if(f(n.descriptor)||f(o.descriptor)){if(u(n)||u(o)){throw new ReferenceError("Duplicated methods ("+n.key+") can't be decorated.")}o.descriptor=n.descriptor}else{if(u(n)){if(u(o)){throw new ReferenceError("Decorators can't be placed on different accessors with for "+"the same property ("+n.key+").")}o.decorators=n.decorators}c(n,o)}}else{t.push(n)}}return t}function u(e){return e.decorators&&e.decorators.length}function f(e){return e!==undefined&&!(e.value===undefined&&e.writable===undefined)}function p(e,t){var r=e[t];if(r!==undefined&&typeof r!=="function"){throw new TypeError("Expected '"+t+"' to be a function")}return r}function h(e){var t=m(e,"string");return"symbol"==typeof t?t:t+""}function m(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}let v=t.LocationService=s([(0,o.Service)()],function(e){class t{constructor(){e(this)}}return{F:t,d:[{kind:"field",key:"url_name",value:void 0},{kind:"field",key:"pin_length",value:void 0},{kind:"field",key:"location_uuid",value:void 0},{kind:"field",key:"location_id",value:void 0},{kind:"field",key:"location_name",value:void 0},{kind:"field",key:"brand_images",value(){return{logo:null,icon:null,logo_light:null,icon_light:null}}},{kind:"field",key:"is_sandbox",value(){return false}},{kind:"field",key:"use_new_option_structure",value:void 0},{kind:"field",key:"tab_pass_configs",value:void 0},{kind:"field",key:"customizations",value(){return{}}},{kind:"field",key:"loyalty_agent_client_configs",value(){return{}}},{kind:"field",key:"display_configs",value(){return{}}},{kind:"field",key:"hide_zero_priced_modifiers",value:void 0},{kind:"field",key:"show_seat_number",value:void 0},{kind:"field",key:"show_pos_item_notes_on_receipt",value:void 0},{kind:"field",key:"location_protocols",value(){return[]}},{kind:"field",key:"country",value:void 0},{kind:"field",key:"timezone",value:void 0},{kind:"method",key:"init",value:function e(t){var r,i,n,o,s;if(!t.location){throw new Error("LocationService requires a location object in the input in order to be initialized")}this.url_name=t.location.url_name;this.pin_length=t.location.pin_length;this.location_uuid=t.location.location_uuid;this.location_id=t.location.location_id;this.location_name=t.location.location_name;this.brand_images=(r=t.location.brand_images)!==null&&r!==void 0?r:this.brand_images;this.is_sandbox=(i=t.location.is_sandbox)!==null&&i!==void 0?i:false;this.use_new_option_structure=(n=t.location.use_new_option_structure)!==null&&n!==void 0?n:false;this.tab_pass_configs=t.location.tab_pass_configs;this.customizations=t.location.customizations;this.loyalty_agent_client_configs=t.location.loyalty_agent_client_configs;this.display_configs=(o=t.location.display_configs)!==null&&o!==void 0?o:this.display_configs;this.hide_zero_priced_modifiers=t.location.hide_zero_priced_modifiers;this.show_seat_number=t.location.show_seat_number;this.show_pos_item_notes_on_receipt=t.location.show_pos_item_notes_on_receipt;this.location_protocols=(s=t.location.location_protocols)!==null&&s!==void 0?s:this.location_protocols;this.country=t.location.country;this.timezone=t.location.timezone}},{kind:"method",key:"details",value:function e(){return{url_name:this.url_name,location_uuid:this.location_uuid,location_id:this.location_id,name:this.location_name}}}]}});var y=t.default=v},166:function(e,t,r){"use strict";var i=r(0);
1Object.defineProperty(t,"__esModule",{value:true});t.default=t.DialogService=void 0;var n=i(r(23));var o=i(r(8));var s=i(r(7));var a=i(r(17));var l=r(19);var c=r(26);const d=["validate"];function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function f(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach(function(t){(0,o.default)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function p(e,t,r,i){var n=h();if(i){for(var o=0;o<i.length;o++){n=i[o](n)}}var s=t(function e(t){n.initializeInstanceElements(t,a.elements)},r);var a=n.decorateClass(y(s.d.map(m)),e);n.initializeClassElements(s.F,a.elements);return n.runClassFinishers(s.F,a.finishers)}function h(){h=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach(function(r){t.forEach(function(t){if(t.kind===r&&t.placement==="own"){this.defineClassElement(e,t)}},this)},this)},initializeClassElements:function(e,t){var r=e.prototype;["method","field"].forEach(function(i){t.forEach(function(t){var n=t.placement;if(t.kind===i&&(n==="static"||n==="prototype")){var o=n==="static"?e:r;this.defineClassElement(o,t)}},this)},this)},defineClassElement:function(e,t){var r=t.descriptor;if(t.kind==="field"){var i=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:i===void 0?void 0:i.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[];var i=[];var n={static:[],prototype:[],own:[]};e.forEach(function(e){this.addElementPlacement(e,n)},this);e.forEach(function(e){if(!k(e))return r.push(e);var t=this.decorateElement(e,n);r.push(t.element);r.push.apply(r,t.extras);i.push.apply(i,t.finishers)},this);if(!t){return{elements:r,finishers:i}}var o=this.decorateConstructor(r,t);i.push.apply(i,o.finishers);o.finishers=i;return o},addElementPlacement:function(e,t,r){var i=t[e.placement];if(!r&&i.indexOf(e.key)!==-1){throw new TypeError("Duplicated element ("+e.key+")")}i.push(e.key)},decorateElement:function(e,t){var r=[];var i=[];for(var n=e.decorators,o=n.length-1;o>=0;o--){var s=t[e.placement];s.splice(s.indexOf(e.key),1);var a=this.fromElementDescriptor(e);var l=this.toElementFinisherExtras((0,n[o])(a)||a);e=l.element;this.addElementPlacement(e,t);if(l.finisher){i.push(l.finisher)}var c=l.extras;if(c){for(var d=0;d<c.length;d++){this.addElementPlacement(c[d],t)}r.push.apply(r,c)}}return{element:e,finishers:i,extras:r}},decorateConstructor:function(e,t){var r=[];for(var i=t.length-1;i>=0;i--){var n=this.fromClassDescriptor(e);var o=this.toClassDescriptor((0,t[i])(n)||n);if(o.finisher!==undefined){r.push(o.finisher)}if(o.elements!==undefined){e=o.elements;for(var s=0;s<e.length-1;s++){for(var a=s+1;a<e.length;a++){if(e[s].key===e[a].key&&e[s].placement===e[a].placement){throw new TypeError("Duplicated element ("+e[s].key+")")}}}}}return{elements:e,finishers:r}},fromElementDescriptor:function(e){var t={kind:e.kind,key:e.key,placement:e.placement,descriptor:e.descriptor};var r={value:"Descriptor",configurable:true};Object.defineProperty(t,Symbol.toStringTag,r);if(e.kind==="field")t.initializer=e.initializer;return t},toElementDescriptors:function(e){if(e===undefined)return;return(0,a.default)(e).map(function(e){var t=this.toElementDescriptor(e);this.disallowProperty(e,"finisher","An element descriptor");this.disallowProperty(e,"extras","An element descriptor");return t},this)},toElementDescriptor:function(e){var t=String(e.kind);if(t!=="method"&&t!=="field"){throw new TypeError('An element descriptor\'s .kind property must be either "method" or'+' "field", but a decorator created an element descriptor with'+' .kind "'+t+'"')}var r=b(e.key);var i=String(e.placement);if(i!=="static"&&i!=="prototype"&&i!=="own"){throw new TypeError('An element descriptor\'s .placement property must be one of "static",'+' "prototype" or "own", but a decorator created an element descriptor'+' with .placement "'+i+'"')}var n=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var o={kind:t,key:r,placement:i,descriptor:Object.assign({},n)};if(t!=="field"){this.disallowProperty(e,"initializer","A method descriptor")}else{this.disallowProperty(n,"get","The property descriptor of a field descriptor");this.disallowProperty(n,"set","The property descriptor of a field descriptor");this.disallowProperty(n,"value","The property descriptor of a field descriptor");o.initializer=e.initializer}return o},toElementFinisherExtras:function(e){var t=this.toElementDescriptor(e);var r=w(e,"finisher");var i=this.toElementDescriptors(e.extras);return{element:t,finisher:r,extras:i}},fromClassDescriptor:function(e){var t={kind:"class",elements:e.map(this.fromElementDescriptor,this)};var r={value:"Descriptor",configurable:true};Object.defineProperty(t,Symbol.toStringTag,r);return t},toClassDescriptor:function(e){var t=String(e.kind);if(t!=="class"){throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator'+' created a class descriptor with .kind "'+t+'"')}this.disallowProperty(e,"key","A class descriptor");this.disallowProperty(e,"placement","A class descriptor");this.disallowProperty(e,"descriptor","A class descriptor");this.disallowProperty(e,"initializer","A class descriptor");this.disallowProperty(e,"extras","A class descriptor");var r=w(e,"finisher");var i=this.toElementDescriptors(e.elements);return{elements:i,finisher:r}},runClassFinishers:function(e,t){for(var r=0;r<t.length;r++){var i=(0,t[r])(e);
1if(i!==undefined){if(typeof i!=="function"){throw new TypeError("Finishers must return a constructor.")}e=i}}return e},disallowProperty:function(e,t,r){if(e[t]!==undefined){throw new TypeError(r+" can't have a ."+t+" property.")}}};return e}function m(e){var t=b(e.key);var r;if(e.kind==="method"){r={value:e.value,writable:true,configurable:true,enumerable:false}}else if(e.kind==="get"){r={get:e.value,configurable:true,enumerable:false}}else if(e.kind==="set"){r={set:e.value,configurable:true,enumerable:false}}else if(e.kind==="field"){r={configurable:true,writable:true,enumerable:true}}var i={kind:e.kind==="field"?"field":"method",key:t,placement:e.static?"static":e.kind==="field"?"own":"prototype",descriptor:r};if(e.decorators)i.decorators=e.decorators;if(e.kind==="field")i.initializer=e.value;return i}function v(e,t){if(e.descriptor.get!==undefined){t.descriptor.get=e.descriptor.get}else{t.descriptor.set=e.descriptor.set}}function y(e){var t=[];var r=function(e){return e.kind==="method"&&e.key===n.key&&e.placement===n.placement};for(var i=0;i<e.length;i++){var n=e[i];var o;if(n.kind==="method"&&(o=t.find(r))){if(g(n.descriptor)||g(o.descriptor)){if(k(n)||k(o)){throw new ReferenceError("Duplicated methods ("+n.key+") can't be decorated.")}o.descriptor=n.descriptor}else{if(k(n)){if(k(o)){throw new ReferenceError("Decorators can't be placed on different accessors with for "+"the same property ("+n.key+").")}o.decorators=n.decorators}v(n,o)}}else{t.push(n)}}return t}function k(e){return e.decorators&&e.decorators.length}function g(e){return e!==undefined&&!(e.value===undefined&&e.writable===undefined)}function w(e,t){var r=e[t];if(r!==undefined&&typeof r!=="function"){throw new TypeError("Expected '"+t+"' to be a function")}return r}function b(e){var t=E(e,"string");return"symbol"==typeof t?t:t+""}function E(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}let _=t.DialogService=p([(0,c.Service)()],function(e){class t{constructor(){e(this)}}return{F:t,d:[{kind:"field",key:"current",value(){return null}},{kind:"field",key:"controller",value(){return null}},{kind:"field",key:"timeout",value(){return null}},{kind:"field",key:"suspendedState",value(){return null}},{kind:"method",key:"init",value:function e(){return[{suspendedState:false}]}},{kind:"method",key:"create",value:function(){var e=(0,s.default)(function*(e,t={},i={}){const n=(yield r.e(2061).then(r.t.bind(null,889,7))).default;return this.show({content:n,input:{input:t,content:e,options:i}})});function t(t){return e.apply(this,arguments)}return t}()},{kind:"method",key:"drawer",value:function(){var e=(0,s.default)(function*(e,t={},i={}){const n=(yield r.e(2062).then(r.t.bind(null,888,7))).default;return this.show({content:n,input:{input:t,content:e,options:i}})});function t(t){return e.apply(this,arguments)}return t}()},{kind:"method",key:"show",value:function e(t,r=5e3){var i=this;return new Promise(function(){var e=(0,s.default)(function*(e,n){if(!t.content){throw new Error("Dialog content must be defined")}clearTimeout(i.timeout);const o=t=>{clearTimeout(i.timeout);(0,l.runInAction)(()=>{i.controller=t});e(e=>i.close(e))};const s=e=>{clearTimeout(i.timeout);n(e)};i.timeout=setTimeout(()=>{n(new Error(`Failed to acccept or reject dialog within ${r}ms. This is likely a bug.`))},r);const a=f(f({input:{}},t),{},{"data-dialog-id":t["data-dialog-id"]||`dialog-${Math.random().toString(36).slice(0,5)}`,accept:o,reject:s});(0,l.runInAction)(()=>{i.current=a})});return function(t,r){return e.apply(this,arguments)}}())}},{kind:"method",key:"clear",value:function e(){const t=this.current;this.current=null;this.controller=null;return t}},{kind:"method",key:"close",value:function(){var e=(0,s.default)(function*(e){var t;yield(t=this.controller)===null||t===void 0?void 0:t.close(e);return this.clear()});function t(t){return e.apply(this,arguments)}return t}()},{kind:"method",key:"suspend",value:function(){var e=(0,s.default)(function*(){this.suspendedState={current:this.current,controller:this.controller};this.close()});function t(){return e.apply(this,arguments)}return t}()},{kind:"method",key:"resume",value:function(){var e=(0,s.default)(function*(e){var t;const{current:r,controller:i}=this.suspendedState;this.suspendedState=null;this.current=r;this.current.input=f(f({},this.current.input),{},{input:f(f({},(t=this.current.input)===null||t===void 0?void 0:t.input),e)});this.controller=i;return this.show(r)}
1);function t(t){return e.apply(this,arguments)}return t}()},{kind:"method",key:"confirm",value:function e(t){var i=this;return new Promise(function(){var e=(0,s.default)(function*(e,n){i.show({content:(yield Promise.all([r.e(25),r.e(23),r.e(30),r.e(28),r.e(32),r.e(24),r.e(22),r.e(29),r.e(33),r.e(21),r.e(31),r.e(26)]).then(r.t.bind(null,473,7))).default,input:f(f({},t),{},{onResult:e,onError:n})})});return function(t,r){return e.apply(this,arguments)}}())}},{kind:"method",key:"confirmForm",value:function e(t){var i=this;return new Promise(function(){var e=(0,s.default)(function*(e,n){i.show({content:(yield Promise.all([r.e(25),r.e(23),r.e(30),r.e(28),r.e(32),r.e(24),r.e(22),r.e(29),r.e(33),r.e(21),r.e(31),r.e(26)]).then(r.t.bind(null,473,7))).default,input:f(f({},t),{},{style:"form",onResult(t,r){e([t,r])},onError:n})})});return function(t,r){return e.apply(this,arguments)}}())}},{kind:"method",key:"confirmPin",value:function e(t={}){var i=this;let{validate:o}=t,a=(0,n.default)(t,d);return new Promise(function(){var e=(0,s.default)(function*(e){i.show({content:(yield Promise.all([r.e(27),r.e(2063)]).then(r.t.bind(null,887,7))).default,input:f(f({},a),{},{closeOnOutsideClick:true,onClosed(){e([false,null])},onPin:function(){var t=(0,s.default)(function*(t,r){var i;const n=(i=yield o===null||o===void 0?void 0:o(t,r))!==null&&i!==void 0?i:false;if(n){yield new Promise(e=>setTimeout(e,700));r.close()}e([n,t])});return function e(r,i){return t.apply(this,arguments)}}()})})});return function(t){return e.apply(this,arguments)}}())}}]}});var P=t.default=_},315:function(e,t,r){"use strict";var i=r(0);Object.defineProperty(t,"__esModule",{value:true});t.default=t.FlagService=void 0;var n=i(r(17));var o=r(37);var s=r(549);var a=r(19);var l=r(138);var c=r(26);function d(e,t,r,i){var n=u();if(i){for(var o=0;o<i.length;o++){n=i[o](n)}}var s=t(function e(t){n.initializeInstanceElements(t,a.elements)},r);var a=n.decorateClass(h(s.d.map(f)),e);n.initializeClassElements(s.F,a.elements);return n.runClassFinishers(s.F,a.finishers)}function u(){u=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach(function(r){t.forEach(function(t){if(t.kind===r&&t.placement==="own"){this.defineClassElement(e,t)}},this)},this)},initializeClassElements:function(e,t){var r=e.prototype;["method","field"].forEach(function(i){t.forEach(function(t){var n=t.placement;if(t.kind===i&&(n==="static"||n==="prototype")){var o=n==="static"?e:r;this.defineClassElement(o,t)}},this)},this)},defineClassElement:function(e,t){var r=t.descriptor;if(t.kind==="field"){var i=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:i===void 0?void 0:i.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[];var i=[];var n={static:[],prototype:[],own:[]};e.forEach(function(e){this.addElementPlacement(e,n)},this);e.forEach(function(e){if(!m(e))return r.push(e);var t=this.decorateElement(e,n);r.push(t.element);r.push.apply(r,t.extras);i.push.apply(i,t.finishers)},this);if(!t){return{elements:r,finishers:i}}var o=this.decorateConstructor(r,t);i.push.apply(i,o.finishers);o.finishers=i;return o},addElementPlacement:function(e,t,r){var i=t[e.placement];if(!r&&i.indexOf(e.key)!==-1){throw new TypeError("Duplicated element ("+e.key+")")}i.push(e.key)},decorateElement:function(e,t){var r=[];var i=[];for(var n=e.decorators,o=n.length-1;o>=0;o--){var s=t[e.placement];s.splice(s.indexOf(e.key),1);var a=this.fromElementDescriptor(e);var l=this.toElementFinisherExtras((0,n[o])(a)||a);e=l.element;this.addElementPlacement(e,t);if(l.finisher){i.push(l.finisher)}var c=l.extras;if(c){for(var d=0;d<c.length;d++){this.addElementPlacement(c[d],t)}r.push.apply(r,c)}}return{element:e,finishers:i,extras:r}},decorateConstructor:function(e,t){var r=[];for(var i=t.length-1;i>=0;i--){var n=this.fromClassDescriptor(e);var o=this.toClassDescriptor((0,t[i])(n)||n);if(o.finisher!==undefined){r.push(o.finisher)}if(o.elements!==undefined){e=o.elements;for(var s=0;s<e.length-1;s++){for(var a=s+1;a<e.length;a++){if(e[s].key===e[a].key&&e[s].placement===e[a].placement){throw new TypeError("Duplicated element ("+e[s].key+")")}}}}}return{elements:e,finishers:r}},fromElementDescriptor:function(e){var t={kind:e.kind,key:e.key,placement:e.placement,descriptor:e.descriptor};var r={value:"Descriptor",configurable:true};Object.defineProperty(t,Symbol.toStringTag,r);if(e.kind==="field")t.initializer=e.initializer;return t},toElementDescriptors:function(e){if(e===undefined)return;return(0,n.default)(e).map(function(e){var t=this.toElementDescriptor(e);this.disallowProperty(e,"finisher","An element descriptor");this.disallowProperty(e,"extras","An element descriptor");return t},this)},toElementDescriptor:function(e){var t=String(e.kind);if(t!=="method"&&t!=="field"){throw new TypeError('An element descriptor\'s .kind property must be either "method" or'+' "field", but a decorator created an element descriptor with'+' .kind "'+t+'"')}var r=k(e.key);var i=String(e.placement);if(i!=="static"&&i!=="prototype"&&i!=="own"){throw new TypeError('An element descriptor\'s .placement property must be one of "static",'+' "prototype" or "own", but a decorator created an element descriptor'+' with .placement "'+i+'"')}var n=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var o={kind:t,key:r,placement:i,descriptor:Object.assign({},n)};if(t!=="field"){this.disallowProperty(e,"initializer","A method descriptor")}else{this.disallowProperty(n,"get","The property descriptor of a field descriptor");this.disallowProperty(n,"set","The property descriptor of a field descriptor");this.disallowProperty(n,"value","The property descriptor of a field descriptor");o.initializer=e.initializer}return o},toElementFinisherExtras:function(e){var t=this.toElementDescriptor(e);var r=y(e,"finisher");var i=this.toElementDescriptors(e.extras);return{element:t,finisher:r,extras:i}},fromClassDescriptor:function(e){var t={kind:"class",elements:e.map(this.fromElementDescriptor,this)};var r={value:"Descriptor",configurable:true};Object.defineProperty(t,Symbol.toStringTag,r);return t},toClassDescriptor:function(e){var t=String(e.kind);if(t!=="class"){throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator'+' created a class descriptor with .kind "'+t+'"')}this.disallowProperty(e,"key","A class descriptor");this.disallowProperty(e,"placement","A class descriptor");this.disallowProperty(e,"descriptor","A class descriptor");this.disallowProperty(e,"initializer","A class descriptor");this.disallowProperty(e,"extras","A class descriptor");var r=y(e,"finisher");var i=this.toElementDescriptors(e.elements);return{elements:i,finisher:r}},runClassFinishers:function(e,t){for(var r=0;r<t.length;r++){var i=(0,t[r])(e);
1if(i!==undefined){if(typeof i!=="function"){throw new TypeError("Finishers must return a constructor.")}e=i}}return e},disallowProperty:function(e,t,r){if(e[t]!==undefined){throw new TypeError(r+" can't have a ."+t+" property.")}}};return e}function f(e){var t=k(e.key);var r;if(e.kind==="method"){r={value:e.value,writable:true,configurable:true,enumerable:false}}else if(e.kind==="get"){r={get:e.value,configurable:true,enumerable:false}}else if(e.kind==="set"){r={set:e.value,configurable:true,enumerable:false}}else if(e.kind==="field"){r={configurable:true,writable:true,enumerable:true}}var i={kind:e.kind==="field"?"field":"method",key:t,placement:e.static?"static":e.kind==="field"?"own":"prototype",descriptor:r};if(e.decorators)i.decorators=e.decorators;if(e.kind==="field")i.initializer=e.value;return i}function p(e,t){if(e.descriptor.get!==undefined){t.descriptor.get=e.descriptor.get}else{t.descriptor.set=e.descriptor.set}}function h(e){var t=[];var r=function(e){return e.kind==="method"&&e.key===n.key&&e.placement===n.placement};for(var i=0;i<e.length;i++){var n=e[i];var o;if(n.kind==="method"&&(o=t.find(r))){if(v(n.descriptor)||v(o.descriptor)){if(m(n)||m(o)){throw new ReferenceError("Duplicated methods ("+n.key+") can't be decorated.")}o.descriptor=n.descriptor}else{if(m(n)){if(m(o)){throw new ReferenceError("Decorators can't be placed on different accessors with for "+"the same property ("+n.key+").")}o.decorators=n.decorators}p(n,o)}}else{t.push(n)}}return t}function m(e){return e.decorators&&e.decorators.length}function v(e){return e!==undefined&&!(e.value===undefined&&e.writable===undefined)}function y(e,t){var r=e[t];if(r!==undefined&&typeof r!=="function"){throw new TypeError("Expected '"+t+"' to be a function")}return r}function k(e){var t=g(e,"string");return"symbol"==typeof t?t:t+""}function g(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}
1let w=t.FlagService=d([(0,c.Service)({debugName:"flags"})],function(e){class t{constructor(){e(this)}}return{F:t,d:[{kind:"field",key:"client",value:void 0},{kind:"field",key:"clientState",value(){return"INITIALIZING"}},{kind:"field",key:"readyPromise",value(){return Promise.resolve()}},{kind:"method",key:"init",value:function e(t,r){var i;if(typeof window==="undefined"){return}const{flags_config:n,user_id:c,location_id:d,location_group_id:u,location:f,customer_id:p,native_app_device_name:h,native_app_package_name:m,native_app_type:v,hostname:y,release_version:k,currentUser:g,isLocal:w,isGoNative:b}=r;const E=new s.FliptWebProvider(n.namespace,{url:n.endpoint,authentication:{clientToken:n.clientToken}},console);this.readyPromise=o.OpenFeature.setProviderAndWait(E,{targetingKey:p,user_id:c,location_id:(i=f===null||f===void 0?void 0:f.location_id)!==null&&i!==void 0?i:d,location_group_id:u,customer_id:p,config_user:(0,l.permissionInAcls)(g===null||g===void 0?void 0:g.location_acls,"config"),admin_user:(0,l.permissionInAcls)(g===null||g===void 0?void 0:g.location_acls,"admin"),release_version:k,native_app_device_name:h,native_app_package_name:m,native_app_type:v,is_local:w,is_native:b,hostname:y,app:t.app}).then(()=>{(0,a.runInAction)(()=>{this.clientState="READY"})}).catch(e=>{console.error("Error setting feature flag provider",e);(0,a.runInAction)(()=>{this.clientState="READY"})});this.client=o.OpenFeature.getClient();this.client.setLogger(console)}},{kind:"method",key:"getValue",value:function e(t,r,i,n){var o;if(!this.client){return i}let s;switch(t){case"boolean":s=this.client.getBooleanValue(r,i,n);break;case"number":s=this.client.getNumberValue(r,i,n);break;case"string":s=this.client.getStringValue(r,i,n);break;case"object":s=this.client.getObjectValue(r,i,n);break;default:console.error(`Unknown flag type: ${t}`);s=i}if(typeof((o=globalThis.DD_RUM)===null||o===void 0?void 0:o.addFeatureFlagEvaluation)!=="undefined"){var a,l;(a=globalThis.DD_RUM)===null||a===void 0?void 0:(l=a.addFeatureFlagEvaluation)===null||l===void 0?void 0:l.call(a,r.replace(/\W/g,"_"),s)}return s}}]}});var b=t.default=w},474:function(e,t,r){"use strict";var i=r(0);Object.defineProperty(t,"__esModule",{value:true});t.default=t.NotificationsService=void 0;var n=i(r(7));var o=i(r(8));var s=i(r(17));var a=r(55);var l=r(26);var c=r(27);var d=r(124);var u=r(109);function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?f(Object(r),!0).forEach(function(t){(0,o.default)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function h(e,t,r,i){var n=m();if(i){for(var o=0;o<i.length;o++){n=i[o](n)}}var s=t(function e(t){n.initializeInstanceElements(t,a.elements)},r);var a=n.decorateClass(k(s.d.map(v)),e);n.initializeClassElements(s.F,a.elements);return n.runClassFinishers(s.F,a.finishers)}function m(){m=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach(function(r){t.forEach(function(t){if(t.kind===r&&t.placement==="own"){this.defineClassElement(e,t)}},this)},this)},initializeClassElements:function(e,t){var r=e.prototype;["method","field"].forEach(function(i){t.forEach(function(t){var n=t.placement;if(t.kind===i&&(n==="static"||n==="prototype")){var o=n==="static"?e:r;this.defineClassElement(o,t)}},this)},this)},defineClassElement:function(e,t){var r=t.descriptor;if(t.kind==="field"){var i=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:i===void 0?void 0:i.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[];var i=[];var n={static:[],prototype:[],own:[]};e.forEach(function(e){this.addElementPlacement(e,n)},this);e.forEach(function(e){if(!g(e))return r.push(e);var t=this.decorateElement(e,n);r.push(t.element);r.push.apply(r,t.extras);i.push.apply(i,t.finishers)},this);if(!t){return{elements:r,finishers:i}}var o=this.decorateConstructor(r,t);i.push.apply(i,o.finishers);o.finishers=i;return o},addElementPlacement:function(e,t,r){var i=t[e.placement];if(!r&&i.indexOf(e.key)!==-1){throw new TypeError("Duplicated element ("+e.key+")")}i.push(e.key)},decorateElement:function(e,t){var r=[];var i=[];for(var n=e.decorators,o=n.length-1;o>=0;o--){var s=t[e.placement];s.splice(s.indexOf(e.key),1);var a=this.fromElementDescriptor(e);var l=this.toElementFinisherExtras((0,n[o])(a)||a);e=l.element;this.addElementPlacement(e,t);if(l.finisher){i.push(l.finisher)}var c=l.extras;if(c){for(var d=0;d<c.length;d++){this.addElementPlacement(c[d],t)}r.push.apply(r,c)}}return{element:e,finishers:i,extras:r}},decorateConstructor:function(e,t){var r=[];for(var i=t.length-1;i>=0;i--){var n=this.fromClassDescriptor(e);var o=this.toClassDescriptor((0,t[i])(n)||n);if(o.finisher!==undefined){r.push(o.finisher)}if(o.elements!==undefined){e=o.elements;for(var s=0;s<e.length-1;s++){for(var a=s+1;a<e.length;a++){if(e[s].key===e[a].key&&e[s].placement===e[a].placement){throw new TypeError("Duplicated element ("+e[s].key+")")}}}}}return{elements:e,finishers:r}},fromElementDescriptor:function(e){var t={kind:e.kind,key:e.key,placement:e.placement,descriptor:e.descriptor};var r={value:"Descriptor",configurable:true};Object.defineProperty(t,Symbol.toStringTag,r);if(e.kind==="field")t.initializer=e.initializer;return t},toElementDescriptors:function(e){if(e===undefined)return;return(0,s.default)(e).map(function(e){var t=this.toElementDescriptor(e);this.disallowProperty(e,"finisher","An element descriptor");this.disallowProperty(e,"extras","An element descriptor");return t},this)},toElementDescriptor:function(e){var t=String(e.kind);if(t!=="method"&&t!=="field"){throw new TypeError('An element descriptor\'s .kind property must be either "method" or'+' "field", but a decorator created an element descriptor with'+' .kind "'+t+'"')}var r=E(e.key);var i=String(e.placement);if(i!=="static"&&i!=="prototype"&&i!=="own"){throw new TypeError('An element descriptor\'s .placement property must be one of "static",'+' "prototype" or "own", but a decorator created an element descriptor'+' with .placement "'+i+'"')}var n=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var o={kind:t,key:r,placement:i,descriptor:Object.assign({},n)};if(t!=="field"){this.disallowProperty(e,"initializer","A method descriptor")}else{this.disallowProperty(n,"get","The property descriptor of a field descriptor");this.disallowProperty(n,"set","The property descriptor of a field descriptor");this.disallowProperty(n,"value","The property descriptor of a field descriptor");o.initializer=e.initializer}return o},toElementFinisherExtras:function(e){var t=this.toElementDescriptor(e);var r=b(e,"finisher");var i=this.toElementDescriptors(e.extras);return{element:t,finisher:r,extras:i}},fromClassDescriptor:function(e){var t={kind:"class",elements:e.map(this.fromElementDescriptor,this)};var r={value:"Descriptor",configurable:true};Object.defineProperty(t,Symbol.toStringTag,r);return t},toClassDescriptor:function(e){var t=String(e.kind);if(t!=="class"){throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator'+' created a class descriptor with .kind "'+t+'"')}this.disallowProperty(e,"key","A class descriptor");this.disallowProperty(e,"placement","A class descriptor");this.disallowProperty(e,"descriptor","A class descriptor");this.disallowProperty(e,"initializer","A class descriptor");this.disallowProperty(e,"extras","A class descriptor");var r=b(e,"finisher");var i=this.toElementDescriptors(e.elements);return{elements:i,finisher:r}},runClassFinishers:function(e,t){for(var r=0;r<t.length;r++){var i=(0,t[r])(e);
1if(i!==undefined){if(typeof i!=="function"){throw new TypeError("Finishers must return a constructor.")}e=i}}return e},disallowProperty:function(e,t,r){if(e[t]!==undefined){throw new TypeError(r+" can't have a ."+t+" property.")}}};return e}function v(e){var t=E(e.key);var r;if(e.kind==="method"){r={value:e.value,writable:true,configurable:true,enumerable:false}}else if(e.kind==="get"){r={get:e.value,configurable:true,enumerable:false}}else if(e.kind==="set"){r={set:e.value,configurable:true,enumerable:false}}else if(e.kind==="field"){r={configurable:true,writable:true,enumerable:true}}var i={kind:e.kind==="field"?"field":"method",key:t,placement:e.static?"static":e.kind==="field"?"own":"prototype",descriptor:r};if(e.decorators)i.decorators=e.decorators;if(e.kind==="field")i.initializer=e.value;return i}function y(e,t){if(e.descriptor.get!==undefined){t.descriptor.get=e.descriptor.get}else{t.descriptor.set=e.descriptor.set}}function k(e){var t=[];var r=function(e){return e.kind==="method"&&e.key===n.key&&e.placement===n.placement};for(var i=0;i<e.length;i++){var n=e[i];var o;if(n.kind==="method"&&(o=t.find(r))){if(w(n.descriptor)||w(o.descriptor)){if(g(n)||g(o)){throw new ReferenceError("Duplicated methods ("+n.key+") can't be decorated.")}o.descriptor=n.descriptor}else{if(g(n)){if(g(o)){throw new ReferenceError("Decorators can't be placed on different accessors with for "+"the same property ("+n.key+").")}o.decorators=n.decorators}y(n,o)}}else{t.push(n)}}return t}function g(e){return e.decorators&&e.decorators.length}function w(e){return e!==undefined&&!(e.value===undefined&&e.writable===undefined)}function b(e,t){var r=e[t];if(r!==undefined&&typeof r!=="function"){throw new TypeError("Expected '"+t+"' to be a function")}return r}function E(e){var t=_(e,"string");return"symbol"==typeof t?t:t+""}function _(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}const P="/api/v2/customers/notifications";const D=e=>{var t;return(t=e.details)!==null&&t!==void 0?t:[e]};let S=t.NotificationsService=h([(0,l.Service)()],function(e){class t{constructor(){e(this)}}return{F:t,d:[{kind:"field",decorators:[(0,c.service)(d.LocationService)],key:"location",value:void 0},{kind:"field",decorators:[(0,c.service)(u.SocketService)],key:"socket",value:void 0},{kind:"field",key:"fetch",value(){return(0,a.createClient)()}},{kind:"field",key:"notifications",value(){return[]}},{kind:"field",key:"readNotificationsQueue",value(){return[]}},{kind:"field",key:"context",value(){return{}}},{kind:"field",key:"settings",value(){return{}}},{kind:"field",key:"generators",value(){return null}},{kind:"get",key:"unreadCount",value:function e(){return this.notifications.filter(e=>!e.read).length}},{kind:"method",key:"init",value:function e(t,r){this.generators=r.generators||t.generators;return[{fetch:false}]}},{kind:"method",key:"setContext",value:function e(t){console.log(t)}},{kind:"method",key:"getQueryParameters",value:function e(t={}){const r=new URLSearchParams({location_id:this.location.location_id});Object.entries(t).forEach(([e,t])=>{if(t){r.set(e,`${t}`)}});return r}},{kind:"method",key:"addOrUpdateNotification",value:function e(t){const r=this.notifications.find(e=>e.id===t.id);if(r){Object.assign(r,t);r.updated=(new Date).toISOString()}else{var i,n;const e=p({},t);(i=e.created)!==null&&i!==void 0?i:e.created=(new Date).toISOString();(n=e.updated)!==null&&n!==void 0?n:e.updated=e.created;this.notifications.push(e)}return t.id}},{kind:"method",key:"load",value:function(){var e=(0,n.default)(function*(e){const t=this.getQueryParameters(e);const{user_uuid:r}=this.context;t.append("user_uuid",r);t.append("showAll",e.showAll?"true":"false");const i=`${P}?${t.toString()}`;const n=yield this.fetch.get(i);if(!n.ok){console.error("Error loading notifications",n.error);return{errors:D(n.error)}}this.notifications.push(...n.data);return this.notifications});function t(t){return e.apply(this,arguments)}return t}()},{kind:"method",key:"loadUnread",value:function(){var e=(0,n.default)(function*(){const e=this.getQueryParameters({limit:1});const t=`${P}/unread?${e.toString()}`;const r=yield this.fetch.get(t);if(!r.ok){console.error("Error loading unread notifications",r.error);return{errors:D(r.error)}}return r.data});function t(){return e.apply(this,arguments)}return t}()},{kind:"method",key:"dismiss",value:function(){var e=(0,n.default)(function*(e,t){const r=this.notifications.find(t=>t.activity_id===e||t.id===e);if(!r){console.error("Notification not found",e)}if(r.origin==="taskservice"){}else{const r=yield this.fetch.post("/api/v2/customers/notifications/dismiss",{body:{customer_id:t,activity_id:e}});if(!r.ok){console.error("Error dismissing notifications",r.error);return{errors:D(r.error)}}}this.notifications=this.notifications.filter(t=>t.activity_id!==e&&t.id!==e);return{}});function t(t,r){return e.apply(this,arguments)}return t}()},{kind:"method",key:"updateNotificationSettings",value:function(){var e=(0,n.default)(function*(e,t,r){const i=yield this.fetch.patch(`/api/v2/loc/${this.location.location_uuid}/users/${e.userUuid}/configs/notifications`,{body:{[t]:r}});if(!i.ok){return null}return i.data});function t(t,r,i){return e.apply(this,arguments)}return t}()},{kind:"method",key:"loadUserNotificationSettings",value:function(){var e=(0,n.default)(function*(e){const t=yield this.fetch.get(`/api/v2/loc/${this.location.location_uuid}/users/${e.userUuid}/configs/notifications`);if(!t.ok){return null}const{settings:r,generators:i}=t.data;this.settings=r;this.generators=i;return{settings:this.settings,generators:this.generators}});function t(t){return e.apply(this,arguments)}return t}()},{kind:"method",decorators:[(0,c.debounce)()],key:"flushReadNotifictions",value:function(){var e=(0,n.default)(function*(){console.log("Flushing read notifications");
1if(this.readNotificationsQueue.length===0){return}const e=this.getQueryParameters();const t=`${P}/unread?${e.toString()}`;const r=yield this.fetch.post(t,{body:{activity_ids:this.readNotificationsQueue}});if(!r.ok){console.error("Error patching notification read",r.error);return}this.readNotificationsQueue=[]});function t(){return e.apply(this,arguments)}return t}()},{kind:"method",key:"markAsRead",value:function e(t){const r=this.notifications.find(e=>e.activity_id===t||e.id===t);if(!r||r.read){return}r.read=true;if((r===null||r===void 0?void 0:r.origin)!=="taskservice"){}void this.flushReadNotifictions()}},{kind:"method",key:"subscribe",value:function(){var e=(0,n.default)(function*({customer_id:e,limit:t,current_day_only:r}){const i=`notifications:delivery:${e}`;const n=yield this.socket.join(i);const o=()=>{void this.load({limit:t,current_day_only:r})};n.on("delivered",o);return()=>{n.removeAllListeners("delivered")}});function t(t){return e.apply(this,arguments)}return t}()}]}});var C=t.default=S},528:function(e,t,r){"use strict";var i=r(0);Object.defineProperty(t,"__esModule",{value:true});t.default=t.ItemGroupManager=void 0;var n=i(r(8));var o=i(r(7));var s=r(19);var a=r(55);function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach(function(t){(0,n.default)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}const d=e=>({item_id:e.item_id,quantity:e.x_quantity||e.quantity});const u=e=>e.quantity%1===0||e.subtotal<-1;const f=e=>e;class p{constructor({tab_uuid:e,location_url_name:t}){this.goFetch=null;this.loading=false;this.loadingItems=false;this.itemGroups=[];this.tempChecks=[];this.selected={item_group_uuid:null,items:[],viewing:null};this.splitSource=null;this.splitDestinations=[];this.autoDistributeOrderRules=false;(0,s.makeAutoObservable)(this);const r=`/api/v2/loc/${t}/tabs/${e}/item-groups`;this.goFetch=(0,a.createClient)({baseURL:r})}updateLoadingItems(e){(0,s.runInAction)(()=>{this.loading=e;this.loadingItems=e})}init({items:e}){var t=this;return(0,o.default)(function*(){t.updateLoadingItems(true);t.itemGroups=[{items:e.map(e=>c(c({},e),{},{spot:{spot_id:"1"}}))},{items:[]}];t.deselectAll();const r=yield t.goFetch.post("/initialize");if(r.ok){(0,s.runInAction)(()=>{t.itemGroups=r.data.sort((e,t)=>e.item_group_id-t.item_group_id)})}t.updateLoadingItems(false)})()}toggleOrderRuleAutoDistribute(){var e=this;return(0,o.default)(function*(){e.autoDistributeOrderRules=!e.autoDistributeOrderRules;if(e.autoDistributeOrderRules){}})()}updateItemGroup(e){const t=this.itemGroups.find(t=>t.item_group_uuid===e.item_group_uuid);if(!t){this.itemGroups.push(e);return}Object.assign(t,e)}getItemGroups(){var e=this;return(0,o.default)(function*(){const t=yield e.goFetch.get("/");if(!t.ok){throw new Error("Could not get item groups")}const r=t.data;if(r.length){(0,s.runInAction)(()=>{e.itemGroups=r.sort((e,t)=>e.item_group_id-t.item_group_id)})}return r})()}createItemGroup(e=[],{moveSelected:t,addSplitDestination:r}={moveSelected:false,addSplitDestination:false}){var i=this;return(0,o.default)(function*(){const n=yield i.goFetch.post("/",{body:{items:e.map(d)}});if(!n.ok){throw new Error("Could not create the item group")}const o=n.data;const a=i.itemGroups.findIndex(e=>e.item_group_uuid===o.item_group_uuid);(0,s.runInAction)(()=>{if(a===-1){i.itemGroups.push(o)}else{i.itemGroups[a]=o}});const{item_group_uuid:l}=o;if(t){i.moveSelected(l)}if(r){i.selectDestination(l)}return l})()}addTempCheck(e){this.tempChecks.push(e)}convertTempChecksToItemGroups(){var e=this;return(0,o.default)(function*(){for(let t=0;t<e.tempChecks.length;t++){const r=t===e.tempChecks.length-1;yield e.createItemGroup([],{moveSelected:r&&e.selected.item_group_uuid&&!e.splitSource,addSplitDestination:r&&!!e.splitSource})}e.tempChecks=[]})()}removeItemGroup(e){var t=this;return(0,o.default)(function*(){const r=t.itemGroups.find(t=>t.item_group_uuid===e);if(!r||r.items.length){return}const i=yield t.goFetch.delete(`/${e}`);if(i.ok){(0,s.runInAction)(()=>{t.itemGroups=t.itemGroups.filter(t=>t.item_group_uuid!==e)})}})()}selectAllInGroup(e){const t=this.itemGroups.find(t=>t.item_group_uuid===e);this.selected={item_group_uuid:e,items:t.items.filter(e=>f(e))};if(this.splitSource&&t.items.some(e=>!u(e))){this.splitSource=null;this.splitDestinations=[]}}isAllSelected(e){return this.selected.item_group_uuid===e&&this.findItemGroup(e).items.filter(e=>f(e)).every(e=>this.isSelected(e))}deselectAll(){this.selected={item_group_uuid:null,items:[],viewing:null};this.splitSource=null;this.splitDestinations=[]}selectItem(e,{item_id:t,quantity:r}){const i=this.findItemGroup(e);const n=this.findItem(e,t);if(i.is_item_group_paid||i.payments.length||this.selected.item_group_uuid&&this.selected.item_group_uuid!==e||!f(n)){return}if(this.selected.item_group_uuid===e){if(r===0){this.selected={item_group_uuid:e,items:this.selected.items.filter(e=>`${e.item_id}`!==`${t}`),viewing:null};if(this.selected.items.length===0){this.selected.item_group_uuid=null;this.splitSource=null;this.splitDestinations=[]}}else{if(this.selected.items.some(e=>`${e.item_id}`===`${t}`)){this.selected={item_group_uuid:e,items:this.selected.items.map(e=>`${e.item_id}`===`${t}`?{item_id:t,quantity:r}:e),viewing:t}}else{this.selected={item_group_uuid:e,items:[...this.selected.items,{item_id:t,quantity:r}],viewing:t}}if(this.splitSource&&!u(n)){this.splitSource=null;this.splitDestinations=[]}}}else{this.selected={item_group_uuid:e,items:[{item_id:t,quantity:r}],viewing:t}}}moveSelected(e){var t=this;return(0,o.default)(function*(){t.loading=true;const r=t.findItemGroup(t.selected.item_group_uuid);const i=[e].map(e=>({destination:e,items:t.selected.items}));const n=yield t.goFetch.post(`/${r.item_group_uuid}/transfer`,{body:i});if(n.ok){yield t.getItemGroups()}t.deselectAll();t.loading=false})()}populateItemGroup(e){var t=this;return(0,o.default)(function*(){t.loading=true;const r=yield t.goFetch.post(`/${e}/populate`);if(r.ok){(0,s.runInAction)(()=>{t.itemGroups=r.data.sort((e,t)=>
1e.item_group_id-t.item_group_id)})}t.loading=false})()}setSource(e){if(e){this.splitDestinations=[e]}else{this.splitDestinations=[]}this.splitSource=e}selectDestination(e){this.splitDestinations.push(e)}deselectDestination(e){this.splitDestinations=this.splitDestinations.filter(t=>t!==e)}splitSelected(){var e=this;return(0,o.default)(function*(){if(!e.canSplitSelected()){return}e.loading=true;const t=e.splitDestinations.length;const r=e.splitDestinations.filter(t=>t!==e.splitSource).map(r=>({destination:r,items:e.selected.items.map(e=>({item_id:e.item_id,quantity:e.quantity/t}))}));const i=yield e.goFetch.post(`/${e.splitSource}/transfer`,{body:r});if(i.ok){yield e.getItemGroups()}e.deselectAll();e.loading=false})()}splitEvenly(e){var t=this;return(0,o.default)(function*(){t.updateLoadingItems(true);t.deselectAll();const r=yield t.goFetch.post("/split-evenly",{body:{num_splits:e}});if(!r.ok){var i;throw(i=r.error.details)!==null&&i!==void 0?i:r.error}(0,s.runInAction)(()=>{t.itemGroups=r.data.sort((e,t)=>e.item_group_id-t.item_group_id)});t.updateLoadingItems(false)})()}splitBySeat(){var e=this;return(0,o.default)(function*(){e.updateLoadingItems(true);e.deselectAll();const t=yield e.goFetch.post("/split-by-seat");if(!t.ok){var r;throw(r=t.error.details)!==null&&r!==void 0?r:t.error}(0,s.runInAction)(()=>{e.itemGroups=t.data.sort((e,t)=>e.item_group_id-t.item_group_id)});e.updateLoadingItems(false)})()}reset(){var e=this;return(0,o.default)(function*(){e.updateLoadingItems(true);e.deselectAll();const t=yield e.goFetch.post("/reset");if(!t.ok){var r;throw(r=t.error.details)!==null&&r!==void 0?r:t.error}(0,s.runInAction)(()=>{e.itemGroups=t.data.sort((e,t)=>e.item_group_id-t.item_group_id)});e.updateLoadingItems(false)})()}canSplitSelected(){if(!this.itemGroups.length||!this.selected.item_group_uuid){return false}return this.itemGroups.find(e=>e.item_group_uuid===this.selected.item_group_uuid).items.filter(e=>this.isSelected(e)).every(e=>u(e))}findItemGroup(e){return this.itemGroups.find(t=>t.item_group_uuid===e)}findItem(e,t){var r,i;return(r=this.itemGroups.find(t=>t.item_group_uuid===e))===null||r===void 0?void 0:(i=r.items)===null||i===void 0?void 0:i.find(e=>e.item_id===t)}findSelectedItem(e){return this.selected.items.find(t=>`${t.item_id}`===`${e}`)}isSelected(e){return this.selected.items.map(e=>e.item_id).includes(e.item_id)}}t.ItemGroupManager=p;var h=t.default=p},529:function(e,t,r){"use strict";var i=r(0);Object.defineProperty(t,"__esModule",{value:true});t.default=t.BookingService=void 0;var n=i(r(7));var o=i(r(17));var s=r(55);var a=r(26);var l=r(27);var c=r(124);var d=r(118);
1function u(e,t,r,i){var n=f();if(i){for(var o=0;o<i.length;o++){n=i[o](n)}}var s=t(function e(t){n.initializeInstanceElements(t,a.elements)},r);var a=n.decorateClass(m(s.d.map(p)),e);n.initializeClassElements(s.F,a.elements);return n.runClassFinishers(s.F,a.finishers)}function f(){f=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach(function(r){t.forEach(function(t){if(t.kind===r&&t.placement==="own"){this.defineClassElement(e,t)}},this)},this)},initializeClassElements:function(e,t){var r=e.prototype;["method","field"].forEach(function(i){t.forEach(function(t){var n=t.placement;if(t.kind===i&&(n==="static"||n==="prototype")){var o=n==="static"?e:r;this.defineClassElement(o,t)}},this)},this)},defineClassElement:function(e,t){var r=t.descriptor;if(t.kind==="field"){var i=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:i===void 0?void 0:i.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[];var i=[];var n={static:[],prototype:[],own:[]};e.forEach(function(e){this.addElementPlacement(e,n)},this);e.forEach(function(e){if(!v(e))return r.push(e);var t=this.decorateElement(e,n);r.push(t.element);r.push.apply(r,t.extras);i.push.apply(i,t.finishers)},this);if(!t){return{elements:r,finishers:i}}var o=this.decorateConstructor(r,t);i.push.apply(i,o.finishers);o.finishers=i;return o},addElementPlacement:function(e,t,r){var i=t[e.placement];if(!r&&i.indexOf(e.key)!==-1){throw new TypeError("Duplicated element ("+e.key+")")}i.push(e.key)},decorateElement:function(e,t){var r=[];var i=[];for(var n=e.decorators,o=n.length-1;o>=0;o--){var s=t[e.placement];s.splice(s.indexOf(e.key),1);var a=this.fromElementDescriptor(e);var l=this.toElementFinisherExtras((0,n[o])(a)||a);e=l.element;this.addElementPlacement(e,t);if(l.finisher){i.push(l.finisher)}var c=l.extras;if(c){for(var d=0;d<c.length;d++){this.addElementPlacement(c[d],t)}r.push.apply(r,c)}}return{element:e,finishers:i,extras:r}},decorateConstructor:function(e,t){var r=[];for(var i=t.length-1;i>=0;i--){var n=this.fromClassDescriptor(e);var o=this.toClassDescriptor((0,t[i])(n)||n);if(o.finisher!==undefined){r.push(o.finisher)}if(o.elements!==undefined){e=o.elements;for(var s=0;s<e.length-1;s++){for(var a=s+1;a<e.length;a++){if(e[s].key===e[a].key&&e[s].placement===e[a].placement){throw new TypeError("Duplicated element ("+e[s].key+")")}}}}}return{elements:e,finishers:r}},fromElementDescriptor:function(e){var t={kind:e.kind,key:e.key,placement:e.placement,descriptor:e.descriptor};var r={value:"Descriptor",configurable:true};Object.defineProperty(t,Symbol.toStringTag,r);if(e.kind==="field")t.initializer=e.initializer;return t},toElementDescriptors:function(e){if(e===undefined)return;return(0,o.default)(e).map(function(e){var t=this.toElementDescriptor(e);this.disallowProperty(e,"finisher","An element descriptor");this.disallowProperty(e,"extras","An element descriptor");return t},this)},toElementDescriptor:function(e){var t=String(e.kind);if(t!=="method"&&t!=="field"){throw new TypeError('An element descriptor\'s .kind property must be either "method" or'+' "field", but a decorator created an element descriptor with'+' .kind "'+t+'"')}var r=g(e.key);var i=String(e.placement);if(i!=="static"&&i!=="prototype"&&i!=="own"){throw new TypeError('An element descriptor\'s .placement property must be one of "static",'+' "prototype" or "own", but a decorator created an element descriptor'+' with .placement "'+i+'"')}var n=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var o={kind:t,key:r,placement:i,descriptor:Object.assign({},n)};if(t!=="field"){this.disallowProperty(e,"initializer","A method descriptor")}else{this.disallowProperty(n,"get","The property descriptor of a field descriptor");this.disallowProperty(n,"set","The property descriptor of a field descriptor");this.disallowProperty(n,"value","The property descriptor of a field descriptor");o.initializer=e.initializer}return o},toElementFinisherExtras:function(e){var t=this.toElementDescriptor(e);var r=k(e,"finisher");var i=this.toElementDescriptors(e.extras);return{element:t,finisher:r,extras:i}},fromClassDescriptor:function(e){var t={kind:"class",elements:e.map(this.fromElementDescriptor,this)};var r={value:"Descriptor",configurable:true};Object.defineProperty(t,Symbol.toStringTag,r);return t},toClassDescriptor:function(e){var t=String(e.kind);if(t!=="class"){throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator'+' created a class descriptor with .kind "'+t+'"')}this.disallowProperty(e,"key","A class descriptor");this.disallowProperty(e,"placement","A class descriptor");this.disallowProperty(e,"descriptor","A class descriptor");this.disallowProperty(e,"initializer","A class descriptor");this.disallowProperty(e,"extras","A class descriptor");var r=k(e,"finisher");var i=this.toElementDescriptors(e.elements);return{elements:i,finisher:r}},runClassFinishers:function(e,t){for(var r=0;r<t.length;r++){var i=(0,t[r])(e);
1if(i!==undefined){if(typeof i!=="function"){throw new TypeError("Finishers must return a constructor.")}e=i}}return e},disallowProperty:function(e,t,r){if(e[t]!==undefined){throw new TypeError(r+" can't have a ."+t+" property.")}}};return e}function p(e){var t=g(e.key);var r;if(e.kind==="method"){r={value:e.value,writable:true,configurable:true,enumerable:false}}else if(e.kind==="get"){r={get:e.value,configurable:true,enumerable:false}}else if(e.kind==="set"){r={set:e.value,configurable:true,enumerable:false}}else if(e.kind==="field"){r={configurable:true,writable:true,enumerable:true}}var i={kind:e.kind==="field"?"field":"method",key:t,placement:e.static?"static":e.kind==="field"?"own":"prototype",descriptor:r};if(e.decorators)i.decorators=e.decorators;if(e.kind==="field")i.initializer=e.value;return i}function h(e,t){if(e.descriptor.get!==undefined){t.descriptor.get=e.descriptor.get}else{t.descriptor.set=e.descriptor.set}}function m(e){var t=[];var r=function(e){return e.kind==="method"&&e.key===n.key&&e.placement===n.placement};for(var i=0;i<e.length;i++){var n=e[i];var o;if(n.kind==="method"&&(o=t.find(r))){if(y(n.descriptor)||y(o.descriptor)){if(v(n)||v(o)){throw new ReferenceError("Duplicated methods ("+n.key+") can't be decorated.")}o.descriptor=n.descriptor}else{if(v(n)){if(v(o)){throw new ReferenceError("Decorators can't be placed on different accessors with for "+"the same property ("+n.key+").")}o.decorators=n.decorators}h(n,o)}}else{t.push(n)}}return t}function v(e){return e.decorators&&e.decorators.length}function y(e){return e!==undefined&&!(e.value===undefined&&e.writable===undefined)}function k(e,t){var r=e[t];if(r!==undefined&&typeof r!=="function"){throw new TypeError("Expected '"+t+"' to be a function")}return r}function g(e){var t=w(e,"string");return"symbol"==typeof t?t:t+""}function w(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}let b=t.BookingService=u([(0,a.Service)()],function(e){class t{constructor(){e(this)}}return{F:t,d:[{kind:"field",decorators:[(0,l.service)(c.LocationService)],key:"location",value:void 0},{kind:"field",decorators:[(0,l.service)(d.ToastService)],key:"toasts",value:void 0},{kind:"field",key:"client",value(){return(0,s.createClient)()}},{kind:"method",key:"init",value:function e(){const{url_name:t}=this.location;const r=`/api/v2/loc/${t}/bookings`;this.client=(0,s.createClient)({baseURL:r})}},{kind:"method",key:"tickBooking",value:function(){var e=(0,n.default)(function*(e){const t=yield this.client.post(`/${e}/tick`);if(!t.ok){var r;this.toasts.error(((r=t.error)===null||r===void 0?void 0:r.message)||"An error occurred refreshing the booking",3e3,{header:false});throw new Error("An error occurred ticking the booking")}return t.data});function t(t){return e.apply(this,arguments)}return t}()},{kind:"method",key:"endBooking",value:function(){var e=(0,n.default)(function*(e,t){const r=yield this.client.post(`/${e}/end`,{body:{ended:t!==null&&t!==void 0?t:null}});if(!r.ok){var i;this.toasts.error(((i=r.error)===null||i===void 0?void 0:i.message)||"An error occurred ending the booking",3e3,{header:false});throw new Error("An error occurred ending the booking")}return r.data});function t(t,r){return e.apply(this,arguments)}return t}()},{kind:"method",key:"updateBookingStart",value:function(){var e=(0,n.default)(function*(e,t){const r=yield this.client.post(`/${e}/start`,{body:{started:t}});if(!r.ok){var i;this.toasts.error(((i=r.error)===null||i===void 0?void 0:i.message)||"An error occurred updating the booking start time",3e3,{header:false});throw new Error("An error occurred updating the booking start time")}return r.data});function t(t,r){return e.apply(this,arguments)}return t}()}]}});var E=t.default=b},545:function(e,t,r){"use strict";var i=r(0);Object.defineProperty(t,"__esModule",{value:true});t.default=t.DeviceController=void 0;var n=i(r(17));var o=r(26);var s=r(39);function a(e,t,r,i){var n=l();if(i){for(var o=0;o<i.length;o++){n=i[o](n)}}var s=t(function e(t){n.initializeInstanceElements(t,a.elements)},r);var a=n.decorateClass(u(s.d.map(c)),e);n.initializeClassElements(s.F,a.elements);return n.runClassFinishers(s.F,a.finishers)}function l(){l=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach(function(r){t.forEach(function(t){if(t.kind===r&&t.placement==="own"){this.defineClassElement(e,t)}},this)},this)},initializeClassElements:function(e,t){var r=e.prototype;["method","field"].forEach(function(i){t.forEach(function(t){var n=t.placement;if(t.kind===i&&(n==="static"||n==="prototype")){var o=n==="static"?e:r;this.defineClassElement(o,t)}},this)},this)},defineClassElement:function(e,t){var r=t.descriptor;if(t.kind==="field"){var i=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:i===void 0?void 0:i.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[];var i=[];var n={static:[],prototype:[],own:[]};e.forEach(function(e){this.addElementPlacement(e,n)},this);e.forEach(function(e){if(!f(e))return r.push(e);var t=this.decorateElement(e,n);r.push(t.element);r.push.apply(r,t.extras);i.push.apply(i,t.finishers)},this);if(!t){return{elements:r,finishers:i}}var o=this.decorateConstructor(r,t);i.push.apply(i,o.finishers);o.finishers=i;return o},addElementPlacement:function(e,t,r){var i=t[e.placement];if(!r&&i.indexOf(e.key)!==-1){throw new TypeError("Duplicated element ("+e.key+")")}i.push(e.key)},decorateElement:function(e,t){var r=[];var i=[];for(var n=e.decorators,o=n.length-1;o>=0;o--){var s=t[e.placement];s.splice(s.indexOf(e.key),1);var a=this.fromElementDescriptor(e);var l=this.toElementFinisherExtras((0,n[o])(a)||a);e=l.element;this.addElementPlacement(e,t);if(l.finisher){i.push(l.finisher)}var c=l.extras;if(c){for(var d=0;d<c.length;d++){this.addElementPlacement(c[d],t)}r.push.apply(r,c)}}return{element:e,finishers:i,extras:r}},decorateConstructor:function(e,t){var r=[];for(var i=t.length-1;i>=0;i--){var n=this.fromClassDescriptor(e);var o=this.toClassDescriptor((0,t[i])(n)||n);if(o.finisher!==undefined){r.push(o.finisher)}if(o.elements!==undefined){e=o.elements;for(var s=0;s<e.length-1;s++){for(var a=s+1;a<e.length;a++){if(e[s].key===e[a].key&&e[s].placement===e[a].placement){throw new TypeError("Duplicated element ("+e[s].key+")")}}}}}return{elements:e,finishers:r}},fromElementDescriptor:function(e){var t={kind:e.kind,key:e.key,placement:e.placement,descriptor:e.descriptor};var r={value:"Descriptor",configurable:true};Object.defineProperty(t,Symbol.toStringTag,r);if(e.kind==="field")t.initializer=e.initializer;return t},toElementDescriptors:function(e){if(e===undefined)return;return(0,n.default)(e).map(function(e){var t=this.toElementDescriptor(e);this.disallowProperty(e,"finisher","An element descriptor");this.disallowProperty(e,"extras","An element descriptor");return t},this)},toElementDescriptor:function(e){var t=String(e.kind);if(t!=="method"&&t!=="field"){throw new TypeError('An element descriptor\'s .kind property must be either "method" or'+' "field", but a decorator created an element descriptor with'+' .kind "'+t+'"')}var r=m(e.key);var i=String(e.placement);if(i!=="static"&&i!=="prototype"&&i!=="own"){throw new TypeError('An element descriptor\'s .placement property must be one of "static",'+' "prototype" or "own", but a decorator created an element descriptor'+' with .placement "'+i+'"')}var n=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var o={kind:t,key:r,placement:i,descriptor:Object.assign({},n)};if(t!=="field"){this.disallowProperty(e,"initializer","A method descriptor")}else{this.disallowProperty(n,"get","The property descriptor of a field descriptor");this.disallowProperty(n,"set","The property descriptor of a field descriptor");this.disallowProperty(n,"value","The property descriptor of a field descriptor");o.initializer=e.initializer}return o},toElementFinisherExtras:function(e){var t=this.toElementDescriptor(e);var r=h(e,"finisher");var i=this.toElementDescriptors(e.extras);return{element:t,finisher:r,extras:i}},fromClassDescriptor:function(e){var t={kind:"class",elements:e.map(this.fromElementDescriptor,this)};var r={value:"Descriptor",configurable:true};Object.defineProperty(t,Symbol.toStringTag,r);return t},toClassDescriptor:function(e){var t=String(e.kind);if(t!=="class"){throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator'+' created a class descriptor with .kind "'+t+'"')}this.disallowProperty(e,"key","A class descriptor");this.disallowProperty(e,"placement","A class descriptor");this.disallowProperty(e,"descriptor","A class descriptor");this.disallowProperty(e,"initializer","A class descriptor");this.disallowProperty(e,"extras","A class descriptor");var r=h(e,"finisher");var i=this.toElementDescriptors(e.elements);return{elements:i,finisher:r}},runClassFinishers:function(e,t){for(var r=0;r<t.length;r++){var i=(0,t[r])(e);
1if(i!==undefined){if(typeof i!=="function"){throw new TypeError("Finishers must return a constructor.")}e=i}}return e},disallowProperty:function(e,t,r){if(e[t]!==undefined){throw new TypeError(r+" can't have a ."+t+" property.")}}};return e}function c(e){var t=m(e.key);var r;if(e.kind==="method"){r={value:e.value,writable:true,configurable:true,enumerable:false}}else if(e.kind==="get"){r={get:e.value,configurable:true,enumerable:false}}else if(e.kind==="set"){r={set:e.value,configurable:true,enumerable:false}}else if(e.kind==="field"){r={configurable:true,writable:true,enumerable:true}}var i={kind:e.kind==="field"?"field":"method",key:t,placement:e.static?"static":e.kind==="field"?"own":"prototype",descriptor:r};if(e.decorators)i.decorators=e.decorators;if(e.kind==="field")i.initializer=e.value;return i}function d(e,t){if(e.descriptor.get!==undefined){t.descriptor.get=e.descriptor.get}else{t.descriptor.set=e.descriptor.set}}function u(e){var t=[];var r=function(e){return e.kind==="method"&&e.key===n.key&&e.placement===n.placement};for(var i=0;i<e.length;i++){var n=e[i];var o;if(n.kind==="method"&&(o=t.find(r))){if(p(n.descriptor)||p(o.descriptor)){if(f(n)||f(o)){throw new ReferenceError("Duplicated methods ("+n.key+") can't be decorated.")}o.descriptor=n.descriptor}else{if(f(n)){if(f(o)){throw new ReferenceError("Decorators can't be placed on different accessors with for "+"the same property ("+n.key+").")}o.decorators=n.decorators}d(n,o)}}else{t.push(n)}}return t}function f(e){return e.decorators&&e.decorators.length}function p(e){return e!==undefined&&!(e.value===undefined&&e.writable===undefined)}function h(e,t){var r=e[t];if(r!==undefined&&typeof r!=="function"){throw new TypeError("Expected '"+t+"' to be a function")}return r}function m(e){var t=v(e,"string");return"symbol"==typeof t?t:t+""}function v(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}let y=t.DeviceController=a([(0,o.Service)()],function(e){class t{constructor(){e(this)}}return{F:t,d:[{kind:"field",key:"available",value(){return false}},{kind:"field",key:"bridge",value(){return null}},{kind:"field",key:"brightness",value(){return"1"}},{kind:"method",key:"init",value:function e(){var t,r,i,n;this.bridge=(t=(r=window)===null||r===void 0?void 0:r.median)!==null&&t!==void 0?t:(i=window)===null||i===void 0?void 0:i.gonative;this.available=!!this.bridge;if(typeof((n=this.nativeLibrary)===null||n===void 0?void 0:n.getScreenBrightness)==="function"){var o;const e=(o=this.nativeLibrary)===null||o===void 0?void 0:o.getScreenBrightness();if(e!=null){this.brightness=e/100}}return[{bridge:false}]}},{kind:"get",key:"nativeLibrary",value:function e(){if(typeof window==="undefined"){return null}return window.median_gotab||window.gonative_handpoint||window.gonative_adyen||window.gonative_gotab}},{kind:"method",key:"setBrightness",value:function e({brightness:t,restoreOnNavigation:r=false}={}){var i,n;this.brightness=t;if(!this.available||typeof((i=this.bridge)===null||i===void 0?void 0:(n=i.screen)===null||n===void 0?void 0:n.setBrightness)!=="function"){console.log("DeviceController.setBrightness: Device controller is not available",{brightness:t,restoreOnNavigation:r});return}this.bridge.screen.setBrightness({brightness:t===null||t===void 0?void 0:t.toString(),restoreOnNavigation:r})}},{kind:"method",key:"setScreenMode",value:function e(t){var r,i;if(!this.available||typeof((r=this.bridge)===null||r===void 0?void 0:(i=r.screen)===null||i===void 0?void 0:i.setMode)!=="function"){console.log("DeviceController.setScreenMode: Device controller is not available",{mode:t});return}const{userAgent:n}=window.navigator;const o=n.match(s.IOS_AGENT_REGEX);const a=false;if(!o||!a){return}this.bridge.screen.setMode({mode:t})}},{kind:"method",key:"toggleKeepScreenOn",value:function e(t){var r,i,n;if(!this.available||typeof((r=this.bridge)===null||r===void 0?void 0:(i=r.android)===null||i===void 0?void 0:(n=i.screen)===null||n===void 0?void 0:n.keepScreenOn)!=="function"){console.log(`DeviceController.toggleKeepScreenOn: Device controller is not available: ${JSON.stringify({value:t})}`);return}if(t===true){this.bridge.android.screen.keepScreenOn()}else if(t===false){this.bridge.android.screen.keepScreenNormal()}}}]}});var k=t.default=y},548:function(e,t,r){"use strict";var i=r(0);
1Object.defineProperty(t,"__esModule",{value:true});t.default=t.ConnectionService=void 0;var n=i(r(17));var o=r(19);var s=r(27);var a=r(26);var l=r(109);function c(e,t,r,i){var n=d();if(i){for(var o=0;o<i.length;o++){n=i[o](n)}}var s=t(function e(t){n.initializeInstanceElements(t,a.elements)},r);var a=n.decorateClass(p(s.d.map(u)),e);n.initializeClassElements(s.F,a.elements);return n.runClassFinishers(s.F,a.finishers)}function d(){d=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach(function(r){t.forEach(function(t){if(t.kind===r&&t.placement==="own"){this.defineClassElement(e,t)}},this)},this)},initializeClassElements:function(e,t){var r=e.prototype;["method","field"].forEach(function(i){t.forEach(function(t){var n=t.placement;if(t.kind===i&&(n==="static"||n==="prototype")){var o=n==="static"?e:r;this.defineClassElement(o,t)}},this)},this)},defineClassElement:function(e,t){var r=t.descriptor;if(t.kind==="field"){var i=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:i===void 0?void 0:i.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[];var i=[];var n={static:[],prototype:[],own:[]};e.forEach(function(e){this.addElementPlacement(e,n)},this);e.forEach(function(e){if(!h(e))return r.push(e);var t=this.decorateElement(e,n);r.push(t.element);r.push.apply(r,t.extras);i.push.apply(i,t.finishers)},this);if(!t){return{elements:r,finishers:i}}var o=this.decorateConstructor(r,t);i.push.apply(i,o.finishers);o.finishers=i;return o},addElementPlacement:function(e,t,r){var i=t[e.placement];if(!r&&i.indexOf(e.key)!==-1){throw new TypeError("Duplicated element ("+e.key+")")}i.push(e.key)},decorateElement:function(e,t){var r=[];var i=[];for(var n=e.decorators,o=n.length-1;o>=0;o--){var s=t[e.placement];s.splice(s.indexOf(e.key),1);var a=this.fromElementDescriptor(e);var l=this.toElementFinisherExtras((0,n[o])(a)||a);e=l.element;this.addElementPlacement(e,t);if(l.finisher){i.push(l.finisher)}var c=l.extras;if(c){for(var d=0;d<c.length;d++){this.addElementPlacement(c[d],t)}r.push.apply(r,c)}}return{element:e,finishers:i,extras:r}},decorateConstructor:function(e,t){var r=[];for(var i=t.length-1;i>=0;i--){var n=this.fromClassDescriptor(e);var o=this.toClassDescriptor((0,t[i])(n)||n);if(o.finisher!==undefined){r.push(o.finisher)}if(o.elements!==undefined){e=o.elements;for(var s=0;s<e.length-1;s++){for(var a=s+1;a<e.length;a++){if(e[s].key===e[a].key&&e[s].placement===e[a].placement){throw new TypeError("Duplicated element ("+e[s].key+")")}}}}}return{elements:e,finishers:r}},fromElementDescriptor:function(e){var t={kind:e.kind,key:e.key,placement:e.placement,descriptor:e.descriptor};var r={value:"Descriptor",configurable:true};Object.defineProperty(t,Symbol.toStringTag,r);if(e.kind==="field")t.initializer=e.initializer;return t},toElementDescriptors:function(e){if(e===undefined)return;return(0,n.default)(e).map(function(e){var t=this.toElementDescriptor(e);this.disallowProperty(e,"finisher","An element descriptor");this.disallowProperty(e,"extras","An element descriptor");return t},this)},toElementDescriptor:function(e){var t=String(e.kind);if(t!=="method"&&t!=="field"){throw new TypeError('An element descriptor\'s .kind property must be either "method" or'+' "field", but a decorator created an element descriptor with'+' .kind "'+t+'"')}var r=y(e.key);var i=String(e.placement);if(i!=="static"&&i!=="prototype"&&i!=="own"){throw new TypeError('An element descriptor\'s .placement property must be one of "static",'+' "prototype" or "own", but a decorator created an element descriptor'+' with .placement "'+i+'"')}var n=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var o={kind:t,key:r,placement:i,descriptor:Object.assign({},n)};if(t!=="field"){this.disallowProperty(e,"initializer","A method descriptor")}else{this.disallowProperty(n,"get","The property descriptor of a field descriptor");this.disallowProperty(n,"set","The property descriptor of a field descriptor");this.disallowProperty(n,"value","The property descriptor of a field descriptor");o.initializer=e.initializer}return o},toElementFinisherExtras:function(e){var t=this.toElementDescriptor(e);var r=v(e,"finisher");var i=this.toElementDescriptors(e.extras);return{element:t,finisher:r,extras:i}},fromClassDescriptor:function(e){var t={kind:"class",elements:e.map(this.fromElementDescriptor,this)};var r={value:"Descriptor",configurable:true};Object.defineProperty(t,Symbol.toStringTag,r);return t},toClassDescriptor:function(e){var t=String(e.kind);if(t!=="class"){throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator'+' created a class descriptor with .kind "'+t+'"')}this.disallowProperty(e,"key","A class descriptor");this.disallowProperty(e,"placement","A class descriptor");this.disallowProperty(e,"descriptor","A class descriptor");this.disallowProperty(e,"initializer","A class descriptor");this.disallowProperty(e,"extras","A class descriptor");var r=v(e,"finisher");var i=this.toElementDescriptors(e.elements);return{elements:i,finisher:r}},runClassFinishers:function(e,t){for(var r=0;r<t.length;r++){var i=(0,t[r])(e);
1if(i!==undefined){if(typeof i!=="function"){throw new TypeError("Finishers must return a constructor.")}e=i}}return e},disallowProperty:function(e,t,r){if(e[t]!==undefined){throw new TypeError(r+" can't have a ."+t+" property.")}}};return e}function u(e){var t=y(e.key);var r;if(e.kind==="method"){r={value:e.value,writable:true,configurable:true,enumerable:false}}else if(e.kind==="get"){r={get:e.value,configurable:true,enumerable:false}}else if(e.kind==="set"){r={set:e.value,configurable:true,enumerable:false}}else if(e.kind==="field"){r={configurable:true,writable:true,enumerable:true}}var i={kind:e.kind==="field"?"field":"method",key:t,placement:e.static?"static":e.kind==="field"?"own":"prototype",descriptor:r};if(e.decorators)i.decorators=e.decorators;if(e.kind==="field")i.initializer=e.value;return i}function f(e,t){if(e.descriptor.get!==undefined){t.descriptor.get=e.descriptor.get}else{t.descriptor.set=e.descriptor.set}}function p(e){var t=[];var r=function(e){return e.kind==="method"&&e.key===n.key&&e.placement===n.placement};for(var i=0;i<e.length;i++){var n=e[i];var o;if(n.kind==="method"&&(o=t.find(r))){if(m(n.descriptor)||m(o.descriptor)){if(h(n)||h(o)){throw new ReferenceError("Duplicated methods ("+n.key+") can't be decorated.")}o.descriptor=n.descriptor}else{if(h(n)){if(h(o)){throw new ReferenceError("Decorators can't be placed on different accessors with for "+"the same property ("+n.key+").")}o.decorators=n.decorators}f(n,o)}}else{t.push(n)}}return t}function h(e){return e.decorators&&e.decorators.length}function m(e){return e!==undefined&&!(e.value===undefined&&e.writable===undefined)}function v(e,t){var r=e[t];if(r!==undefined&&typeof r!=="function"){throw new TypeError("Expected '"+t+"' to be a function")}return r}function y(e){var t=k(e,"string");return"symbol"==typeof t?t:t+""}function k(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}let g=t.ConnectionService=c([(0,a.Service)()],function(e){class t{constructor(){e(this)}}return{F:t,d:[{kind:"field",decorators:[(0,s.service)(l.SocketService)],key:"socket",value:void 0},{kind:"field",key:"isConnected",value(){return true}},{kind:"field",key:"isServerConnected",value(){return true}},{kind:"field",key:"isNetworkConnected",value(){return true}},{kind:"field",key:"subscriptions",value(){return new Set}},{kind:"field",key:"serverMethod",value(){return"socket"}},{kind:"method",key:"init",value:function e(t,r){if(typeof window!=="undefined"){if(this.serverMethod==="poll"){this.listenPoll()}else{this.listenSocket()}this.listenNetwork()}}},{kind:"method",key:"subscribe",value:function e(t){this.subscriptions.add(t);t(this.isConnected);return()=>{console.log("unsubscribing from connection service");this.subscriptions.delete(t)}}},{kind:"method",key:"checkConnections",value:function e(){if(this.isServerConnected&&this.isNetworkConnected){this.onConnect();return}this.onDisconnect()}},{kind:"method",key:"listenNetwork",value:function e(){const t=()=>(0,o.runInAction)(()=>{this.isNetworkConnected=true;this.checkConnections()});const r=()=>(0,o.runInAction)(()=>{this.isNetworkConnected=false;this.checkConnections()});window.addEventListener("online",t);window.addEventListener("offline",r);return()=>{window.removeEventListener("online",t);window.removeEventListener("offline",r)}}},{kind:"method",key:"listenSocket",value:function e(){this.socket.events.on("disconnect",()=>{(0,o.runInAction)(()=>{this.isServerConnected=false;this.checkConnections()})});this.socket.events.on("connect",()=>{(0,o.runInAction)(()=>{this.isServerConnected=true;this.checkConnections()})})}},{kind:"method",key:"listenPoll",value:function e(){fetch("/pos").then(()=>{this.isServerConnected=true;this.checkConnections()}).catch(()=>{this.isServerConnected=false;this.checkConnections()});const t=1e4+Math.floor(Math.random()*1e4);setTimeout(()=>this.listenPoll(),t)}},{kind:"method",key:"onConnect",value:function e(){const t=!this.isConnected;if(t){this.toggleConnection(true);this.notify()}}},{kind:"method",key:"onDisconnect",value:function e(){const t=!!this.isConnected;if(t){this.toggleConnection(false);this.notify()}}},{kind:"method",key:"notify",value:function e(){for(const e of this.subscriptions){e(this.isConnected)}}},{kind:"method",key:"toggleConnection",value:function e(t=!this.isConnected){this.isConnected=t}}]}});var w=t.default=g},560:function(e,t,r){"use strict";var i=r(0);
1Object.defineProperty(t,"__esModule",{value:true});t.default=t.LocalController=void 0;var n=i(r(7));var o=i(r(17));var s=r(26);var a=r(118);var l=r(27);var c=r(810);function d(e,t,r,i){var n=u();if(i){for(var o=0;o<i.length;o++){n=i[o](n)}}var s=t(function e(t){n.initializeInstanceElements(t,a.elements)},r);var a=n.decorateClass(h(s.d.map(f)),e);n.initializeClassElements(s.F,a.elements);return n.runClassFinishers(s.F,a.finishers)}function u(){u=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach(function(r){t.forEach(function(t){if(t.kind===r&&t.placement==="own"){this.defineClassElement(e,t)}},this)},this)},initializeClassElements:function(e,t){var r=e.prototype;["method","field"].forEach(function(i){t.forEach(function(t){var n=t.placement;if(t.kind===i&&(n==="static"||n==="prototype")){var o=n==="static"?e:r;this.defineClassElement(o,t)}},this)},this)},defineClassElement:function(e,t){var r=t.descriptor;if(t.kind==="field"){var i=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:i===void 0?void 0:i.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[];var i=[];var n={static:[],prototype:[],own:[]};e.forEach(function(e){this.addElementPlacement(e,n)},this);e.forEach(function(e){if(!m(e))return r.push(e);var t=this.decorateElement(e,n);r.push(t.element);r.push.apply(r,t.extras);i.push.apply(i,t.finishers)},this);if(!t){return{elements:r,finishers:i}}var o=this.decorateConstructor(r,t);i.push.apply(i,o.finishers);o.finishers=i;return o},addElementPlacement:function(e,t,r){var i=t[e.placement];if(!r&&i.indexOf(e.key)!==-1){throw new TypeError("Duplicated element ("+e.key+")")}i.push(e.key)},decorateElement:function(e,t){var r=[];var i=[];for(var n=e.decorators,o=n.length-1;o>=0;o--){var s=t[e.placement];s.splice(s.indexOf(e.key),1);var a=this.fromElementDescriptor(e);var l=this.toElementFinisherExtras((0,n[o])(a)||a);e=l.element;this.addElementPlacement(e,t);if(l.finisher){i.push(l.finisher)}var c=l.extras;if(c){for(var d=0;d<c.length;d++){this.addElementPlacement(c[d],t)}r.push.apply(r,c)}}return{element:e,finishers:i,extras:r}},decorateConstructor:function(e,t){var r=[];for(var i=t.length-1;i>=0;i--){var n=this.fromClassDescriptor(e);var o=this.toClassDescriptor((0,t[i])(n)||n);if(o.finisher!==undefined){r.push(o.finisher)}if(o.elements!==undefined){e=o.elements;for(var s=0;s<e.length-1;s++){for(var a=s+1;a<e.length;a++){if(e[s].key===e[a].key&&e[s].placement===e[a].placement){throw new TypeError("Duplicated element ("+e[s].key+")")}}}}}return{elements:e,finishers:r}},fromElementDescriptor:function(e){var t={kind:e.kind,key:e.key,placement:e.placement,descriptor:e.descriptor};var r={value:"Descriptor",configurable:true};Object.defineProperty(t,Symbol.toStringTag,r);if(e.kind==="field")t.initializer=e.initializer;return t},toElementDescriptors:function(e){if(e===undefined)return;return(0,o.default)(e).map(function(e){var t=this.toElementDescriptor(e);this.disallowProperty(e,"finisher","An element descriptor");this.disallowProperty(e,"extras","An element descriptor");return t},this)},toElementDescriptor:function(e){var t=String(e.kind);if(t!=="method"&&t!=="field"){throw new TypeError('An element descriptor\'s .kind property must be either "method" or'+' "field", but a decorator created an element descriptor with'+' .kind "'+t+'"')}var r=k(e.key);var i=String(e.placement);if(i!=="static"&&i!=="prototype"&&i!=="own"){throw new TypeError('An element descriptor\'s .placement property must be one of "static",'+' "prototype" or "own", but a decorator created an element descriptor'+' with .placement "'+i+'"')}var n=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var o={kind:t,key:r,placement:i,descriptor:Object.assign({},n)};if(t!=="field"){this.disallowProperty(e,"initializer","A method descriptor")}else{this.disallowProperty(n,"get","The property descriptor of a field descriptor");this.disallowProperty(n,"set","The property descriptor of a field descriptor");this.disallowProperty(n,"value","The property descriptor of a field descriptor");o.initializer=e.initializer}return o},toElementFinisherExtras:function(e){var t=this.toElementDescriptor(e);var r=y(e,"finisher");var i=this.toElementDescriptors(e.extras);return{element:t,finisher:r,extras:i}},fromClassDescriptor:function(e){var t={kind:"class",elements:e.map(this.fromElementDescriptor,this)};var r={value:"Descriptor",configurable:true};Object.defineProperty(t,Symbol.toStringTag,r);return t},toClassDescriptor:function(e){var t=String(e.kind);if(t!=="class"){throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator'+' created a class descriptor with .kind "'+t+'"')}this.disallowProperty(e,"key","A class descriptor");this.disallowProperty(e,"placement","A class descriptor");this.disallowProperty(e,"descriptor","A class descriptor");this.disallowProperty(e,"initializer","A class descriptor");this.disallowProperty(e,"extras","A class descriptor");var r=y(e,"finisher");var i=this.toElementDescriptors(e.elements);return{elements:i,finisher:r}},runClassFinishers:function(e,t){for(var r=0;r<t.length;r++){var i=(0,t[r])(e);
1if(i!==undefined){if(typeof i!=="function"){throw new TypeError("Finishers must return a constructor.")}e=i}}return e},disallowProperty:function(e,t,r){if(e[t]!==undefined){throw new TypeError(r+" can't have a ."+t+" property.")}}};return e}function f(e){var t=k(e.key);var r;if(e.kind==="method"){r={value:e.value,writable:true,configurable:true,enumerable:false}}else if(e.kind==="get"){r={get:e.value,configurable:true,enumerable:false}}else if(e.kind==="set"){r={set:e.value,configurable:true,enumerable:false}}else if(e.kind==="field"){r={configurable:true,writable:true,enumerable:true}}var i={kind:e.kind==="field"?"field":"method",key:t,placement:e.static?"static":e.kind==="field"?"own":"prototype",descriptor:r};if(e.decorators)i.decorators=e.decorators;if(e.kind==="field")i.initializer=e.value;return i}function p(e,t){if(e.descriptor.get!==undefined){t.descriptor.get=e.descriptor.get}else{t.descriptor.set=e.descriptor.set}}function h(e){var t=[];var r=function(e){return e.kind==="method"&&e.key===n.key&&e.placement===n.placement};for(var i=0;i<e.length;i++){var n=e[i];var o;if(n.kind==="method"&&(o=t.find(r))){if(v(n.descriptor)||v(o.descriptor)){if(m(n)||m(o)){throw new ReferenceError("Duplicated methods ("+n.key+") can't be decorated.")}o.descriptor=n.descriptor}else{if(m(n)){if(m(o)){throw new ReferenceError("Decorators can't be placed on different accessors with for "+"the same property ("+n.key+").")}o.decorators=n.decorators}p(n,o)}}else{t.push(n)}}return t}function m(e){return e.decorators&&e.decorators.length}function v(e){return e!==undefined&&!(e.value===undefined&&e.writable===undefined)}function y(e,t){var r=e[t];if(r!==undefined&&typeof r!=="function"){throw new TypeError("Expected '"+t+"' to be a function")}return r}function k(e){var t=g(e,"string");return"symbol"==typeof t?t:t+""}function g(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}const w=1500;const b=1e4;const E=3e5;
1let _=t.LocalController=d([(0,s.Service)({debugName:"localCtrl"})],function(e){class t{constructor(){e(this)}}return{F:t,d:[{kind:"field",decorators:[(0,l.service)(a.ToastService)],key:"toasts",value:void 0},{kind:"field",key:"isOfflineEnabled",value(){return false}},{kind:"field",key:"hasProbed",value(){return false}},{kind:"field",key:"probeFailures",value(){return 0}},{kind:"field",key:"isLocal",value(){return false}},{kind:"field",key:"isNgrok",value(){return false}},{kind:"field",key:"onPremisePreferred",value(){return false}},{kind:"field",key:"customer_id",value(){return""}},{kind:"field",key:"display_id",value(){return""}},{kind:"field",key:"NODE_ENV",value(){return"development"}},{kind:"field",key:"probeTimerId",value(){return null}},{kind:"field",key:"probeInFlight",value(){return null}},{kind:"field",key:"resolvedLocalOrigin",value(){return""}},{kind:"field",key:"cloudUrl",value(){return""}},{kind:"method",key:"init",value:function e(t,r){this.customer_id=r.customer_id;this.display_id=r.display_id;this.isLocal=r.isLocal;this.isNgrok=r.isNgrok;this.onPremisePreferred=r.onPremisePreferred;this.NODE_ENV=r.NODE_ENV==="production"?"production":"development";const i=(0,c.getLocalOrigins)(this.NODE_ENV,this.isNgrok);this.cloudUrl=`${i.cloud[0]}/displays`;if(typeof window!=="undefined"&&this.onPremisePreferred){if(this.NODE_ENV==="development"){console.log("Local origins:",i.local)}this.startProbe().catch(()=>{})}}},{kind:"method",key:"getHandoverUrl",value:function e(t){const{display_id:r,customer_id:i}=this;return`${t}/displays/handover?display_id=${r}&customer_id=${i}`}},{kind:"method",key:"transferToLocal",value:function e(t=this.resolvedLocalOrigin){if(!t){return false}window.location.href=this.getHandoverUrl(t);return true}},{kind:"method",key:"transferToCloud",value:function e(){window.location.href=this.cloudUrl;return true}},{kind:"method",key:"transfer",value:function(){var e=(0,n.default)(function*(){if(this.isLocal){return this.transferToCloud()}const e=yield this.startProbe();if(!e||!this.resolvedLocalOrigin){this.toasts.warn("Unable to reach the on-premise server right now. Please try again later.",5e3);return false}return this.transferToLocal(this.resolvedLocalOrigin)});function t(){return e.apply(this,arguments)}return t}()},{kind:"method",key:"scheduleNextProbe",value:function e(){this.stopProbe();const t=Math.min(b*Math.pow(2,Math.max(this.probeFailures-1,0)),E);this.probeTimerId=setTimeout(()=>{this.startProbe().catch(()=>{})},t)}},{kind:"method",key:"startProbe",value:function(){var e=(0,n.default)(function*(){if(this.isLocal||!this.onPremisePreferred){return false}if(this.probeInFlight){return this.probeInFlight}const e=yield this.probe();this.scheduleNextProbe();return e});function t(){return e.apply(this,arguments)}return t}()},{kind:"method",key:"stopProbe",value:function e(){if(this.probeTimerId!=null){clearTimeout(this.probeTimerId);this.probeTimerId=null}}},{kind:"method",key:"probe",value:function(){var e=(0,n.default)(function*(){var e=this;this.probeInFlight=(0,n.default)(function*(){const t=(0,c.getLocalOrigins)(e.NODE_ENV,e.isNgrok).local;for(const r of t){const t=new AbortController;const i=setTimeout(()=>t.abort(),w);try{yield fetch(r,{mode:"no-cors",signal:t.signal});e.isOfflineEnabled=true;e.probeFailures=0;e.resolvedLocalOrigin=r;return true}catch(e){}finally{clearTimeout(i)}}e.isOfflineEnabled=false;e.probeFailures+=1;e.resolvedLocalOrigin="";return false})();try{return yield this.probeInFlight}finally{this.hasProbed=true;this.probeInFlight=null}});function t(){return e.apply(this,arguments)}return t}()}]}});var P=t.default=_}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.