UNPKG

@xuda.io/runtime-bundle

Version:

The Xuda Runtime Bundle refers to a collection of scripts and libraries packaged together to provide the necessary runtime environment for executing plugins or components in the Xuda platform.

119 lines 981 kB
!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(ie,e){"use strict";var oe=[],r=Object.getPrototypeOf,ae=oe.slice,g=oe.flat?function(e){return oe.flat.call(e)}:function(e){return oe.concat.apply([],e)},s=oe.push,se=oe.indexOf,n={},i=n.toString,ue=n.hasOwnProperty,o=ue.toString,a=o.call(Object),le={},v=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},y=function(e){return null!=e&&e===e.window},C=ie.document,u={type:!0,src:!0,nonce:!0,noModule:!0};function m(e,t,n){var r,i,o=(n=n||C).createElement("script");if(o.text=e,t)for(r in u)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[i.call(e)]||"object":typeof e}var t="3.7.1",l=/HTML$/i,ce=function(e,t){return new ce.fn.init(e,t)};function c(e){var t=!!e&&"length"in e&&e.length,n=x(e);return!v(e)&&!y(e)&&("array"===n||0===t||"number"==typeof t&&0<t&&t-1 in e)}function fe(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}ce.fn=ce.prototype={jquery:t,constructor:ce,length:0,toArray:function(){return ae.call(this)},get:function(e){return null==e?ae.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=ce.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return ce.each(this,e)},map:function(n){return this.pushStack(ce.map(this,function(e,t){return n.call(e,t,e)}))},slice:function(){return this.pushStack(ae.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(ce.grep(this,function(e,t){return(t+1)%2}))},odd:function(){return this.pushStack(ce.grep(this,function(e,t){return t%2}))},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(0<=n&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:s,sort:oe.sort,splice:oe.splice},ce.extend=ce.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||v(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)r=e[t],"__proto__"!==t&&a!==r&&(l&&r&&(ce.isPlainObject(r)||(i=Array.isArray(r)))?(n=a[t],o=i&&!Array.isArray(n)?[]:i||ce.isPlainObject(n)?n:{},i=!1,a[t]=ce.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},ce.extend({expando:"jQuery"+(t+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==i.call(e))&&(!(t=r(e))||"function"==typeof(n=ue.call(t,"constructor")&&t.constructor)&&o.call(n)===a)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e,t,n){m(e,{nonce:t&&t.nonce},n)},each:function(e,t){var n,r=0;if(c(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},text:function(e){var t,n="",r=0,i=e.nodeType;if(!i)while(t=e[r++])n+=ce.text(t);return 1===i||11===i?e.textContent:9===i?e.documentElement.textContent:3===i||4===i?e.nodeValue:n},makeArray:function(e,t){var n=t||[];return null!=e&&(c(Object(e))?ce.merge(n,"string"==typeof e?[e]:e):s.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:se.call(t,e,n)},isXMLDoc:function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return!l.test(t||n&&n.nodeName||"HTML")},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r=[],i=0,o=e.length,a=!n;i<o;i++)!t(e[i],i)!==a&&r.push(e[i]);return r},map:function(e,t,n){var r,i,o=0,a=[];if(c(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&a.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&a.push(i);return g(a)},guid:1,support:le}),"function"==typeof Symbol&&(ce.fn[Symbol.iterator]=oe[Symbol.iterator]),ce.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){n["[object "+t+"]"]=t.toLowerCase()});var pe=oe.pop,de=oe.sort,he=oe.splice,ge="[\\x20\\t\\r\\n\\f]",ve=new RegExp("^"+ge+"+|((?:^|[^\\\\])(?:\\\\.)*)"+ge+"+$","g");ce.contains=function(e,t){var n=t&&t.parentNode;return e===n||!(!n||1!==n.nodeType||!(e.contains?e.contains(n):e.compareDocumentPosition&&16&e.compareDocumentPosition(n)))};var f=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;function p(e,t){return t?"\0"===e?"�":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e}ce.escapeSelector=function(e){return(e+"").replace(f,p)};var ye=C,me=s;!function(){var e,b,w,o,a,T,r,C,d,i,k=me,S=ce.expando,E=0,n=0,s=W(),c=W(),u=W(),h=W(),l=function(e,t){return e===t&&(a=!0),0},f="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",t="(?:\\\\[\\da-fA-F]{1,6}"+ge+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",p="\\["+ge+"*("+t+")(?:"+ge+"*([*^$|!~]?=)"+ge+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+t+"))|)"+ge+"*\\]",g=":("+t+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+p+")*)|.*)\\)|)",v=new RegExp(ge+"+","g"),y=new RegExp("^"+ge+"*,"+ge+"*"),m=new RegExp("^"+ge+"*([>+~]|"+ge+")"+ge+"*"),x=new RegExp(ge+"|>"),j=new RegExp(g),A=new RegExp("^"+t+"$"),D={ID:new RegExp("^#("+t+")"),CLASS:new RegExp("^\\.("+t+")"),TAG:new RegExp("^("+t+"|[*])"),ATTR:new RegExp("^"+p),PSEUDO:new RegExp("^"+g),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ge+"*(even|odd|(([+-]|)(\\d*)n|)"+ge+"*(?:([+-]|)"+ge+"*(\\d+)|))"+ge+"*\\)|)","i"),bool:new RegExp("^(?:"+f+")$","i"),needsContext:new RegExp("^"+ge+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ge+"*((?:-\\d)?\\d*)"+ge+"*\\)|)(?=[^-]|$)","i")},N=/^(?:input|select|textarea|button)$/i,q=/^h\d$/i,L=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,H=/[+~]/,O=new RegExp("\\\\[\\da-fA-F]{1,6}"+ge+"?|\\\\([^\\r\\n\\f])","g"),P=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},M=function(){V()},R=J(function(e){return!0===e.disabled&&fe(e,"fieldset")},{dir:"parentNode",next:"legend"});try{k.apply(oe=ae.call(ye.childNodes),ye.childNodes),oe[ye.childNodes.length].nodeType}catch(e){k={apply:function(e,t){me.apply(e,ae.call(t))},call:function(e){me.apply(e,ae.call(arguments,1))}}}function I(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(V(e),e=e||T,C)){if(11!==p&&(u=L.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return k.call(n,a),n}else if(f&&(a=f.getElementById(i))&&I.contains(e,a)&&a.id===i)return k.call(n,a),n}else{if(u[2])return k.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&e.getElementsByClassName)return k.apply(n,e.getElementsByClassName(i)),n}if(!(h[t+" "]||d&&d.test(t))){if(c=t,f=e,1===p&&(x.test(t)||m.test(t))){(f=H.test(t)&&U(e.parentNode)||e)==e&&le.scope||((s=e.getAttribute("id"))?s=ce.escapeSelector(s):e.setAttribute("id",s=S)),o=(l=Y(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+Q(l[o]);c=l.join(",")}try{return k.apply(n,f.querySelectorAll(c)),n}catch(e){h(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return re(t.replace(ve,"$1"),e,n,r)}function W(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function F(e){return e[S]=!0,e}function $(e){var t=T.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function B(t){return function(e){return fe(e,"input")&&e.type===t}}function _(t){return function(e){return(fe(e,"input")||fe(e,"button"))&&e.type===t}}function z(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&R(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function X(a){return F(function(o){return o=+o,F(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function U(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function V(e){var t,n=e?e.ownerDocument||e:ye;return n!=T&&9===n.nodeType&&n.documentElement&&(r=(T=n).documentElement,C=!ce.isXMLDoc(T),i=r.matches||r.webkitMatchesSelector||r.msMatchesSelector,r.msMatchesSelector&&ye!=T&&(t=T.defaultView)&&t.top!==t&&t.addEventListener("unload",M),le.getById=$(function(e){return r.appendChild(e).id=ce.expando,!T.getElementsByName||!T.getElementsByName(ce.expando).length}),le.disconnectedMatch=$(function(e){return i.call(e,"*")}),le.scope=$(function(){return T.querySelectorAll(":scope")}),le.cssHas=$(function(){try{return T.querySelector(":has(*,:jqfake)"),!1}catch(e){return!0}}),le.getById?(b.filter.ID=function(e){var t=e.replace(O,P);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&C){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(O,P);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&C){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):t.querySelectorAll(e)},b.find.CLASS=function(e,t){if("undefined"!=typeof t.getElementsByClassName&&C)return t.getElementsByClassName(e)},d=[],$(function(e){var t;r.appendChild(e).innerHTML="<a id='"+S+"' href='' disabled='disabled'></a><select id='"+S+"-\r\\' disabled='disabled'><option selected=''></option></select>",e.querySelectorAll("[selected]").length||d.push("\\["+ge+"*(?:value|"+f+")"),e.querySelectorAll("[id~="+S+"-]").length||d.push("~="),e.querySelectorAll("a#"+S+"+*").length||d.push(".#.+[+~]"),e.querySelectorAll(":checked").length||d.push(":checked"),(t=T.createElement("input")).setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),r.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&d.push(":enabled",":disabled"),(t=T.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||d.push("\\["+ge+"*name"+ge+"*="+ge+"*(?:''|\"\")")}),le.cssHas||d.push(":has"),d=d.length&&new RegExp(d.join("|")),l=function(e,t){if(e===t)return a=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!le.sortDetached&&t.compareDocumentPosition(e)===n?e===T||e.ownerDocument==ye&&I.contains(ye,e)?-1:t===T||t.ownerDocument==ye&&I.contains(ye,t)?1:o?se.call(o,e)-se.call(o,t):0:4&n?-1:1)}),T}for(e in I.matches=function(e,t){return I(e,null,null,t)},I.matchesSelector=function(e,t){if(V(e),C&&!h[t+" "]&&(!d||!d.test(t)))try{var n=i.call(e,t);if(n||le.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){h(t,!0)}return 0<I(t,T,null,[e]).length},I.contains=function(e,t){return(e.ownerDocument||e)!=T&&V(e),ce.contains(e,t)},I.attr=function(e,t){(e.ownerDocument||e)!=T&&V(e);var n=b.attrHandle[t.toLowerCase()],r=n&&ue.call(b.attrHandle,t.toLowerCase())?n(e,t,!C):void 0;return void 0!==r?r:e.getAttribute(t)},I.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},ce.uniqueSort=function(e){var t,n=[],r=0,i=0;if(a=!le.sortStable,o=!le.sortStable&&ae.call(e,0),de.call(e,l),a){while(t=e[i++])t===e[i]&&(r=n.push(i));while(r--)he.call(e,n[r],1)}return o=null,e},ce.fn.uniqueSort=function(){return this.pushStack(ce.uniqueSort(ae.apply(this)))},(b=ce.expr={cacheLength:50,createPseudo:F,match:D,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(O,P),e[3]=(e[3]||e[4]||e[5]||"").replace(O,P),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||I.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&I.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return D.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&j.test(n)&&(t=Y(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(O,P).toLowerCase();return"*"===e?function(){return!0}:function(e){return fe(e,t)}},CLASS:function(e){var t=s[e+" "];return t||(t=new RegExp("(^|"+ge+")"+e+"("+ge+"|$)"))&&s(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=I.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1<t.indexOf(i):"$="===r?i&&t.slice(-i.length)===i:"~="===r?-1<(" "+t.replace(v," ")+" ").indexOf(i):"|="===r&&(t===i||t.slice(0,i.length+1)===i+"-"))}},CHILD:function(d,e,t,h,g){var v="nth"!==d.slice(0,3),y="last"!==d.slice(-4),m="of-type"===e;return 1===h&&0===g?function(e){return!!e.parentNode}:function(e,t,n){var r,i,o,a,s,u=v!==y?"nextSibling":"previousSibling",l=e.parentNode,c=m&&e.nodeName.toLowerCase(),f=!n&&!m,p=!1;if(l){if(v){while(u){o=e;while(o=o[u])if(m?fe(o,c):1===o.nodeType)return!1;s=u="only"===d&&!s&&"nextSibling"}return!0}if(s=[y?l.firstChild:l.lastChild],y&&f){p=(a=(r=(i=l[S]||(l[S]={}))[d]||[])[0]===E&&r[1])&&r[2],o=a&&l.childNodes[a];while(o=++a&&o&&o[u]||(p=a=0)||s.pop())if(1===o.nodeType&&++p&&o===e){i[d]=[E,a,p];break}}else if(f&&(p=a=(r=(i=e[S]||(e[S]={}))[d]||[])[0]===E&&r[1]),!1===p)while(o=++a&&o&&o[u]||(p=a=0)||s.pop())if((m?fe(o,c):1===o.nodeType)&&++p&&(f&&((i=o[S]||(o[S]={}))[d]=[E,p]),o===e))break;return(p-=g)===h||p%h==0&&0<=p/h}}},PSEUDO:function(e,o){var t,a=b.pseudos[e]||b.setFilters[e.toLowerCase()]||I.error("unsupported pseudo: "+e);return a[S]?a(o):1<a.length?(t=[e,e,"",o],b.setFilters.hasOwnProperty(e.toLowerCase())?F(function(e,t){var n,r=a(e,o),i=r.length;while(i--)e[n=se.call(e,r[i])]=!(t[n]=r[i])}):function(e){return a(e,0,t)}):a}},pseudos:{not:F(function(e){var r=[],i=[],s=ne(e.replace(ve,"$1"));return s[S]?F(function(e,t,n,r){var i,o=s(e,null,r,[]),a=e.length;while(a--)(i=o[a])&&(e[a]=!(t[a]=i))}):function(e,t,n){return r[0]=e,s(r,null,n,i),r[0]=null,!i.pop()}}),has:F(function(t){return function(e){return 0<I(t,e).length}}),contains:F(function(t){return t=t.replace(O,P),function(e){return-1<(e.textContent||ce.text(e)).indexOf(t)}}),lang:F(function(n){return A.test(n||"")||I.error("unsupported lang: "+n),n=n.replace(O,P).toLowerCase(),function(e){var t;do{if(t=C?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return(t=t.toLowerCase())===n||0===t.indexOf(n+"-")}while((e=e.parentNode)&&1===e.nodeType);return!1}}),target:function(e){var t=ie.location&&ie.location.hash;return t&&t.slice(1)===e.id},root:function(e){return e===r},focus:function(e){return e===function(){try{return T.activeElement}catch(e){}}()&&T.hasFocus()&&!!(e.type||e.href||~e.tabIndex)},enabled:z(!1),disabled:z(!0),checked:function(e){return fe(e,"input")&&!!e.checked||fe(e,"option")&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!b.pseudos.empty(e)},header:function(e){return q.test(e.nodeName)},input:function(e){return N.test(e.nodeName)},button:function(e){return fe(e,"input")&&"button"===e.type||fe(e,"button")},text:function(e){var t;return fe(e,"input")&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:X(function(){return[0]}),last:X(function(e,t){return[t-1]}),eq:X(function(e,t,n){return[n<0?n+t:n]}),even:X(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:X(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:X(function(e,t,n){var r;for(r=n<0?n+t:t<n?t:n;0<=--r;)e.push(r);return e}),gt:X(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}}).pseudos.nth=b.pseudos.eq,{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})b.pseudos[e]=B(e);for(e in{submit:!0,reset:!0})b.pseudos[e]=_(e);function G(){}function Y(e,t){var n,r,i,o,a,s,u,l=c[e+" "];if(l)return t?0:l.slice(0);a=e,s=[],u=b.preFilter;while(a){for(o in n&&!(r=y.exec(a))||(r&&(a=a.slice(r[0].length)||a),s.push(i=[])),n=!1,(r=m.exec(a))&&(n=r.shift(),i.push({value:n,type:r[0].replace(ve," ")}),a=a.slice(n.length)),b.filter)!(r=D[o].exec(a))||u[o]&&!(r=u[o](r))||(n=r.shift(),i.push({value:n,type:o,matches:r}),a=a.slice(n.length));if(!n)break}return t?a.length:a?I.error(e):c(e,s).slice(0)}function Q(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function J(a,e,t){var s=e.dir,u=e.next,l=u||s,c=t&&"parentNode"===l,f=n++;return e.first?function(e,t,n){while(e=e[s])if(1===e.nodeType||c)return a(e,t,n);return!1}:function(e,t,n){var r,i,o=[E,f];if(n){while(e=e[s])if((1===e.nodeType||c)&&a(e,t,n))return!0}else while(e=e[s])if(1===e.nodeType||c)if(i=e[S]||(e[S]={}),u&&fe(e,u))e=e[s]||e;else{if((r=i[l])&&r[0]===E&&r[1]===f)return o[2]=r[2];if((i[l]=o)[2]=a(e,t,n))return!0}return!1}}function K(i){return 1<i.length?function(e,t,n){var r=i.length;while(r--)if(!i[r](e,t,n))return!1;return!0}:i[0]}function Z(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;s<u;s++)(o=e[s])&&(n&&!n(o,r,i)||(a.push(o),l&&t.push(s)));return a}function ee(d,h,g,v,y,e){return v&&!v[S]&&(v=ee(v)),y&&!y[S]&&(y=ee(y,e)),F(function(e,t,n,r){var i,o,a,s,u=[],l=[],c=t.length,f=e||function(e,t,n){for(var r=0,i=t.length;r<i;r++)I(e,t[r],n);return n}(h||"*",n.nodeType?[n]:n,[]),p=!d||!e&&h?f:Z(f,u,d,n,r);if(g?g(p,s=y||(e?d:c||v)?[]:t,n,r):s=p,v){i=Z(s,l),v(i,[],n,r),o=i.length;while(o--)(a=i[o])&&(s[l[o]]=!(p[l[o]]=a))}if(e){if(y||d){if(y){i=[],o=s.length;while(o--)(a=s[o])&&i.push(p[o]=a);y(null,s=[],i,r)}o=s.length;while(o--)(a=s[o])&&-1<(i=y?se.call(e,a):u[o])&&(e[i]=!(t[i]=a))}}else s=Z(s===t?s.splice(c,s.length):s),y?y(null,t,s,r):k.apply(t,s)})}function te(e){for(var i,t,n,r=e.length,o=b.relative[e[0].type],a=o||b.relative[" "],s=o?1:0,u=J(function(e){return e===i},a,!0),l=J(function(e){return-1<se.call(i,e)},a,!0),c=[function(e,t,n){var r=!o&&(n||t!=w)||((i=t).nodeType?u(e,t,n):l(e,t,n));return i=null,r}];s<r;s++)if(t=b.relative[e[s].type])c=[J(K(c),t)];else{if((t=b.filter[e[s].type].apply(null,e[s].matches))[S]){for(n=++s;n<r;n++)if(b.relative[e[n].type])break;return ee(1<s&&K(c),1<s&&Q(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace(ve,"$1"),t,s<n&&te(e.slice(s,n)),n<r&&te(e=e.slice(n)),n<r&&Q(e))}c.push(t)}return K(c)}function ne(e,t){var n,v,y,m,x,r,i=[],o=[],a=u[e+" "];if(!a){t||(t=Y(e)),n=t.length;while(n--)(a=te(t[n]))[S]?i.push(a):o.push(a);(a=u(e,(v=o,m=0<(y=i).length,x=0<v.length,r=function(e,t,n,r,i){var o,a,s,u=0,l="0",c=e&&[],f=[],p=w,d=e||x&&b.find.TAG("*",i),h=E+=null==p?1:Math.random()||.1,g=d.length;for(i&&(w=t==T||t||i);l!==g&&null!=(o=d[l]);l++){if(x&&o){a=0,t||o.ownerDocument==T||(V(o),n=!C);while(s=v[a++])if(s(o,t||T,n)){k.call(r,o);break}i&&(E=h)}m&&((o=!s&&o)&&u--,e&&c.push(o))}if(u+=l,m&&l!==u){a=0;while(s=y[a++])s(c,f,t,n);if(e){if(0<u)while(l--)c[l]||f[l]||(f[l]=pe.call(r));f=Z(f)}k.apply(r,f),i&&!e&&0<f.length&&1<u+y.length&&ce.uniqueSort(r)}return i&&(E=h,w=p),c},m?F(r):r))).selector=e}return a}function re(e,t,n,r){var i,o,a,s,u,l="function"==typeof e&&e,c=!r&&Y(e=l.selector||e);if(n=n||[],1===c.length){if(2<(o=c[0]=c[0].slice(0)).length&&"ID"===(a=o[0]).type&&9===t.nodeType&&C&&b.relative[o[1].type]){if(!(t=(b.find.ID(a.matches[0].replace(O,P),t)||[])[0]))return n;l&&(t=t.parentNode),e=e.slice(o.shift().value.length)}i=D.needsContext.test(e)?0:o.length;while(i--){if(a=o[i],b.relative[s=a.type])break;if((u=b.find[s])&&(r=u(a.matches[0].replace(O,P),H.test(o[0].type)&&U(t.parentNode)||t))){if(o.splice(i,1),!(e=r.length&&Q(o)))return k.apply(n,r),n;break}}}return(l||ne(e,c))(r,t,!C,n,!t||H.test(e)&&U(t.parentNode)||t),n}G.prototype=b.filters=b.pseudos,b.setFilters=new G,le.sortStable=S.split("").sort(l).join("")===S,V(),le.sortDetached=$(function(e){return 1&e.compareDocumentPosition(T.createElement("fieldset"))}),ce.find=I,ce.expr[":"]=ce.expr.pseudos,ce.unique=ce.uniqueSort,I.compile=ne,I.select=re,I.setDocument=V,I.tokenize=Y,I.escape=ce.escapeSelector,I.getText=ce.text,I.isXML=ce.isXMLDoc,I.selectors=ce.expr,I.support=ce.support,I.uniqueSort=ce.uniqueSort}();var d=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&ce(e).is(n))break;r.push(e)}return r},h=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},b=ce.expr.match.needsContext,w=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function T(e,n,r){return v(n)?ce.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?ce.grep(e,function(e){return e===n!==r}):"string"!=typeof n?ce.grep(e,function(e){return-1<se.call(n,e)!==r}):ce.filter(n,e,r)}ce.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?ce.find.matchesSelector(r,e)?[r]:[]:ce.find.matches(e,ce.grep(t,function(e){return 1===e.nodeType}))},ce.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(ce(e).filter(function(){for(t=0;t<r;t++)if(ce.contains(i[t],this))return!0}));for(n=this.pushStack([]),t=0;t<r;t++)ce.find(e,i[t],n);return 1<r?ce.uniqueSort(n):n},filter:function(e){return this.pushStack(T(this,e||[],!1))},not:function(e){return this.pushStack(T(this,e||[],!0))},is:function(e){return!!T(this,"string"==typeof e&&b.test(e)?ce(e):e||[],!1).length}});var k,S=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(ce.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||k,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:S.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof ce?t[0]:t,ce.merge(this,ce.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:C,!0)),w.test(r[1])&&ce.isPlainObject(t))for(r in t)v(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=C.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):v(e)?void 0!==n.ready?n.ready(e):e(ce):ce.makeArray(e,this)}).prototype=ce.fn,k=ce(C);var E=/^(?:parents|prev(?:Until|All))/,j={children:!0,contents:!0,next:!0,prev:!0};function A(e,t){while((e=e[t])&&1!==e.nodeType);return e}ce.fn.extend({has:function(e){var t=ce(e,this),n=t.length;return this.filter(function(){for(var e=0;e<n;e++)if(ce.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,o=[],a="string"!=typeof e&&ce(e);if(!b.test(e))for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?-1<a.index(n):1===n.nodeType&&ce.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(1<o.length?ce.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?se.call(ce(e),this[0]):se.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(ce.uniqueSort(ce.merge(this.get(),ce(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),ce.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return d(e,"parentNode")},parentsUntil:function(e,t,n){return d(e,"parentNode",n)},next:function(e){return A(e,"nextSibling")},prev:function(e){return A(e,"previousSibling")},nextAll:function(e){return d(e,"nextSibling")},prevAll:function(e){return d(e,"previousSibling")},nextUntil:function(e,t,n){return d(e,"nextSibling",n)},prevUntil:function(e,t,n){return d(e,"previousSibling",n)},siblings:function(e){return h((e.parentNode||{}).firstChild,e)},children:function(e){return h(e.firstChild)},contents:function(e){return null!=e.contentDocument&&r(e.contentDocument)?e.contentDocument:(fe(e,"template")&&(e=e.content||e),ce.merge([],e.childNodes))}},function(r,i){ce.fn[r]=function(e,t){var n=ce.map(this,i,e);return"Until"!==r.slice(-5)&&(t=e),t&&"string"==typeof t&&(n=ce.filter(t,n)),1<this.length&&(j[r]||ce.uniqueSort(n),E.test(r)&&n.reverse()),this.pushStack(n)}});var D=/[^\x20\t\r\n\f]+/g;function N(e){return e}function q(e){throw e}function L(e,t,n,r){var i;try{e&&v(i=e.promise)?i.call(e).done(t).fail(n):e&&v(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}ce.Callbacks=function(r){var e,n;r="string"==typeof r?(e=r,n={},ce.each(e.match(D)||[],function(e,t){n[t]=!0}),n):ce.extend({},r);var i,t,o,a,s=[],u=[],l=-1,c=function(){for(a=a||r.once,o=i=!0;u.length;l=-1){t=u.shift();while(++l<s.length)!1===s[l].apply(t[0],t[1])&&r.stopOnFalse&&(l=s.length,t=!1)}r.memory||(t=!1),i=!1,a&&(s=t?[]:"")},f={add:function(){return s&&(t&&!i&&(l=s.length-1,u.push(t)),function n(e){ce.each(e,function(e,t){v(t)?r.unique&&f.has(t)||s.push(t):t&&t.length&&"string"!==x(t)&&n(t)})}(arguments),t&&!i&&c()),this},remove:function(){return ce.each(arguments,function(e,t){var n;while(-1<(n=ce.inArray(t,s,n)))s.splice(n,1),n<=l&&l--}),this},has:function(e){return e?-1<ce.inArray(e,s):0<s.length},empty:function(){return s&&(s=[]),this},disable:function(){return a=u=[],s=t="",this},disabled:function(){return!s},lock:function(){return a=u=[],t||i||(s=t=""),this},locked:function(){return!!a},fireWith:function(e,t){return a||(t=[e,(t=t||[]).slice?t.slice():t],u.push(t),i||c()),this},fire:function(){return f.fireWith(this,arguments),this},fired:function(){return!!o}};return f},ce.extend({Deferred:function(e){var o=[["notify","progress",ce.Callbacks("memory"),ce.Callbacks("memory"),2],["resolve","done",ce.Callbacks("once memory"),ce.Callbacks("once memory"),0,"resolved"],["reject","fail",ce.Callbacks("once memory"),ce.Callbacks("once memory"),1,"rejected"]],i="pending",a={state:function(){return i},always:function(){return s.done(arguments).fail(arguments),this},catch:function(e){return a.then(null,e)},pipe:function(){var i=arguments;return ce.Deferred(function(r){ce.each(o,function(e,t){var n=v(i[t[4]])&&i[t[4]];s[t[1]](function(){var e=n&&n.apply(this,arguments);e&&v(e.promise)?e.promise().progress(r.notify).done(r.resolve).fail(r.reject):r[t[0]+"With"](this,n?[e]:arguments)})}),i=null}).promise()},then:function(t,n,r){var u=0;function l(i,o,a,s){return function(){var n=this,r=arguments,e=function(){var e,t;if(!(i<u)){if((e=a.apply(n,r))===o.promise())throw new TypeError("Thenable self-resolution");t=e&&("object"==typeof e||"function"==typeof e)&&e.then,v(t)?s?t.call(e,l(u,o,N,s),l(u,o,q,s)):(u++,t.call(e,l(u,o,N,s),l(u,o,q,s),l(u,o,N,o.notifyWith))):(a!==N&&(n=void 0,r=[e]),(s||o.resolveWith)(n,r))}},t=s?e:function(){try{e()}catch(e){ce.Deferred.exceptionHook&&ce.Deferred.exceptionHook(e,t.error),u<=i+1&&(a!==q&&(n=void 0,r=[e]),o.rejectWith(n,r))}};i?t():(ce.Deferred.getErrorHook?t.error=ce.Deferred.getErrorHook():ce.Deferred.getStackHook&&(t.error=ce.Deferred.getStackHook()),ie.setTimeout(t))}}return ce.Deferred(function(e){o[0][3].add(l(0,e,v(r)?r:N,e.notifyWith)),o[1][3].add(l(0,e,v(t)?t:N)),o[2][3].add(l(0,e,v(n)?n:q))}).promise()},promise:function(e){return null!=e?ce.extend(e,a):a}},s={};return ce.each(o,function(e,t){var n=t[2],r=t[5];a[t[1]]=n.add,r&&n.add(function(){i=r},o[3-e][2].disable,o[3-e][3].disable,o[0][2].lock,o[0][3].lock),n.add(t[3].fire),s[t[0]]=function(){return s[t[0]+"With"](this===s?void 0:this,arguments),this},s[t[0]+"With"]=n.fireWith}),a.promise(s),e&&e.call(s,s),s},when:function(e){var n=arguments.length,t=n,r=Array(t),i=ae.call(arguments),o=ce.Deferred(),a=function(t){return function(e){r[t]=this,i[t]=1<arguments.length?ae.call(arguments):e,--n||o.resolveWith(r,i)}};if(n<=1&&(L(e,o.done(a(t)).resolve,o.reject,!n),"pending"===o.state()||v(i[t]&&i[t].then)))return o.then();while(t--)L(i[t],a(t),o.reject);return o.promise()}});var H=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;ce.Deferred.exceptionHook=function(e,t){ie.console&&ie.console.warn&&e&&H.test(e.name)&&ie.console.warn("jQuery.Deferred exception: "+e.message,e.stack,t)},ce.readyException=function(e){ie.setTimeout(function(){throw e})};var O=ce.Deferred();function P(){C.removeEventListener("DOMContentLoaded",P),ie.removeEventListener("load",P),ce.ready()}ce.fn.ready=function(e){return O.then(e)["catch"](function(e){ce.readyException(e)}),this},ce.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--ce.readyWait:ce.isReady)||(ce.isReady=!0)!==e&&0<--ce.readyWait||O.resolveWith(C,[ce])}}),ce.ready.then=O.then,"complete"===C.readyState||"loading"!==C.readyState&&!C.documentElement.doScroll?ie.setTimeout(ce.ready):(C.addEventListener("DOMContentLoaded",P),ie.addEventListener("load",P));var M=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if("object"===x(n))for(s in i=!0,n)M(e,t,s,n[s],!0,o,a);else if(void 0!==r&&(i=!0,v(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(ce(e),n)})),t))for(;s<u;s++)t(e[s],n,a?r:r.call(e[s],s,t(e[s],n)));return i?e:l?t.call(e):u?t(e[0],n):o},R=/^-ms-/,I=/-([a-z])/g;function W(e,t){return t.toUpperCase()}function F(e){return e.replace(R,"ms-").replace(I,W)}var $=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};function B(){this.expando=ce.expando+B.uid++}B.uid=1,B.prototype={cache:function(e){var t=e[this.expando];return t||(t={},$(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if("string"==typeof t)i[F(t)]=n;else for(r in t)i[F(r)]=t[r];return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][F(t)]},access:function(e,t,n){return void 0===t||t&&"string"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){n=(t=Array.isArray(t)?t.map(F):(t=F(t))in r?[t]:t.match(D)||[]).length;while(n--)delete r[t[n]]}(void 0===t||ce.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!ce.isEmptyObject(t)}};var _=new B,z=new B,X=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,U=/[A-Z]/g;function V(e,t,n){var r,i;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(U,"-$&").toLowerCase(),"string"==typeof(n=e.getAttribute(r))){try{n="true"===(i=n)||"false"!==i&&("null"===i?null:i===+i+""?+i:X.test(i)?JSON.parse(i):i)}catch(e){}z.set(e,t,n)}else n=void 0;return n}ce.extend({hasData:function(e){return z.hasData(e)||_.hasData(e)},data:function(e,t,n){return z.access(e,t,n)},removeData:function(e,t){z.remove(e,t)},_data:function(e,t,n){return _.access(e,t,n)},_removeData:function(e,t){_.remove(e,t)}}),ce.fn.extend({data:function(n,e){var t,r,i,o=this[0],a=o&&o.attributes;if(void 0===n){if(this.length&&(i=z.get(o),1===o.nodeType&&!_.get(o,"hasDataAttrs"))){t=a.length;while(t--)a[t]&&0===(r=a[t].name).indexOf("data-")&&(r=F(r.slice(5)),V(o,r,i[r]));_.set(o,"hasDataAttrs",!0)}return i}return"object"==typeof n?this.each(function(){z.set(this,n)}):M(this,function(e){var t;if(o&&void 0===e)return void 0!==(t=z.get(o,n))?t:void 0!==(t=V(o,n))?t:void 0;this.each(function(){z.set(this,n,e)})},null,e,1<arguments.length,null,!0)},removeData:function(e){return this.each(function(){z.remove(this,e)})}}),ce.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=_.get(e,t),n&&(!r||Array.isArray(n)?r=_.access(e,t,ce.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=ce.queue(e,t),r=n.length,i=n.shift(),o=ce._queueHooks(e,t);"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,function(){ce.dequeue(e,t)},o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return _.get(e,n)||_.access(e,n,{empty:ce.Callbacks("once memory").add(function(){_.remove(e,[t+"queue",n])})})}}),ce.fn.extend({queue:function(t,n){var e=2;return"string"!=typeof t&&(n=t,t="fx",e--),arguments.length<e?ce.queue(this[0],t):void 0===n?this:this.each(function(){var e=ce.queue(this,t,n);ce._queueHooks(this,t),"fx"===t&&"inprogress"!==e[0]&&ce.dequeue(this,t)})},dequeue:function(e){return this.each(function(){ce.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=ce.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=void 0),e=e||"fx";while(a--)(n=_.get(o[a],e+"queueHooks"))&&n.empty&&(r++,n.empty.add(s));return s(),i.promise(t)}});var G=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,Y=new RegExp("^(?:([+-])=|)("+G+")([a-z%]*)$","i"),Q=["Top","Right","Bottom","Left"],J=C.documentElement,K=function(e){return ce.contains(e.ownerDocument,e)},Z={composed:!0};J.getRootNode&&(K=function(e){return ce.contains(e.ownerDocument,e)||e.getRootNode(Z)===e.ownerDocument});var ee=function(e,t){return"none"===(e=t||e).style.display||""===e.style.display&&K(e)&&"none"===ce.css(e,"display")};function te(e,t,n,r){var i,o,a=20,s=r?function(){return r.cur()}:function(){return ce.css(e,t,"")},u=s(),l=n&&n[3]||(ce.cssNumber[t]?"":"px"),c=e.nodeType&&(ce.cssNumber[t]||"px"!==l&&+u)&&Y.exec(ce.css(e,t));if(c&&c[3]!==l){u/=2,l=l||c[3],c=+u||1;while(a--)ce.style(e,t,c+l),(1-o)*(1-(o=s()/u||.5))<=0&&(a=0),c/=o;c*=2,ce.style(e,t,c+l),n=n||[]}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}var ne={};function re(e,t){for(var n,r,i,o,a,s,u,l=[],c=0,f=e.length;c<f;c++)(r=e[c]).style&&(n=r.style.display,t?("none"===n&&(l[c]=_.get(r,"display")||null,l[c]||(r.style.display="")),""===r.style.display&&ee(r)&&(l[c]=(u=a=o=void 0,a=(i=r).ownerDocument,s=i.nodeName,(u=ne[s])||(o=a.body.appendChild(a.createElement(s)),u=ce.css(o,"display"),o.parentNode.removeChild(o),"none"===u&&(u="block"),ne[s]=u)))):"none"!==n&&(l[c]="none",_.set(r,"display",n)));for(c=0;c<f;c++)null!=l[c]&&(e[c].style.display=l[c]);return e}ce.fn.extend({show:function(){return re(this,!0)},hide:function(){return re(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){ee(this)?ce(this).show():ce(this).hide()})}});var xe,be,we=/^(?:checkbox|radio)$/i,Te=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i,Ce=/^$|^module$|\/(?:java|ecma)script/i;xe=C.createDocumentFragment().appendChild(C.createElement("div")),(be=C.createElement("input")).setAttribute("type","radio"),be.setAttribute("checked","checked"),be.setAttribute("name","t"),xe.appendChild(be),le.checkClone=xe.cloneNode(!0).cloneNode(!0).lastChild.checked,xe.innerHTML="<textarea>x</textarea>",le.noCloneChecked=!!xe.cloneNode(!0).lastChild.defaultValue,xe.innerHTML="<option></option>",le.option=!!xe.lastChild;var ke={thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};function Se(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&fe(e,t)?ce.merge([e],n):n}function Ee(e,t){for(var n=0,r=e.length;n<r;n++)_.set(e[n],"globalEval",!t||_.get(t[n],"globalEval"))}ke.tbody=ke.tfoot=ke.colgroup=ke.caption=ke.thead,ke.th=ke.td,le.option||(ke.optgroup=ke.option=[1,"<select multiple='multiple'>","</select>"]);var je=/<|&#?\w+;/;function Ae(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d<h;d++)if((o=e[d])||0===o)if("object"===x(o))ce.merge(p,o.nodeType?[o]:o);else if(je.test(o)){a=a||f.appendChild(t.createElement("div")),s=(Te.exec(o)||["",""])[1].toLowerCase(),u=ke[s]||ke._default,a.innerHTML=u[1]+ce.htmlPrefilter(o)+u[2],c=u[0];while(c--)a=a.lastChild;ce.merge(p,a.childNodes),(a=f.firstChild).textContent=""}else p.push(t.createTextNode(o));f.textContent="",d=0;while(o=p[d++])if(r&&-1<ce.inArray(o,r))i&&i.push(o);else if(l=K(o),a=Se(f.appendChild(o),"script"),l&&Ee(a),n){c=0;while(o=a[c++])Ce.test(o.type||"")&&n.push(o)}return f}var De=/^([^.]*)(?:\.(.+)|)/;function Ne(){return!0}function qe(){return!1}function Le(e,t,n,r,i,o){var a,s;if("object"==typeof t){for(s in"string"!=typeof n&&(r=r||n,n=void 0),t)Le(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=qe;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return ce().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=ce.guid++)),e.each(function(){ce.event.add(this,t,i,r,n)})}function He(e,r,t){t?(_.set(e,r,!1),ce.event.add(e,r,{namespace:!1,handler:function(e){var t,n=_.get(this,r);if(1&e.isTrigger&&this[r]){if(n)(ce.event.special[r]||{}).delegateType&&e.stopPropagation();else if(n=ae.call(arguments),_.set(this,r,n),this[r](),t=_.get(this,r),_.set(this,r,!1),n!==t)return e.stopImmediatePropagation(),e.preventDefault(),t}else n&&(_.set(this,r,ce.event.trigger(n[0],n.slice(1),this)),e.stopPropagation(),e.isImmediatePropagationStopped=Ne)}})):void 0===_.get(e,r)&&ce.event.add(e,r,Ne)}ce.event={global:{},add:function(t,e,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=_.get(t);if($(t)){n.handler&&(n=(o=n).handler,i=o.selector),i&&ce.find.matchesSelector(J,i),n.guid||(n.guid=ce.guid++),(u=v.events)||(u=v.events=Object.create(null)),(a=v.handle)||(a=v.handle=function(e){return"undefined"!=typeof ce&&ce.event.triggered!==e.type?ce.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(D)||[""]).length;while(l--)d=g=(s=De.exec(e[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=ce.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=ce.event.special[d]||{},c=ce.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&ce.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,h,a)||t.addEventListener&&t.addEventListener(d,a)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),ce.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=_.hasData(e)&&_.get(e);if(v&&(u=v.events)){l=(t=(t||"").match(D)||[""]).length;while(l--)if(d=g=(s=De.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d){f=ce.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,v.handle)||ce.removeEvent(e,d,v.handle),delete u[d])}else for(d in u)ce.event.remove(e,d+t[l],n,r,!0);ce.isEmptyObject(u)&&_.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,s=new Array(arguments.length),u=ce.event.fix(e),l=(_.get(this,"events")||Object.create(null))[u.type]||[],c=ce.event.special[u.type]||{};for(s[0]=u,t=1;t<arguments.length;t++)s[t]=arguments[t];if(u.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,u)){a=ce.event.handlers.call(this,u,l),t=0;while((i=a[t++])&&!u.isPropagationStopped()){u.currentTarget=i.elem,n=0;while((o=i.handlers[n++])&&!u.isImmediatePropagationStopped())u.rnamespace&&!1!==o.namespace&&!u.rnamespace.test(o.namespace)||(u.handleObj=o,u.data=o.data,void 0!==(r=((ce.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,s))&&!1===(u.result=r)&&(u.preventDefault(),u.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,u),u.result}},handlers:function(e,t){var n,r,i,o,a,s=[],u=t.delegateCount,l=e.target;if(u&&l.nodeType&&!("click"===e.type&&1<=e.button))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n<u;n++)void 0===a[i=(r=t[n]).selector+" "]&&(a[i]=r.needsContext?-1<ce(i,this).index(l):ce.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u<t.length&&s.push({elem:l,handlers:t.slice(u)}),s},addProp:function(t,e){Object.defineProperty(ce.Event.prototype,t,{enumerable:!0,configurable:!0,get:v(e)?function(){if(this.originalEvent)return e(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[t]},set:function(e){Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:e})}})},fix:function(e){return e[ce.expando]?e:new ce.Event(e)},special:{load:{noBubble:!0},click:{setup:function(e){var t=this||e;return we.test(t.type)&&t.click&&fe(t,"input")&&He(t,"click",!0),!1},trigger:function(e){var t=this||e;return we.test(t.type)&&t.click&&fe(t,"input")&&He(t,"click"),!0},_default:function(e){var t=e.target;return we.test(t.type)&&t.click&&fe(t,"input")&&_.get(t,"click")||fe(t,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},ce.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},ce.Event=function(e,t){if(!(this instanceof ce.Event))return new ce.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?Ne:qe,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&ce.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),this[ce.expando]=!0},ce.Event.prototype={constructor:ce.Event,isDefaultPrevented:qe,isPropagationStopped:qe,isImmediatePropagationStopped:qe,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=Ne,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=Ne,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=Ne,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},ce.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,char:!0,code:!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:!0},ce.event.addProp),ce.each({focus:"focusin",blur:"focusout"},function(r,i){function o(e){if(C.documentMode){var t=_.get(this,"handle"),n=ce.event.fix(e);n.type="focusin"===e.type?"focus":"blur",n.isSimulated=!0,t(e),n.target===n.currentTarget&&t(n)}else ce.event.simulate(i,e.target,ce.event.fix(e))}ce.event.special[r]={setup:function(){var e;if(He(this,r,!0),!C.documentMode)return!1;(e=_.get(this,i))||this.addEventListener(i,o),_.set(this,i,(e||0)+1)},trigger:function(){return He(this,r),!0},teardown:function(){var e;if(!C.documentMode)return!1;(e=_.get(this,i)-1)?_.set(this,i,e):(this.removeEventListener(i,o),_.remove(this,i))},_default:function(e){return _.get(e.target,r)},delegateType:i},ce.event.special[i]={setup:function(){var e=this.ownerDocument||this.document||this,t=C.documentMode?this:e,n=_.get(t,i);n||(C.documentMode?this.addEventListener(i,o):e.addEventListener(r,o,!0)),_.set(t,i,(n||0)+1)},teardown:function(){var e=this.ownerDocument||this.document||this,t=C.documentMode?this:e,n=_.get(t,i)-1;n?_.set(t,i,n):(C.documentMode?this.removeEventListener(i,o):e.removeEventListener(r,o,!0),_.remove(t,i))}}}),ce.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,i){ce.event.special[e]={delegateType:i,bindType:i,handle:function(e){var t,n=e.relatedTarget,r=e.handleObj;return n&&(n===this||ce.contains(this,n))||(e.type=r.origType,t=r.handler.apply(this,arguments),e.type=i),t}}}),ce.fn.extend({on:function(e,t,n,r){return Le(this,e,t,n,r)},one:function(e,t,n,r){return Le(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,ce(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return!1!==t&&"function"!=typeof t||(n=t,t=void 0),!1===n&&(n=qe),this.each(function(){ce.event.remove(this,e,n,t)})}});var Oe=/<script|<style|<link/i,Pe=/checked\s*(?:[^=]|=\s*.checked.)/i,Me=/^\s*<!\[CDATA\[|\]\]>\s*$/g;function Re(e,t){return fe(e,"table")&&fe(11!==t.nodeType?t:t.firstChild,"tr")&&ce(e).children("tbody")[0]||e}function Ie(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function We(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Fe(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(_.hasData(e)&&(s=_.get(e).events))for(i in _.remove(t,"handle events"),s)for(n=0,r=s[i].length;n<r;n++)ce.event.add(t,i,s[i][n]);z.hasData(e)&&(o=z.access(e),a=ce.extend({},o),z.set(t,a))}}function $e(n,r,i,o){r=g(r);var e,t,a,s,u,l,c=0,f=n.length,p=f-1,d=r[0],h=v(d);if(h||1<f&&"string"==typeof d&&!le.checkClone&&Pe.test(d))return n.each(function(e){var t=n.eq(e);h&&(r[0]=d.call(this,e,t.html())),$e(t,r,i,o)});if(f&&(t=(e=Ae(r,n[0].ownerDocument,!1,n,o)).firstChild,1===e.childNodes.length&&(e=t),t||o)){for(s=(a=ce.map(Se(e,"script"),Ie)).length;c<f;c++)u=e,c!==p&&(u=ce.clone(u,!0,!0),s&&ce.merge(a,Se(u,"script"))),i.call(n[c],u,c);if(s)for(l=a[a.length-1].ownerDocument,ce.map(a,We),c=0;c<s;c++)u=a[c],Ce.test(u.type||"")&&!_.access(u,"globalEval")&&ce.contains(l,u)&&(u.src&&"module"!==(u.type||"").toLowerCase()?ce._evalUrl&&!u.noModule&&ce._evalUrl(u.src,{nonce:u.nonce||u.getAttribute("nonce")},l):m(u.textContent.replace(Me,""),u,l))}return n}function Be(e,t,n){for(var r,i=t?ce.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||ce.cleanData(Se(r)),r.parentNode&&(n&&K(r)&&Ee(Se(r,"script")),r.parentNode.removeChild(r));return e}ce.extend({htmlPrefilter:function(e){return e},clone:function(e,t,n){var r,i,o,a,s,u,l,c=e.cloneNode(!0),f=K(e);if(!(le.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||ce.isXMLDoc(e)))for(a=Se(c),r=0,i=(o=Se(e)).length;r<i;r++)s=o[r],u=a[r],void 0,"input"===(l=u.nodeName.toLowerCase())&&we.test(s.type)?u.checked=s.checked:"input"!==l&&"textarea"!==l||(u.defaultValue=s.defaultValue);if(t)if(n)for(o=o||Se(e),a=a||Se(c),r=0,i=o.length;r<i;r++)Fe(o[r],a[r]);else Fe(e,c);return 0<(a=Se(c,"script")).length&&Ee(a,!f&&Se(e,"script")),c},cleanData:function(e){for(var t,n,r,i=ce.event.special,o=0;void 0!==(n=e[o]);o++)if($(n)){if(t=n[_.expando]){if(t.events)for(r in t.events)i[r]?ce.event.remove(n,r):ce.removeEvent(n,r,t.handle);n[_.expando]=void 0}n[z.expando]&&(n[z.expando]=void 0)}}}),ce.fn.extend({detach:function(e){return Be(this,e,!0)},remove:function(e){return Be(this,e)},text:function(e){return M(this,function(e){return void 0===e?ce.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return $e(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Re(this,e).appendChild(e)})},prepend:function(){return $e(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Re(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return $e(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return $e(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(ce.cleanData(Se(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return ce.clone(this,e,t)})},html:function(e){return M(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Oe.test(e)&&!ke[(Te.exec(e)||["",""])[1].toLowerCase()]){e=ce.htmlPrefilter(e);try{for(;n<r;n++)1===(t=this[n]||{}).nodeType&&(ce.cleanData(Se(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var n=[];return $e(this,arguments,function(e){var t=this.parentNode;ce.inArray(this,n)<0&&(ce.cleanData(Se(this)),t&&t.replaceChild(e,this))},n)}}),ce.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,a){ce.fn[e]=function(e){for(var t,n=[],r=ce(e),i=r.length-1,o=0;o<=i;o++)t=o===i?this:this.clone(!0),ce(r[o])[a](t),s.apply(n,t.get());return this.pushStack(n)}});var _e=new RegExp("^("+G+")(?!px)[a-z%]+$","i"),ze=/^--/,Xe=function(e){var t=e.ownerDocument.defaultView;return t&&t.opener||(t=ie),t.getComputedStyle(e)},Ue=function(e,t,n){var r,i,o={};for(i in t)o[i]=e.style[i],e.style[i]=t[i];for(i in r=n.call(e),t)e.style[i]=o[i];return r},Ve=new RegExp(Q.join("|"),"i");function Ge(e,t,n){var r,i,o,a,s=ze.test(t),u=e.style;return(n=n||Xe(e))&&(a=n.getPropertyValue(t)||n[t],s&&a&&(a=a.replace(ve,"$1")||void 0),""!==a||K(e)||(a=ce.style(e,t)),!le.pixelBoxStyles()&&_e.test(a)&&Ve.test(t)&&(r=u.width,i=u.minWidth,o=u.maxWidth,u.minWidth=u.maxWidth=u.width=a,a=n.width,u.width=r,u.minWidth=i,u.maxWidth=o)),void 0!==a?a+"":a}function Ye(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}!function(){function e(){if(l){u.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",l.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",J.appendChild(u).appendChild(l);var e=ie.getComputedStyle(l);n="1%"!==e.top,s=12===t(e.marginLeft),l.style.right="60%",o=36===t(e.right),r=36===t(e.width),l.style.position="absolute",i=12===t(l.offsetWidth/3),J.removeChild(u),l=null}}function t(e){return Math.round(parseFloat(e))}var n,r,i,o,a,s,u=C.createElement("div"),l=C.createElement("div");l.style&&(l.style.backgroundClip="content-box",l.cloneNode(!0).style.backgroundClip="",le.clearCloneStyle="content-box"===l.style.backgroundClip,ce.extend(le,{boxSizingReliable:function(){return e(),r},pixelBoxStyles:function(){return e(),o},pixelPosition:function(){return e(),n},reliableMarginLeft:function(){return e(),s},scrollboxSize:function(){return e(),i},reliableTrDimensions:function(){var e,t,n,r;return null==a&&(e=C.createElement("table"),t=C.createElement("tr"),n=C.createElement("div"),e.style.cssText="position:absolute;left:-11111px;border-collapse:separate",t.style.cssText="box-sizing:content-box;border:1px solid",t.style.height="1px",n.style.height="9px",n.style.display="block",J.appendChild(e).appendChild(t).appendChild(n),r=ie.getComputedStyle(t),a=parseInt(r.height,10)+parseInt(r.borderTopWidth,10)+parseInt(r.borderBottomWidth,10)===t.offsetHeight,J.removeChild(e)),a}}))}();var Qe=["Webkit","Moz","ms"],Je=C.createElement("div").style,Ke={};function Ze(e){var t=ce.cssProps[e]||Ke[e];return t||(e in Je?e:Ke[e]=function(e){var t=e[0].toUpperCase()+e.slice(1),n=Qe.length;while(n--)if((e=Qe[n]+t)in Je)return e}(e)||e)}var et=/^(none|table(?!-c[ea]).+)/,tt={position:"absolute",visibility:"hidden",display:"block"},nt={letterSpacing:"0",fontWeight:"400"};function rt(e,t,n){var r=Y.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function it(e,t,n,r,i,o){var a="width"===t?1:0,s=0,u=0,l=0;if(n===(r?"border":"content"))return 0;for(;a<4;a+=2)"margin"===n&&(l+=ce.css(e,n+Q[a],!0,i)),r?("content"===n&&(u-=ce.css(e,"padding"+Q[a],!0,i)),"margin"!==n&&(u-=ce.css(e,"border"+Q[a]+"Width",!0,i))):(u+=ce.css(e,"padding"+Q[a],!0,i),"padding"!==n?u+=ce.css(e,"border"+Q[a]+"Width",!0,i):s+=ce.css(e,"border"+Q[a]+"Width",!0,i));return!r&&0<=o&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))||0),u+l}function ot(e,t,n){var r=Xe(e),i=(!le.boxSizingReliable()||n)&&"border-box"===ce.css(e,"boxSizing",!1,r),o=i,a=Ge(e,t,r),s="offset"+t[0].toUpperCase()+t.slice(1);if(_e.test(a)){if(!n)return a;a="auto"}return(!le.boxSizingReliable()&&i||!le.reliableTrDimensions()&&fe(e,"tr")||"auto"===a||!parseFloat(a)&&"inline"===ce.css(e,"display",!1,r))&&e.getClientRects().length&&(i="border-box"===ce.css(e,"boxSizing",!1,r),(o=s in e)&&(a=e[s])),(a=parseFloat(a)||0)+it(e,t,n||(i?"border":"content"),o,r,a)+"px"}function at(e,t,n,r,i){return new at.prototype.init(e,t,n,r,i)}ce.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Ge(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,aspectRatio:!0,borderImageSlice:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,scale:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeMiterlimit:!0,strokeOpacity:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=F(t),u=ze.test(t),l=e.style;if(u||(t=Ze(s)),a=ce.cssHooks[t]||ce.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];"string"===(o=typeof n)&&(i=Y.exec(n))&&i[1]&&(n=te(e,t,i),o="number"),null!=n&&n==n&&("number"!==o||u||(n+=i&&i[3]||(ce.cssNumber[s]?"":"px")),le.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=F(t);return ze.test(t)||(t=Ze(s)),(a=ce.cssHooks[t]||ce.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=Ge(e,t,r)),"normal"===i&&t in nt&&(i=nt[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),ce.each(["height","width"],function(e,u){ce.cssHooks[u]={get:function(e,t,n){if(t)return!et.test(ce.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?ot(e,u,n):Ue(e,tt,function(){return ot(e,u,n)})},set:function(e,t,n){var r,i=Xe(e),o=!le.scrollboxSize()&&"absolute"===i.position,a=(o||n)&&"border-box"===ce.css(e,"boxSizing",!1,i),s=n?it(e,u,n,a,i):0;return a&&o&&(s-=Math.ceil(e["offset"+u[0].toUpperCase()+u.slice(1)]-parseFloat(i[u])-it(e,u,"border",!1,i)-.5)),s&&(r=Y.exec(t))&&"px"!==(r[3]||"px")&&(e.style[u]=t,t=ce.css(e,u)),rt(0,t,s)}}}),ce.cssHooks.marginLeft=Ye(le.reliableMarginLeft,function(e,t){if(t)return(parseFloat(Ge(e,"marginLeft"))||e.getBoundingClientRect().left-Ue(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),ce.each({margin:"",padding:"",border:"Width"},function(i,o){ce.cssHooks[i+o]={expand:function(e){for(var t=0,n={},r="string"==typeof e?e.split(" "):[e];t<4;t++)n[i+Q[t]+o]=r[t]||r[t-2]||r[0];return n}},"margin"!==i&&(ce.cssHooks[i+o].set=rt)}),ce.fn.extend({css:function(e,t){return M(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=Xe(e),i=t.length;a<i;a++)o[t[a]]=ce.css(e,t[a],!1,r);return o}return void 0!==n?ce.style(e,t,n):ce.css(e,t)},e,t,1<arguments.length)}}),((ce.Tween=at).prototype={constructor:at,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||ce.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(ce.cssNumber[n]?"":"px")},cur:function(){var e=at.propHooks[this.prop];return e&&e.get?e.get(this):at.propHooks._default.get(this)},run:function(e){var t,n=at.propHooks[this.prop];return this.options.duration?this.pos=t=ce.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):at.propHooks._default.set(this),this}}).init.prototype=at.prototype,(at.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=ce.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){ce.fx.step[e.prop]?ce.fx.step[e.prop](e):1!==e.elem.nodeType||!ce.cssHooks[e.prop]&&null==e.elem.style[Ze(e.prop)]?e.elem[e.prop]=e.now:ce.style(e.elem,e.prop,e.now+e.unit)}}}).scrollTop=at.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},ce.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},ce.fx=at.prototype.init,ce.fx.step={};var st,ut,lt,ct,ft=/^(?:toggle|show|hide)$/,pt=/queueHooks$/;function dt(){ut&&(!1===C.hidden&&ie.requestAnimationFrame?ie.requestAnimationFrame(dt):ie.setTimeout(dt,ce.fx.interval),ce.fx.tick())}function ht(){return ie.setTimeout(function(){st=void 0}),st=Date.now()}function gt(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=Q[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function vt(e,t,n){for(var r,i=(yt.tweeners[t]||[]).concat(yt.tweeners["*"]),o=0,a=i.length;o<a;o++)if(r=i[o].call(n,t,e))return r}function yt(o,e,t){var n,a,r=0,i=yt.prefilters.length,s=ce.Deferred().always(function(){delete u.elem}),u=function(){if(a)return!1;for(var e=st||ht(),t=Math.max(0,l.startTime+l.duration-e),n=1-(t/l.duration||0),r=0,i=l.tweens.length;r<i;r++)l.tweens[r].run(n);return s.notifyWith(o,[l,n,t]),n<1&&i?t:(i||s.notifyWith(o,[l,1,0]),s.resolveWith(o,[l]),!1)},l=s.promise({elem:o,props:ce.extend({},e),opts:ce.extend(!0,{specialEasing:{},easing:ce.easing._default},t),originalProperties:e,originalOptions:t,startTime:st||ht(),duration:t.duration,tweens:[],createTween:function(e,t){var n=ce.Tween(o,l.opts,e,t,l.opts.specialEasing[e]||l.opts.easing);return l.tweens.push(n),n},stop:function(e){var t=0,n=e?l.tweens.length:0;if(a)return this;for(a=!0;t<n;t++)l.tweens[t].run(1);return e?(s.notifyWith(o,[l,1,0]),s.resolveWith(o,[l,e])):s.rejectWith(o,[l,e]),this}}),c=l.props;for(!function(e,t){var n,r,i,o,a;for(n in e)if(i=t[r=F(n)],o=e[n],Array.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(a=ce.cssHooks[r])&&"expand"in a)for(n in o=a.expand(o),delete e[r],o)n in e||(e[n]=o[n],t[n]=i);else t[r]=i}(c,l.opts.specialEasing);r<i;r++)if(n=yt.prefilters[r].call(l,o,c,l.opts))return v(n.stop)&&(ce._queueHooks(l.elem,l.opts.queue).stop=n.stop.bind(n)),n;return ce.map(c,vt,l),v(l.opts.start)&&l.opts.start.call(o,l),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always),ce.fx.timer(ce.extend(u,{elem:o,anim:l,queue:l.opts.queue})),l}ce.Animation=ce.extend(yt,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return te(n.elem,e,Y.exec(t),n),n}]},tweener:function(e,t){v(e)?(t=e,e=["*"]):e=e.match(D);for(var n,r=0,i=e.length;r<i;r++)n=e[r],yt.tweeners[n]=yt.tweeners[n]||[],yt.tweeners[n].unshift(t)},prefilters:[function(e,t,n){var r,i,o,a,s,u,l,c,f="width"in t||"height"in t,p=this,d={},h=e.style,g=e.nodeType&&ee(e),v=_.get(e,"fxshow");for(r in n.queue||(null==(a=ce._queueHooks(e,"fx")).unqueued&&(a.unqueued=0,s=a.empty.fire,a.empty.fire=function(){a.unqueued||s()}),a.unqueued++,p.always(function(){p.always(function(){a.unqueued--,ce.queue(e,"fx").length||a.empty.fire()})})),t)if(i=t[r],ft.test(i)){if(delete t[r],o=o||"toggle"===i,i===(g?"hide":"show")){if("show"!==i||!v||void 0===v[r])continue;g=!0}d[r]=v&&v[r]||ce.style(e,r)}if((u=!ce.isEmptyObject(t))||!ce.isEmptyObject(d))for(r in f&&1===e.nodeType&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],null==(l=v&&v.display)&&(l=_.get(e,"display")),"none"===(c=ce.css(e,"display"))&&(l?c=l:(re([e],!0),l=e.style.display||l,c=ce.css(e,"display"),re([e]))),("inline"===c||"inline-block"===c&&null!=l)&&"none"===ce.css(e,"float")&&(u||(p.done(function(){h.display=l}),null==l&&(c=h.display,l="none"===c?"":c)),h.display="inline-block")),n.overflow&&(h.overflow="hidden",p.always(function(){h.overflow=n.overflow[0],h.overflowX=n.overflow[1],h.overflowY=n.overflow[2]})),u=!1,d)u||(v?"hidden"in v&&(g=v.hidden):v=_.access(e,"fxshow",{display:l}),o&&(v.hidden=!g),g&&re([e],!0),p.done(function(){for(r in g||re([e]),_.remove(e,"fxshow"),d)ce.style(e,r,d[r])})),u=vt(g?v[r]:0,r,p),r in v||(v[r]=u.start,g&&(u.end=u.start,u.start=0))}],prefilter:function(e,t){t?yt.prefilters.unshift(e):yt.prefilters.push(e)}}),ce.speed=function(e,t,n){var r=e&&"object"==typeof e?ce.extend({},e):{complete:n||!n&&t||v(e)&&e,duration:e,easing:n&&t||t&&!v(t)&&t};return ce.fx.off?r.duration=0:"number"!=typeof r.duration&&(r.duration in ce.fx.speeds?r.duration=ce.fx.speeds[r.duration]:r.duration=ce.fx.speeds._default),null!=r.queue&&!0!==r.queue||(r.queue="fx"),r.old=r.complete,r.complete=function(){v(r.old)&&r.old.call(this),r.queue&&ce.dequeue(this,r.queue)},r},ce.fn.extend({fadeTo:function(e,t,n,r){return this.filter(ee).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(t,e,n,r){var i=ce.isEmptyObject(t),o=ce.speed(e,n,r),a=function(){var e=yt(this,ce.extend({},t),o);(i||_.get(this,"finish"))&&e.stop(!0)};return a.finish=a,i||!1===o.queue?this.each(a):this.queue(o.queue,a)},stop:function(i,e,o){var a=function(e){var t=e.stop;delete e.stop,t(o)};return"string"!=typeof i&&(o=e,e=i,i=void 0),e&&this.queue(i||"fx",[]),this.each(function(){var e=!0,t=null!=i&&i+"queueHooks",n=ce.timers,r=_.get(this);if(t)r[t]&&r[t].stop&&a(r[t]);else for(t in r)r[t]&&r[t].stop&&pt.test(t)&&a(r[t]);for(t=n.length;t--;)n[t].elem!==this||null!=i&&n[t].queue!==i||(n[t].anim.stop(o),e=!1,n.splice(t,1));!e&&o||ce.dequeue(this,i)})},finish:function(a){return!1!==a&&(a=a||"fx"),this.each(function(){var e,t=_.get(this),n=t[a+"queue"],r=t[a+"queueHooks"],i=ce.timers,o=n?n.length:0;for(t.finish=!0,ce.queue(this,a,[]),r&&r.stop&&r.stop.call(this,!0),e=i.length;e--;)i[e].elem===this&&i[e].queue===a&&(i[e].anim.stop(!0),i.splice(e,1));for(e=0;e<o;e++)n[e]&&n[e].finish&&n[e].finish.call(this);delete t.finish})}}),ce.each(["toggle","show","hide"],function(e,r){var i=ce.fn[r];ce.fn[r]=function(e,t,n){return null==e||"boolean"==typeof e?i.apply(this,arguments):this.animate(gt(r,!0),e,t,n)}}),ce.each({slideDown:gt("show"),slideUp:gt("hide"),slideToggle:gt("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,r){ce.fn[e]=function(e,t,n){return this.animate(r,e,t,n)}}),ce.timers=[],ce.fx.tick=function(){var e,t=0,n=ce.timers;for(st=Date.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||ce.fx.stop(),st=void 0},ce.fx.timer=function(e){ce.timers.push(e),ce.fx.start()},ce.fx.interval=13,ce.fx.start=function(){ut||(ut=!0,dt())},ce.fx.stop=function(){ut=null},ce.fx.speeds={slow:600,fast:200,_default:400},ce.fn.delay=function(r,e){return r=ce.fx&&ce.fx.speeds[r]||r,e=e||"fx",this.queue(e,function(e,t){var n=ie.setTimeout(e,r);t.stop=function(){ie.clearTimeout(n)}})},lt=C.createElement("input"),ct=C.createElement("select").appendChild(C.createElement("option")),lt.type="checkbox",le.checkOn=""!==lt.value,le.optSelected=ct.selected,(lt=C.createElement("input")).value="t",lt.type="radio",le.radioValue="t"===lt.value;var mt,xt=ce.expr.attrHandle;ce.fn.extend({attr:function(e,t){return M(this,ce.attr,e,t,1<arguments.length)},removeAttr:function(e){return this.each(function(){ce.removeAttr(this,e)})}}),ce.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?ce.prop(e,t,n):(1===o&&ce.isXMLDoc(e)||(i=ce.attrHooks[t.toLowerCase()]||(ce.expr.match.bool.test(t)?mt:void 0)),void 0!==n?null===n?void ce.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=ce.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!le.radioValue&&"radio"===t&&fe(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(D);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),mt={set:function(e,t,n){return!1===t?ce.removeAttr(e,n):e.setAttribute(n,n),n}},ce.each(ce.expr.match.bool.source.match(/\w+/g),function(e,t){var a=xt[t]||ce.find.attr;xt[t]=function(e,t,n){var r,i,o=t.toLowerCase();return n||(i=xt[o],xt[o]=r,r=null!=a(e,t,n)?o:null,xt[o]=i),r}});var bt=/^(?:input|select|textarea|button)$/i,wt=/^(?:a|area)$/i;function Tt(e){return(e.match(D)||[]).join(" ")}function Ct(e){return e.getAttribute&&e.getAttribute("class")||""}function kt(e){return Array.isArray(e)?e:"string"==typeof e&&e.match(D)||[]}ce.fn.extend({prop:function(e,t){return M(this,ce.prop,e,t,1<arguments.length)},removeProp:function(e){return this.each(function(){delete this[ce.propFix[e]||e]})}}),ce.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&ce.isXMLDoc(e)||(t=ce.propFix[t]||t,i=ce.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=ce.find.attr(e,"tabindex");return t?parseInt(t,10):bt.test(e.nodeName)||wt.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),le.optSelected||(ce.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),ce.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){ce.propFix[this.toLowerCase()]=this}),ce.fn.extend({addClass:function(t){var e,n,r,i,o,a;return v(t)?this.each(function(e){ce(this).addClass(t.call(this,e,Ct(this)))}):(e=kt(t)).length?this.each(function(){if(r=Ct(this),n=1===this.nodeType&&" "+Tt(r)+" "){for(o=0;o<e.length;o++)i=e[o],n.indexOf(" "+i+" ")<0&&(n+=i+" ");a=Tt(n),r!==a&&this.setAttribute("class",a)}}):this},removeClass:function(t){var e,n,r,i,o,a;return v(t)?this.each(function(e){ce(this).removeClass(t.call(this,e,Ct(this)))}):arguments.length?(e=kt(t)).length?this.each(function(){if(r=Ct(this),n=1===this.nodeType&&" "+Tt(r)+" "){for(o=0;o<e.length;o++){i=e[o];while(-1<n.indexOf(" "+i+" "))n=n.replace(" "+i+" "," ")}a=Tt(n),r!==a&&this.setAttribute("class",a)}}):this:this.attr("class","")},toggleClass:function(t,n){var e,r,i,o,a=typeof t,s="string"===a||Array.isArray(t);return v(t)?this.each(function(e){ce(this).toggleClass(t.call(this,e,Ct(this),n),n)}):"boolean"==typeof n&&s?n?this.addClass(t):this.removeClass(t):(e=kt(t),this.each(function(){if(s)for(o=ce(this),i=0;i<e.length;i++)r=e[i],o.hasClass(r)?o.removeClass(r):o.addClass(r);else void 0!==t&&"boolean"!==a||((r=Ct(this))&&_.set(this,"__className__",r),this.setAttribute&&this.setAttribute("class",r||!1===t?"":_.get(this,"__className__")||""))}))},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(1===n.nodeType&&-1<(" "+Tt(Ct(n))+" ").indexOf(t))return!0;return!1}});var St=/\r/g;ce.fn.extend({val:function(n){var r,e,i,t=this[0];return arguments.length?(i=v(n),this.each(function(e){var t;1===this.nodeType&&(null==(t=i?n.call(this,e,ce(this).val()):n)?t="":"number"==typeof t?t+="":Array.isArray(t)&&(t=ce.map(t,function(e){return null==e?"":e+""})),(r=ce.valHooks[this.type]||ce.valHooks[this.nodeName.toLowerCase()])&&"set"in r&&void 0!==r.set(this,t,"value")||(this.value=t))})):t?(r=ce.valHooks[t.type]||ce.valHooks[t.nodeName.toLowerCase()])&&"get"in r&&void 0!==(e=r.get(t,"value"))?e:"string"==typeof(e=t.value)?e.replace(St,""):null==e?"":e:void 0}}),ce.extend({valHooks:{option:{get:function(e){var t=ce.find.attr(e,"value");return null!=t?t:Tt(ce.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r<u;r++)if(((n=i[r]).selected||r===o)&&!n.disabled&&(!n.parentNode.disabled||!fe(n.parentNode,"optgroup"))){if(t=ce(n).val(),a)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=ce.makeArray(t),a=i.length;while(a--)((r=i[a]).selected=-1<ce.inArray(ce.valHooks.option.get(r),o))&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),ce.each(["radio","checkbox"],function(){ce.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=-1<ce.inArray(ce(e).val(),t)}},le.checkOn||(ce.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Et=ie.location,jt={guid:Date.now()},At=/\?/;ce.parseXML=function(e){var t,n;if(!e||"string"!=typeof e)return null;try{t=(new ie.DOMParser).parseFromString(e,"text/xml")}catch(e){}return n=t&&t.getElementsByTagName("parsererror")[0],t&&!n||ce.error("Invalid XML: "+(n?ce.map(n.childNodes,function(e){return e.textContent}).join("\n"):e)),t};var Dt=/^(?:focusinfocus|focusoutblur)$/,Nt=function(e){e.stopPropagation()};ce.extend(ce.event,{trigger:function(e,t,n,r){var i,o,a,s,u,l,c,f,p=[n||C],d=ue.call(e,"type")?e.type:e,h=ue.call(e,"namespace")?e.namespace.split("."):[];if(o=f=a=n=n||C,3!==n.nodeType&&8!==n.nodeType&&!Dt.test(d+ce.event.triggered)&&(-1<d.indexOf(".")&&(d=(h=d.split(".")).shift(),h.sort()),u=d.indexOf(":")<0&&"on"+d,(e=e[ce.expando]?e:new ce.Event(d,"object"==typeof e&&e)).isTrigger=r?2:3,e.namespace=h.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),t=null==t?[e]:ce.makeArray(t,[e]),c=ce.event.special[d]||{},r||!c.trigger||!1!==c.trigger.apply(n,t))){if(!r&&!c.noBubble&&!y(n)){for(s=c.delegateType||d,Dt.test(s+d)||(o=o.parentNode);o;o=o.parentNode)p.push(o),a=o;a===(n.ownerDocument||C)&&p.push(a.defaultView||a.parentWindow||ie)}i=0;while((o=p[i++])&&!e.isPropagationStopped())f=o,e.type=1<i?s:c.bindType||d,(l=(_.get(o,"events")||Object.create(null))[e.type]&&_.get(o,"handle"))&&l.apply(o,t),(l=u&&o[u])&&l.apply&&$(o)&&(e.result=l.apply(o,t),!1===e.result&&e.preventDefault());return e.type=d,r||e.isDefaultPrevented()||c._default&&!1!==c._default.apply(p.pop(),t)||!$(n)||u&&v(n[d])&&!y(n)&&((a=n[u])&&(n[u]=null),ce.event.triggered=d,e.isPropagationStopped()&&f.addEventListener(d,Nt),n[d](),e.isPropagationStopped()&&f.removeEventListener(d,Nt),ce.event.triggered=void 0,a&&(n[u]=a)),e.result}},simulate:function(e,t,n){var r=ce.extend(new ce.Event,n,{type:e,isSimulated:!0});ce.event.trigger(r,null,t)}}),ce.fn.extend({trigger:function(e,t){return this.each(function(){ce.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return ce.event.trigger(e,t,n,!0)}});var qt=/\[\]$/,Lt=/\r?\n/g,Ht=/^(?:submit|button|image|reset|file)$/i,Ot=/^(?:input|select|textarea|keygen)/i;function Pt(n,e,r,i){var t;if(Array.isArray(e))ce.each(e,function(e,t){r||qt.test(n)?i(n,t):Pt(n+"["+("object"==typeof t&&null!=t?e:"")+"]",t,r,i)});else if(r||"object"!==x(e))i(n,e);else for(t in e)Pt(n+"["+t+"]",e[t],r,i)}ce.param=function(e,t){var n,r=[],i=function(e,t){var n=v(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(null==e)return"";if(Array.isArray(e)||e.jquery&&!ce.isPlainObject(e))ce.each(e,function(){i(this.name,this.value)});else for(n in e)Pt(n,e[n],t,i);return r.join("&")},ce.fn.extend({serialize:function(){return ce.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=ce.prop(this,"elements");return e?ce.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!ce(this).is(":disabled")&&Ot.test(this.nodeName)&&!Ht.test(e)&&(this.checked||!we.test(e))}).map(function(e,t){var n=ce(this).val();return null==n?null:Array.isArray(n)?ce.map(n,function(e){return{name:t.name,value:e.replace(Lt,"\r\n")}}):{name:t.name,value:n.replace(Lt,"\r\n")}}).get()}});var Mt=/%20/g,Rt=/#.*$/,It=/([?&])_=[^&]*/,Wt=/^(.*?):[ \t]*([^\r\n]*)$/gm,Ft=/^(?:GET|HEAD)$/,$t=/^\/\//,Bt={},_t={},zt="*/".concat("*"),Xt=C.createElement("a");function Ut(o){return function(e,t){"string"!=typeof e&&(t=e,e="*");var n,r=0,i=e.toLowerCase().match(D)||[];if(v(t))while(n=i[r++])"+"===n[0]?(n=n.slice(1)||"*",(o[n]=o[n]||[]).unshift(t)):(o[n]=o[n]||[]).push(t)}}function Vt(t,i,o,a){var s={},u=t===_t;function l(e){var r;return s[e]=!0,ce.each(t[e]||[],function(e,t){var n=t(i,o,a);return"string"!=typeof n||u||s[n]?u?!(r=n):void 0:(i.dataTypes.unshift(n),l(n),!1)}),r}return l(i.dataTypes[0])||!s["*"]&&l("*")}function Gt(e,t){var n,r,i=ce.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&ce.extend(!0,e,r),e}Xt.href=Et.href,ce.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Et.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(Et.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":zt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":ce.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Gt(Gt(e,ce.ajaxSettings),t):Gt(ce.ajaxSettings,e)},ajaxPrefilter:Ut(Bt),ajaxTransport:Ut(_t),ajax:function(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var c,f,p,n,d,r,h,g,i,o,v=ce.ajaxSetup({},t),y=v.context||v,m=v.context&&(y.nodeType||y.jquery)?ce(y):ce.event,x=ce.Deferred(),b=ce.Callbacks("once memory"),w=v.statusCode||{},a={},s={},u="canceled",T={readyState:0,getResponseHeader:function(e){var t;if(h){if(!n){n={};while(t=Wt.exec(p))n[t[1].toLowerCase()+" "]=(n[t[1].toLowerCase()+" "]||[]).concat(t[2])}t=n[e.toLowerCase()+" "]}return null==t?null:t.join(", ")},getAllResponseHeaders:function(){return h?p:null},setRequestHeader:function(e,t){return null==h&&(e=s[e.toLowerCase()]=s[e.toLowerCase()]||e,a[e]=t),this},overrideMimeType:function(e){return null==h&&(v.mimeType=e),this},statusCode:function(e){var t;if(e)if(h)T.always(e[T.status]);else for(t in e)w[t]=[w[t],e[t]];return this},abort:function(e){var t=e||u;return c&&c.abort(t),l(0,t),this}};if(x.promise(T),v.url=((e||v.url||Et.href)+"").replace($t,Et.protocol+"//"),v.type=t.method||t.type||v.method||v.type,v.dataTypes=(v.dataType||"*").toLowerCase().match(D)||[""],null==v.crossDomain){r=C.createElement("a");try{r.href=v.url,r.href=r.href,v.crossDomain=Xt.protocol+"//"+Xt.host!=r.protocol+"//"+r.host}catch(e){v.crossDomain=!0}}if(v.data&&v.processData&&"string"!=typeof v.data&&(v.data=ce.param(v.data,v.traditional)),Vt(Bt,v,t,T),h)return T;for(i in(g=ce.event&&v.global)&&0==ce.active++&&ce.event.trigger("ajaxStart"),v.type=v.type.toUpperCase(),v.hasContent=!Ft.test(v.type),f=v.url.replace(Rt,""),v.hasContent?v.data&&v.processData&&0===(v.contentType||"").indexOf("application/x-www-form-urlencoded")&&(v.data=v.data.replace(Mt,"+")):(o=v.url.slice(f.length),v.data&&(v.processData||"string"==typeof v.data)&&(f+=(At.test(f)?"&":"?")+v.data,delete v.data),!1===v.cache&&(f=f.replace(It,"$1"),o=(At.test(f)?"&":"?")+"_="+jt.guid+++o),v.url=f+o),v.ifModified&&(ce.lastModified[f]&&T.setRequestHeader("If-Modified-Since",ce.lastModified[f]),ce.etag[f]&&T.setRequestHeader("If-None-Match",ce.etag[f])),(v.data&&v.hasContent&&!1!==v.contentType||t.contentType)&&T.setRequestHeader("Content-Type",v.contentType),T.setRequestHeader("Accept",v.dataTypes[0]&&v.accepts[v.dataTypes[0]]?v.accepts[v.dataTypes[0]]+("*"!==v.dataTypes[0]?", "+zt+"; q=0.01":""):v.accepts["*"]),v.headers)T.setRequestHeader(i,v.headers[i]);if(v.beforeSend&&(!1===v.beforeSend.call(y,T,v)||h))return T.abort();if(u="abort",b.add(v.complete),T.done(v.success),T.fail(v.error),c=Vt(_t,v,t,T)){if(T.readyState=1,g&&m.trigger("ajaxSend",[T,v]),h)return T;v.async&&0<v.timeout&&(d=ie.setTimeout(function(){T.abort("timeout")},v.timeout));try{h=!1,c.send(a,l)}catch(e){if(h)throw e;l(-1,e)}}else l(-1,"No Transport");function l(e,t,n,r){var i,o,a,s,u,l=t;h||(h=!0,d&&ie.clearTimeout(d),c=void 0,p=r||"",T.readyState=0<e?4:0,i=200<=e&&e<300||304===e,n&&(s=function(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}(v,T,n)),!i&&-1<ce.inArray("script",v.dataTypes)&&ce.inArray("json",v.dataTypes)<0&&(v.converters["text script"]=function(){}),s=function(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(a=l[u+" "+o]||l["* "+o]))for(i in l)if((s=i.split(" "))[1]===o&&(a=l[u+" "+s[0]]||l["* "+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}(v,s,T,i),i?(v.ifModified&&((u=T.getResponseHeader("Last-Modified"))&&(ce.lastModified[f]=u),(u=T.getResponseHeader("etag"))&&(ce.etag[f]=u)),204===e||"HEAD"===v.type?l="nocontent":304===e?l="notmodified":(l=s.state,o=s.data,i=!(a=s.error))):(a=l,!e&&l||(l="error",e<0&&(e=0))),T.status=e,T.statusText=(t||l)+"",i?x.resolveWith(y,[o,l,T]):x.rejectWith(y,[T,l,a]),T.statusCode(w),w=void 0,g&&m.trigger(i?"ajaxSuccess":"ajaxError",[T,v,i?o:a]),b.fireWith(y,[T,l]),g&&(m.trigger("ajaxComplete",[T,v]),--ce.active||ce.event.trigger("ajaxStop")))}return T},getJSON:function(e,t,n){return ce.get(e,t,n,"json")},getScript:function(e,t){return ce.get(e,void 0,t,"script")}}),ce.each(["get","post"],function(e,i){ce[i]=function(e,t,n,r){return v(t)&&(r=r||n,n=t,t=void 0),ce.ajax(ce.extend({url:e,type:i,dataType:r,data:t,success:n},ce.isPlainObject(e)&&e))}}),ce.ajaxPrefilter(function(e){var t;for(t in e.headers)"content-type"===t.toLowerCase()&&(e.contentType=e.headers[t]||"")}),ce._evalUrl=function(e,t,n){return ce.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(e){ce.globalEval(e,t,n)}})},ce.fn.extend({wrapAll:function(e){var t;return this[0]&&(v(e)&&(e=e.call(this[0])),t=ce(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(n){return v(n)?this.each(function(e){ce(this).wrapInner(n.call(this,e))}):this.each(function(){var e=ce(this),t=e.contents();t.length?t.wrapAll(n):e.append(n)})},wrap:function(t){var n=v(t);return this.each(function(e){ce(this).wrapAll(n?t.call(this,e):t)})},unwrap:function(e){return this.parent(e).not("body").each(function(){ce(this).replaceWith(this.childNodes)}),this}}),ce.expr.pseudos.hidden=function(e){return!ce.expr.pseudos.visible(e)},ce.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},ce.ajaxSettings.xhr=function(){try{return new ie.XMLHttpRequest}catch(e){}};var Yt={0:200,1223:204},Qt=ce.ajaxSettings.xhr();le.cors=!!Qt&&"withCredentials"in Qt,le.ajax=Qt=!!Qt,ce.ajaxTransport(function(i){var o,a;if(le.cors||Qt&&!i.crossDomain)return{send:function(e,t){var n,r=i.xhr();if(r.open(i.type,i.url,i.async,i.username,i.password),i.xhrFields)for(n in i.xhrFields)r[n]=i.xhrFields[n];for(n in i.mimeType&&r.overrideMimeType&&r.overrideMimeType(i.mimeType),i.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest"),e)r.setRequestHeader(n,e[n]);o=function(e){return function(){o&&(o=a=r.onload=r.onerror=r.onabort=r.ontimeout=r.onreadystatechange=null,"abort"===e?r.abort():"error"===e?"number"!=typeof r.status?t(0,"error"):t(r.status,r.statusText):t(Yt[r.status]||r.status,r.statusText,"text"!==(r.responseType||"text")||"string"!=typeof r.responseText?{binary:r.response}:{text:r.responseText},r.getAllResponseHeaders()))}},r.onload=o(),a=r.onerror=r.ontimeout=o("error"),void 0!==r.onabort?r.onabort=a:r.onreadystatechange=function(){4===r.readyState&&ie.setTimeout(function(){o&&a()})},o=o("abort");try{r.send(i.hasContent&&i.data||null)}catch(e){if(o)throw e}},abort:function(){o&&o()}}}),ce.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),ce.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return ce.globalEval(e),e}}}),ce.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),ce.ajaxTransport("script",function(n){var r,i;if(n.crossDomain||n.scriptAttrs)return{send:function(e,t){r=ce("<script>").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),C.head.appendChild(r[0])},abort:function(){i&&i()}}});var Jt,Kt=[],Zt=/(=)\?(?=&|$)|\?\?/;ce.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Kt.pop()||ce.expando+"_"+jt.guid++;return this[e]=!0,e}}),ce.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Zt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Zt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=v(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Zt,"$1"+r):!1!==e.jsonp&&(e.url+=(At.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||ce.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=ie[r],ie[r]=function(){o=arguments},n.always(function(){void 0===i?ce(ie).removeProp(r):ie[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Kt.push(r)),o&&v(i)&&i(o[0]),o=i=void 0}),"script"}),le.createHTMLDocument=((Jt=C.implementation.createHTMLDocument("").body).innerHTML="<form></form><form></form>",2===Jt.childNodes.length),ce.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(le.createHTMLDocument?((r=(t=C.implementation.createHTMLDocument("")).createElement("base")).href=C.location.href,t.head.appendChild(r)):t=C),o=!n&&[],(i=w.exec(e))?[t.createElement(i[1])]:(i=Ae([e],t,o),o&&o.length&&ce(o).remove(),ce.merge([],i.childNodes)));var r,i,o},ce.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1<s&&(r=Tt(e.slice(s)),e=e.slice(0,s)),v(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),0<a.length&&ce.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){o=arguments,a.html(r?ce("<div>").append(ce.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},ce.expr.pseudos.animated=function(t){return ce.grep(ce.timers,function(e){return t===e.elem}).length},ce.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=ce.css(e,"position"),c=ce(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=ce.css(e,"top"),u=ce.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),v(t)&&(t=t.call(e,n,ce.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},ce.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){ce.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===ce.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===ce.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=ce(e).offset()).top+=ce.css(e,"borderTopWidth",!0),i.left+=ce.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-ce.css(r,"marginTop",!0),left:t.left-i.left-ce.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===ce.css(e,"position"))e=e.offsetParent;return e||J})}}),ce.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;ce.fn[t]=function(e){return M(this,function(e,t,n){var r;if(y(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),ce.each(["top","left"],function(e,n){ce.cssHooks[n]=Ye(le.pixelPosition,function(e,t){if(t)return t=Ge(e,n),_e.test(t)?ce(e).position()[n]+"px":t})}),ce.each({Height:"height",Width:"width"},function(a,s){ce.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){ce.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return M(this,function(e,t,n){var r;return y(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?ce.css(e,t,i):ce.style(e,t,n,i)},s,n?e:void 0,n)}})}),ce.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){ce.fn[t]=function(e){return this.on(t,e)}}),ce.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.on("mouseenter",e).on("mouseleave",t||e)}}),ce.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){ce.fn[n]=function(e,t){return 0<arguments.length?this.on(n,null,e,t):this.trigger(n)}});var en=/^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g;ce.proxy=function(e,t){var n,r,i;if("string"==typeof t&&(n=e[t],t=e,e=n),v(e))return r=ae.call(arguments,2),(i=function(){return e.apply(t||this,r.concat(ae.call(arguments)))}).guid=e.guid=e.guid||ce.guid++,i},ce.holdReady=function(e){e?ce.readyWait++:ce.ready(!0)},ce.isArray=Array.isArray,ce.parseJSON=JSON.parse,ce.nodeName=fe,ce.isFunction=v,ce.isWindow=y,ce.camelCase=F,ce.type=x,ce.now=Date.now,ce.isNumeric=function(e){var t=ce.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},ce.trim=function(e){return null==e?"":(e+"").replace(en,"$1")},"function"==typeof define&&define.amd&&define("jquery",[],function(){return ce});var tn=ie.jQuery,nn=ie.$;return ce.noConflict=function(e){return ie.$===ce&&(ie.$=nn),e&&ie.jQuery===ce&&(ie.jQuery=tn),ce},"undefined"==typeof e&&(ie.jQuery=ie.$=ce),ce});!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?a(require("jquery")):a(jQuery)}(function(a){function b(a){return h.raw?a:encodeURIComponent(a)}function c(a){return h.raw?a:decodeURIComponent(a)}function d(a){return b(h.json?JSON.stringify(a):String(a))}function e(a){0===a.indexOf('"')&&(a=a.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return a=decodeURIComponent(a.replace(g," ")),h.json?JSON.parse(a):a}catch(b){}}function f(b,c){var d=h.raw?b:e(b);return a.isFunction(c)?c(d):d}var g=/\+/g,h=a.cookie=function(e,g,i){if(void 0!==g&&!a.isFunction(g)){if(i=a.extend({},h.defaults,i),"number"==typeof i.expires){var j=i.expires,k=i.expires=new Date;k.setTime(+k+864e5*j)}return document.cookie=[b(e),"=",d(g),i.expires?"; expires="+i.expires.toUTCString():"",i.path?"; path="+i.path:"",i.domain?"; domain="+i.domain:"",i.secure?"; secure":""].join("")}for(var l=e?void 0:{},m=document.cookie?document.cookie.split("; "):[],n=0,o=m.length;o>n;n++){var p=m[n].split("="),q=c(p.shift()),r=p.join("=");if(e&&e===q){l=f(r,g);break}e||void 0===(r=f(r))||(l[q]=r)}return l};h.defaults={},a.removeCookie=function(b,c){return void 0===a.cookie(b)?!1:(a.cookie(b,"",a.extend({},c,{expires:-1})),!a.cookie(b))}});!function(e){"use strict";var t=function(){this.cssImportStatements=[],this.cssKeyframeStatements=[],this.cssRegex=new RegExp("([\\s\\S]*?){([\\s\\S]*?)}","gi"),this.cssMediaQueryRegex="((@media [\\s\\S]*?){([\\s\\S]*?}\\s*?)})",this.cssKeyframeRegex="((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})",this.combinedCSSRegex="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",this.cssCommentsRegex="(\\/\\*[\\s\\S]*?\\*\\/)",this.cssImportStatementRegex=new RegExp("@import .*?;","gi")};t.prototype.stripComments=function(e){var t=new RegExp(this.cssCommentsRegex,"gi");return e.replace(t,"")},t.prototype.parseCSS=function(e){if(void 0===e)return[];for(var t=[];;){var s=this.cssImportStatementRegex.exec(e);if(null===s)break;this.cssImportStatements.push(s[0]),t.push({selector:"@imports",type:"imports",styles:s[0]})}e=e.replace(this.cssImportStatementRegex,"");for(var r,i=new RegExp(this.cssKeyframeRegex,"gi");null!==(r=i.exec(e));)t.push({selector:"@keyframes",type:"keyframes",styles:r[0]});e=e.replace(i,"");for(var n=new RegExp(this.combinedCSSRegex,"gi");null!==(r=n.exec(e));){var o="";o=void 0===r[2]?r[5].split("\r\n").join("\n").trim():r[2].split("\r\n").join("\n").trim();var l=new RegExp(this.cssCommentsRegex,"gi"),p=l.exec(o);if(null!==p&&(o=o.replace(l,"").trim()),-1!==(o=o.replace(/\n+/,"\n")).indexOf("@media")){var a={selector:o,type:"media",subStyles:this.parseCSS(r[3]+"\n}")};null!==p&&(a.comments=p[0]),t.push(a)}else{var c={selector:o,rules:this.parseRules(r[6])};"@font-face"===o&&(c.type="font-face"),null!==p&&(c.comments=p[0]),t.push(c)}}return t},t.prototype.parseRules=function(e){var t=[];e=(e=e.split("\r\n").join("\n")).split(";");for(var s=0;s<e.length;s++){var r=e[s];if(-1!==(r=r.trim()).indexOf(":")){var i=(r=r.split(":"))[0].trim(),n=r.slice(1).join(":").trim();if(i.length<1||n.length<1)continue;t.push({directive:i,value:n})}else"base64,"===r.trim().substr(0,7)?t[t.length-1].value+=r.trim():r.length>0&&t.push({directive:"",value:r,defective:!0})}return t},t.prototype.findCorrespondingRule=function(e,t,s){void 0===s&&(s=!1);for(var r=!1,i=0;i<e.length&&(e[i].directive!==t||(r=e[i],s!==e[i].value));i++);return r},t.prototype.findBySelector=function(e,t,s){void 0===s&&(s=!1);for(var r=[],i=0;i<e.length;i++)!1===s?e[i].selector===t&&r.push(e[i]):-1!==e[i].selector.indexOf(t)&&r.push(e[i]);if("@imports"===t||r.length<2)return r;var n=r[0];for(i=1;i<r.length;i++)this.intelligentCSSPush([n],r[i]);return[n]},t.prototype.deleteBySelector=function(e,t){for(var s=[],r=0;r<e.length;r++)e[r].selector!==t&&s.push(e[r]);return s},t.prototype.compressCSS=function(e){for(var t=[],s={},r=0;r<e.length;r++){var i=e[r];if(!0!==s[i.selector]){var n=this.findBySelector(e,i.selector);0!==n.length&&(t=t.concat(n),s[i.selector]=!0)}}return t},t.prototype.cssDiff=function(e,t){if(e.selector!==t.selector)return!1;if("media"===e.type||"media"===t.type)return!1;for(var s,r,i={selector:e.selector,rules:[]},n=0;n<e.rules.length;n++)s=e.rules[n],!1===(r=this.findCorrespondingRule(t.rules,s.directive,s.value))?i.rules.push(s):s.value!==r.value&&i.rules.push(s);for(var o=0;o<t.rules.length;o++)r=t.rules[o],!1===(s=this.findCorrespondingRule(e.rules,r.directive))&&(r.type="DELETED",i.rules.push(r));return 0!==i.rules.length&&i},t.prototype.intelligentMerge=function(e,t,s){void 0===s&&(s=!1);for(var r=0;r<t.length;r++)this.intelligentCSSPush(e,t[r],s);for(r=0;r<e.length;r++){var i=e[r];"media"!==i.type&&"keyframes"!==i.type&&(i.rules=this.compactRules(i.rules))}},t.prototype.intelligentCSSPush=function(e,t,s){var r=t.selector,i=!1;if(void 0===s&&(s=!1),!1===s){for(var n=0;n<e.length;n++)if(e[n].selector===r){i=e[n];break}}else for(var o=e.length-1;o>-1;o--)if(e[o].selector===r){i=e[o];break}if(!1===i)e.push(t);else if("media"!==t.type)for(var l=0;l<t.rules.length;l++){var p=t.rules[l],a=this.findCorrespondingRule(i.rules,p.directive);!1===a?i.rules.push(p):"DELETED"===p.type?a.type="DELETED":a.value=p.value}else i.subStyles=i.subStyles.concat(t.subStyles)},t.prototype.compactRules=function(e){for(var t=[],s=0;s<e.length;s++)"DELETED"!==e[s].type&&t.push(e[s]);return t},t.prototype.getCSSForEditor=function(e,t){void 0===t&&(t=0);var s="";void 0===e&&(e=this.css);for(var r=0;r<e.length;r++)"imports"===e[r].type&&(s+=e[r].styles+"\n\n");for(r=0;r<e.length;r++){var i=e[r];if(void 0!==i.selector){var n="";void 0!==i.comments&&(n=i.comments+"\n"),"media"===i.type?(s+=n+i.selector+"{\n",s+=this.getCSSForEditor(i.subStyles,t+1),s+="}\n\n"):"keyframes"!==i.type&&"imports"!==i.type&&(s+=this.getSpaces(t)+n+i.selector+" {\n",s+=this.getCSSOfRules(i.rules,t+1),s+=this.getSpaces(t)+"}\n\n")}}for(r=0;r<e.length;r++)"keyframes"===e[r].type&&(s+=e[r].styles+"\n\n");return s},t.prototype.getImports=function(e){for(var t=[],s=0;s<e.length;s++)"imports"===e[s].type&&t.push(e[s].styles);return t},t.prototype.getCSSOfRules=function(e,t){for(var s="",r=0;r<e.length;r++)void 0!==e[r]&&(void 0===e[r].defective?s+=this.getSpaces(t)+e[r].directive+": "+e[r].value+";\n":s+=this.getSpaces(t)+e[r].value+";\n");return s||"\n"},t.prototype.getSpaces=function(e){for(var t="",s=0;s<4*e;s++)t+=" ";return t},t.prototype.applyNamespacing=function(e,t){var s=e,r="."+this.cssPreviewNamespace;void 0!==t&&(r=t),"string"==typeof e&&(s=this.parseCSS(e));for(var i=0;i<s.length;i++){var n=s[i];if(!(n.selector.indexOf("@font-face")>-1||n.selector.indexOf("keyframes")>-1||n.selector.indexOf("@import")>-1||n.selector.indexOf(".form-all")>-1||n.selector.indexOf("#stage")>-1))if("media"!==n.type){for(var o=n.selector.split(","),l=[],p=0;p<o.length;p++)-1===o[p].indexOf(".supernova")?l.push(r+" "+o[p]):l.push(o[p]);n.selector=l.join(",")}else n.subStyles=this.applyNamespacing(n.subStyles,t)}return s},t.prototype.clearNamespacing=function(e,t){void 0===t&&(t=!1);var s=e,r="."+this.cssPreviewNamespace;"string"==typeof e&&(s=this.parseCSS(e));for(var i=0;i<s.length;i++){var n=s[i];if("media"!==n.type){for(var o=n.selector.split(","),l=[],p=0;p<o.length;p++)l.push(o[p].split(r+" ").join(""));n.selector=l.join(",")}else n.subStyles=this.clearNamespacing(n.subStyles,!0)}return!1===t?this.getCSSForEditor(s):s},t.prototype.createStyleElement=function(e,t,s){if(void 0===s&&(s=!1),!1===this.testMode&&"nonamespace"!==s&&(t=this.applyNamespacing(t)),"string"!=typeof t&&(t=this.getCSSForEditor(t)),!0===s&&(t=this.getCSSForEditor(this.parseCSS(t))),!1!==this.testMode)return this.testMode("create style #"+e,t);var r=document.getElementById(e);r&&r.parentNode.removeChild(r);var i=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.id=e,n.type="text/css",i.appendChild(n),n.styleSheet&&!n.sheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))},e.cssjs=t}(this);!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).PouchDB=e()}}(function(){return function e(t,n,r){function i(s,a){if(!n[s]){if(!t[s]){var c="function"==typeof require&&require;if(!a&&c)return c(s,!0);if(o)return o(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var f=n[s]={exports:{}};t[s][0].call(f.exports,function(e){return i(t[s][1][e]||e)},f,f.exports,e,t,n,r)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(e,t,n){var r=Object.create||function(e){var t=function(){};return t.prototype=e,new t},i=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return n},o=Function.prototype.bind||function(e){var t=this;return function(){return t.apply(e,arguments)}};function s(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=r(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}t.exports=s,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._maxListeners=void 0;var a,c=10;try{var u={};Object.defineProperty&&Object.defineProperty(u,"x",{value:0}),a=0===u.x}catch(e){a=!1}function f(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function l(e,t,n){if(t)e.call(n);else for(var r=e.length,i=w(e,r),o=0;o<r;++o)i[o].call(n)}function d(e,t,n,r){if(t)e.call(n,r);else for(var i=e.length,o=w(e,i),s=0;s<i;++s)o[s].call(n,r)}function h(e,t,n,r,i){if(t)e.call(n,r,i);else for(var o=e.length,s=w(e,o),a=0;a<o;++a)s[a].call(n,r,i)}function p(e,t,n,r,i,o){if(t)e.call(n,r,i,o);else for(var s=e.length,a=w(e,s),c=0;c<s;++c)a[c].call(n,r,i,o)}function v(e,t,n,r){if(t)e.apply(n,r);else for(var i=e.length,o=w(e,i),s=0;s<i;++s)o[s].apply(n,r)}function _(e,t,n,i){var o,s,a;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((s=e._events)?(s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),a=s[t]):(s=e._events=r(null),e._eventsCount=0),a){if("function"==typeof a?a=s[t]=i?[n,a]:[a,n]:i?a.unshift(n):a.push(n),!a.warned&&(o=f(e))&&o>0&&a.length>o){a.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+a.length+' "'+String(t)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=a.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",c.name,c.message)}}else a=s[t]=n,++e._eventsCount;return e}function y(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var e=new Array(arguments.length),t=0;t<e.length;++t)e[t]=arguments[t];this.listener.apply(this.target,e)}}function g(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=o.call(y,r);return i.listener=n,r.wrapFn=i,i}function m(e,t,n){var r=e._events;if(!r)return[];var i=r[t];return i?"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):w(i,i.length):[]}function b(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function w(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}a?Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if("number"!=typeof e||e<0||e!=e)throw new TypeError('"defaultMaxListeners" must be a positive number');c=e}}):s.defaultMaxListeners=c,s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return f(this)},s.prototype.emit=function(e){var t,n,r,i,o,s,a="error"===e;if(s=this._events)a=a&&null==s.error;else if(!a)return!1;if(a){if(arguments.length>1&&(t=arguments[1]),t instanceof Error)throw t;var c=new Error('Unhandled "error" event. ('+t+")");throw c.context=t,c}if(!(n=s[e]))return!1;var u="function"==typeof n;switch(r=arguments.length){case 1:l(n,u,this);break;case 2:d(n,u,this,arguments[1]);break;case 3:h(n,u,this,arguments[1],arguments[2]);break;case 4:p(n,u,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),o=1;o<r;o++)i[o-1]=arguments[o];v(n,u,this,i)}return!0},s.prototype.addListener=function(e,t){return _(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return _(this,e,t,!0)},s.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,g(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,g(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,i,o,s,a;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(i=this._events))return this;if(!(n=i[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=r(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(o=-1,s=n.length-1;s>=0;s--)if(n[s]===t||n[s].listener===t){a=n[s].listener,o=s;break}if(o<0)return this;0===o?n.shift():function(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1)e[n]=e[r];e.pop()}(n,o),1===n.length&&(i[e]=n[0]),i.removeListener&&this.emit("removeListener",e,a||t)}return this},s.prototype.removeAllListeners=function(e){var t,n,o;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=r(null),this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=r(null):delete n[e]),this;if(0===arguments.length){var s,a=i(n);for(o=0;o<a.length;++o)"removeListener"!==(s=a[o])&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=r(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(t)for(o=t.length-1;o>=0;o--)this.removeListener(e,t[o]);return this},s.prototype.listeners=function(e){return m(this,e,!0)},s.prototype.rawListeners=function(e){return m(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):b.call(e,t)},s.prototype.listenerCount=b,s.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],2:[function(e,t,n){var r,i,o=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function c(e){if(r===setTimeout)return setTimeout(e,0);if((r===s||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:s}catch(e){r=s}try{i="function"==typeof clearTimeout?clearTimeout:a}catch(e){i=a}}();var u,f=[],l=!1,d=-1;function h(){l&&u&&(l=!1,u.length?f=u.concat(f):d=-1,f.length&&p())}function p(){if(!l){var e=c(h);l=!0;for(var t=f.length;t;){for(u=f,f=[];++d<t;)u&&u[d].run();d=-1,t=f.length}u=null,l=!1,function(e){if(i===clearTimeout)return clearTimeout(e);if((i===a||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}(e)}}function v(e,t){this.fun=e,this.array=t}function _(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];f.push(new v(e,t)),1!==f.length||l||c(p)},v.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=_,o.addListener=_,o.once=_,o.off=_,o.removeListener=_,o.removeAllListeners=_,o.emit=_,o.prependListener=_,o.prependOnceListener=_,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},{}],3:[function(e,t,n){!function(e){if("object"==typeof n)t.exports=e();else{var r;try{r=window}catch(e){r=self}r.SparkMD5=e()}}(function(e){"use strict";var t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function n(e,t){var n=e[0],r=e[1],i=e[2],o=e[3];r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&i|~r&o)+t[0]-680876936|0)<<7|n>>>25)+r|0)&r|~n&i)+t[1]-389564586|0)<<12|o>>>20)+n|0)&n|~o&r)+t[2]+606105819|0)<<17|i>>>15)+o|0)&o|~i&n)+t[3]-1044525330|0)<<22|r>>>10)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&i|~r&o)+t[4]-176418897|0)<<7|n>>>25)+r|0)&r|~n&i)+t[5]+1200080426|0)<<12|o>>>20)+n|0)&n|~o&r)+t[6]-1473231341|0)<<17|i>>>15)+o|0)&o|~i&n)+t[7]-45705983|0)<<22|r>>>10)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&i|~r&o)+t[8]+1770035416|0)<<7|n>>>25)+r|0)&r|~n&i)+t[9]-1958414417|0)<<12|o>>>20)+n|0)&n|~o&r)+t[10]-42063|0)<<17|i>>>15)+o|0)&o|~i&n)+t[11]-1990404162|0)<<22|r>>>10)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&i|~r&o)+t[12]+1804603682|0)<<7|n>>>25)+r|0)&r|~n&i)+t[13]-40341101|0)<<12|o>>>20)+n|0)&n|~o&r)+t[14]-1502002290|0)<<17|i>>>15)+o|0)&o|~i&n)+t[15]+1236535329|0)<<22|r>>>10)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&o|i&~o)+t[1]-165796510|0)<<5|n>>>27)+r|0)&i|r&~i)+t[6]-1069501632|0)<<9|o>>>23)+n|0)&r|n&~r)+t[11]+643717713|0)<<14|i>>>18)+o|0)&n|o&~n)+t[0]-373897302|0)<<20|r>>>12)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&o|i&~o)+t[5]-701558691|0)<<5|n>>>27)+r|0)&i|r&~i)+t[10]+38016083|0)<<9|o>>>23)+n|0)&r|n&~r)+t[15]-660478335|0)<<14|i>>>18)+o|0)&n|o&~n)+t[4]-405537848|0)<<20|r>>>12)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&o|i&~o)+t[9]+568446438|0)<<5|n>>>27)+r|0)&i|r&~i)+t[14]-1019803690|0)<<9|o>>>23)+n|0)&r|n&~r)+t[3]-187363961|0)<<14|i>>>18)+o|0)&n|o&~n)+t[8]+1163531501|0)<<20|r>>>12)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&o|i&~o)+t[13]-1444681467|0)<<5|n>>>27)+r|0)&i|r&~i)+t[2]-51403784|0)<<9|o>>>23)+n|0)&r|n&~r)+t[7]+1735328473|0)<<14|i>>>18)+o|0)&n|o&~n)+t[12]-1926607734|0)<<20|r>>>12)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r^i^o)+t[5]-378558|0)<<4|n>>>28)+r|0)^r^i)+t[8]-2022574463|0)<<11|o>>>21)+n|0)^n^r)+t[11]+1839030562|0)<<16|i>>>16)+o|0)^o^n)+t[14]-35309556|0)<<23|r>>>9)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r^i^o)+t[1]-1530992060|0)<<4|n>>>28)+r|0)^r^i)+t[4]+1272893353|0)<<11|o>>>21)+n|0)^n^r)+t[7]-155497632|0)<<16|i>>>16)+o|0)^o^n)+t[10]-1094730640|0)<<23|r>>>9)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r^i^o)+t[13]+681279174|0)<<4|n>>>28)+r|0)^r^i)+t[0]-358537222|0)<<11|o>>>21)+n|0)^n^r)+t[3]-722521979|0)<<16|i>>>16)+o|0)^o^n)+t[6]+76029189|0)<<23|r>>>9)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r^i^o)+t[9]-640364487|0)<<4|n>>>28)+r|0)^r^i)+t[12]-421815835|0)<<11|o>>>21)+n|0)^n^r)+t[15]+530742520|0)<<16|i>>>16)+o|0)^o^n)+t[2]-995338651|0)<<23|r>>>9)+i|0,r=((r+=((o=((o+=(r^((n=((n+=(i^(r|~o))+t[0]-198630844|0)<<6|n>>>26)+r|0)|~i))+t[7]+1126891415|0)<<10|o>>>22)+n|0)^((i=((i+=(n^(o|~r))+t[14]-1416354905|0)<<15|i>>>17)+o|0)|~n))+t[5]-57434055|0)<<21|r>>>11)+i|0,r=((r+=((o=((o+=(r^((n=((n+=(i^(r|~o))+t[12]+1700485571|0)<<6|n>>>26)+r|0)|~i))+t[3]-1894986606|0)<<10|o>>>22)+n|0)^((i=((i+=(n^(o|~r))+t[10]-1051523|0)<<15|i>>>17)+o|0)|~n))+t[1]-2054922799|0)<<21|r>>>11)+i|0,r=((r+=((o=((o+=(r^((n=((n+=(i^(r|~o))+t[8]+1873313359|0)<<6|n>>>26)+r|0)|~i))+t[15]-30611744|0)<<10|o>>>22)+n|0)^((i=((i+=(n^(o|~r))+t[6]-1560198380|0)<<15|i>>>17)+o|0)|~n))+t[13]+1309151649|0)<<21|r>>>11)+i|0,r=((r+=((o=((o+=(r^((n=((n+=(i^(r|~o))+t[4]-145523070|0)<<6|n>>>26)+r|0)|~i))+t[11]-1120210379|0)<<10|o>>>22)+n|0)^((i=((i+=(n^(o|~r))+t[2]+718787259|0)<<15|i>>>17)+o|0)|~n))+t[9]-343485551|0)<<21|r>>>11)+i|0,e[0]=n+e[0]|0,e[1]=r+e[1]|0,e[2]=i+e[2]|0,e[3]=o+e[3]|0}function r(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function i(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n}function o(e){var t,i,o,s,a,c,u=e.length,f=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=u;t+=64)n(f,r(e.substring(t-64,t)));for(i=(e=e.substring(t-64)).length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t<i;t+=1)o[t>>2]|=e.charCodeAt(t)<<(t%4<<3);if(o[t>>2]|=128<<(t%4<<3),t>55)for(n(f,o),t=0;t<16;t+=1)o[t]=0;return s=(s=8*u).toString(16).match(/(.*?)(.{0,8})$/),a=parseInt(s[2],16),c=parseInt(s[1],16)||0,o[14]=a,o[15]=c,n(f,o),f}function s(e){var n,r="";for(n=0;n<4;n+=1)r+=t[e>>8*n+4&15]+t[e>>8*n&15];return r}function a(e){var t;for(t=0;t<e.length;t+=1)e[t]=s(e[t]);return e.join("")}function c(e){return/[\u0080-\uFFFF]/.test(e)&&(e=unescape(encodeURIComponent(e))),e}function u(e){var t,n=[],r=e.length;for(t=0;t<r-1;t+=2)n.push(parseInt(e.substr(t,2),16));return String.fromCharCode.apply(String,n)}function f(){this.reset()}return"5d41402abc4b2a76b9719d911017c592"!==a(o("hello"))&&function(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n},"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||function(){function t(e,t){return(e=0|e||0)<0?Math.max(e+t,0):Math.min(e,t)}ArrayBuffer.prototype.slice=function(n,r){var i,o,s,a,c=this.byteLength,u=t(n,c),f=c;return r!==e&&(f=t(r,c)),u>f?new ArrayBuffer(0):(i=f-u,o=new ArrayBuffer(i),s=new Uint8Array(o),a=new Uint8Array(this,u,i),s.set(a),o)}}(),f.prototype.append=function(e){return this.appendBinary(c(e)),this},f.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,i=this._buff.length;for(t=64;t<=i;t+=64)n(this._hash,r(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},f.prototype.end=function(e){var t,n,r=this._buff,i=r.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<i;t+=1)o[t>>2]|=r.charCodeAt(t)<<(t%4<<3);return this._finish(o,i),n=a(this._hash),e&&(n=u(n)),this.reset(),n},f.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},f.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},f.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},f.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},f.prototype._finish=function(e,t){var r,i,o,s=t;if(e[s>>2]|=128<<(s%4<<3),s>55)for(n(this._hash,e),s=0;s<16;s+=1)e[s]=0;r=(r=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),i=parseInt(r[2],16),o=parseInt(r[1],16)||0,e[14]=i,e[15]=o,n(this._hash,e)},f.hash=function(e,t){return f.hashBinary(c(e),t)},f.hashBinary=function(e,t){var n=a(o(e));return t?u(n):n},f.ArrayBuffer=function(){this.reset()},f.ArrayBuffer.prototype.append=function(e){var t,r,o,s,a,c=(r=this._buff.buffer,o=e,s=!0,(a=new Uint8Array(r.byteLength+o.byteLength)).set(new Uint8Array(r)),a.set(new Uint8Array(o),r.byteLength),s?a:a.buffer),u=c.length;for(this._length+=e.byteLength,t=64;t<=u;t+=64)n(this._hash,i(c.subarray(t-64,t)));return this._buff=t-64<u?new Uint8Array(c.buffer.slice(t-64)):new Uint8Array(0),this},f.ArrayBuffer.prototype.end=function(e){var t,n,r=this._buff,i=r.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<i;t+=1)o[t>>2]|=r[t]<<(t%4<<3);return this._finish(o,i),n=a(this._hash),e&&(n=u(n)),this.reset(),n},f.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},f.ArrayBuffer.prototype.getState=function(){var e,t=f.prototype.getState.call(this);return t.buff=(e=t.buff,String.fromCharCode.apply(null,new Uint8Array(e))),t},f.ArrayBuffer.prototype.setState=function(e){return e.buff=function(e,t){var n,r=e.length,i=new ArrayBuffer(r),o=new Uint8Array(i);for(n=0;n<r;n+=1)o[n]=e.charCodeAt(n);return t?o:i}(e.buff,!0),f.prototype.setState.call(this,e)},f.ArrayBuffer.prototype.destroy=f.prototype.destroy,f.ArrayBuffer.prototype._finish=f.prototype._finish,f.ArrayBuffer.hash=function(e,t){var r=a(function(e){var t,r,o,s,a,c,u=e.length,f=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=u;t+=64)n(f,i(e.subarray(t-64,t)));for(r=(e=t-64<u?e.subarray(t-64):new Uint8Array(0)).length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t<r;t+=1)o[t>>2]|=e[t]<<(t%4<<3);if(o[t>>2]|=128<<(t%4<<3),t>55)for(n(f,o),t=0;t<16;t+=1)o[t]=0;return s=(s=8*u).toString(16).match(/(.*?)(.{0,8})$/),a=parseInt(s[2],16),c=parseInt(s[1],16)||0,o[14]=a,o[15]=c,n(f,o),f}(new Uint8Array(e)));return t?u(r):r},f})},{}],4:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"v1",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(n,"v3",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(n,"v4",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(n,"v5",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(n,"NIL",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(n,"version",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(n,"validate",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(n,"stringify",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(n,"parse",{enumerable:!0,get:function(){return l.default}});var r=d(e("./v1.js")),i=d(e("./v3.js")),o=d(e("./v4.js")),s=d(e("./v5.js")),a=d(e("./nil.js")),c=d(e("./version.js")),u=d(e("./validate.js")),f=d(e("./stringify.js")),l=d(e("./parse.js"));function d(e){return e&&e.__esModule?e:{default:e}}},{"./nil.js":6,"./parse.js":7,"./stringify.js":11,"./v1.js":12,"./v3.js":13,"./v4.js":15,"./v5.js":16,"./validate.js":17,"./version.js":18}],5:[function(e,t,n){"use strict";function r(e){return 14+(e+64>>>9<<4)+1}function i(e,t){const n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function o(e,t,n,r,o,s){return i((a=i(i(t,e),i(r,s)))<<(c=o)|a>>>32-c,n);var a,c}function s(e,t,n,r,i,s,a){return o(t&n|~t&r,e,t,i,s,a)}function a(e,t,n,r,i,s,a){return o(t&r|n&~r,e,t,i,s,a)}function c(e,t,n,r,i,s,a){return o(t^n^r,e,t,i,s,a)}function u(e,t,n,r,i,s,a){return o(n^(t|~r),e,t,i,s,a)}Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var f=function(e){if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(let n=0;n<t.length;++n)e[n]=t.charCodeAt(n)}return function(e){const t=[],n=32*e.length;for(let r=0;r<n;r+=8){const n=e[r>>5]>>>r%32&255,i=parseInt("0123456789abcdef".charAt(n>>>4&15)+"0123456789abcdef".charAt(15&n),16);t.push(i)}return t}(function(e,t){e[t>>5]|=128<<t%32,e[r(t)-1]=t;let n=1732584193,o=-271733879,f=-1732584194,l=271733878;for(let t=0;t<e.length;t+=16){const r=n,d=o,h=f,p=l;n=s(n,o,f,l,e[t],7,-680876936),l=s(l,n,o,f,e[t+1],12,-389564586),f=s(f,l,n,o,e[t+2],17,606105819),o=s(o,f,l,n,e[t+3],22,-1044525330),n=s(n,o,f,l,e[t+4],7,-176418897),l=s(l,n,o,f,e[t+5],12,1200080426),f=s(f,l,n,o,e[t+6],17,-1473231341),o=s(o,f,l,n,e[t+7],22,-45705983),n=s(n,o,f,l,e[t+8],7,1770035416),l=s(l,n,o,f,e[t+9],12,-1958414417),f=s(f,l,n,o,e[t+10],17,-42063),o=s(o,f,l,n,e[t+11],22,-1990404162),n=s(n,o,f,l,e[t+12],7,1804603682),l=s(l,n,o,f,e[t+13],12,-40341101),f=s(f,l,n,o,e[t+14],17,-1502002290),o=s(o,f,l,n,e[t+15],22,1236535329),n=a(n,o,f,l,e[t+1],5,-165796510),l=a(l,n,o,f,e[t+6],9,-1069501632),f=a(f,l,n,o,e[t+11],14,643717713),o=a(o,f,l,n,e[t],20,-373897302),n=a(n,o,f,l,e[t+5],5,-701558691),l=a(l,n,o,f,e[t+10],9,38016083),f=a(f,l,n,o,e[t+15],14,-660478335),o=a(o,f,l,n,e[t+4],20,-405537848),n=a(n,o,f,l,e[t+9],5,568446438),l=a(l,n,o,f,e[t+14],9,-1019803690),f=a(f,l,n,o,e[t+3],14,-187363961),o=a(o,f,l,n,e[t+8],20,1163531501),n=a(n,o,f,l,e[t+13],5,-1444681467),l=a(l,n,o,f,e[t+2],9,-51403784),f=a(f,l,n,o,e[t+7],14,1735328473),o=a(o,f,l,n,e[t+12],20,-1926607734),n=c(n,o,f,l,e[t+5],4,-378558),l=c(l,n,o,f,e[t+8],11,-2022574463),f=c(f,l,n,o,e[t+11],16,1839030562),o=c(o,f,l,n,e[t+14],23,-35309556),n=c(n,o,f,l,e[t+1],4,-1530992060),l=c(l,n,o,f,e[t+4],11,1272893353),f=c(f,l,n,o,e[t+7],16,-155497632),o=c(o,f,l,n,e[t+10],23,-1094730640),n=c(n,o,f,l,e[t+13],4,681279174),l=c(l,n,o,f,e[t],11,-358537222),f=c(f,l,n,o,e[t+3],16,-722521979),o=c(o,f,l,n,e[t+6],23,76029189),n=c(n,o,f,l,e[t+9],4,-640364487),l=c(l,n,o,f,e[t+12],11,-421815835),f=c(f,l,n,o,e[t+15],16,530742520),o=c(o,f,l,n,e[t+2],23,-995338651),n=u(n,o,f,l,e[t],6,-198630844),l=u(l,n,o,f,e[t+7],10,1126891415),f=u(f,l,n,o,e[t+14],15,-1416354905),o=u(o,f,l,n,e[t+5],21,-57434055),n=u(n,o,f,l,e[t+12],6,1700485571),l=u(l,n,o,f,e[t+3],10,-1894986606),f=u(f,l,n,o,e[t+10],15,-1051523),o=u(o,f,l,n,e[t+1],21,-2054922799),n=u(n,o,f,l,e[t+8],6,1873313359),l=u(l,n,o,f,e[t+15],10,-30611744),f=u(f,l,n,o,e[t+6],15,-1560198380),o=u(o,f,l,n,e[t+13],21,1309151649),n=u(n,o,f,l,e[t+4],6,-145523070),l=u(l,n,o,f,e[t+11],10,-1120210379),f=u(f,l,n,o,e[t+2],15,718787259),o=u(o,f,l,n,e[t+9],21,-343485551),n=i(n,r),o=i(o,d),f=i(f,h),l=i(l,p)}return[n,o,f,l]}(function(e){if(0===e.length)return[];const t=8*e.length,n=new Uint32Array(r(t));for(let r=0;r<t;r+=8)n[r>>5]|=(255&e[r/8])<<r%32;return n}(e),8*e.length))};n.default=f},{}],6:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;n.default="00000000-0000-0000-0000-000000000000"},{}],7:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r,i=(r=e("./validate.js"))&&r.__esModule?r:{default:r};var o=function(e){if(!(0,i.default)(e))throw TypeError("Invalid UUID");let t;const n=new Uint8Array(16);return n[0]=(t=parseInt(e.slice(0,8),16))>>>24,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=255&t,n[4]=(t=parseInt(e.slice(9,13),16))>>>8,n[5]=255&t,n[6]=(t=parseInt(e.slice(14,18),16))>>>8,n[7]=255&t,n[8]=(t=parseInt(e.slice(19,23),16))>>>8,n[9]=255&t,n[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,n[11]=t/4294967296&255,n[12]=t>>>24&255,n[13]=t>>>16&255,n[14]=t>>>8&255,n[15]=255&t,n};n.default=o},{"./validate.js":17}],8:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;n.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i},{}],9:[function(e,t,n){"use strict";let r;Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(){if(!r&&(r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),!r))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(i)};const i=new Uint8Array(16)},{}],10:[function(e,t,n){"use strict";function r(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:return t^n^r;case 2:return t&n^t&r^n&r;case 3:return t^n^r}}function i(e,t){return e<<t|e>>>32-t}Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var o=function(e){const t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=[];for(let n=0;n<t.length;++n)e.push(t.charCodeAt(n))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);const o=e.length/4+2,s=Math.ceil(o/16),a=new Array(s);for(let t=0;t<s;++t){const n=new Uint32Array(16);for(let r=0;r<16;++r)n[r]=e[64*t+4*r]<<24|e[64*t+4*r+1]<<16|e[64*t+4*r+2]<<8|e[64*t+4*r+3];a[t]=n}a[s-1][14]=8*(e.length-1)/Math.pow(2,32),a[s-1][14]=Math.floor(a[s-1][14]),a[s-1][15]=8*(e.length-1)&4294967295;for(let e=0;e<s;++e){const o=new Uint32Array(80);for(let t=0;t<16;++t)o[t]=a[e][t];for(let e=16;e<80;++e)o[e]=i(o[e-3]^o[e-8]^o[e-14]^o[e-16],1);let s=n[0],c=n[1],u=n[2],f=n[3],l=n[4];for(let e=0;e<80;++e){const n=Math.floor(e/20),a=i(s,5)+r(n,c,u,f)+l+t[n]+o[e]>>>0;l=f,f=u,u=i(c,30)>>>0,c=s,s=a}n[0]=n[0]+s>>>0,n[1]=n[1]+c>>>0,n[2]=n[2]+u>>>0,n[3]=n[3]+f>>>0,n[4]=n[4]+l>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]};n.default=o},{}],11:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r,i=(r=e("./validate.js"))&&r.__esModule?r:{default:r};const o=[];for(let e=0;e<256;++e)o.push((e+256).toString(16).substr(1));var s=function(e,t=0){const n=(o[e[t+0]]+o[e[t+1]]+o[e[t+2]]+o[e[t+3]]+"-"+o[e[t+4]]+o[e[t+5]]+"-"+o[e[t+6]]+o[e[t+7]]+"-"+o[e[t+8]]+o[e[t+9]]+"-"+o[e[t+10]]+o[e[t+11]]+o[e[t+12]]+o[e[t+13]]+o[e[t+14]]+o[e[t+15]]).toLowerCase();if(!(0,i.default)(n))throw TypeError("Stringified UUID is invalid");return n};n.default=s},{"./validate.js":17}],12:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=o(e("./rng.js")),i=o(e("./stringify.js"));function o(e){return e&&e.__esModule?e:{default:e}}let s,a,c=0,u=0;var f=function(e,t,n){let o=t&&n||0;const f=t||new Array(16);let l=(e=e||{}).node||s,d=void 0!==e.clockseq?e.clockseq:a;if(null==l||null==d){const t=e.random||(e.rng||r.default)();null==l&&(l=s=[1|t[0],t[1],t[2],t[3],t[4],t[5]]),null==d&&(d=a=16383&(t[6]<<8|t[7]))}let h=void 0!==e.msecs?e.msecs:Date.now(),p=void 0!==e.nsecs?e.nsecs:u+1;const v=h-c+(p-u)/1e4;if(v<0&&void 0===e.clockseq&&(d=d+1&16383),(v<0||h>c)&&void 0===e.nsecs&&(p=0),p>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");c=h,u=p,a=d,h+=122192928e5;const _=(1e4*(268435455&h)+p)%4294967296;f[o++]=_>>>24&255,f[o++]=_>>>16&255,f[o++]=_>>>8&255,f[o++]=255&_;const y=h/4294967296*1e4&268435455;f[o++]=y>>>8&255,f[o++]=255&y,f[o++]=y>>>24&15|16,f[o++]=y>>>16&255,f[o++]=d>>>8|128,f[o++]=255&d;for(let e=0;e<6;++e)f[o+e]=l[e];return t||(0,i.default)(f)};n.default=f},{"./rng.js":9,"./stringify.js":11}],13:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=o(e("./v35.js")),i=o(e("./md5.js"));function o(e){return e&&e.__esModule?e:{default:e}}var s=(0,r.default)("v3",48,i.default);n.default=s},{"./md5.js":5,"./v35.js":14}],14:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(e,t,n){function o(e,o,s,a){if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));const t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n));return t}(e)),"string"==typeof o&&(o=(0,i.default)(o)),16!==o.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+e.length);if(c.set(o),c.set(e,o.length),c=n(c),c[6]=15&c[6]|t,c[8]=63&c[8]|128,s){a=a||0;for(let e=0;e<16;++e)s[a+e]=c[e];return s}return(0,r.default)(c)}try{o.name=e}catch(e){}return o.DNS=s,o.URL=a,o},n.URL=n.DNS=void 0;var r=o(e("./stringify.js")),i=o(e("./parse.js"));function o(e){return e&&e.__esModule?e:{default:e}}const s="6ba7b810-9dad-11d1-80b4-00c04fd430c8";n.DNS=s;const a="6ba7b811-9dad-11d1-80b4-00c04fd430c8";n.URL=a},{"./parse.js":7,"./stringify.js":11}],15:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=o(e("./rng.js")),i=o(e("./stringify.js"));function o(e){return e&&e.__esModule?e:{default:e}}var s=function(e,t,n){const o=(e=e||{}).random||(e.rng||r.default)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=o[e];return t}return(0,i.default)(o)};n.default=s},{"./rng.js":9,"./stringify.js":11}],16:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=o(e("./v35.js")),i=o(e("./sha1.js"));function o(e){return e&&e.__esModule?e:{default:e}}var s=(0,r.default)("v5",80,i.default);n.default=s},{"./sha1.js":10,"./v35.js":14}],17:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r,i=(r=e("./regex.js"))&&r.__esModule?r:{default:r};var o=function(e){return"string"==typeof e&&i.default.test(e)};n.default=o},{"./regex.js":8}],18:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r,i=(r=e("./validate.js"))&&r.__esModule?r:{default:r};var o=function(e){if(!(0,i.default)(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)};n.default=o},{"./validate.js":17}],19:[function(e,t,n){"use strict";function r(e,t,n){var r=n[n.length-1];e===r.element&&(n.pop(),r=n[n.length-1]);var i=r.element,o=r.index;if(Array.isArray(i))i.push(e);else if(o===t.length-2){i[t.pop()]=e}else t.push(e)}n.stringify=function(e){var t=[];t.push({obj:e});for(var n,r,i,o,s,a,c,u,f,l,d="";n=t.pop();)if(r=n.obj,d+=n.prefix||"",i=n.val||"")d+=i;else if("object"!=typeof r)d+=void 0===r?null:JSON.stringify(r);else if(null===r)d+="null";else if(Array.isArray(r)){for(t.push({val:"]"}),o=r.length-1;o>=0;o--)s=0===o?"":",",t.push({obj:r[o],prefix:s});t.push({val:"["})}else{for(c in a=[],r)r.hasOwnProperty(c)&&a.push(c);for(t.push({val:"}"}),o=a.length-1;o>=0;o--)f=r[u=a[o]],l=o>0?",":"",l+=JSON.stringify(u)+":",t.push({obj:f,prefix:l});t.push({val:"{"})}return d},n.parse=function(e){for(var t,n,i,o,s,a,c,u,f,l=[],d=[],h=0;;)if("}"!==(t=e[h++])&&"]"!==t&&void 0!==t)switch(t){case" ":case"\t":case"\n":case":":case",":break;case"n":h+=3,r(null,l,d);break;case"t":h+=3,r(!0,l,d);break;case"f":h+=4,r(!1,l,d);break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"-":for(n="",h--;;){if(i=e[h++],!/[\d\.\-e\+]/.test(i)){h--;break}n+=i}r(parseFloat(n),l,d);break;case'"':for(o="",s=void 0,a=0;'"'!==(c=e[h++])||"\\"===s&&a%2==1;)o+=c,"\\"===(s=c)?a++:a=0;r(JSON.parse('"'+o+'"'),l,d);break;case"[":u={element:[],index:l.length},l.push(u.element),d.push(u);break;case"{":f={element:{},index:l.length},l.push(f.element),d.push(f);break;default:throw new Error("unexpectedly reached end of input: "+t)}else{if(1===l.length)return l.pop();r(l.pop(),l,d)}}},{}],20:[function(e,t,n){(function(n){(function(){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var i=r(e("spark-md5")),o=e("uuid"),s=r(e("vuvuzela")),a=r(e("events"));var c=Function.prototype.toString,u=c.call(Object);function f(e){var t,n,r;if(!e||"object"!=typeof e)return e;if(Array.isArray(e)){for(t=[],n=0,r=e.length;n<r;n++)t[n]=f(e[n]);return t}if(e instanceof Date&&isFinite(e))return e.toISOString();if(function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer||"undefined"!=typeof Blob&&e instanceof Blob}(e))return function(e){return e instanceof ArrayBuffer?e.slice(0):e.slice(0,e.size,e.type)}(e);if(!function(e){var t=Object.getPrototypeOf(e);if(null===t)return!0;var n=t.constructor;return"function"==typeof n&&n instanceof n&&c.call(n)==u}(e))return e;for(n in t={},e)if(Object.prototype.hasOwnProperty.call(e,n)){var i=f(e[n]);void 0!==i&&(t[n]=i)}return t}function l(e){var t=!1;return function(...n){if(t)throw new Error("once called more than once");t=!0,e.apply(this,n)}}function d(e){return function(...t){t=f(t);var n=this,r="function"==typeof t[t.length-1]&&t.pop(),i=new Promise(function(r,i){var o;try{var s=l(function(e,t){e?i(e):r(t)});t.push(s),(o=e.apply(n,t))&&"function"==typeof o.then&&r(o)}catch(e){i(e)}});return r&&i.then(function(e){r(null,e)},r),i}}function h(e,t){return d(function(...n){if(this._closed)return Promise.reject(new Error("database is closed"));if(this._destroyed)return Promise.reject(new Error("database is destroyed"));var r=this;return function(e,t,n){if(e.constructor.listeners("debug").length){for(var r=["api",e.name,t],i=0;i<n.length-1;i++)r.push(n[i]);e.constructor.emit("debug",r);var o=n[n.length-1];n[n.length-1]=function(n,r){var i=["api",e.name,t];i=i.concat(n?["error",n]:["success",r]),e.constructor.emit("debug",i),o(n,r)}}}(r,e,n),this.taskqueue.isReady?t.apply(this,n):new Promise(function(t,i){r.taskqueue.addTask(function(o){o?i(o):t(r[e].apply(r,n))})})})}function p(e,t){for(var n={},r=0,i=t.length;r<i;r++){var o=t[r];o in e&&(n[o]=e[o])}return n}var v;function _(e){return e}function y(e){return[{ok:e}]}function g(e,t,n){var r=t.docs,i=new Map;r.forEach(function(e){i.has(e.id)?i.get(e.id).push(e):i.set(e.id,[e])});var o=i.size,s=0,a=new Array(o);function c(){var e;++s===o&&(e=[],a.forEach(function(t){t.docs.forEach(function(n){e.push({id:t.id,docs:[n]})})}),n(null,{results:e}))}var u=[];i.forEach(function(e,t){u.push(t)});var f=0;function l(){if(!(f>=u.length)){var n=Math.min(f+6,u.length),r=u.slice(f,n);!function(n,r){n.forEach(function(n,o){var s=r+o,u=i.get(n),f=p(u[0],["atts_since","attachments"]);f.open_revs=u.map(function(e){return e.rev}),f.open_revs=f.open_revs.filter(_);var d=_;0===f.open_revs.length&&(delete f.open_revs,d=y),["revs","attachments","binary","ajax","latest"].forEach(function(e){e in t&&(f[e]=t[e])}),e.get(n,f,function(e,t){var r,i,o;r=e?[{error:e}]:d(t),i=n,o=r,a[s]={id:i,docs:o},c(),l()})})}(r,f),f+=r.length}}l()}try{localStorage.setItem("_pouch_check_localstorage",1),v=!!localStorage.getItem("_pouch_check_localstorage")}catch(e){v=!1}function m(){return v}const b="function"==typeof queueMicrotask?queueMicrotask:function(e){Promise.resolve().then(e)};function w(e){if("undefined"!=typeof console&&"function"==typeof console[e]){var t=Array.prototype.slice.call(arguments,1);console[e].apply(console,t)}}function k(e){var t=0;return e||(t=2e3),function(e,t){return e=parseInt(e,10)||0,(t=parseInt(t,10))!=t||t<=e?t=(e||1)<<1:t+=1,t>6e5&&(e=3e5,t=6e5),~~((t-e)*Math.random()+e)}(e,t)}function j(e,t){w("info","The above "+e+" is totally normal. "+t)}class q extends Error{constructor(e,t,n){super(),this.status=e,this.name=t,this.message=n,this.error=!0}toString(){return JSON.stringify({status:this.status,name:this.name,message:this.message,reason:this.reason})}}new q(401,"unauthorized","Name or password is incorrect.");var O=new q(400,"bad_request","Missing JSON list of 'docs'"),A=new q(404,"not_found","missing"),S=new q(409,"conflict","Document update conflict"),x=new q(400,"bad_request","_id field must contain a string"),P=new q(412,"missing_id","_id is required for puts"),C=new q(400,"bad_request","Only reserved document ids may start with underscore."),E=(new q(412,"precondition_failed","Database not open"),new q(500,"unknown_error","Database encountered an unknown error")),$=new q(500,"badarg","Some query argument is invalid"),I=(new q(400,"invalid_request","Request was invalid"),new q(400,"query_parse_error","Some query parameter is invalid")),L=new q(500,"doc_validation","Bad special document member"),D=new q(400,"bad_request","Something wrong with the request"),T=new q(400,"bad_request","Document must be a JSON object"),B=(new q(404,"not_found","Database not found"),new q(500,"indexed_db_went_bad","unknown")),M=(new q(500,"web_sql_went_bad","unknown"),new q(500,"levelDB_went_went_bad","unknown"),new q(403,"forbidden","Forbidden by design doc validate_doc_update function"),new q(400,"bad_request","Invalid rev format")),R=(new q(412,"file_exists","The database could not be created, the file already exists."),new q(412,"missing_stub","A pre-existing attachment stub wasn't found"));new q(413,"invalid_url","Provided URL is invalid");function N(e,t){function n(t){for(var n=Object.getOwnPropertyNames(e),r=0,i=n.length;r<i;r++)"function"!=typeof e[n[r]]&&(this[n[r]]=e[n[r]]);void 0===this.stack&&(this.stack=(new Error).stack),void 0!==t&&(this.reason=t)}return n.prototype=q.prototype,new n(t)}function U(e){if("object"!=typeof e){var t=e;(e=E).data=t}return"error"in e&&"conflict"===e.error&&(e.name="conflict",e.status=409),"name"in e||(e.name=e.error||"unknown"),"status"in e||(e.status=500),"message"in e||(e.message=e.message||e.reason),"stack"in e||(e.stack=(new Error).stack),e}function F(e){var t={},n=e.filter&&"function"==typeof e.filter;return t.query=e.query_params,function(r){r.doc||(r.doc={});var i=n&&function(e,t,n){try{return!e(t,n)}catch(e){var r="Filter function threw: "+e.toString();return N(D,r)}}(e.filter,r.doc,t);if("object"==typeof i)return i;if(i)return!1;if(e.include_docs){if(!e.attachments)for(var o in r.doc._attachments)Object.prototype.hasOwnProperty.call(r.doc._attachments,o)&&(r.doc._attachments[o].stub=!0)}else delete r.doc;return!0}}function K(e){var t;if(e?"string"!=typeof e?t=N(x):/^_/.test(e)&&!/^_(design|local)/.test(e)&&(t=N(C)):t=N(P),t)throw t}function J(e){return"boolean"==typeof e._remote?e._remote:"function"==typeof e.type&&(w("warn","db.type() is deprecated and will be removed in a future version of PouchDB"),"http"===e.type())}function z(e){if(!e)return null;var t=e.split("/");return 2===t.length?t:1===t.length?[e,e]:null}function V(e){var t=z(e);return t?t.join("/"):null}var G=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],Q=/(?:^|&)([^&=]*)=?([^&]*)/g,W=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/;function Y(e){for(var t=W.exec(e),n={},r=14;r--;){var i=G[r],o=t[r]||"",s=-1!==["user","password"].indexOf(i);n[i]=s?decodeURIComponent(o):o}return n.queryKey={},n[G[12]].replace(Q,function(e,t,r){t&&(n.queryKey[t]=r)}),n}function H(e,t){var n=[],r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n.push(i),r.push(t[i]));return n.push(e),Function.apply(null,n).apply(null,r)}function X(e,t,n){return e.get(t).catch(function(e){if(404!==e.status)throw e;return{}}).then(function(r){var i=r._rev,o=n(r);return o?(o._id=t,o._rev=i,function(e,t,n){return e.put(t).then(function(e){return{updated:!0,rev:e.rev}},function(r){if(409!==r.status)throw r;return X(e,t._id,n)})}(e,o,n)):{updated:!1,rev:i}})}var Z=function(e){return atob(e)},ee=function(e){return btoa(e)};function te(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(i){if("TypeError"!==i.name)throw i;for(var n=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),r=0;r<e.length;r+=1)n.append(e[r]);return n.getBlob(t.type)}}function ne(e){for(var t=e.length,n=new ArrayBuffer(t),r=new Uint8Array(n),i=0;i<t;i++)r[i]=e.charCodeAt(i);return n}function re(e,t){return te([ne(e)],{type:t})}function ie(e,t){return re(Z(e),t)}function oe(e,t){var n=new FileReader,r="function"==typeof n.readAsBinaryString;n.onloadend=function(e){var n=e.target.result||"";if(r)return t(n);t(function(e){for(var t="",n=new Uint8Array(e),r=n.byteLength,i=0;i<r;i++)t+=String.fromCharCode(n[i]);return t}(n))},r?n.readAsBinaryString(e):n.readAsArrayBuffer(e)}function se(e,t){oe(e,function(e){t(e)})}function ae(e,t){se(e,function(e){t(ee(e))})}var ce=self.setImmediate||self.setTimeout;function ue(e,t,n,r,i){(n>0||r<t.size)&&(t=t.slice(n,r)),function(e,t){var n=new FileReader;n.onloadend=function(e){var n=e.target.result||new ArrayBuffer(0);t(n)},n.readAsArrayBuffer(e)}(t,function(t){e.append(t),i()})}function fe(e,t,n,r,i){(n>0||r<t.length)&&(t=t.substring(n,r)),e.appendBinary(t),i()}function le(e,t){var n="string"==typeof e,r=n?e.length:e.size,o=Math.min(32768,r),s=Math.ceil(r/o),a=0,c=n?new i:new i.ArrayBuffer,u=n?fe:ue;function f(){ce(d)}function l(){var e=function(e){return ee(e)}(c.end(!0));t(e),c.destroy()}function d(){var t=a*o,n=t+o;a++,u(c,e,t,n,a<s?f:l)}d()}function de(e){return i.hash(e)}function he(e,t){if(!t)return o.v4().replace(/-/g,"").toLowerCase();var n=Object.assign({},e);return delete n._rev_tree,de(JSON.stringify(n))}var pe=o.v4;function ve(e){for(var t,n,r,i,o=e.rev_tree.slice();i=o.pop();){var s=i.ids,a=s[2],c=i.pos;if(a.length)for(var u=0,f=a.length;u<f;u++)o.push({pos:c+1,ids:a[u]});else{var l=!!s[1].deleted,d=s[0];t&&!(r!==l?r:n!==c?n<c:t<d)||(t=d,n=c,r=l)}}return n+"-"+t}function _e(e,t){for(var n,r=e.slice();n=r.pop();)for(var i=n.pos,o=n.ids,s=o[2],a=t(0===s.length,i,o[0],n.ctx,o[1]),c=0,u=s.length;c<u;c++)r.push({pos:i+1,ids:s[c],ctx:a})}function ye(e,t){return e.pos-t.pos}function ge(e){var t=[];_e(e,function(e,n,r,i,o){e&&t.push({rev:n+"-"+r,pos:n,opts:o})}),t.sort(ye).reverse();for(var n=0,r=t.length;n<r;n++)delete t[n].pos;return t}function me(e){for(var t=ve(e),n=ge(e.rev_tree),r=[],i=0,o=n.length;i<o;i++){var s=n[i];s.rev===t||s.opts.deleted||r.push(s.rev)}return r}function be(e){for(var t,n=[],r=e.slice();t=r.pop();){var i=t.pos,o=t.ids,s=o[0],a=o[1],c=o[2],u=0===c.length,f=t.history?t.history.slice():[];f.push({id:s,opts:a}),u&&n.push({pos:i+1-f.length,ids:f});for(var l=0,d=c.length;l<d;l++)r.push({pos:i+1,ids:c[l],history:f})}return n.reverse()}function we(e,t){return e.pos-t.pos}function ke(e,t,n){var r=function(e,t,n){for(var r,i=0,o=e.length;i<o;)n(e[r=i+o>>>1],t)<0?i=r+1:o=r;return i}(e,t,n);e.splice(r,0,t)}function je(e,t){for(var n,r,i=t,o=e.length;i<o;i++){var s=e[i],a=[s.id,s.opts,[]];r?(r[2].push(a),r=a):n=r=a}return n}function qe(e,t){return e[0]<t[0]?-1:1}function Oe(e,t){for(var n=[{tree1:e,tree2:t}],r=!1;n.length>0;){var i=n.pop(),o=i.tree1,s=i.tree2;(o[1].status||s[1].status)&&(o[1].status="available"===o[1].status||"available"===s[1].status?"available":"missing");for(var a=0;a<s[2].length;a++)if(o[2][0]){for(var c=!1,u=0;u<o[2].length;u++)o[2][u][0]===s[2][a][0]&&(n.push({tree1:o[2][u],tree2:s[2][a]}),c=!0);c||(r="new_branch",ke(o[2],s[2][a],qe))}else r="new_leaf",o[2][0]=s[2][a]}return{conflicts:r,tree:e}}function Ae(e,t,n){var r,i=[],o=!1,s=!1;if(!e.length)return{tree:[t],conflicts:"new_leaf"};for(var a=0,c=e.length;a<c;a++){var u=e[a];if(u.pos===t.pos&&u.ids[0]===t.ids[0])r=Oe(u.ids,t.ids),i.push({pos:u.pos,ids:r.tree}),o=o||r.conflicts,s=!0;else if(!0!==n){var f=u.pos<t.pos?u:t,l=u.pos<t.pos?t:u,d=l.pos-f.pos,h=[],p=[];for(p.push({ids:f.ids,diff:d,parent:null,parentIdx:null});p.length>0;){var v=p.pop();if(0!==v.diff)for(var _=v.ids[2],y=0,g=_.length;y<g;y++)p.push({ids:_[y],diff:v.diff-1,parent:v.ids,parentIdx:y});else v.ids[0]===l.ids[0]&&h.push(v)}var m=h[0];m?(r=Oe(m.ids,l.ids),m.parent[2][m.parentIdx]=r.tree,i.push({pos:f.pos,ids:f.ids}),o=o||r.conflicts,s=!0):i.push(u)}else i.push(u)}return s||i.push(t),i.sort(we),{tree:i,conflicts:o||"internal_node"}}function Se(e,t,n){var r=Ae(e,t),i=function(e,t){for(var n,r,i=be(e),o=0,s=i.length;o<s;o++){var a,c=i[o],u=c.ids;if(u.length>t){n||(n={});var f=u.length-t;a={pos:c.pos+f,ids:je(u,f)};for(var l=0;l<f;l++){var d=c.pos+l+"-"+u[l].id;n[d]=!0}}else a={pos:c.pos,ids:je(u,0)};r=r?Ae(r,a,!0).tree:[a]}return n&&_e(r,function(e,t,r){delete n[t+"-"+r]}),{tree:r,revs:n?Object.keys(n):[]}}(r.tree,n);return{tree:i.tree,stemmedRevs:i.revs,conflicts:r.conflicts}}function xe(e){return e.ids}function Pe(e,t){t||(t=ve(e));for(var n,r=t.substring(t.indexOf("-")+1),i=e.rev_tree.map(xe);n=i.pop();){if(n[0]===r)return!!n[1].deleted;i=i.concat(n[2])}}function Ce(e){return"string"==typeof e&&e.startsWith("_local/")}function Ee(e,t,n){var r=[{rev:e._rev}];"all_docs"===n.style&&(r=ge(t.rev_tree).map(function(e){return{rev:e.rev}}));var i={id:t.id,changes:r,doc:e};return Pe(t,e._rev)&&(i.deleted=!0),n.conflicts&&(i.doc._conflicts=me(t),i.doc._conflicts.length||delete i.doc._conflicts),i}class $e extends a{constructor(e,t,n){super(),this.db=e;var r=(t=t?f(t):{}).complete=l((t,n)=>{var r,o;t?(o="error",("listenerCount"in(r=this)?r.listenerCount(o):a.listenerCount(r,o))>0&&this.emit("error",t)):this.emit("complete",n),this.removeAllListeners(),e.removeListener("destroyed",i)});n&&(this.on("complete",function(e){n(null,e)}),this.on("error",n));const i=()=>{this.cancel()};e.once("destroyed",i),t.onChange=(e,t,n)=>{this.isCancelled||function(e,t,n,r){try{e.emit("change",t,n,r)}catch(e){w("error",'Error in .on("change", function):',e)}}(this,e,t,n)};var o=new Promise(function(e,n){t.complete=function(t,r){t?n(t):e(r)}});this.once("cancel",function(){e.removeListener("destroyed",i),t.complete(null,{status:"cancelled"})}),this.then=o.then.bind(o),this.catch=o.catch.bind(o),this.then(function(e){r(null,e)},r),e.taskqueue.isReady?this.validateChanges(t):e.taskqueue.addTask(e=>{e?t.complete(e):this.isCancelled?this.emit("cancel"):this.validateChanges(t)})}cancel(){this.isCancelled=!0,this.db.taskqueue.isReady&&this.emit("cancel")}validateChanges(e){var t=e.complete;Ke._changesFilterPlugin?Ke._changesFilterPlugin.validate(e,n=>{if(n)return t(n);this.doChanges(e)}):this.doChanges(e)}doChanges(e){var t=e.complete;if("live"in(e=f(e))&&!("continuous"in e)&&(e.continuous=e.live),e.processChange=Ee,"latest"===e.since&&(e.since="now"),e.since||(e.since=0),"now"!==e.since){if(Ke._changesFilterPlugin){if(Ke._changesFilterPlugin.normalize(e),Ke._changesFilterPlugin.shouldFilter(this,e))return Ke._changesFilterPlugin.filter(this,e)}else["doc_ids","filter","selector","view"].forEach(function(t){t in e&&w("warn",'The "'+t+'" option was passed in to changes/replicate, but pouchdb-changes-filter plugin is not installed, so it was ignored. Please install the plugin to enable filtering.')});"descending"in e||(e.descending=!1),e.limit=0===e.limit?1:e.limit,e.complete=t;var n=this.db._changes(e);if(n&&"function"==typeof n.cancel){const e=this.cancel;this.cancel=(...t)=>{n.cancel(),e.apply(this,t)}}}else this.db.info().then(n=>{this.isCancelled?t(null,{status:"cancelled"}):(e.since=n.update_seq,this.doChanges(e))},t)}}function Ie(e,t){return function(n,r){n||r[0]&&r[0].error?((n=n||r[0]).docId=t,e(n)):e(null,r.length?r[0]:r)}}function Le(e,t){if(e._id===t._id){return(e._revisions?e._revisions.start:0)-(t._revisions?t._revisions.start:0)}return e._id<t._id?-1:1}function De(e,t,n){return e.get("_local/purges").then(function(e){const r=e.purgeSeq+1;return e.purges.push({docId:t,rev:n,purgeSeq:r}),e.purges.length>self.purged_infos_limit&&e.purges.splice(0,e.purges.length-self.purged_infos_limit),e.purgeSeq=r,e}).catch(function(e){if(404!==e.status)throw e;return{_id:"_local/purges",purges:[{docId:t,rev:n,purgeSeq:0}],purgeSeq:0}}).then(function(t){return e.put(t)})}function Te(e){return null===e||"object"!=typeof e||Array.isArray(e)}const Be=/^\d+-[^-]*$/;function Me(e){return"string"==typeof e&&Be.test(e)}class Re extends a{_setup(){this.post=h("post",function(e,t,n){if("function"==typeof t&&(n=t,t={}),Te(e))return n(N(T));this.bulkDocs({docs:[e]},t,Ie(n,e._id))}).bind(this),this.put=h("put",function(e,t,n){if("function"==typeof t&&(n=t,t={}),Te(e))return n(N(T));if(K(e._id),"_rev"in e&&!Me(e._rev))return n(N(M));if(Ce(e._id)&&"function"==typeof this._putLocal)return e._deleted?this._removeLocal(e,n):this._putLocal(e,n);const r=n=>{"function"==typeof this._put&&!1!==t.new_edits?this._put(e,t,n):this.bulkDocs({docs:[e]},t,Ie(n,e._id))};var i,o,s,a;t.force&&e._rev?(i=e._rev.split("-"),o=i[1],s=parseInt(i[0],10)+1,a=he(),e._revisions={start:s,ids:[a,o]},e._rev=s+"-"+a,t.new_edits=!1,r(function(t){var r=t?null:{ok:!0,id:e._id,rev:e._rev};n(t,r)})):r(n)}).bind(this),this.putAttachment=h("putAttachment",function(e,t,n,r,i){var o=this;function s(e){var n="_rev"in e?parseInt(e._rev,10):0;return e._attachments=e._attachments||{},e._attachments[t]={content_type:i,data:r,revpos:++n},o.put(e)}return"function"==typeof i&&(i=r,r=n,n=null),void 0===i&&(i=r,r=n,n=null),i||w("warn","Attachment",t,"on document",e,"is missing content_type"),o.get(e).then(function(e){if(e._rev!==n)throw N(S);return s(e)},function(t){if(t.reason===A.message)return s({_id:e});throw t})}).bind(this),this.removeAttachment=h("removeAttachment",function(e,t,n,r){this.get(e,(e,i)=>{if(e)r(e);else if(i._rev===n){if(!i._attachments)return r();delete i._attachments[t],0===Object.keys(i._attachments).length&&delete i._attachments,this.put(i,r)}else r(N(S))})}).bind(this),this.remove=h("remove",function(e,t,n,r){var i;"string"==typeof t?(i={_id:e,_rev:t},"function"==typeof n&&(r=n,n={})):(i=e,"function"==typeof t?(r=t,n={}):(r=n,n=t)),(n=n||{}).was_delete=!0;var o={_id:i._id,_rev:i._rev||n.rev,_deleted:!0};if(Ce(o._id)&&"function"==typeof this._removeLocal)return this._removeLocal(i,r);this.bulkDocs({docs:[o]},n,Ie(r,o._id))}).bind(this),this.revsDiff=h("revsDiff",function(e,t,n){"function"==typeof t&&(n=t,t={});var r=Object.keys(e);if(!r.length)return n(null,{});var i=0,o=new Map;function s(e,t){o.has(e)||o.set(e,{missing:[]}),o.get(e).missing.push(t)}r.forEach(function(t){this._getRevisionTree(t,function(a,c){if(a&&404===a.status&&"missing"===a.message)o.set(t,{missing:e[t]});else{if(a)return n(a);!function(t,n){var r=e[t].slice(0);_e(n,function(e,n,i,o,a){var c=n+"-"+i,u=r.indexOf(c);-1!==u&&(r.splice(u,1),"available"!==a.status&&s(t,c))}),r.forEach(function(e){s(t,e)})}(t,c)}if(++i===r.length){var u={};return o.forEach(function(e,t){u[t]=e}),n(null,u)}})},this)}).bind(this),this.bulkGet=h("bulkGet",function(e,t){g(this,e,t)}).bind(this),this.compactDocument=h("compactDocument",function(e,t,n){this._getRevisionTree(e,(r,i)=>{if(r)return n(r);var o=function(e){var t={},n=[];return _e(e,function(e,r,i,o){var s=r+"-"+i;return e&&(t[s]=0),void 0!==o&&n.push({from:o,to:s}),s}),n.reverse(),n.forEach(function(e){void 0===t[e.from]?t[e.from]=1+t[e.to]:t[e.from]=Math.min(t[e.from],1+t[e.to])}),t}(i),s=[],a=[];Object.keys(o).forEach(function(e){o[e]>t&&s.push(e)}),_e(i,function(e,t,n,r,i){var o=t+"-"+n;"available"===i.status&&-1!==s.indexOf(o)&&a.push(o)}),this._doCompaction(e,a,n)})}).bind(this),this.compact=h("compact",function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{},this._compactionQueue=this._compactionQueue||[],this._compactionQueue.push({opts:e,callback:t}),1===this._compactionQueue.length&&function e(t){var n=t._compactionQueue[0],r=n.opts,i=n.callback;t.get("_local/compaction").catch(function(){return!1}).then(function(n){n&&n.last_seq&&(r.last_seq=n.last_seq),t._compact(r,function(n,r){n?i(n):i(null,r),b(function(){t._compactionQueue.shift(),t._compactionQueue.length&&e(t)})})})}(this)}).bind(this),this.get=h("get",function(e,t,n){if("function"==typeof t&&(n=t,t={}),t=t||{},"string"!=typeof e)return n(N(x));if(Ce(e)&&"function"==typeof this._getLocal)return this._getLocal(e,n);var r=[];const i=()=>{var i=[],o=r.length;if(!o)return n(null,i);r.forEach(r=>{this.get(e,{rev:r,revs:t.revs,latest:t.latest,attachments:t.attachments,binary:t.binary},function(e,t){if(e)i.push({missing:r});else{for(var s,a=0,c=i.length;a<c;a++)if(i[a].ok&&i[a].ok._rev===t._rev){s=!0;break}s||i.push({ok:t})}--o||n(null,i)})})};if(!t.open_revs)return this._get(e,t,(r,i)=>{if(r)return r.docId=e,n(r);var o=i.doc,s=i.metadata,a=i.ctx;if(t.conflicts){var c=me(s);c.length&&(o._conflicts=c)}if(Pe(s,o._rev)&&(o._deleted=!0),t.revs||t.revs_info){for(var u=o._rev.split("-"),f=parseInt(u[0],10),l=u[1],d=be(s.rev_tree),h=null,p=0;p<d.length;p++){var v=d[p];const e=v.ids.findIndex(e=>e.id===l);(e===f-1||!h&&-1!==e)&&(h=v)}if(!h)return(r=new Error("invalid rev tree")).docId=e,n(r);const i=o._rev.split("-")[1],a=h.ids.findIndex(e=>e.id===i)+1;var _=h.ids.length-a;if(h.ids.splice(a,_),h.ids.reverse(),t.revs&&(o._revisions={start:h.pos+h.ids.length-1,ids:h.ids.map(function(e){return e.id})}),t.revs_info){var y=h.pos+h.ids.length;o._revs_info=h.ids.map(function(e){return{rev:--y+"-"+e.id,status:e.opts.status}})}}if(t.attachments&&o._attachments){var g=o._attachments,m=Object.keys(g).length;if(0===m)return n(null,o);Object.keys(g).forEach(e=>{this._getAttachment(o._id,e,g[e],{binary:t.binary,metadata:s,ctx:a},function(t,r){var i=o._attachments[e];i.data=r,delete i.stub,delete i.length,--m||n(null,o)})})}else{if(o._attachments)for(var b in o._attachments)Object.prototype.hasOwnProperty.call(o._attachments,b)&&(o._attachments[b].stub=!0);n(null,o)}});if("all"===t.open_revs)this._getRevisionTree(e,function(e,t){if(e)return n(e);r=ge(t).map(function(e){return e.rev}),i()});else{if(!Array.isArray(t.open_revs))return n(N(E,"function_clause"));r=t.open_revs;for(var o=0;o<r.length;o++){if(!Me(r[o]))return n(N(M))}i()}}).bind(this),this.getAttachment=h("getAttachment",function(e,t,n,r){n instanceof Function&&(r=n,n={}),this._get(e,n,(i,o)=>i?r(i):o.doc._attachments&&o.doc._attachments[t]?(n.ctx=o.ctx,n.binary=!0,n.metadata=o.metadata,void this._getAttachment(e,t,o.doc._attachments[t],n,r)):r(N(A)))}).bind(this),this.allDocs=h("allDocs",function(e,t){if("function"==typeof e&&(t=e,e={}),e.skip=void 0!==e.skip?e.skip:0,e.start_key&&(e.startkey=e.start_key),e.end_key&&(e.endkey=e.end_key),"keys"in e){if(!Array.isArray(e.keys))return t(new TypeError("options.keys must be an array"));var n=["startkey","endkey","key"].filter(function(t){return t in e})[0];if(n)return void t(N(I,"Query parameter `"+n+"` is not compatible with multi-get"));if(!J(this)&&(function(e){var t="limit"in e?e.keys.slice(e.skip,e.limit+e.skip):e.skip>0?e.keys.slice(e.skip):e.keys;e.keys=t,e.skip=0,delete e.limit,e.descending&&(t.reverse(),e.descending=!1)}(e),0===e.keys.length))return this._allDocs({limit:0},t)}return this._allDocs(e,t)}).bind(this),this.close=h("close",function(e){return this._closed=!0,this.emit("closed"),this._close(e)}).bind(this),this.info=h("info",function(e){this._info((t,n)=>{if(t)return e(t);n.db_name=n.db_name||this.name,n.auto_compaction=!(!this.auto_compaction||J(this)),n.adapter=this.adapter,e(null,n)})}).bind(this),this.id=h("id",function(e){return this._id(e)}).bind(this),this.bulkDocs=h("bulkDocs",function(e,t,n){if("function"==typeof t&&(n=t,t={}),t=t||{},Array.isArray(e)&&(e={docs:e}),!e||!e.docs||!Array.isArray(e.docs))return n(N(O));for(var r=0;r<e.docs.length;++r){const t=e.docs[r];if(Te(t))return n(N(T));if("_rev"in t&&!Me(t._rev))return n(N(M))}var i;if(e.docs.forEach(function(e){e._attachments&&Object.keys(e._attachments).forEach(function(t){i=i||function(e){return"_"===e.charAt(0)&&e+" is not a valid attachment name, attachment names cannot start with '_'"}(t),e._attachments[t].content_type||w("warn","Attachment",t,"on document",e._id,"is missing content_type")})}),i)return n(N(D,i));"new_edits"in t||(t.new_edits=!("new_edits"in e)||e.new_edits);var o=this;t.new_edits||J(o)||e.docs.sort(Le),function(e){for(var t=0;t<e.length;t++){var n=e[t];if(n._deleted)delete n._attachments;else if(n._attachments)for(var r=Object.keys(n._attachments),i=0;i<r.length;i++){var o=r[i];n._attachments[o]=p(n._attachments[o],["data","digest","content_type","length","revpos","stub"])}}}(e.docs);var s=e.docs.map(function(e){return e._id});this._bulkDocs(e,t,function(e,r){if(e)return n(e);if(t.new_edits||(r=r.filter(function(e){return e.error})),!J(o))for(var i=0,a=r.length;i<a;i++)r[i].id=r[i].id||s[i];n(null,r)})}).bind(this),this.registerDependentDatabase=h("registerDependentDatabase",function(e,t){var n=f(this.__opts);this.__opts.view_adapter&&(n.adapter=this.__opts.view_adapter);var r=new this.constructor(e,n);X(this,"_local/_pouch_dependentDbs",function(t){return t.dependentDbs=t.dependentDbs||{},!t.dependentDbs[e]&&(t.dependentDbs[e]=!0,t)}).then(function(){t(null,{db:r})}).catch(t)}).bind(this),this.destroy=h("destroy",function(e,t){"function"==typeof e&&(t=e,e={});var n=!("use_prefix"in this)||this.use_prefix;const r=()=>{this._destroy(e,(e,n)=>{if(e)return t(e);this._destroyed=!0,this.emit("destroyed"),t(null,n||{ok:!0})})};if(J(this))return r();this.get("_local/_pouch_dependentDbs",(e,i)=>{if(e)return 404!==e.status?t(e):r();var o=i.dependentDbs,s=this.constructor,a=Object.keys(o).map(e=>{var t=n?e.replace(new RegExp("^"+s.prefix),""):e;return new s(t,this.__opts).destroy()});Promise.all(a).then(r,t)})}).bind(this)}_compact(e,t){var n,r={return_docs:!1,last_seq:e.last_seq||0,since:e.last_seq||0},i=[],o=0;const s=e=>{this.activeTasks.update(n,{completed_items:++o}),i.push(this.compactDocument(e.id,0))},a=e=>{this.activeTasks.remove(n,e),t(e)},c=e=>{var r=e.last_seq;Promise.all(i).then(()=>X(this,"_local/compaction",e=>(!e.last_seq||e.last_seq<r)&&(e.last_seq=r,e))).then(()=>{this.activeTasks.remove(n),t(null,{ok:!0})}).catch(a)};this.info().then(e=>{n=this.activeTasks.add({name:"database_compaction",total_items:e.update_seq-r.last_seq}),this.changes(r).on("change",s).on("complete",c).on("error",a)})}changes(e,t){return"function"==typeof e&&(t=e,e={}),(e=e||{}).return_docs="return_docs"in e?e.return_docs:!e.live,new $e(this,e,t)}type(){return"function"==typeof this._type?this._type():this.adapter}}Re.prototype.purge=h("_purge",function(e,t,n){if(void 0===this._purge)return n(N(E,"Purge is not implemented in the "+this.adapter+" adapter."));var r=this;r._getRevisionTree(e,(i,o)=>{if(i)return n(i);if(!o)return n(N(A));let s;try{s=function(e,t){let n=[];const r=e.slice();let i;for(;i=r.pop();){const{pos:e,ids:o}=i,s=`${e}-${o[0]}`,a=o[2];if(n.push(s),s===t){if(0!==a.length)throw new Error("The requested revision is not a leaf");return n.reverse()}(0===a.length||a.length>1)&&(n=[]);for(let t=0,n=a.length;t<n;t++)r.push({pos:e+1,ids:a[t]})}if(0===n.length)throw new Error("The requested revision does not exist");return n.reverse()}(o,t)}catch(i){return n(i.message||i)}r._purge(e,s,(i,o)=>{if(i)return n(i);De(r,e,t).then(function(){return n(null,o)})})})});class Ne{constructor(){this.isReady=!1,this.failed=!1,this.queue=[]}execute(){var e;if(this.failed)for(;e=this.queue.shift();)e(this.failed);else for(;e=this.queue.shift();)e()}fail(e){this.failed=e,this.execute()}ready(e){this.isReady=!0,this.db=e,this.execute()}addTask(e){this.queue.push(e),this.failed&&this.execute()}}function Ue(e,t){let n=function(...e){if(!(this instanceof n))return new n(...e);t.apply(this,e)};var r,i;return i=e,(r=n).prototype=Object.create(i.prototype,{constructor:{value:r}}),n}class Fe extends Re{constructor(e,t){super(),this._setup(e,t)}_setup(e,t){if(super._setup(),t=t||{},e&&"object"==typeof e&&(e=(t=e).name,delete t.name),void 0===t.deterministic_revs&&(t.deterministic_revs=!0),this.__opts=t=f(t),this.auto_compaction=t.auto_compaction,this.purged_infos_limit=t.purged_infos_limit||1e3,this.prefix=Ke.prefix,"string"!=typeof e)throw new Error("Missing/invalid DB name");var n=function(e,t){var n=e.match(/([a-z-]*):\/\/(.*)/);if(n)return{name:/https?/.test(n[1])?n[1]+"://"+n[2]:n[2],adapter:n[1]};var r=Ke.adapters,i=Ke.preferredAdapters,o=Ke.prefix,s=t.adapter;if(!s)for(var a=0;a<i.length&&"idb"===(s=i[a])&&"websql"in r&&m()&&localStorage["_pouch__websqldb_"+o+e];++a)w("log",'PouchDB is downgrading "'+e+'" to WebSQL to avoid data loss, because it was already opened with WebSQL.');var c=r[s];return{name:!c||!("use_prefix"in c)||c.use_prefix?o+e:e,adapter:s}}((t.prefix||"")+e,t);if(t.name=n.name,t.adapter=t.adapter||n.adapter,this.name=e,this._adapter=t.adapter,Ke.emit("debug",["adapter","Picked adapter: ",t.adapter]),!Ke.adapters[t.adapter]||!Ke.adapters[t.adapter].valid())throw new Error("Invalid Adapter: "+t.adapter);if(t.view_adapter&&(!Ke.adapters[t.view_adapter]||!Ke.adapters[t.view_adapter].valid()))throw new Error("Invalid View Adapter: "+t.view_adapter);this.taskqueue=new Ne,this.adapter=t.adapter,Ke.adapters[t.adapter].call(this,t,e=>{if(e)return this.taskqueue.fail(e);!function(e){function t(t){e.removeListener("closed",n),t||e.constructor.emit("destroyed",e.name)}function n(){e.removeListener("destroyed",t),e.constructor.emit("unref",e)}e.once("destroyed",t),e.once("closed",n),e.constructor.emit("ref",e)}(this),this.emit("created",this),Ke.emit("created",this.name),this.taskqueue.ready(this)})}}const Ke=Ue(Fe,function(e,t){Fe.prototype._setup.call(this,e,t)});var Je=fetch,ze=Headers;Ke.adapters={},Ke.preferredAdapters=[],Ke.prefix="_pouch_";var Ve=new a;!function(e){Object.keys(a.prototype).forEach(function(t){"function"==typeof a.prototype[t]&&(e[t]=Ve[t].bind(Ve))});var t=e._destructionListeners=new Map;e.on("ref",function(e){t.has(e.name)||t.set(e.name,[]),t.get(e.name).push(e)}),e.on("unref",function(e){if(t.has(e.name)){var n=t.get(e.name),r=n.indexOf(e);r<0||(n.splice(r,1),n.length>1?t.set(e.name,n):t.delete(e.name))}}),e.on("destroyed",function(e){if(t.has(e)){var n=t.get(e);t.delete(e),n.forEach(function(e){e.emit("destroyed",!0)})}})}(Ke),Ke.adapter=function(e,t,n){t.valid()&&(Ke.adapters[e]=t,n&&Ke.preferredAdapters.push(e))},Ke.plugin=function(e){if("function"==typeof e)e(Ke);else{if("object"!=typeof e||0===Object.keys(e).length)throw new Error('Invalid plugin: got "'+e+'", expected an object or a function');Object.keys(e).forEach(function(t){Ke.prototype[t]=e[t]})}return this.__defaults&&(Ke.__defaults=Object.assign({},this.__defaults)),Ke},Ke.defaults=function(e){let t=Ue(Ke,function(e,n){n=n||{},e&&"object"==typeof e&&(e=(n=e).name,delete n.name),n=Object.assign({},t.__defaults,n),Ke.call(this,e,n)});return t.preferredAdapters=Ke.preferredAdapters.slice(),Object.keys(Ke).forEach(function(e){e in t||(t[e]=Ke[e])}),t.__defaults=Object.assign({},this.__defaults,e),t},Ke.fetch=function(e,t){return Je(e,t)},Ke.prototype.activeTasks=Ke.activeTasks=new class{constructor(){this.tasks={}}list(){return Object.values(this.tasks)}add(e){const t=o.v4();return this.tasks[t]={id:t,name:e.name,total_items:e.total_items,created_at:(new Date).toJSON()},t}get(e){return this.tasks[e]}remove(e,t){return delete this.tasks[e],this.tasks}update(e,t){const n=this.tasks[e];if(void 0!==n){const r={id:n.id,name:n.name,created_at:n.created_at,total_items:t.total_items||n.total_items,completed_items:t.completed_items||n.completed_items,updated_at:(new Date).toJSON()};this.tasks[e]=r}return this.tasks}};function Ge(e,t){for(var n=e,r=0,i=t.length;r<i;r++){if(!(n=n[t[r]]))break}return n}function Qe(e){for(var t=[],n="",r=0,i=e.length;r<i;r++){var o=e[r];r>0&&"\\"===e[r-1]&&("$"===o||"."===o)?n=n.substring(0,n.length-1)+o:"."===o?(t.push(n),n=""):n+=o}return t.push(n),t}var We=["$or","$nor","$not"];function Ye(e){return We.indexOf(e)>-1}function He(e){return Object.keys(e)[0]}function Xe(e){var t={},n={$or:!0,$nor:!0};return e.forEach(function(e){Object.keys(e).forEach(function(r){var i=e[r];if("object"!=typeof i&&(i={$eq:i}),Ye(r))if(i instanceof Array){if(n[r])return n[r]=!1,void(t[r]=i);var o=[];t[r].forEach(function(e){Object.keys(i).forEach(function(t){var n=i[t],r=Math.max(Object.keys(e).length,Object.keys(n).length),s=Xe([e,n]);Object.keys(s).length<=r||o.push(s)})}),t[r]=o}else t[r]=Xe([i]);else{var s=t[r]=t[r]||{};Object.keys(i).forEach(function(e){var t=i[e];return"$gt"===e||"$gte"===e?function(e,t,n){if(void 0!==n.$eq)return;void 0!==n.$gte?"$gte"===e?t>n.$gte&&(n.$gte=t):t>=n.$gte&&(delete n.$gte,n.$gt=t):void 0!==n.$gt?"$gte"===e?t>n.$gt&&(delete n.$gt,n.$gte=t):t>n.$gt&&(n.$gt=t):n[e]=t}(e,t,s):"$lt"===e||"$lte"===e?function(e,t,n){if(void 0!==n.$eq)return;void 0!==n.$lte?"$lte"===e?t<n.$lte&&(n.$lte=t):t<=n.$lte&&(delete n.$lte,n.$lt=t):void 0!==n.$lt?"$lte"===e?t<n.$lt&&(delete n.$lt,n.$lte=t):t<n.$lt&&(n.$lt=t):n[e]=t}(e,t,s):"$ne"===e?function(e,t){"$ne"in t?t.$ne.push(e):t.$ne=[e]}(t,s):"$eq"===e?function(e,t){delete t.$gt,delete t.$gte,delete t.$lt,delete t.$lte,delete t.$ne,t.$eq=e}(t,s):"$regex"===e?function(e,t){"$regex"in t?t.$regex.push(e):t.$regex=[e]}(t,s):void(s[e]=t)})}})}),t}function Ze(e){var t=f(e);(function e(t,n){for(var r in t){"$and"===r&&(n=!0);var i=t[r];"object"==typeof i&&(n=e(i,n))}return n})(t,!1)&&"$and"in(t=function e(t){for(var n in t){if(Array.isArray(t))for(var r in t)t[r].$and&&(t[r]=Xe(t[r].$and));var i=t[n];"object"==typeof i&&e(i)}return t}(t))&&(t=Xe(t.$and)),["$or","$nor"].forEach(function(e){e in t&&t[e].forEach(function(e){for(var t=Object.keys(e),n=0;n<t.length;n++){var r=t[n],i=e[r];"object"==typeof i&&null!==i||(e[r]={$eq:i})}})}),"$not"in t&&(t.$not=Xe([t.$not]));for(var n=Object.keys(t),r=0;r<n.length;r++){var i=n[r],o=t[i];"object"==typeof o&&null!==o||(o={$eq:o}),t[i]=o}return function e(t){Object.keys(t).forEach(function(n){var r=t[n];Array.isArray(r)?r.forEach(function(t){t&&"object"==typeof t&&e(t)}):"$ne"===n?t.$ne=[r]:"$regex"===n?t.$regex=[r]:r&&"object"==typeof r&&e(r)})}(t),t}function et(e,t){if(e===t)return 0;e=tt(e),t=tt(t);var n=st(e),r=st(t);if(n-r!=0)return n-r;switch(typeof e){case"number":return e-t;case"boolean":return e<t?-1:1;case"string":return function(e,t){return e===t?0:e>t?1:-1}(e,t)}return Array.isArray(e)?function(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){var i=et(e[r],t[r]);if(0!==i)return i}return e.length===t.length?0:e.length>t.length?1:-1}(e,t):function(e,t){for(var n=Object.keys(e),r=Object.keys(t),i=Math.min(n.length,r.length),o=0;o<i;o++){var s=et(n[o],r[o]);if(0!==s)return s;if(0!==(s=et(e[n[o]],t[r[o]])))return s}return n.length===r.length?0:n.length>r.length?1:-1}(e,t)}function tt(e){switch(typeof e){case"undefined":return null;case"number":return e===1/0||e===-1/0||isNaN(e)?null:e;case"object":var t=e;if(Array.isArray(e)){var n=e.length;e=new Array(n);for(var r=0;r<n;r++)e[r]=tt(t[r])}else{if(e instanceof Date)return e.toJSON();if(null!==e)for(var i in e={},t)if(Object.prototype.hasOwnProperty.call(t,i)){var o=t[i];void 0!==o&&(e[i]=tt(o))}}}return e}function nt(e){if(null!==e)switch(typeof e){case"boolean":return e?1:0;case"number":return function(e){if(0===e)return"1";var t=e.toExponential().split(/e\+?/),n=parseInt(t[1],10),r=e<0,i=r?"0":"2",o=(s=((r?-n:n)- -324).toString(),a="0",c=3,function(e,t,n){for(var r="",i=n-e.length;r.length<i;)r+=t;return r}(s,a,c)+s);var s,a,c;i+=""+o;var u=Math.abs(parseFloat(t[0]));r&&(u=10-u);var f=u.toFixed(20);return f=f.replace(/\.?0+$/,""),i+=""+f}(e);case"string":return e.replace(/\u0002/g,"").replace(/\u0001/g,"").replace(/\u0000/g,"");case"object":var t=Array.isArray(e),n=t?e:Object.keys(e),r=-1,i=n.length,o="";if(t)for(;++r<i;)o+=rt(n[r]);else for(;++r<i;){var s=n[r];o+=rt(s)+rt(e[s])}return o}return""}function rt(e){return st(e=tt(e))+""+nt(e)+"\0"}function it(e,t){var n,r=t;if("1"===e[t])n=0,t++;else{var i="0"===e[t];t++;var o="",s=e.substring(t,t+3),a=parseInt(s,10)+-324;for(i&&(a=-a),t+=3;;){var c=e[t];if("\0"===c)break;o+=c,t++}n=1===(o=o.split(".")).length?parseInt(o,10):parseFloat(o[0]+"."+o[1]),i&&(n-=10),0!==a&&(n=parseFloat(n+"e"+a))}return{num:n,length:t-r}}function ot(e,t){var n=e.pop();if(t.length){var r=t[t.length-1];n===r.element&&(t.pop(),r=t[t.length-1]);var i=r.element,o=r.index;if(Array.isArray(i))i.push(n);else if(o===e.length-2){i[e.pop()]=n}else e.push(n)}}function st(e){var t=["boolean","number","string","object"].indexOf(typeof e);return~t?null===e?1:Array.isArray(e)?5:t<3?t+2:t+3:Array.isArray(e)?5:void 0}function at(e,t,n){if(e=e.filter(function(e){return ct(e.doc,t.selector,n)}),t.sort){var r=function(e){function t(t){return e.map(function(e){var n=Qe(He(e));return Ge(t,n)})}return function(e,n){var r,i,o=et(t(e.doc),t(n.doc));return 0!==o?o:(r=e.doc._id,i=n.doc._id,r<i?-1:r>i?1:0)}}(t.sort);e=e.sort(r),"string"!=typeof t.sort[0]&&"desc"===(i=t.sort[0])[He(i)]&&(e=e.reverse())}var i;if("limit"in t||"skip"in t){var o=t.skip||0,s=("limit"in t?t.limit:e.length)+o;e=e.slice(o,s)}return e}function ct(e,t,n){return n.every(function(n){var r=t[n],i=Qe(n),o=Ge(e,i);return Ye(n)?function(e,t,n){if("$or"===e)return t.some(function(e){return ct(n,e,Object.keys(e))});if("$not"===e)return!ct(n,t,Object.keys(t));return!t.find(function(e){return ct(n,e,Object.keys(e))})}(n,r,e):ut(r,e,i,o)})}function ut(e,t,n,r){return!e||("object"==typeof e?Object.keys(e).every(function(i){var o=e[i];if(0===i.indexOf("$"))return ft(i,t,o,n,r);var s=Qe(i);if(void 0===r&&"object"!=typeof o&&s.length>0)return!1;var a=Ge(r,s);return"object"==typeof o?ut(o,t,n,a):ft("$eq",t,o,s,a)}):e===r)}function ft(e,t,n,r,i){if(!pt[e])throw new Error('unknown operator "'+e+'" - should be one of $eq, $lte, $lt, $gt, $gte, $exists, $ne, $in, $nin, $size, $mod, $regex, $elemMatch, $type, $allMatch or $all');return pt[e](t,n,r,i)}function lt(e){return null!=e}function dt(e){return void 0!==e}function ht(e,t){return t.some(function(t){return e instanceof Array?e.some(function(e){return 0===et(t,e)}):0===et(t,e)})}var pt={$elemMatch:function(e,t,n,r){return!!Array.isArray(r)&&0!==r.length&&("object"==typeof r[0]&&null!==r[0]?r.some(function(e){return ct(e,t,Object.keys(t))}):r.some(function(r){return ut(t,e,n,r)}))},$allMatch:function(e,t,n,r){return!!Array.isArray(r)&&0!==r.length&&("object"==typeof r[0]&&null!==r[0]?r.every(function(e){return ct(e,t,Object.keys(t))}):r.every(function(r){return ut(t,e,n,r)}))},$eq:function(e,t,n,r){return dt(r)&&0===et(r,t)},$gte:function(e,t,n,r){return dt(r)&&et(r,t)>=0},$gt:function(e,t,n,r){return dt(r)&&et(r,t)>0},$lte:function(e,t,n,r){return dt(r)&&et(r,t)<=0},$lt:function(e,t,n,r){return dt(r)&&et(r,t)<0},$exists:function(e,t,n,r){return t?dt(r):!dt(r)},$mod:function(e,t,n,r){return lt(r)&&function(e,t){return"number"==typeof e&&parseInt(e,10)===e&&e%t[0]===t[1]}(r,t)},$ne:function(e,t,n,r){return t.every(function(e){return 0!==et(r,e)})},$in:function(e,t,n,r){return lt(r)&&ht(r,t)},$nin:function(e,t,n,r){return lt(r)&&!ht(r,t)},$size:function(e,t,n,r){return lt(r)&&Array.isArray(r)&&function(e,t){return e.length===t}(r,t)},$all:function(e,t,n,r){return Array.isArray(r)&&function(e,t){return t.every(function(t){return e.some(function(e){return 0===et(t,e)})})}(r,t)},$regex:function(e,t,n,r){return lt(r)&&"string"==typeof r&&t.every(function(e){return function(e,t){return new RegExp(t).test(e)}(r,e)})},$type:function(e,t,n,r){return function(e,t){switch(t){case"null":return null===e;case"boolean":return"boolean"==typeof e;case"number":return"number"==typeof e;case"string":return"string"==typeof e;case"array":return e instanceof Array;case"object":return"[object Object]"==={}.toString.call(e)}}(r,t)}};function vt(e,t){if(e.selector&&e.filter&&"_selector"!==e.filter){var n="string"==typeof e.filter?e.filter:"function";return t(new Error('selector invalid for filter "'+n+'"'))}t()}function _t(e){e.view&&!e.filter&&(e.filter="_view"),e.selector&&!e.filter&&(e.filter="_selector"),e.filter&&"string"==typeof e.filter&&("_view"===e.filter?e.view=V(e.view):e.filter=V(e.filter))}function yt(e,t){return t.filter&&"string"==typeof t.filter&&!t.doc_ids&&!J(e.db)}function gt(e,t){var n=t.complete;if("_view"===t.filter){if(!t.view||"string"!=typeof t.view){var r=N(D,"`view` filter parameter not found or invalid.");return n(r)}var i=z(t.view);e.db.get("_design/"+i[0],function(r,o){if(e.isCancelled)return n(null,{status:"cancelled"});if(r)return n(U(r));var s=o&&o.views&&o.views[i[1]]&&o.views[i[1]].map;if(!s)return n(N(A,o.views?"missing json key: "+i[1]:"missing json key: views"));t.filter=H(["return function(doc) {",'  "use strict";',"  var emitted = false;","  var emit = function (a, b) {","    emitted = true;","  };","  var view = "+s+";","  view(doc);","  if (emitted) {","    return true;","  }","};"].join("\n"),{}),e.doChanges(t)})}else if(t.selector)t.filter=function(e){return function(e,t){if("object"!=typeof t)throw new Error("Selector error: expected a JSON object");var n=at([{doc:e}],{selector:t=Ze(t)},Object.keys(t));return n&&1===n.length}(e,t.selector)},e.doChanges(t);else{var o=z(t.filter);e.db.get("_design/"+o[0],function(r,i){if(e.isCancelled)return n(null,{status:"cancelled"});if(r)return n(U(r));var s=i&&i.filters&&i.filters[o[1]];if(!s)return n(N(A,i&&i.filters?"missing json key: "+o[1]:"missing json key: filters"));t.filter=H('"use strict";\nreturn '+s+";",{}),e.doChanges(t)})}}function mt(e){return e.reduce(function(e,t){return e[t]=!0,e},{})}Ke.plugin(function(e){e._changesFilterPlugin={validate:vt,normalize:_t,shouldFilter:yt,filter:gt}}),Ke.version="9.0.0";var bt=mt(["_id","_rev","_access","_attachments","_deleted","_revisions","_revs_info","_conflicts","_deleted_conflicts","_local_seq","_rev_tree","_replication_id","_replication_state","_replication_state_time","_replication_state_reason","_replication_stats","_removed"]),wt=mt(["_access","_attachments","_replication_id","_replication_state","_replication_state_time","_replication_state_reason","_replication_stats"]);function kt(e){if(!/^\d+-/.test(e))return N(M);var t=e.indexOf("-"),n=e.substring(0,t),r=e.substring(t+1);return{prefix:parseInt(n,10),id:r}}function jt(e,t,n){var r,i,o;n||(n={deterministic_revs:!0});var s={status:"available"};if(e._deleted&&(s.deleted=!0),t)if(e._id||(e._id=pe()),i=he(e,n.deterministic_revs),e._rev){if((o=kt(e._rev)).error)return o;e._rev_tree=[{pos:o.prefix,ids:[o.id,{status:"missing"},[[i,s,[]]]]}],r=o.prefix+1}else e._rev_tree=[{pos:1,ids:[i,s,[]]}],r=1;else if(e._revisions&&(e._rev_tree=function(e,t){for(var n=e.start-e.ids.length+1,r=e.ids,i=[r[0],t,[]],o=1,s=r.length;o<s;o++)i=[r[o],{status:"missing"},[i]];return[{pos:n,ids:i}]}(e._revisions,s),r=e._revisions.start,i=e._revisions.ids[0]),!e._rev_tree){if((o=kt(e._rev)).error)return o;r=o.prefix,i=o.id,e._rev_tree=[{pos:r,ids:[i,s,[]]}]}K(e._id),e._rev=r+"-"+i;var a={metadata:{},data:{}};for(var c in e)if(Object.prototype.hasOwnProperty.call(e,c)){var u="_"===c[0];if(u&&!bt[c]){var f=N(L,c);throw f.message=L.message+": "+c,f}u&&!wt[c]?a.metadata[c.slice(1)]=e[c]:a.data[c]=e[c]}return a}function qt(e,t,n){var r=function(e){try{return Z(e)}catch(e){return{error:N($,"Attachment is not a valid base64 string")}}}(e.data);if(r.error)return n(r.error);e.length=r.length,e.data="blob"===t?re(r,e.content_type):"base64"===t?ee(r):r,le(r,function(t){e.digest="md5-"+t,n()})}function Ot(e,t,n){if(e.stub)return n();"string"==typeof e.data?qt(e,t,n):function(e,t,n){le(e.data,function(r){e.digest="md5-"+r,e.length=e.data.size||e.data.length||0,"binary"===t?se(e.data,function(t){e.data=t,n()}):"base64"===t?ae(e.data,function(t){e.data=t,n()}):n()})}(e,t,n)}function At(e,t,n,r,i,o,s,a){if(function(e,t){for(var n,r=e.slice(),i=t.split("-"),o=parseInt(i[0],10),s=i[1];n=r.pop();){if(n.pos===o&&n.ids[0]===s)return!0;for(var a=n.ids[2],c=0,u=a.length;c<u;c++)r.push({pos:n.pos+1,ids:a[c]})}return!1}(t.rev_tree,n.metadata.rev)&&!a)return r[i]=n,o();var c=t.winningRev||ve(t),u="deleted"in t?t.deleted:Pe(t,c),f="deleted"in n.metadata?n.metadata.deleted:Pe(n.metadata),l=/^1-/.test(n.metadata.rev);if(u&&!f&&a&&l){var d=n.data;d._rev=c,d._id=n.metadata.id,n=jt(d,a)}var h=Se(t.rev_tree,n.metadata.rev_tree[0],e);if(a&&(u&&f&&"new_leaf"!==h.conflicts||!u&&"new_leaf"!==h.conflicts||u&&!f&&"new_branch"===h.conflicts)){var p=N(S);return r[i]=p,o()}var v=n.metadata.rev;n.metadata.rev_tree=h.tree,n.stemmedRevs=h.stemmedRevs||[],t.rev_map&&(n.metadata.rev_map=t.rev_map);var _=ve(n.metadata),y=Pe(n.metadata,_),g=u===y?0:u<y?-1:1;s(n,_,y,v===_?y:Pe(n.metadata,v),!0,g,i,o)}function St(e,t,n,r,i,o,s,a,c){e=e||1e3;var u=a.new_edits,f=new Map,l=0,d=t.length;function h(){++l===d&&c&&c()}t.forEach(function(e,t){if(e._id&&Ce(e._id)){var r=e._deleted?"_removeLocal":"_putLocal";n[r](e,{ctx:i},function(e,n){o[t]=e||n,h()})}else{var s=e.metadata.id;f.has(s)?(d--,f.get(s).push([e,t])):f.set(s,[[e,t]])}}),f.forEach(function(t,n){var i=0;function c(){++i<t.length?f():h()}function f(){var f=t[i],l=f[0],d=f[1];if(r.has(n))At(e,r.get(n),l,o,d,c,s,u);else{var h=Se([],l.metadata.rev_tree[0],e);l.metadata.rev_tree=h.tree,l.stemmedRevs=h.stemmedRevs||[],function(e,t,n){var r=ve(e.metadata),i=Pe(e.metadata,r);if("was_delete"in a&&i)return o[t]=N(A,"deleted"),n();if(u&&function(e){return"missing"===e.metadata.rev_tree[0].ids[1].status}(e)){var c=N(S);return o[t]=c,n()}s(e,r,i,i,!1,i?0:1,t,n)}(l,d,c)}}f()})}var xt="document-store",Pt="meta-store";function Ct(e){try{return JSON.stringify(e)}catch(t){return s.stringify(e)}}function Et(e){return function(t){var n="unknown_error";t.target&&t.target.error&&(n=t.target.error.name||t.target.error.message),e(N(B,n,t.type))}}function $t(e,t,n){return{data:Ct(e),winningRev:t,deletedOrLocal:n?"1":"0",seq:e.seq,id:e.id}}function It(e){if(!e)return null;var t=function(e){try{return JSON.parse(e)}catch(t){return s.parse(e)}}(e.data);return t.winningRev=e.winningRev,t.deleted="1"===e.deletedOrLocal,t.seq=e.seq,t}function Lt(e){if(!e)return e;var t=e._doc_id_rev.lastIndexOf(":");return e._id=e._doc_id_rev.substring(0,t-1),e._rev=e._doc_id_rev.substring(t+1),delete e._doc_id_rev,e}function Dt(e,t,n,r){n?r(e?"string"!=typeof e?e:ie(e,t):te([""],{type:t})):e?"string"!=typeof e?oe(e,function(e){r(ee(e))}):r(e):r("")}function Tt(e,t,n,r){var i=Object.keys(e._attachments||{});if(!i.length)return r&&r();var o=0;function s(){++o===i.length&&r&&r()}i.forEach(function(r){t.attachments&&t.include_docs?function(e,t){var r=e._attachments[t],i=r.digest;n.objectStore("attach-store").get(i).onsuccess=function(e){r.body=e.target.result.body,s()}}(e,r):(e._attachments[r].stub=!0,s())})}function Bt(e,t){return Promise.all(e.map(function(e){if(e.doc&&e.doc._attachments){var n=Object.keys(e.doc._attachments);return Promise.all(n.map(function(n){var r=e.doc._attachments[n];if("body"in r){var i=r.body,o=r.content_type;return new Promise(function(s){Dt(i,o,t,function(t){e.doc._attachments[n]=Object.assign(p(r,["digest","content_type"]),{data:t}),s()})})}}))}}))}function Mt(e,t,n){var r=[],i=n.objectStore("by-sequence"),o=n.objectStore("attach-store"),s=n.objectStore("attach-seq-store"),a=e.length;function c(){--a||function(){if(!r.length)return;r.forEach(function(e){s.index("digestSeq").count(IDBKeyRange.bound(e+"::",e+"::￿",!1,!1)).onsuccess=function(t){t.target.result||o.delete(e)}})}()}e.forEach(function(e){var n=i.index("_doc_id_rev"),o=t+"::"+e;n.getKey(o).onsuccess=function(e){var t=e.target.result;if("number"!=typeof t)return c();i.delete(t),s.index("seq").openCursor(IDBKeyRange.only(t)).onsuccess=function(e){var t=e.target.result;if(t){var n=t.value.digestSeq.split("::")[0];r.push(n),s.delete(t.primaryKey),t.continue()}else c()}}})}function Rt(e,t,n){try{return{txn:e.transaction(t,n)}}catch(e){return{error:e}}}var Nt=new class extends a{constructor(){super(),this._listeners={},m()&&addEventListener("storage",e=>{this.emit(e.key)})}addListener(e,t,n,r){if(!this._listeners[t]){var i=!1,o=this;this._listeners[t]=s,this.on(e,s)}function s(){if(o._listeners[t])if(i)i="waiting";else{i=!0;var e=p(r,["style","include_docs","attachments","conflicts","filter","doc_ids","view","since","query_params","binary","return_docs"]);n.changes(e).on("change",function(e){e.seq>r.since&&!r.cancelled&&(r.since=e.seq,r.onChange(e))}).on("complete",function(){"waiting"===i&&b(s),i=!1}).on("error",function(){i=!1})}}}removeListener(e,t){t in this._listeners&&(super.removeListener(e,this._listeners[t]),delete this._listeners[t])}notifyLocalWindows(e){m()&&(localStorage[e]="a"===localStorage[e]?"b":"a")}notify(e){this.emit(e),this.notifyLocalWindows(e)}};function Ut(e,t,n,r,i,o){for(var s,a,c,u,f,l,d,h,p=t.docs,v=0,_=p.length;v<_;v++){var y=p[v];y._id&&Ce(y._id)||(y=p[v]=jt(y,n.new_edits,e)).error&&!d&&(d=y)}if(d)return o(d);var g=!1,m=0,b=new Array(p.length),w=new Map,k=!1,j=r._meta.blobSupport?"blob":"base64";function q(){g=!0,O()}function O(){h&&g&&(h.docCount+=m,l.put(h))}function A(){k||(Nt.notify(r._meta.name),o(null,b))}function S(e,t,n,r,i,o,s,a){e.metadata.winningRev=t,e.metadata.deleted=n;var c=e.data;if(c._id=e.metadata.id,c._rev=e.metadata.rev,r&&(c._deleted=!0),c._attachments&&Object.keys(c._attachments).length)return function(e,t,n,r,i,o){var s=e.data,a=0,c=Object.keys(s._attachments);function f(){a===c.length&&x(e,t,n,r,i,o)}function l(){a++,f()}c.forEach(function(n){var r=e.data._attachments[n];if(r.stub)a++,f();else{var i=r.data;delete r.data,r.revpos=parseInt(t,10),function(e,t,n){u.count(e).onsuccess=function(r){if(r.target.result)return n();var i={digest:e,body:t};u.put(i).onsuccess=n}}(r.digest,i,l)}})}(e,t,n,i,s,a);m+=o,O(),x(e,t,n,i,s,a)}function x(e,t,n,i,o,u){var l=e.data,d=e.metadata;function h(o){var c=e.stemmedRevs||[];i&&r.auto_compaction&&(c=c.concat(function(e){var t=[];return _e(e.rev_tree,function(e,n,r,i,o){"available"!==o.status||e||(t.push(n+"-"+r),o.status="missing")}),t}(e.metadata))),c&&c.length&&Mt(c,e.metadata.id,s),d.seq=o.target.result;var u=$t(d,t,n);a.put(u).onsuccess=p}function p(){b[o]={ok:!0,id:d.id,rev:d.rev},w.set(e.metadata.id,e.metadata),function(e,t,n){var r=0,i=Object.keys(e.data._attachments||{});if(!i.length)return n();function o(){++r===i.length&&n()}function s(n){var r=e.data._attachments[n].digest,i=f.put({seq:t,digestSeq:r+"::"+t});i.onsuccess=o,i.onerror=function(e){e.preventDefault(),e.stopPropagation(),o()}}for(var a=0;a<i.length;a++)s(i[a])}(e,d.seq,u)}l._doc_id_rev=d.id+"::"+d.rev,delete l._id,delete l._rev;var v=c.put(l);v.onsuccess=h,v.onerror=function(e){e.preventDefault(),e.stopPropagation(),c.index("_doc_id_rev").getKey(l._doc_id_rev).onsuccess=function(e){c.put(l,e.target.result).onsuccess=h}}}!function(e,t,n){if(!e.length)return n();var r,i=0;function o(){i++,e.length===i&&(r?n(r):n())}e.forEach(function(e){var n=e.data&&e.data._attachments?Object.keys(e.data._attachments):[],i=0;if(!n.length)return o();function s(e){r=e,++i===n.length&&o()}for(var a in e.data._attachments)Object.prototype.hasOwnProperty.call(e.data._attachments,a)&&Ot(e.data._attachments[a],t,s)})}(p,j,function(t){if(t)return o(t);!function(){var t=Rt(i,[xt,"by-sequence","attach-store","local-store","attach-seq-store",Pt],"readwrite");if(t.error)return o(t.error);(s=t.txn).onabort=Et(o),s.ontimeout=Et(o),s.oncomplete=A,a=s.objectStore(xt),c=s.objectStore("by-sequence"),u=s.objectStore("attach-store"),f=s.objectStore("attach-seq-store"),(l=s.objectStore(Pt)).get(Pt).onsuccess=function(e){h=e.target.result,O()},function(e){var t=[];if(p.forEach(function(e){e.data&&e.data._attachments&&Object.keys(e.data._attachments).forEach(function(n){var r=e.data._attachments[n];r.stub&&t.push(r.digest)})}),!t.length)return e();var n,r=0;t.forEach(function(i){!function(e,t){u.get(e).onsuccess=function(n){if(n.target.result)t();else{var r=N(R,"unknown stub attachment with digest "+e);r.status=412,t(r)}}}(i,function(i){i&&!n&&(n=i),++r===t.length&&e(n)})})}(function(t){if(t)return k=!0,o(t);!function(){if(!p.length)return;var t=0;function i(){++t===p.length&&St(e.revs_limit,p,r,w,s,b,S,n,q)}function o(e){var t=It(e.target.result);t&&w.set(t.id,t),i()}for(var c=0,u=p.length;c<u;c++){var f=p[c];if(f._id&&Ce(f._id))i();else a.get(f.metadata.id).onsuccess=o}}()})}()})}function Ft(e,t,n,r,i){var o,s,a;function c(e){s=e.target.result,o&&i(o,s,a)}function u(e){o=e.target.result,s&&i(o,s,a)}function f(e){var t=e.target.result;if(!t)return i();i([t.key],[t.value],t)}-1===r&&(r=1e3),"function"==typeof e.getAll&&"function"==typeof e.getAllKeys&&r>1&&!n?(a={continue:function(){if(!o.length)return i();var n,a=o[o.length-1];if(t&&t.upper)try{n=IDBKeyRange.bound(a,t.upper,!0,t.upperOpen)}catch(e){if("DataError"===e.name&&0===e.code)return i()}else n=IDBKeyRange.lowerBound(a,!0);t=n,o=null,s=null,e.getAll(t,r).onsuccess=c,e.getAllKeys(t,r).onsuccess=u}},e.getAll(t,r).onsuccess=c,e.getAllKeys(t,r).onsuccess=u):n?e.openCursor(t,"prev").onsuccess=f:e.openCursor(t).onsuccess=f}function Kt(e,t,n){var r,i,o="startkey"in e&&e.startkey,s="endkey"in e&&e.endkey,a="key"in e&&e.key,c="keys"in e&&e.keys,u=e.skip||0,f="number"==typeof e.limit?e.limit:-1,l=!1!==e.inclusive_end;if(!c&&(i=(r=function(e,t,n,r,i){try{if(e&&t)return i?IDBKeyRange.bound(t,e,!n,!1):IDBKeyRange.bound(e,t,!1,!n);if(e)return i?IDBKeyRange.upperBound(e):IDBKeyRange.lowerBound(e);if(t)return i?IDBKeyRange.lowerBound(t,!n):IDBKeyRange.upperBound(t,!n);if(r)return IDBKeyRange.only(r)}catch(e){return{error:e}}return null}(o,s,l,a,e.descending))&&r.error)&&("DataError"!==i.name||0!==i.code))return n(N(B,i.name,i.message));var d=[xt,"by-sequence",Pt];e.attachments&&d.push("attach-store");var h=Rt(t,d,"readonly");if(h.error)return n(h.error);var p=h.txn;p.oncomplete=function(){e.attachments?Bt(w,e.binary).then(O):O()},p.onabort=Et(n);var v,_,y=p.objectStore(xt),g=p.objectStore("by-sequence"),m=p.objectStore(Pt),b=g.index("_doc_id_rev"),w=[];function k(t,n){var r={id:n.id,key:n.id,value:{rev:t}};n.deleted?c&&(w.push(r),r.value.deleted=!0,r.doc=null):u--<=0&&(w.push(r),e.include_docs&&function(t,n,r){var i=t.id+"::"+r;b.get(i).onsuccess=function(r){if(n.doc=Lt(r.target.result)||{},e.conflicts){var i=me(t);i.length&&(n.doc._conflicts=i)}Tt(n.doc,e,p)}}(n,r,t))}function j(e){for(var t=0,n=e.length;t<n&&w.length!==f;t++){var r=e[t];if(r.error&&c)w.push(r);else{var i=It(r);k(i.winningRev,i)}}}function q(e,t,n){n&&(j(t),w.length<f&&n.continue())}function O(){var t={total_rows:v,offset:e.skip,rows:w};e.update_seq&&void 0!==_&&(t.update_seq=_),n(null,t)}return m.get(Pt).onsuccess=function(e){v=e.target.result.docCount},e.update_seq&&(g.openKeyCursor(null,"prev").onsuccess=e=>{var t=e.target.result;t&&t.key&&(_=t.key)}),i||0===f?void 0:c?function(e,t,n){var r=new Array(e.length),i=0;e.forEach(function(o,s){t.get(o).onsuccess=function(t){t.target.result?r[s]=t.target.result:r[s]={key:o,error:"not_found"},++i===e.length&&n(e,r,{})}})}(c,y,q):-1===f?function(e,t,n){if("function"!=typeof e.getAll){var r=[];e.openCursor(t).onsuccess=function(e){var t=e.target.result;t?(r.push(t.value),t.continue()):n({target:{result:r}})}}else e.getAll(t).onsuccess=n}(y,r,function(t){var n=t.target.result;e.descending&&(n=n.reverse()),j(n)}):void Ft(y,r,e.descending,f+u,q)}var Jt=!1,zt=[];function Vt(){!Jt&&zt.length&&(Jt=!0,zt.shift()())}function Gt(e,t,n,r){if((e=f(e)).continuous){var i=n+":"+pe();return Nt.addListener(n,i,t,e),Nt.notify(n),{cancel:function(){Nt.removeListener(n,i)}}}var o=e.doc_ids&&new Set(e.doc_ids);e.since=e.since||0;var s=e.since,a="limit"in e?e.limit:-1;0===a&&(a=1);var c,u,l,d,h=[],p=0,v=F(e),_=new Map;function y(e,t,n,r){if(n.seq!==t)return r();if(n.winningRev===e._rev)return r(n,e);var i=e._id+"::"+n.winningRev;d.get(i).onsuccess=function(e){r(n,Lt(e.target.result))}}function g(){e.complete(null,{results:h,last_seq:s})}var m=[xt,"by-sequence"];e.attachments&&m.push("attach-store");var b=Rt(r,m,"readonly");if(b.error)return e.complete(b.error);(c=b.txn).onabort=Et(e.complete),c.oncomplete=function(){!e.continuous&&e.attachments?Bt(h).then(g):g()},u=c.objectStore("by-sequence"),l=c.objectStore(xt),d=u.index("_doc_id_rev"),Ft(u,e.since&&!e.descending?IDBKeyRange.lowerBound(e.since,!0):null,e.descending,a,function(t,n,r){if(r&&t.length){var i=new Array(t.length),u=new Array(t.length),f=0;n.forEach(function(n,s){!function(e,t,n){if(o&&!o.has(e._id))return n();var r=_.get(e._id);if(r)return y(e,t,r,n);l.get(e._id).onsuccess=function(i){r=It(i.target.result),_.set(e._id,r),y(e,t,r,n)}}(Lt(n),t[s],function(n,o){u[s]=n,i[s]=o,++f===t.length&&function(){for(var t=[],n=0,o=i.length;n<o&&p!==a;n++){var s=i[n];if(s){var c=u[n];t.push(d(c,s))}}Promise.all(t).then(function(t){for(var n=0,r=t.length;n<r;n++)t[n]&&e.onChange(t[n])}).catch(e.complete),p!==a&&r.continue()}()})})}function d(t,n){var r=e.processChange(n,t,e);s=r.seq=t.seq;var i=v(r);return"object"==typeof i?Promise.reject(i):i?(p++,e.return_docs&&h.push(r),e.attachments&&e.include_docs?new Promise(function(t){Tt(n,e,c,function(){Bt([r],e.binary).then(function(){t(r)})})}):Promise.resolve(r)):Promise.resolve()}})}var Qt,Wt=new Map,Yt=new Map;function Ht(e,t){var n=this;!function(e,t,n){zt.push(function(){e(function(e,r){!function(e,t,n,r){try{e(t,n)}catch(t){r.emit("error",t)}}(t,e,r,n),Jt=!1,b(function(){Vt()})})}),Vt()}(function(t){!function(e,t,n){var r=t.name,i=null,o=null;function s(e){return function(t,n){t&&t instanceof Error&&!t.reason&&o&&(t.reason=o),e(t,n)}}function a(e,t){var n=e.objectStore(xt);n.createIndex("deletedOrLocal","deletedOrLocal",{unique:!1}),n.openCursor().onsuccess=function(e){var r=e.target.result;if(r){var i=r.value,o=Pe(i);i.deletedOrLocal=o?"1":"0",n.put(i),r.continue()}else t()}}function c(e,t){var n=e.objectStore("local-store"),r=e.objectStore(xt),i=e.objectStore("by-sequence");r.openCursor().onsuccess=function(e){var o=e.target.result;if(o){var s=o.value,a=s.id,c=Ce(a),u=ve(s);if(c){var f=a+"::"+u,l=a+"::",d=a+"::~",h=i.index("_doc_id_rev"),p=IDBKeyRange.bound(l,d,!1,!1),v=h.openCursor(p);v.onsuccess=function(e){if(v=e.target.result){var t=v.value;t._doc_id_rev===f&&n.put(t),i.delete(v.primaryKey),v.continue()}else r.delete(o.primaryKey),o.continue()}}else o.continue()}else t&&t()}}function u(e,t){var n=e.objectStore("by-sequence"),r=e.objectStore("attach-store"),i=e.objectStore("attach-seq-store");r.count().onsuccess=function(e){if(!e.target.result)return t();n.openCursor().onsuccess=function(e){var n=e.target.result;if(!n)return t();for(var r=n.value,o=n.primaryKey,s=Object.keys(r._attachments||{}),a={},c=0;c<s.length;c++){a[r._attachments[s[c]].digest]=!0}var u=Object.keys(a);for(c=0;c<u.length;c++){var f=u[c];i.put({seq:o,digestSeq:f+"::"+o})}n.continue()}}}function f(e){var t=e.objectStore("by-sequence"),n=e.objectStore(xt);n.openCursor().onsuccess=function(e){var r=e.target.result;if(r){var i,o=(i=r.value).data?It(i):(i.deleted="1"===i.deletedOrLocal,i);if(o.winningRev=o.winningRev||ve(o),o.seq)return s();!function(){var e=o.id+"::",n=o.id+"::￿",r=t.index("_doc_id_rev").openCursor(IDBKeyRange.bound(e,n)),i=0;r.onsuccess=function(e){var t=e.target.result;if(!t)return o.seq=i,s();var n=t.primaryKey;n>i&&(i=n),t.continue()}}()}function s(){var e=$t(o,o.winningRev,o.deleted);n.put(e).onsuccess=function(){r.continue()}}}}e._meta=null,e._remote=!1,e.type=function(){return"idb"},e._id=d(function(t){t(null,e._meta.instanceId)}),e._bulkDocs=function(n,r,o){Ut(t,n,r,e,i,s(o))},e._get=function(e,t,n){var r,o,s,a=t.ctx;if(!a){var c=Rt(i,[xt,"by-sequence","attach-store"],"readonly");if(c.error)return n(c.error);a=c.txn}function u(){n(s,{doc:r,metadata:o,ctx:a})}a.objectStore(xt).get(e).onsuccess=function(e){if(!(o=It(e.target.result)))return s=N(A,"missing"),u();var n;if(t.rev)n=t.latest?function(e,t){for(var n,r=t.rev_tree.slice();n=r.pop();){var i=n.pos,o=n.ids,s=o[0],a=o[1],c=o[2],u=0===c.length,f=n.history?n.history.slice():[];if(f.push({id:s,pos:i,opts:a}),u)for(var l=0,d=f.length;l<d;l++){var h=f[l];if(h.pos+"-"+h.id===e)return i+"-"+s}for(var p=0,v=c.length;p<v;p++)r.push({pos:i+1,ids:c[p],history:f})}throw new Error("Unable to resolve latest revision for id "+t.id+", rev "+e)}(t.rev,o):t.rev;else if(n=o.winningRev,Pe(o))return s=N(A,"deleted"),u();var i=a.objectStore("by-sequence"),c=o.id+"::"+n;i.index("_doc_id_rev").get(c).onsuccess=function(e){if((r=e.target.result)&&(r=Lt(r)),!r)return s=N(A,"missing"),u();u()}}},e._getAttachment=function(e,t,n,r,o){var s;if(r.ctx)s=r.ctx;else{var a=Rt(i,[xt,"by-sequence","attach-store"],"readonly");if(a.error)return o(a.error);s=a.txn}var c=n.digest,u=n.content_type;s.objectStore("attach-store").get(c).onsuccess=function(e){Dt(e.target.result.body,u,r.binary,function(e){o(null,e)})}},e._info=function(t){var n,r,o=Rt(i,[Pt,"by-sequence"],"readonly");if(o.error)return t(o.error);var s=o.txn;s.objectStore(Pt).get(Pt).onsuccess=function(e){r=e.target.result.docCount},s.objectStore("by-sequence").openKeyCursor(null,"prev").onsuccess=function(e){var t=e.target.result;n=t?t.key:0},s.oncomplete=function(){t(null,{doc_count:r,update_seq:n,idb_attachment_format:e._meta.blobSupport?"binary":"base64"})}},e._allDocs=function(e,t){Kt(e,i,s(t))},e._changes=function(t){return Gt(t,e,r,i)},e._close=function(e){i.close(),Wt.delete(r),e()},e._getRevisionTree=function(e,t){var n=Rt(i,[xt],"readonly");if(n.error)return t(n.error);n.txn.objectStore(xt).get(e).onsuccess=function(e){var n=It(e.target.result);n?t(null,n.rev_tree):t(N(A))}},e._doCompaction=function(e,t,n){var r=Rt(i,[xt,"by-sequence","attach-store","attach-seq-store"],"readwrite");if(r.error)return n(r.error);var o=r.txn;o.objectStore(xt).get(e).onsuccess=function(n){var r=It(n.target.result);_e(r.rev_tree,function(e,n,r,i,o){var s=n+"-"+r;-1!==t.indexOf(s)&&(o.status="missing")}),Mt(t,e,o);var i=r.winningRev,s=r.deleted;o.objectStore(xt).put($t(r,i,s))},o.onabort=Et(n),o.oncomplete=function(){n()}},e._getLocal=function(e,t){var n=Rt(i,["local-store"],"readonly");if(n.error)return t(n.error);var r=n.txn.objectStore("local-store").get(e);r.onerror=Et(t),r.onsuccess=function(e){var n=e.target.result;n?(delete n._doc_id_rev,t(null,n)):t(N(A))}},e._putLocal=function(e,t,n){"function"==typeof t&&(n=t,t={}),delete e._revisions;var r=e._rev,o=e._id;e._rev=r?"0-"+(parseInt(r.split("-")[1],10)+1):"0-1";var s,a=t.ctx;if(!a){var c=Rt(i,["local-store"],"readwrite");if(c.error)return n(c.error);(a=c.txn).onerror=Et(n),a.oncomplete=function(){s&&n(null,s)}}var u,f=a.objectStore("local-store");r?(u=f.get(o)).onsuccess=function(i){var o=i.target.result;o&&o._rev===r?f.put(e).onsuccess=function(){s={ok:!0,id:e._id,rev:e._rev},t.ctx&&n(null,s)}:n(N(S))}:((u=f.add(e)).onerror=function(e){n(N(S)),e.preventDefault(),e.stopPropagation()},u.onsuccess=function(){s={ok:!0,id:e._id,rev:e._rev},t.ctx&&n(null,s)})},e._removeLocal=function(e,t,n){"function"==typeof t&&(n=t,t={});var r,o=t.ctx;if(!o){var s=Rt(i,["local-store"],"readwrite");if(s.error)return n(s.error);(o=s.txn).oncomplete=function(){r&&n(null,r)}}var a=e._id,c=o.objectStore("local-store"),u=c.get(a);u.onerror=Et(n),u.onsuccess=function(i){var o=i.target.result;o&&o._rev===e._rev?(c.delete(a),r={ok:!0,id:a,rev:"0-0"},t.ctx&&n(null,r)):n(N(A))}},e._destroy=function(e,t){Nt.removeAllListeners(r);var n=Yt.get(r);n&&n.result&&(n.result.close(),Wt.delete(r));var i=indexedDB.deleteDatabase(r);i.onsuccess=function(){Yt.delete(r),m()&&r in localStorage&&delete localStorage[r],t(null,{ok:!0})},i.onerror=Et(t)};var l=Wt.get(r);if(l)return i=l.idb,e._meta=l.global,b(function(){n(null,e)});var h=indexedDB.open(r,5);Yt.set(r,h),h.onupgradeneeded=function(e){var t=e.target.result;if(e.oldVersion<1)return function(e){var t=e.createObjectStore(xt,{keyPath:"id"});e.createObjectStore("by-sequence",{autoIncrement:!0}).createIndex("_doc_id_rev","_doc_id_rev",{unique:!0}),e.createObjectStore("attach-store",{keyPath:"digest"}),e.createObjectStore(Pt,{keyPath:"id",autoIncrement:!1}),e.createObjectStore("detect-blob-support"),t.createIndex("deletedOrLocal","deletedOrLocal",{unique:!1}),e.createObjectStore("local-store",{keyPath:"_id"});var n=e.createObjectStore("attach-seq-store",{autoIncrement:!0});n.createIndex("seq","seq"),n.createIndex("digestSeq","digestSeq",{unique:!0})}(t);var n=e.currentTarget.transaction;e.oldVersion<3&&function(e){e.createObjectStore("local-store",{keyPath:"_id"}).createIndex("_doc_id_rev","_doc_id_rev",{unique:!0})}(t),e.oldVersion<4&&function(e){var t=e.createObjectStore("attach-seq-store",{autoIncrement:!0});t.createIndex("seq","seq"),t.createIndex("digestSeq","digestSeq",{unique:!0})}(t);var r=[a,c,u,f],i=e.oldVersion;!function e(){var t=r[i-1];i++,t&&t(n,e)}()},h.onsuccess=function(t){(i=t.target.result).onversionchange=function(){i.close(),Wt.delete(r)},i.onabort=function(e){w("error","Database has a global failure",e.target.error),o=e.target.error,i.close(),Wt.delete(r)};var s,a,c,u,f=i.transaction([Pt,"detect-blob-support",xt],"readwrite"),l=!1;function d(){void 0!==c&&l&&(e._meta={name:r,instanceId:u,blobSupport:c},Wt.set(r,{idb:i,global:e._meta}),n(null,e))}function h(){if(void 0!==a&&void 0!==s){var e=r+"_id";e in s?u=s[e]:s[e]=u=pe(),s.docCount=a,f.objectStore(Pt).put(s)}}f.objectStore(Pt).get(Pt).onsuccess=function(e){s=e.target.result||{id:Pt},h()},function(e,t){e.objectStore(xt).index("deletedOrLocal").count(IDBKeyRange.only("0")).onsuccess=function(e){t(e.target.result)}}(f,function(e){a=e,h()}),Qt||(Qt=function(e,t,n){return new Promise(function(r){var i=te([""]);let o;if("function"==typeof n){const r=n(i);o=e.objectStore(t).put(r)}else{const r=n;o=e.objectStore(t).put(i,r)}o.onsuccess=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),t=navigator.userAgent.match(/Edge\//);r(t||!e||parseInt(e[1],10)>=43)},o.onerror=e.onabort=function(e){e.preventDefault(),e.stopPropagation(),r(!1)}}).catch(function(){return!1})}(f,"detect-blob-support","key")),Qt.then(function(e){c=e,d()}),f.oncomplete=function(){l=!0,d()},f.onabort=Et(n)},h.onerror=function(e){var t=e.target.error&&e.target.error.message;t?-1!==t.indexOf("stored database is a higher version")&&(t=new Error('This DB was created with the newer "indexeddb" adapter, but you are trying to open it with the older "idb" adapter')):t="Failed to open indexedDB, are you in private browsing mode?",w("error",t),n(N(B,t))}}(n,e,t)},t,n.constructor)}Ht.valid=function(){try{return"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}};const Xt={};function Zt(e){const t=e.doc||e.ok,n=t&&t._attachments;n&&Object.keys(n).forEach(function(e){const t=n[e];t.data=ie(t.data,t.content_type)})}function en(e){return/^_design/.test(e)?"_design/"+encodeURIComponent(e.slice(8)):e.startsWith("_local/")?"_local/"+encodeURIComponent(e.slice(7)):encodeURIComponent(e)}function tn(e){return e._attachments&&Object.keys(e._attachments)?Promise.all(Object.keys(e._attachments).map(function(t){const n=e._attachments[t];if(n.data&&"string"!=typeof n.data)return new Promise(function(e){ae(n.data,e)}).then(function(e){n.data=e})})):Promise.resolve()}function nn(e,t){if(function(e){if(!e.prefix)return!1;const t=Y(e.prefix).protocol;return"http"===t||"https"===t}(t)){const n=t.name.substr(t.prefix.length);e=t.prefix.replace(/\/?$/,"/")+encodeURIComponent(n)}const n=Y(e);(n.user||n.password)&&(n.auth={username:n.user,password:n.password});const r=n.path.replace(/(^\/|\/$)/g,"").split("/");return n.db=r.pop(),-1===n.db.indexOf("%")&&(n.db=encodeURIComponent(n.db)),n.path=r.join("/"),n}function rn(e,t){return on(e,e.db+"/"+t)}function on(e,t){const n=e.path?"/":"";return e.protocol+"://"+e.host+(e.port?":"+e.port:"")+"/"+e.path+n+t}function sn(e){const t=Object.keys(e);return 0===t.length?"":"?"+t.map(t=>t+"="+encodeURIComponent(e[t])).join("&")}function an(e,t){const r=this,i=nn(e.name,e),o=rn(i,"");e=f(e);const s=async function(t,n){if((n=n||{}).headers=n.headers||new ze,n.credentials="include",e.auth||i.auth){const t=e.auth||i.auth,r=t.username+":"+t.password,o=ee(unescape(encodeURIComponent(r)));n.headers.set("Authorization","Basic "+o)}const r=e.headers||{};Object.keys(r).forEach(function(e){n.headers.append(e,r[e])}),function(e){const t="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",n=-1!==t.indexOf("msie"),r=-1!==t.indexOf("trident"),i=-1!==t.indexOf("edge"),o=!("method"in e)||"GET"===e.method;return(n||r||i)&&o}(n)&&(t+=(-1===t.indexOf("?")?"?":"&")+"_nonce="+Date.now());const o=e.fetch||Je;return await o(t,n)};function a(e,t){return h(e,function(...e){l().then(function(){return t.apply(this,e)}).catch(function(t){e.pop()(t)})}).bind(r)}async function c(e,t){const n={};(t=t||{}).headers=t.headers||new ze,t.headers.get("Content-Type")||t.headers.set("Content-Type","application/json"),t.headers.get("Accept")||t.headers.set("Accept","application/json");const r=await s(e,t);n.ok=r.ok,n.status=r.status;const i=await r.json();if(n.data=i,!n.ok){n.data.status=n.status;throw U(n.data)}return Array.isArray(n.data)&&(n.data=n.data.map(function(e){return e.error||e.missing?U(e):e})),n}let u;async function l(){return e.skip_setup?Promise.resolve():u||(u=c(o).catch(function(e){return e&&e.status&&404===e.status?(j(404,"PouchDB is just detecting if the remote exists."),c(o,{method:"PUT"})):Promise.reject(e)}).catch(function(e){return!(!e||!e.status||412!==e.status)||Promise.reject(e)}),u.catch(function(){u=null}),u)}function d(e){return e.split("/").map(encodeURIComponent).join("/")}b(function(){t(null,r)}),r._remote=!0,r.type=function(){return"http"},r.id=a("id",async function(e){let t;try{const e=await s(on(i,""));t=await e.json()}catch(e){t={}}e(null,t&&t.uuid?t.uuid+i.db:rn(i,""))}),r.compact=a("compact",async function(e,t){"function"==typeof e&&(t=e,e={}),e=f(e),await c(rn(i,"_compact"),{method:"POST"}),function n(){r.info(function(r,i){i&&!i.compact_running?t(null,{ok:!0}):setTimeout(n,e.interval||200)})}()}),r.bulkGet=h("bulkGet",function(e,t){const n=this;async function r(t){const n={};e.revs&&(n.revs=!0),e.attachments&&(n.attachments=!0),e.latest&&(n.latest=!0);try{const r=await c(rn(i,"_bulk_get"+sn(n)),{method:"POST",body:JSON.stringify({docs:e.docs})});e.attachments&&e.binary&&r.data.results.forEach(function(e){e.docs.forEach(Zt)}),t(null,r.data)}catch(e){t(e)}}function o(){const r=Math.ceil(e.docs.length/50);let i=0;const o=new Array(r);function s(e){return function(n,s){o[e]=s.results,++i===r&&t(null,{results:o.flat()})}}for(let t=0;t<r;t++){const r=p(e,["revs","attachments","binary","latest"]);r.docs=e.docs.slice(50*t,Math.min(e.docs.length,50*(t+1))),g(n,r,s(t))}}const s=on(i,""),a=Xt[s];"boolean"!=typeof a?r(function(e,n){e?(Xt[s]=!1,j(e.status,"PouchDB is just detecting if the remote supports the _bulk_get API."),o()):(Xt[s]=!0,t(null,n))}):a?r(t):o()}),r._info=async function(e){try{await l();const t=await s(rn(i,"")),n=await t.json();n.host=rn(i,""),e(null,n)}catch(t){e(t)}},r.fetch=async function(e,t){await l();const n="/"===e.substring(0,1)?on(i,e.substring(1)):rn(i,e);return s(n,t)},r.get=a("get",async function(e,t,n){"function"==typeof t&&(n=t,t={});const r={};function o(e){const n=e._attachments,r=n&&Object.keys(n);if(!n||!r.length)return;return function(e,t){return new Promise(function(n,r){var i,o=0,s=0,a=0,c=e.length;function u(){++a===c?i?r(i):n():d()}function f(){o--,u()}function l(e){o--,i=i||e,u()}function d(){for(;o<t&&s<c;)o++,e[s++]().then(f,l)}d()})}(r.map(function(r){return function(){return async function(r){const o=n[r],a=en(e._id)+"/"+d(r)+"?rev="+e._rev,c=await s(rn(i,a));let u,f;if(u="buffer"in c?await c.buffer():await c.blob(),t.binary){const e=Object.getOwnPropertyDescriptor(u.__proto__,"type");e&&!e.set||(u.type=o.content_type),f=u}else f=await new Promise(function(e){ae(u,e)});delete o.stub,delete o.length,o.data=f}(r)}}),5)}(t=f(t)).revs&&(r.revs=!0),t.revs_info&&(r.revs_info=!0),t.latest&&(r.latest=!0),t.open_revs&&("all"!==t.open_revs&&(t.open_revs=JSON.stringify(t.open_revs)),r.open_revs=t.open_revs),t.rev&&(r.rev=t.rev),t.conflicts&&(r.conflicts=t.conflicts),t.update_seq&&(r.update_seq=t.update_seq),e=en(e);const a=rn(i,e+sn(r));try{const e=await c(a);t.attachments&&await(u=e.data,Array.isArray(u)?Promise.all(u.map(function(e){if(e.ok)return o(e.ok)})):o(u)),n(null,e.data)}catch(t){t.docId=e,n(t)}var u}),r.remove=a("remove",async function(e,t,n,r){let o;"string"==typeof t?(o={_id:e,_rev:t},"function"==typeof n&&(r=n,n={})):(o=e,"function"==typeof t?(r=t,n={}):(r=n,n=t));const s=o._rev||n.rev,a=rn(i,en(o._id))+"?rev="+s;try{r(null,(await c(a,{method:"DELETE"})).data)}catch(e){r(e)}}),r.getAttachment=a("getAttachment",async function(e,t,r,o){"function"==typeof r&&(o=r,r={});const a=r.rev?"?rev="+r.rev:"",c=rn(i,en(e))+"/"+d(t)+a;let u;try{const e=await s(c,{method:"GET"});if(!e.ok)throw e;let t;if(u=e.headers.get("content-type"),t=void 0===n||n.browser||"function"!=typeof e.buffer?await e.blob():await e.buffer(),void 0!==n&&!n.browser){const e=Object.getOwnPropertyDescriptor(t.__proto__,"type");e&&!e.set||(t.type=u)}o(null,t)}catch(e){o(e)}}),r.removeAttachment=a("removeAttachment",async function(e,t,n,r){const o=rn(i,en(e)+"/"+d(t))+"?rev="+n;try{r(null,(await c(o,{method:"DELETE"})).data)}catch(e){r(e)}}),r.putAttachment=a("putAttachment",async function(e,t,n,r,o,s){"function"==typeof o&&(s=o,o=r,r=n,n=null);const a=en(e)+"/"+d(t);let u=rn(i,a);if(n&&(u+="?rev="+n),"string"==typeof r){let e;try{e=Z(r)}catch(e){return s(N($,"Attachment is not a valid base64 string"))}r=e?re(e,o):""}try{s(null,(await c(u,{headers:new ze({"Content-Type":o}),method:"PUT",body:r})).data)}catch(e){s(e)}}),r._bulkDocs=async function(e,t,n){e.new_edits=t.new_edits;try{await l(),await Promise.all(e.docs.map(tn));n(null,(await c(rn(i,"_bulk_docs"),{method:"POST",body:JSON.stringify(e)})).data)}catch(e){n(e)}},r._put=async function(e,t,n){try{await l(),await tn(e);n(null,(await c(rn(i,en(e._id)),{method:"PUT",body:JSON.stringify(e)})).data)}catch(t){t.docId=e&&e._id,n(t)}},r.allDocs=a("allDocs",async function(e,t){"function"==typeof e&&(t=e,e={});const n={};let r,o="GET";(e=f(e)).conflicts&&(n.conflicts=!0),e.update_seq&&(n.update_seq=!0),e.descending&&(n.descending=!0),e.include_docs&&(n.include_docs=!0),e.attachments&&(n.attachments=!0),e.key&&(n.key=JSON.stringify(e.key)),e.start_key&&(e.startkey=e.start_key),e.startkey&&(n.startkey=JSON.stringify(e.startkey)),e.end_key&&(e.endkey=e.end_key),e.endkey&&(n.endkey=JSON.stringify(e.endkey)),void 0!==e.inclusive_end&&(n.inclusive_end=!!e.inclusive_end),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.skip&&(n.skip=e.skip);const s=sn(n);void 0!==e.keys&&(o="POST",r={keys:e.keys});try{const n=await c(rn(i,"_all_docs"+s),{method:o,body:JSON.stringify(r)});e.include_docs&&e.attachments&&e.binary&&n.data.rows.forEach(Zt),t(null,n.data)}catch(e){t(e)}}),r._changes=function(e){const t="batch_size"in e?e.batch_size:25;(e=f(e)).continuous&&!("heartbeat"in e)&&(e.heartbeat=1e4);let n="timeout"in e?e.timeout:3e4;"timeout"in e&&e.timeout&&n-e.timeout<5e3&&(n=e.timeout+5e3),"heartbeat"in e&&e.heartbeat&&n-e.heartbeat<5e3&&(n=e.heartbeat+5e3);const r={};"timeout"in e&&e.timeout&&(r.timeout=e.timeout);const o=void 0!==e.limit&&e.limit;let s=o;if(e.style&&(r.style=e.style),(e.include_docs||e.filter&&"function"==typeof e.filter)&&(r.include_docs=!0),e.attachments&&(r.attachments=!0),e.continuous&&(r.feed="longpoll"),e.seq_interval&&(r.seq_interval=e.seq_interval),e.conflicts&&(r.conflicts=!0),e.descending&&(r.descending=!0),e.update_seq&&(r.update_seq=!0),"heartbeat"in e&&e.heartbeat&&(r.heartbeat=e.heartbeat),e.filter&&"string"==typeof e.filter&&(r.filter=e.filter),e.view&&"string"==typeof e.view&&(r.filter="_view",r.view=e.view),e.query_params&&"object"==typeof e.query_params)for(const t in e.query_params)Object.prototype.hasOwnProperty.call(e.query_params,t)&&(r[t]=e.query_params[t]);let a,u="GET";e.doc_ids?(r.filter="_doc_ids",u="POST",a={doc_ids:e.doc_ids}):e.selector&&(r.filter="_selector",u="POST",a={selector:e.selector});const d=new AbortController;let h;const p=async function(n,f){if(e.aborted)return;r.since=n,"object"==typeof r.since&&(r.since=JSON.stringify(r.since)),e.descending?o&&(r.limit=s):r.limit=!o||s>t?t:s;const p=rn(i,"_changes"+sn(r)),v={signal:d.signal,method:u,body:JSON.stringify(a)};if(h=n,!e.aborted)try{await l();f(null,(await c(p,v)).data)}catch(e){f(e)}},v={results:[]},_=function(n,r){if(e.aborted)return;let i=0;if(r&&r.results){i=r.results.length,v.last_seq=r.last_seq;let t=null,n=null;"number"==typeof r.pending&&(t=r.pending),"string"!=typeof v.last_seq&&"number"!=typeof v.last_seq||(n=v.last_seq);({}).query=e.query_params,r.results=r.results.filter(function(r){s--;const i=F(e)(r);return i&&(e.include_docs&&e.attachments&&e.binary&&Zt(r),e.return_docs&&v.results.push(r),e.onChange(r,t,n)),i})}else if(n)return e.aborted=!0,void e.complete(n);r&&r.last_seq&&(h=r.last_seq);const a=o&&s<=0||r&&i<t||e.descending;(!e.continuous||o&&s<=0)&&a?e.complete(null,v):b(function(){p(h,_)})};return p(e.since||0,_),{cancel:function(){e.aborted=!0,d.abort()}}},r.revsDiff=a("revsDiff",async function(e,t,n){"function"==typeof t&&(n=t,t={});try{n(null,(await c(rn(i,"_revs_diff"),{method:"POST",body:JSON.stringify(e)})).data)}catch(e){n(e)}}),r._close=function(e){e()},r._destroy=async function(e,t){try{t(null,await c(rn(i,""),{method:"DELETE"}))}catch(e){404===e.status?t(null,{ok:!0}):t(e)}}}an.valid=function(){return!0};class cn extends Error{constructor(e){super(),this.status=400,this.name="query_parse_error",this.message=e,this.error=!0;try{Error.captureStackTrace(this,cn)}catch(e){}}}class un extends Error{constructor(e){super(),this.status=404,this.name="not_found",this.message=e,this.error=!0;try{Error.captureStackTrace(this,un)}catch(e){}}}class fn extends Error{constructor(e){super(),this.status=500,this.name="invalid_value",this.message=e,this.error=!0;try{Error.captureStackTrace(this,fn)}catch(e){}}}function ln(e,t){return t&&e.then(function(e){b(function(){t(null,e)})},function(e){b(function(){t(e)})}),e}function dn(e,t){return function(){var n=arguments,r=this;return e.add(function(){return t.apply(r,n)})}}function hn(e){var t=new Set(e),n=new Array(t.size),r=-1;return t.forEach(function(e){n[++r]=e}),n}function pn(e){var t=new Array(e.size),n=-1;return e.forEach(function(e,r){t[++n]=r}),t}function vn(e){return new fn("builtin "+e+" function requires map values to be numbers or number arrays")}function _n(e){for(var t=0,n=0,r=e.length;n<r;n++){var i=e[n];if("number"!=typeof i){if(!Array.isArray(i))throw vn("_sum");t="number"==typeof t?[t]:t;for(var o=0,s=i.length;o<s;o++){var a=i[o];if("number"!=typeof a)throw vn("_sum");void 0===t[o]?t.push(a):t[o]+=a}}else"number"==typeof t?t+=i:t[0]+=i}return t}var yn=w.bind(null,"log"),gn=Array.isArray,mn=JSON.parse;function bn(e,t){return H("return ("+e.replace(/;\s*$/,"")+");",{emit:t,sum:_n,log:yn,isArray:gn,toJSON:mn})}class wn{constructor(){this.promise=Promise.resolve()}add(e){return this.promise=this.promise.catch(()=>{}).then(()=>e()),this.promise}finish(){return this.promise}}function kn(e){if(!e)return"undefined";switch(typeof e){case"function":case"string":return e.toString();default:return JSON.stringify(e)}}async function jn(e,t,n,r,i,o){const s=function(e,t){return kn(e)+kn(t)+"undefined"}(n,r);let a;if(!i&&(a=e._cachedViews=e._cachedViews||{},a[s]))return a[s];const c=e.info().then(async function(c){const u=c.db_name+"-mrview-"+(i?"temp":de(s));await X(e,"_local/"+o,function(e){e.views=e.views||{};let n=t;-1===n.indexOf("/")&&(n=t+"/"+t);const r=e.views[n]=e.views[n]||{};if(!r[u])return r[u]=!0,e});const f=(await e.registerDependentDatabase(u)).db;f.auto_compaction=!0;const l={name:u,db:f,sourceDB:e,adapter:e.adapter,mapFun:n,reduceFun:r};let d;try{d=await l.db.get("_local/lastSeq")}catch(e){if(404!==e.status)throw e}return l.seq=d?d.seq:0,a&&l.db.once("destroyed",function(){delete a[s]}),l});return a&&(a[s]=c),c}const qn={},On=new wn;function An(e){return-1===e.indexOf("/")?[e,e]:e.split("/")}function Sn(e,t,n){try{e.emit("error",t)}catch(e){w("error","The user's map/reduce function threw an uncaught error.\nYou can debug this error by doing:\nmyDatabase.on('error', function (err) { debugger; });\nPlease double-check your map/reduce function."),w("error",t,n)}}var xn=function(e,t){return _n(t)},Pn=function(e,t){return t.length},Cn=function(e,t){return{sum:_n(t),min:Math.min.apply(null,t),max:Math.max.apply(null,t),count:t.length,sumsqr:function(e){for(var t=0,n=0,r=e.length;n<r;n++){var i=e[n];t+=i*i}return t}(t)}};var En=function(e,t,n,r){function i(e,t,n){try{t(n)}catch(r){Sn(e,r,{fun:t,doc:n})}}function o(e,t,n,r,i){try{return{output:t(n,r,i)}}catch(o){return Sn(e,o,{fun:t,keys:n,values:r,rereduce:i}),{error:o}}}function s(e,t){const n=et(e.key,t.key);return 0!==n?n:et(e.value,t.value)}function a(e,t,n){return n=n||0,"number"==typeof t?e.slice(n,t+n):n>0?e.slice(n):e}function c(e){const t=e.value;return t&&"object"==typeof t&&t._id||e.id}function u(e){return function(t){return e.include_docs&&e.attachments&&e.binary&&function(e){for(const t of e.rows){const e=t.doc&&t.doc._attachments;if(e)for(const t of Object.keys(e)){const n=e[t];e[t].data=ie(n.data,n.content_type)}}}(t),t}}function f(e,t,n,r){let i=t[e];void 0!==i&&(r&&(i=encodeURIComponent(JSON.stringify(i))),n.push(e+"="+i))}function l(e){if(void 0!==e){const t=Number(e);return isNaN(t)||t!==parseInt(e,10)?e:t}}function d(e){if(e){if("number"!=typeof e)return new cn(`Invalid value for integer: "${e}"`);if(e<0)return new cn(`Invalid value for positive integer: "${e}"`)}}function h(e,t){const n=e.descending?"endkey":"startkey",r=e.descending?"startkey":"endkey";if(void 0!==e[n]&&void 0!==e[r]&&et(e[n],e[r])>0)throw new cn("No rows can match your key range, reverse your start_key and end_key or set {descending : true}");if(t.reduce&&!1!==e.reduce){if(e.include_docs)throw new cn("{include_docs:true} is invalid for reduce");if(e.keys&&e.keys.length>1&&!e.group&&!e.group_level)throw new cn("Multi-key fetches for reduce views must use {group: true}")}for(const t of["group_level","limit","skip"]){const n=d(e[t]);if(n)throw n}}function p(e){return function(t){if(404===t.status)return e;throw t}}function v(e,t,n){return e.db.get("_local/lastSeq").catch(p({_id:"_local/lastSeq",seq:0})).then(function(r){var i=pn(t);return Promise.all(i.map(function(n){return async function(e,t,n){const r="_local/doc_"+e,i={_id:r,keys:[]},o=n.get(e),s=o[0],a=o[1],c=await(function(e){return 1===e.length&&/^1-/.test(e[0].rev)}(a)?Promise.resolve(i):t.db.get(r).catch(p(i)));return function(e,t){const n=[],r=new Set;for(const e of t.rows){const t=e.doc;if(t&&(n.push(t),r.add(t._id),t._deleted=!s.has(t._id),!t._deleted)){const e=s.get(t._id);"value"in e&&(t.value=e.value)}}const i=pn(s);for(const e of i)if(!r.has(e)){const t={_id:e},r=s.get(e);"value"in r&&(t.value=r.value),n.push(t)}return e.keys=hn(i.concat(e.keys)),n.push(e),n}(c,await function(e){return e.keys.length?t.db.allDocs({keys:e.keys,include_docs:!0}):Promise.resolve({rows:[]})}(c))}(n,e,t)})).then(function(t){var i=t.flat();return r.seq=n,i.push(r),e.db.bulkDocs({docs:i})}).then(()=>function(e){return e.sourceDB.get("_local/purges").then(function(t){const n=t.purgeSeq;return e.db.get("_local/purgeSeq").then(function(e){return e._rev}).catch(p(void 0)).then(function(t){return e.db.put({_id:"_local/purgeSeq",_rev:t,purgeSeq:n})})}).catch(function(e){if(404!==e.status)throw e})}(e))})}function _(e){const t="string"==typeof e?e:e.name;let n=qn[t];return n||(n=qn[t]=new wn),n}async function y(e,n){return dn(_(e),function(){return async function(e,n){let r,o,a;const c=t(e.mapFun,function(e,t){const n={id:o._id,key:tt(e)};null!=t&&(n.value=tt(t)),r.push(n)});let u=e.seq||0;let f=0;const l={view:e.name,indexed_docs:f};e.sourceDB.emit("indexing",l);const d=new wn;async function h(){return function(t,l){const p=t.results;if(!p.length&&!l.length)return;for(const e of l){if(p.findIndex(function(t){return t.id===e.docId})<0){const t={_id:e.docId,doc:{_id:e.docId,_deleted:1},changes:[]};e.doc&&(t.doc=e.doc,t.changes.push({rev:e.doc._rev})),p.push(t)}}const y=function(t){const n=new Map;for(const a of t){if("_"!==a.doc._id[0]){r=[],o=a.doc,o._deleted||i(e.sourceDB,c,o),r.sort(s);const t=_(r);n.set(a.doc._id,[t,a.changes])}u=a.seq}return n}(p);d.add(function(t,n){return function(){return v(e,t,n)}}(y,u)),f+=p.length;const g={view:e.name,last_seq:t.last_seq,results_count:p.length,indexed_docs:f};if(e.sourceDB.emit("indexing",g),e.sourceDB.activeTasks.update(a,{completed_items:f}),p.length<n.changes_batch_size)return;return h()}(await e.sourceDB.changes({return_docs:!0,conflicts:!0,include_docs:!0,style:"all_docs",since:u,limit:n.changes_batch_size}),await e.db.get("_local/purgeSeq").then(function(e){return e.purgeSeq}).catch(p(-1)).then(function(t){return e.sourceDB.get("_local/purges").then(function(n){const r=n.purges.filter(function(e,n){return n>t}).map(e=>e.docId),i=r.filter(function(e,t){return r.indexOf(e)===t});return Promise.all(i.map(function(t){return e.sourceDB.get(t).then(function(e){return{docId:t,doc:e}}).catch(p({docId:t}))}))}).catch(p([]))}))}function _(e){const t=new Map;let n;for(let r=0,i=e.length;r<i;r++){const i=e[r],o=[i.key,i.id];r>0&&0===et(i.key,n)&&o.push(r),t.set(rt(o),i),n=i.key}return t}try{await e.sourceDB.info().then(function(t){a=e.sourceDB.activeTasks.add({name:"view_indexing",total_items:t.update_seq-u})}),await h(),await d.finish(),e.seq=u,e.sourceDB.activeTasks.remove(a)}catch(t){e.sourceDB.activeTasks.remove(a,t)}}(e,n)})()}function g(e,t){return dn(_(e),function(){return async function(e,t){let r;const i=e.reduceFun&&!1!==t.reduce,s=t.skip||0;void 0===t.keys||t.keys.length||(t.limit=0,delete t.keys);async function u(t){t.include_docs=!0;const n=await e.db.allDocs(t);return r=n.total_rows,n.rows.map(function(e){if("value"in e.doc&&"object"==typeof e.doc.value&&null!==e.doc.value){const t=Object.keys(e.doc.value).sort(),n=["id","key","value"];if(!(t<n||t>n))return e.doc.value}const t=function(e){for(var t=[],n=[],r=0;;){var i=e[r++];if("\0"!==i)switch(i){case"1":t.push(null);break;case"2":t.push("1"===e[r]),r++;break;case"3":var o=it(e,r);t.push(o.num),r+=o.length;break;case"4":for(var s="";;){var a=e[r];if("\0"===a)break;s+=a,r++}s=s.replace(/\u0001\u0001/g,"\0").replace(/\u0001\u0002/g,"").replace(/\u0002\u0002/g,""),t.push(s);break;case"5":var c={element:[],index:t.length};t.push(c.element),n.push(c);break;case"6":var u={element:{},index:t.length};t.push(u.element),n.push(u);break;default:throw new Error("bad collationIndex or unexpectedly reached end of input: "+i)}else{if(1===t.length)return t.pop();ot(t,n)}}}(e.doc._id);return{key:t[0],id:t[1],value:"value"in e.doc?e.doc.value:null}})}async function f(u){let f;if(f=i?function(e,t,r){0===r.group_level&&delete r.group_level;const i=r.group||r.group_level,s=n(e.reduceFun),c=[],u=isNaN(r.group_level)?Number.POSITIVE_INFINITY:r.group_level;for(const e of t){const t=c[c.length-1];let n=i?e.key:null;i&&Array.isArray(n)&&(n=n.slice(0,u)),t&&0===et(t.groupKey,n)?(t.keys.push([e.key,e.id]),t.values.push(e.value)):c.push({keys:[[e.key,e.id]],values:[e.value],groupKey:n})}t=[];for(const n of c){const r=o(e.sourceDB,s,n.keys,n.values,!1);if(r.error&&r.error instanceof fn)throw r.error;t.push({value:r.error?null:r.output,key:n.groupKey})}return{rows:a(t,r.limit,r.skip)}}(e,u,t):void 0===t.keys?{total_rows:r,offset:s,rows:u}:{total_rows:r,offset:s,rows:a(u,t.limit,t.skip)},t.update_seq&&(f.update_seq=e.seq),t.include_docs){const n=hn(u.map(c)),r=await e.sourceDB.allDocs({keys:n,include_docs:!0,conflicts:t.conflicts,attachments:t.attachments,binary:t.binary}),i=new Map;for(const e of r.rows)i.set(e.id,e.doc);for(const e of u){const t=c(e),n=i.get(t);n&&(e.doc=n)}}return f}if(void 0!==t.keys){const e=t.keys.map(function(e){const n={startkey:rt([e]),endkey:rt([e,{}])};return t.update_seq&&(n.update_seq=!0),u(n)}),n=await Promise.all(e);return f(n.flat())}{const e={descending:t.descending};let n,r;if(t.update_seq&&(e.update_seq=!0),"start_key"in t&&(n=t.start_key),"startkey"in t&&(n=t.startkey),"end_key"in t&&(r=t.end_key),"endkey"in t&&(r=t.endkey),void 0!==n&&(e.startkey=t.descending?rt([n,{}]):rt([n])),void 0!==r){let n=!1!==t.inclusive_end;t.descending&&(n=!n),e.endkey=rt(n?[r,{}]:[r])}if(void 0!==t.key){const n=rt([t.key]),r=rt([t.key,{}]);e.descending?(e.endkey=n,e.startkey=r):(e.startkey=n,e.endkey=r)}i||("number"==typeof t.limit&&(e.limit=t.limit),e.skip=s);return f(await u(e))}}(e,t)})()}async function m(t,n,i){if("function"==typeof t._query)return function(e,t,n){return new Promise(function(r,i){e._query(t,n,function(e,t){if(e)return i(e);r(t)})})}(t,n,i);if(J(t))return async function(e,t,n){let r,i,o=[],s="GET";if(f("reduce",n,o),f("include_docs",n,o),f("attachments",n,o),f("limit",n,o),f("descending",n,o),f("group",n,o),f("group_level",n,o),f("skip",n,o),f("stale",n,o),f("conflicts",n,o),f("startkey",n,o,!0),f("start_key",n,o,!0),f("endkey",n,o,!0),f("end_key",n,o,!0),f("inclusive_end",n,o),f("key",n,o,!0),f("update_seq",n,o),o=o.join("&"),o=""===o?"":"?"+o,void 0!==n.keys){const e=2e3,i="keys="+encodeURIComponent(JSON.stringify(n.keys));i.length+o.length+1<=e?o+=("?"===o[0]?"&":"?")+i:(s="POST","string"==typeof t?r={keys:n.keys}:t.keys=n.keys)}if("string"==typeof t){const a=An(t),c=await e.fetch("_design/"+a[0]+"/_view/"+a[1]+o,{headers:new ze({"Content-Type":"application/json"}),method:s,body:JSON.stringify(r)});i=c.ok;const f=await c.json();if(!i)throw f.status=c.status,U(f);for(const e of f.rows)if(e.value&&e.value.error&&"builtin_reduce_error"===e.value.error)throw new Error(e.reason);return new Promise(function(e){e(f)}).then(u(n))}r=r||{};for(const e of Object.keys(t))Array.isArray(t[e])?r[e]=t[e]:r[e]=t[e].toString();const a=await e.fetch("_temp_view"+o,{headers:new ze({"Content-Type":"application/json"}),method:"POST",body:JSON.stringify(r)});i=a.ok;const c=await a.json();if(!i)throw c.status=a.status,U(c);return new Promise(function(e){e(c)}).then(u(n))}(t,n,i);const o={changes_batch_size:t.__opts.view_update_changes_batch_size||50};if("string"!=typeof n)return h(i,n),On.add(async function(){const r=await jn(t,"temp_view/temp_view",n.map,n.reduce,!0,e);return s=y(r,o).then(function(){return g(r,i)}),a=function(){return r.db.destroy()},s.then(function(e){return a().then(function(){return e})},function(e){return a().then(function(){throw e})});var s,a}),On.finish();{const s=n,a=An(s),c=a[0],u=a[1],f=await t.get("_design/"+c);if(!(n=f.views&&f.views[u]))throw new un(`ddoc ${f._id} has no view named ${u}`);r(f,u),h(i,n);const l=await jn(t,s,n.map,n.reduce,!1,e);return"ok"===i.stale||"update_after"===i.stale?("update_after"===i.stale&&b(function(){y(l,o)}),g(l,i)):(await y(l,o),g(l,i))}}var w;return{query:function(e,t,n){const r=this;"function"==typeof t&&(n=t,t={}),t=t?function(e){return e.group_level=l(e.group_level),e.limit=l(e.limit),e.skip=l(e.skip),e}(t):{},"function"==typeof e&&(e={map:e});const i=Promise.resolve().then(function(){return m(r,e,t)});return ln(i,n),i},viewCleanup:(w=function(){const t=this;return"function"==typeof t._viewCleanup?function(e){return new Promise(function(t,n){e._viewCleanup(function(e,r){if(e)return n(e);t(r)})})}(t):J(t)?async function(e){return(await e.fetch("_view_cleanup",{headers:new ze({"Content-Type":"application/json"}),method:"POST"})).json()}(t):async function(t){try{const n=await t.get("_local/"+e),r=new Map;for(const e of Object.keys(n.views)){const t=An(e),n="_design/"+t[0],i=t[1];let o=r.get(n);o||(o=new Set,r.set(n,o)),o.add(i)}const i={keys:pn(r),include_docs:!0},o=await t.allDocs(i),s={};for(const e of o.rows){const t=e.key.substring(8);for(const i of r.get(e.key)){let r=t+"/"+i;n.views[r]||(r=i);const o=Object.keys(n.views[r]),a=e.doc&&e.doc.views&&e.doc.views[i];for(const e of o)s[e]=s[e]||a}}const a=Object.keys(s).filter(function(e){return!s[e]}).map(function(e){return dn(_(e),function(){return new t.constructor(e,t.__opts).destroy()})()});return Promise.all(a).then(function(){return{ok:!0}})}catch(e){if(404===e.status)return{ok:!0};throw e}}(t)},function(...e){var t=e.pop(),n=w.apply(this,e);return"function"==typeof t&&ln(n,t),n})}}("mrviews",function(e,t){if("function"==typeof e&&2===e.length){var n=e;return function(e){return n(e,t)}}return bn(e.toString(),t)},function(e){var t=e.toString(),n=function(e){if(/^_sum/.test(e))return xn;if(/^_count/.test(e))return Pn;if(/^_stats/.test(e))return Cn;if(/^_/.test(e))throw new Error(e+" is not a supported reduce function.")}(t);return n||bn(t)},function(e,t){var n=e.views&&e.views[t];if("string"!=typeof n.map)throw new un("ddoc "+e._id+" has no string view named "+t+", instead found object of type: "+typeof n.map)});var $n={query:function(e,t,n){return En.query.call(this,e,t,n)},viewCleanup:function(e){return En.viewCleanup.call(this,e)}};function In(e,t){var n=Object.keys(t._attachments);return Promise.all(n.map(function(n){return e.getAttachment(t._id,n,{rev:t._rev})}))}function Ln(e,t,n,r){n=f(n);var i=[],o=!0;return Promise.resolve().then(function(){var s=function(e){var t=[];return Object.keys(e).forEach(function(n){e[n].missing.forEach(function(e){t.push({id:n,rev:e})})}),{docs:t,revs:!0,latest:!0}}(n);if(s.docs.length)return e.bulkGet(s).then(function(n){if(r.cancelled)throw new Error("cancelled");return Promise.all(n.results.map(function(n){return Promise.all(n.docs.map(function(n){var r=n.ok;return n.error&&(o=!1),r&&r._attachments?function(e,t,n){var r=J(t)&&!J(e),i=Object.keys(n._attachments);return r?e.get(n._id).then(function(r){return Promise.all(i.map(function(i){return function(e,t,n){return!e._attachments||!e._attachments[n]||e._attachments[n].digest!==t._attachments[n].digest}(r,n,i)?t.getAttachment(n._id,i):e.getAttachment(r._id,i)}))}).catch(function(e){if(404!==e.status)throw e;return In(t,n)}):In(t,n)}(t,e,r).then(e=>{var t=Object.keys(r._attachments);return e.forEach(function(e,n){var i=r._attachments[t[n]];delete i.stub,delete i.length,i.data=e}),r}):r}))})).then(function(e){i=i.concat(e.flat().filter(Boolean))})})}).then(function(){return{ok:o,docs:i}})}function Dn(e,t,n,r,i){return e.get(t).catch(function(n){if(404===n.status)return"http"!==e.adapter&&"https"!==e.adapter||j(404,"PouchDB is just checking if a remote checkpoint exists."),{session_id:r,_id:t,history:[],replicator:"pouchdb",version:1};throw n}).then(function(o){if(!i.cancelled&&o.last_seq!==n)return o.history=(o.history||[]).filter(function(e){return e.session_id!==r}),o.history.unshift({last_seq:n,session_id:r}),o.history=o.history.slice(0,5),o.version=1,o.replicator="pouchdb",o.session_id=r,o.last_seq=n,e.put(o).catch(function(o){if(409===o.status)return Dn(e,t,n,r,i);throw o})})}class Tn{constructor(e,t,n,r,i={writeSourceCheckpoint:!0,writeTargetCheckpoint:!0}){this.src=e,this.target=t,this.id=n,this.returnValue=r,this.opts=i,void 0===i.writeSourceCheckpoint&&(i.writeSourceCheckpoint=!0),void 0===i.writeTargetCheckpoint&&(i.writeTargetCheckpoint=!0)}writeCheckpoint(e,t){var n=this;return this.updateTarget(e,t).then(function(){return n.updateSource(e,t)})}updateTarget(e,t){return this.opts.writeTargetCheckpoint?Dn(this.target,this.id,e,t,this.returnValue):Promise.resolve(!0)}updateSource(e,t){if(this.opts.writeSourceCheckpoint){var n=this;return Dn(this.src,this.id,e,t,this.returnValue).catch(function(e){if(Rn(e))return n.opts.writeSourceCheckpoint=!1,!0;throw e})}return Promise.resolve(!0)}getCheckpoint(){var e=this;return e.opts.writeSourceCheckpoint||e.opts.writeTargetCheckpoint?e.opts&&e.opts.writeSourceCheckpoint&&!e.opts.writeTargetCheckpoint?e.src.get(e.id).then(function(e){return e.last_seq||0}).catch(function(e){if(404!==e.status)throw e;return 0}):e.target.get(e.id).then(function(t){return e.opts&&e.opts.writeTargetCheckpoint&&!e.opts.writeSourceCheckpoint?t.last_seq||0:e.src.get(e.id).then(function(e){return t.version!==e.version?0:(n=t.version?t.version.toString():"undefined")in Bn?Bn[n](t,e):0;var n},function(n){if(404===n.status&&t.last_seq)return e.src.put({_id:e.id,last_seq:0}).then(function(){return 0},function(n){return Rn(n)?(e.opts.writeSourceCheckpoint=!1,t.last_seq):0});throw n})}).catch(function(e){if(404!==e.status)throw e;return 0}):Promise.resolve(0)}}var Bn={undefined:function(e,t){return 0===et(e.last_seq,t.last_seq)?t.last_seq:0},1:function(e,t){return function(e,t){if(e.session_id===t.session_id)return{last_seq:e.last_seq,history:e.history};return function e(t,n){var r=t[0],i=t.slice(1),o=n[0],s=n.slice(1);if(!r||0===n.length)return{last_seq:0,history:[]};if(Mn(r.session_id,n))return{last_seq:r.last_seq,history:t};if(Mn(o.session_id,i))return{last_seq:o.last_seq,history:s};return e(i,s)}(e.history,t.history)}(t,e).last_seq}};function Mn(e,t){var n=t[0],r=t.slice(1);return!(!e||0===t.length)&&(e===n.session_id||Mn(e,r))}function Rn(e){return"number"==typeof e.status&&4===Math.floor(e.status/100)}function Nn(e,t,n,r,i){return this instanceof Tn?Nn:new Tn(e,t,n,r,i)}function Un(e,t,n){var r=n.doc_ids?n.doc_ids.sort(et):"",i=n.filter?n.filter.toString():"",o="",s="",a="";return n.selector&&(a=JSON.stringify(n.selector)),n.filter&&n.query_params&&(o=JSON.stringify(function(e){return Object.keys(e).sort(et).reduce(function(t,n){return t[n]=e[n],t},{})}(n.query_params))),n.filter&&"_view"===n.filter&&(s=n.view.toString()),Promise.all([e.id(),t.id()]).then(function(e){var t=e[0]+e[1]+i+s+o+r+a;return new Promise(function(e){le(t,e)})}).then(function(e){return"_local/"+(e=e.replace(/\//g,".").replace(/\+/g,"_"))})}function Fn(e,t,n,r,i){var o,s,a,c,u=[],l={seq:0,changes:[],docs:[]},d=!1,h=!1,p=!1,v=0,_=0,y=n.continuous||n.live||!1,g=n.batch_size||100,m=n.batches_limit||10,w=n.style||"all_docs",j=!1,q=n.doc_ids,O=n.selector,A=[],S=pe();i=i||{ok:!0,start_time:(new Date).toISOString(),docs_read:0,docs_written:0,doc_write_failures:0,errors:[]};var x={};function P(){return a?Promise.resolve():Un(e,t,n).then(function(i){s=i;var o={};o=!1===n.checkpoint?{writeSourceCheckpoint:!1,writeTargetCheckpoint:!1}:"source"===n.checkpoint?{writeSourceCheckpoint:!0,writeTargetCheckpoint:!1}:"target"===n.checkpoint?{writeSourceCheckpoint:!1,writeTargetCheckpoint:!0}:{writeSourceCheckpoint:!0,writeTargetCheckpoint:!0},a=new Nn(e,t,s,r,o)})}function C(){if(A=[],0!==o.docs.length){var e=o.docs,s={timeout:n.timeout};return t.bulkDocs({docs:e,new_edits:!1},s).then(function(t){if(r.cancelled)throw T(),new Error("cancelled");var n=Object.create(null);t.forEach(function(e){e.error&&(n[e.id]=e)});var o=Object.keys(n).length;i.doc_write_failures+=o,i.docs_written+=e.length-o,e.forEach(function(e){var t=n[e._id];if(t){i.errors.push(t);var o=(t.name||"").toLowerCase();if("unauthorized"!==o&&"forbidden"!==o)throw t;r.emit("denied",f(t))}else A.push(e)})},function(t){throw i.doc_write_failures+=e.length,t})}}function E(){if(o.error)throw new Error("There was a problem getting docs.");i.last_seq=_=o.seq;var t=f(i);return A.length&&(t.docs=A,"number"==typeof o.pending&&(t.pending=o.pending,delete o.pending),r.emit("change",t)),d=!0,e.info().then(function(t){var n=e.activeTasks.get(c);if(o&&n){var r=n.completed_items||0,i=parseInt(t.update_seq,10)-parseInt(v,10);e.activeTasks.update(c,{completed_items:r+o.changes.length,total_items:i})}}),a.writeCheckpoint(o.seq,S).then(function(){if(r.emit("checkpoint",{checkpoint:o.seq}),d=!1,r.cancelled)throw T(),new Error("cancelled");o=void 0,U()}).catch(function(e){throw z(e),e})}function $(){return Ln(e,t,o.diffs,r).then(function(e){o.error=!e.ok,e.docs.forEach(function(e){delete o.diffs[e._id],i.docs_read++,o.docs.push(e)})})}function I(){var e;r.cancelled||o||(0!==u.length?(o=u.shift(),r.emit("checkpoint",{start_next_batch:o.seq}),(e={},o.changes.forEach(function(t){r.emit("checkpoint",{revs_diff:t}),"_user/"!==t.id&&(e[t.id]=t.changes.map(function(e){return e.rev}))}),t.revsDiff(e).then(function(e){if(r.cancelled)throw T(),new Error("cancelled");o.diffs=e})).then($).then(C).then(E).then(I).catch(function(e){D("batch processing terminated with error",e)})):L(!0))}function L(e){0!==l.changes.length?(e||h||l.changes.length>=g)&&(u.push(l),l={seq:0,changes:[],docs:[]},"pending"!==r.state&&"stopped"!==r.state||(r.state="active",r.emit("active")),I()):0!==u.length||o||((y&&x.live||h)&&(r.state="pending",r.emit("paused")),h&&T())}function D(e,t){p||(t.message||(t.message=e),i.ok=!1,i.status="aborting",u=[],l={seq:0,changes:[],docs:[]},T(t))}function T(o){if(!(p||r.cancelled&&(i.status="cancelled",d)))if(i.status=i.status||"complete",i.end_time=(new Date).toISOString(),i.last_seq=_,p=!0,e.activeTasks.remove(c,o),o){(o=N(o)).result=i;var s=(o.name||"").toLowerCase();"unauthorized"===s||"forbidden"===s?(r.emit("error",o),r.removeAllListeners()):function(e,t,n,r){if(!1===e.retry)return t.emit("error",n),void t.removeAllListeners();if("function"!=typeof e.back_off_function&&(e.back_off_function=k),t.emit("requestError",n),"active"===t.state||"pending"===t.state){t.emit("paused",n),t.state="stopped";var i=function(){e.current_back_off=0};t.once("paused",function(){t.removeListener("active",i)}),t.once("active",i)}e.current_back_off=e.current_back_off||0,e.current_back_off=e.back_off_function(e.current_back_off),setTimeout(r,e.current_back_off)}(n,r,o,function(){Fn(e,t,n,r)})}else r.emit("complete",i),r.removeAllListeners()}function B(t,i,o){if(r.cancelled)return T();if("number"==typeof i&&(l.pending=i),F(n)(t))l.seq=t.seq||o,l.changes.push(t),r.emit("checkpoint",{pending_batch:l.seq}),b(function(){L(0===u.length&&x.live)});else{var s=e.activeTasks.get(c);if(s){var a=s.completed_items||0;e.activeTasks.update(c,{completed_items:++a})}}}function M(e){if(j=!1,r.cancelled)return T();if(e.results.length>0)x.since=e.results[e.results.length-1].seq,U(),L(!0);else{var t=function(){y?(x.live=!0,U()):h=!0,L(!0)};o||0!==e.results.length?t():(d=!0,a.writeCheckpoint(e.last_seq,S).then(function(){if(d=!1,i.last_seq=_=e.last_seq,r.cancelled)throw T(),new Error("cancelled");t()}).catch(z))}}function R(e){if(j=!1,r.cancelled)return T();D("changes rejected",e)}function U(){if(!j&&!h&&u.length<m){j=!0,r._changes&&(r.removeListener("cancel",r._abortChanges),r._changes.cancel()),r.once("cancel",i);var t=e.changes(x).on("change",B);t.then(o,o),t.then(M).catch(R),n.retry&&(r._changes=t,r._abortChanges=i)}function i(){t.cancel()}function o(){r.removeListener("cancel",i)}}function K(t){return e.info().then(function(r){var i=void 0===n.since?parseInt(r.update_seq,10)-parseInt(t,10):parseInt(r.update_seq,10);return c=e.activeTasks.add({name:`${y?"continuous ":""}replication from ${r.db_name}`,total_items:i}),t})}function J(){P().then(function(){if(!r.cancelled)return a.getCheckpoint().then(K).then(function(e){v=e,x={since:_=e,limit:g,batch_size:g,style:w,doc_ids:q,selector:O,return_docs:!0},n.filter&&("string"!=typeof n.filter?x.include_docs=!0:x.filter=n.filter),"heartbeat"in n&&(x.heartbeat=n.heartbeat),"timeout"in n&&(x.timeout=n.timeout),n.query_params&&(x.query_params=n.query_params),n.view&&(x.view=n.view),U()});T()}).catch(function(e){D("getCheckpoint rejected with ",e)})}function z(e){d=!1,D("writeCheckpoint completed with error",e)}r.ready(e,t),r.cancelled?T():(r._addedListeners||(r.once("cancel",T),"function"==typeof n.complete&&(r.once("error",n.complete),r.once("complete",function(e){n.complete(null,e)})),r._addedListeners=!0),void 0===n.since?J():P().then(function(){return d=!0,a.writeCheckpoint(n.since,S)}).then(function(){d=!1,r.cancelled?T():(_=n.since,J())}).catch(z))}class Kn extends a{constructor(){super(),this.cancelled=!1,this.state="pending";const e=new Promise((e,t)=>{this.once("complete",e),this.once("error",t)});this.then=function(t,n){return e.then(t,n)},this.catch=function(t){return e.catch(t)},this.catch(function(){})}cancel(){this.cancelled=!0,this.state="cancelled",this.emit("cancel")}ready(e,t){if(this._readyCalled)return;this._readyCalled=!0;const n=()=>{this.cancel()};function r(){e.removeListener("destroyed",n),t.removeListener("destroyed",n)}e.once("destroyed",n),t.once("destroyed",n),this.once("complete",r),this.once("error",r)}}function Jn(e,t){var n=t.PouchConstructor;return"string"==typeof e?new n(e,t):e}function zn(e,t,n,r){if("function"==typeof n&&(r=n,n={}),void 0===n&&(n={}),n.doc_ids&&!Array.isArray(n.doc_ids))throw N(D,"`doc_ids` filter parameter is not a list.");n.complete=r,(n=f(n)).continuous=n.continuous||n.live,n.retry="retry"in n&&n.retry,n.PouchConstructor=n.PouchConstructor||this;var i=new Kn(n);return Fn(Jn(e,n),Jn(t,n),n,i),i}function Vn(e,t,n,r){return"function"==typeof n&&(r=n,n={}),void 0===n&&(n={}),(n=f(n)).PouchConstructor=n.PouchConstructor||this,e=Jn(e,n),t=Jn(t,n),new Gn(e,t,n,r)}class Gn extends a{constructor(e,t,n,r){super(),this.canceled=!1;const i=n.push?Object.assign({},n,n.push):n,o=n.pull?Object.assign({},n,n.pull):n;this.push=zn(e,t,i),this.pull=zn(t,e,o),this.pushPaused=!0,this.pullPaused=!0;const s=e=>{this.emit("change",{direction:"pull",change:e})},a=e=>{this.emit("change",{direction:"push",change:e})},c=e=>{this.emit("denied",{direction:"push",doc:e})},u=e=>{this.emit("denied",{direction:"pull",doc:e})},f=()=>{this.pushPaused=!0,this.pullPaused&&this.emit("paused")},l=()=>{this.pullPaused=!0,this.pushPaused&&this.emit("paused")},d=()=>{this.pushPaused=!1,this.pullPaused&&this.emit("active",{direction:"push"})},h=()=>{this.pullPaused=!1,this.pushPaused&&this.emit("active",{direction:"pull"})};let p={};const v=e=>(t,n)=>{("change"===t&&(n===s||n===a)||"denied"===t&&(n===u||n===c)||"paused"===t&&(n===l||n===f)||"active"===t&&(n===h||n===d))&&(t in p||(p[t]={}),p[t][e]=!0,2===Object.keys(p[t]).length&&this.removeAllListeners(t))};function _(e,t,n){-1==e.listeners(t).indexOf(n)&&e.on(t,n)}n.live&&(this.push.on("complete",this.pull.cancel.bind(this.pull)),this.pull.on("complete",this.push.cancel.bind(this.push))),this.on("newListener",function(e){"change"===e?(_(this.pull,"change",s),_(this.push,"change",a)):"denied"===e?(_(this.pull,"denied",u),_(this.push,"denied",c)):"active"===e?(_(this.pull,"active",h),_(this.push,"active",d)):"paused"===e&&(_(this.pull,"paused",l),_(this.push,"paused",f))}),this.on("removeListener",function(e){"change"===e?(this.pull.removeListener("change",s),this.push.removeListener("change",a)):"denied"===e?(this.pull.removeListener("denied",u),this.push.removeListener("denied",c)):"active"===e?(this.pull.removeListener("active",h),this.push.removeListener("active",d)):"paused"===e&&(this.pull.removeListener("paused",l),this.push.removeListener("paused",f))}),this.pull.on("removeListener",v("pull")),this.push.on("removeListener",v("push"));const y=Promise.all([this.push,this.pull]).then(e=>{const t={push:e[0],pull:e[1]};return this.emit("complete",t),r&&r(null,t),this.removeAllListeners(),t},e=>{if(this.cancel(),r?r(e):this.emit("error",e),this.removeAllListeners(),r)throw e});this.then=function(e,t){return y.then(e,t)},this.catch=function(e){return y.catch(e)}}cancel(){this.canceled||(this.canceled=!0,this.push.cancel(),this.pull.cancel())}}Ke.plugin(function(e){e.adapter("idb",Ht,!0)}).plugin(function(e){e.adapter("http",an,!1),e.adapter("https",an,!1)}).plugin($n).plugin(function(e){e.replicate=zn,e.sync=Vn,Object.defineProperty(e.prototype,"replicate",{get:function(){var e=this;return void 0===this.replicateMethods&&(this.replicateMethods={from:function(t,n,r){return e.constructor.replicate(t,e,n,r)},to:function(t,n,r){return e.constructor.replicate(e,t,n,r)}}),this.replicateMethods}}),e.prototype.sync=function(e,t,n){return this.constructor.sync(this,e,t,n)}}),t.exports=Ke}).call(this)}).call(this,e("_process"))},{_process:2,events:1,"spark-md5":3,uuid:4,vuvuzela:19}]},{},[20])(20)});!function e(t,n,r){function o(s,u){if(!n[s]){if(!t[s]){var c="function"==typeof require&&require;if(!u&&c)return c(s,!0);if(i)return i(s,!0);var a=new Error("Cannot find module '"+s+"'");throw a.code="MODULE_NOT_FOUND",a}var f=n[s]={exports:{}};t[s][0].call(f.exports,function(e){return o(t[s][1][e]||e)},f,f.exports,e,t,n,r)}return n[s].exports}for(var i="function"==typeof require&&require,s=0;s<r.length;s++)o(r[s]);return o}({1:[function(e,t,n){var r=Object.create||function(e){var t=function(){};return t.prototype=e,new t},o=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return n},i=Function.prototype.bind||function(e){var t=this;return function(){return t.apply(e,arguments)}};function s(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=r(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}t.exports=s,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._maxListeners=void 0;var u,c=10;try{var a={};Object.defineProperty&&Object.defineProperty(a,"x",{value:0}),u=0===a.x}catch(e){u=!1}function f(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function l(e,t,n){if(t)e.call(n);else for(var r=e.length,o=w(e,r),i=0;i<r;++i)o[i].call(n)}function d(e,t,n,r){if(t)e.call(n,r);else for(var o=e.length,i=w(e,o),s=0;s<o;++s)i[s].call(n,r)}function y(e,t,n,r,o){if(t)e.call(n,r,o);else for(var i=e.length,s=w(e,i),u=0;u<i;++u)s[u].call(n,r,o)}function p(e,t,n,r,o,i){if(t)e.call(n,r,o,i);else for(var s=e.length,u=w(e,s),c=0;c<s;++c)u[c].call(n,r,o,i)}function h(e,t,n,r){if(t)e.apply(n,r);else for(var o=e.length,i=w(e,o),s=0;s<o;++s)i[s].apply(n,r)}function v(e,t,n,o){var i,s,u;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((s=e._events)?(s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),u=s[t]):(s=e._events=r(null),e._eventsCount=0),u){if("function"==typeof u?u=s[t]=o?[n,u]:[u,n]:o?u.unshift(n):u.push(n),!u.warned&&(i=f(e))&&i>0&&u.length>i){u.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+u.length+' "'+String(t)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=u.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",c.name,c.message)}}else u=s[t]=n,++e._eventsCount;return e}function g(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var e=new Array(arguments.length),t=0;t<e.length;++t)e[t]=arguments[t];this.listener.apply(this.target,e)}}function m(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=i.call(g,r);return o.listener=n,r.wrapFn=o,o}function _(e,t,n){var r=e._events;if(!r)return[];var o=r[t];return o?"function"==typeof o?n?[o.listener||o]:[o]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(o):w(o,o.length):[]}function b(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function w(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}u?Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if("number"!=typeof e||e<0||e!=e)throw new TypeError('"defaultMaxListeners" must be a positive number');c=e}}):s.defaultMaxListeners=c,s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return f(this)},s.prototype.emit=function(e){var t,n,r,o,i,s,u="error"===e;if(s=this._events)u=u&&null==s.error;else if(!u)return!1;if(u){if(arguments.length>1&&(t=arguments[1]),t instanceof Error)throw t;var c=new Error('Unhandled "error" event. ('+t+")");throw c.context=t,c}if(!(n=s[e]))return!1;var a="function"==typeof n;switch(r=arguments.length){case 1:l(n,a,this);break;case 2:d(n,a,this,arguments[1]);break;case 3:y(n,a,this,arguments[1],arguments[2]);break;case 4:p(n,a,this,arguments[1],arguments[2],arguments[3]);break;default:for(o=new Array(r-1),i=1;i<r;i++)o[i-1]=arguments[i];h(n,a,this,o)}return!0},s.prototype.addListener=function(e,t){return v(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return v(this,e,t,!0)},s.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,m(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,m(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,o,i,s,u;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(o=this._events))return this;if(!(n=o[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=r(null):(delete o[e],o.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,s=n.length-1;s>=0;s--)if(n[s]===t||n[s].listener===t){u=n[s].listener,i=s;break}if(i<0)return this;0===i?n.shift():function(e,t){for(var n=t,r=n+1,o=e.length;r<o;n+=1,r+=1)e[n]=e[r];e.pop()}(n,i),1===n.length&&(o[e]=n[0]),o.removeListener&&this.emit("removeListener",e,u||t)}return this},s.prototype.removeAllListeners=function(e){var t,n,i;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=r(null),this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=r(null):delete n[e]),this;if(0===arguments.length){var s,u=o(n);for(i=0;i<u.length;++i)"removeListener"!==(s=u[i])&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=r(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},s.prototype.listeners=function(e){return _(this,e,!0)},s.prototype.rawListeners=function(e){return _(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):b.call(e,t)},s.prototype.listenerCount=b,s.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],2:[function(e,t,n){!function(e){if("object"==typeof n)t.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var r;try{r=window}catch(e){r=self}r.SparkMD5=e()}}(function(e){"use strict";var t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function n(e,t){var n=e[0],r=e[1],o=e[2],i=e[3];r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[0]-680876936|0)<<7|n>>>25)+r|0)&r|~n&o)+t[1]-389564586|0)<<12|i>>>20)+n|0)&n|~i&r)+t[2]+606105819|0)<<17|o>>>15)+i|0)&i|~o&n)+t[3]-1044525330|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[4]-176418897|0)<<7|n>>>25)+r|0)&r|~n&o)+t[5]+1200080426|0)<<12|i>>>20)+n|0)&n|~i&r)+t[6]-1473231341|0)<<17|o>>>15)+i|0)&i|~o&n)+t[7]-45705983|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[8]+1770035416|0)<<7|n>>>25)+r|0)&r|~n&o)+t[9]-1958414417|0)<<12|i>>>20)+n|0)&n|~i&r)+t[10]-42063|0)<<17|o>>>15)+i|0)&i|~o&n)+t[11]-1990404162|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[12]+1804603682|0)<<7|n>>>25)+r|0)&r|~n&o)+t[13]-40341101|0)<<12|i>>>20)+n|0)&n|~i&r)+t[14]-1502002290|0)<<17|o>>>15)+i|0)&i|~o&n)+t[15]+1236535329|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[1]-165796510|0)<<5|n>>>27)+r|0)&o|r&~o)+t[6]-1069501632|0)<<9|i>>>23)+n|0)&r|n&~r)+t[11]+643717713|0)<<14|o>>>18)+i|0)&n|i&~n)+t[0]-373897302|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[5]-701558691|0)<<5|n>>>27)+r|0)&o|r&~o)+t[10]+38016083|0)<<9|i>>>23)+n|0)&r|n&~r)+t[15]-660478335|0)<<14|o>>>18)+i|0)&n|i&~n)+t[4]-405537848|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[9]+568446438|0)<<5|n>>>27)+r|0)&o|r&~o)+t[14]-1019803690|0)<<9|i>>>23)+n|0)&r|n&~r)+t[3]-187363961|0)<<14|o>>>18)+i|0)&n|i&~n)+t[8]+1163531501|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[13]-1444681467|0)<<5|n>>>27)+r|0)&o|r&~o)+t[2]-51403784|0)<<9|i>>>23)+n|0)&r|n&~r)+t[7]+1735328473|0)<<14|o>>>18)+i|0)&n|i&~n)+t[12]-1926607734|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[5]-378558|0)<<4|n>>>28)+r|0)^r^o)+t[8]-2022574463|0)<<11|i>>>21)+n|0)^n^r)+t[11]+1839030562|0)<<16|o>>>16)+i|0)^i^n)+t[14]-35309556|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[1]-1530992060|0)<<4|n>>>28)+r|0)^r^o)+t[4]+1272893353|0)<<11|i>>>21)+n|0)^n^r)+t[7]-155497632|0)<<16|o>>>16)+i|0)^i^n)+t[10]-1094730640|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[13]+681279174|0)<<4|n>>>28)+r|0)^r^o)+t[0]-358537222|0)<<11|i>>>21)+n|0)^n^r)+t[3]-722521979|0)<<16|o>>>16)+i|0)^i^n)+t[6]+76029189|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[9]-640364487|0)<<4|n>>>28)+r|0)^r^o)+t[12]-421815835|0)<<11|i>>>21)+n|0)^n^r)+t[15]+530742520|0)<<16|o>>>16)+i|0)^i^n)+t[2]-995338651|0)<<23|r>>>9)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[0]-198630844|0)<<6|n>>>26)+r|0)|~o))+t[7]+1126891415|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[14]-1416354905|0)<<15|o>>>17)+i|0)|~n))+t[5]-57434055|0)<<21|r>>>11)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[12]+1700485571|0)<<6|n>>>26)+r|0)|~o))+t[3]-1894986606|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[10]-1051523|0)<<15|o>>>17)+i|0)|~n))+t[1]-2054922799|0)<<21|r>>>11)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[8]+1873313359|0)<<6|n>>>26)+r|0)|~o))+t[15]-30611744|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[6]-1560198380|0)<<15|o>>>17)+i|0)|~n))+t[13]+1309151649|0)<<21|r>>>11)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[4]-145523070|0)<<6|n>>>26)+r|0)|~o))+t[11]-1120210379|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[2]+718787259|0)<<15|o>>>17)+i|0)|~n))+t[9]-343485551|0)<<21|r>>>11)+o|0,e[0]=n+e[0]|0,e[1]=r+e[1]|0,e[2]=o+e[2]|0,e[3]=i+e[3]|0}function r(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function o(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n}function i(e){var t,o,i,s,u,c,a=e.length,f=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=a;t+=64)n(f,r(e.substring(t-64,t)));for(o=(e=e.substring(t-64)).length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t<o;t+=1)i[t>>2]|=e.charCodeAt(t)<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(n(f,i),t=0;t<16;t+=1)i[t]=0;return s=(s=8*a).toString(16).match(/(.*?)(.{0,8})$/),u=parseInt(s[2],16),c=parseInt(s[1],16)||0,i[14]=u,i[15]=c,n(f,i),f}function s(e){var n,r="";for(n=0;n<4;n+=1)r+=t[e>>8*n+4&15]+t[e>>8*n&15];return r}function u(e){var t;for(t=0;t<e.length;t+=1)e[t]=s(e[t]);return e.join("")}function c(e){return/[\u0080-\uFFFF]/.test(e)&&(e=unescape(encodeURIComponent(e))),e}function a(e){var t,n=[],r=e.length;for(t=0;t<r-1;t+=2)n.push(parseInt(e.substr(t,2),16));return String.fromCharCode.apply(String,n)}function f(){this.reset()}return"5d41402abc4b2a76b9719d911017c592"!==u(i("hello"))&&function(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n},"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||function(){function t(e,t){return(e=0|e||0)<0?Math.max(e+t,0):Math.min(e,t)}ArrayBuffer.prototype.slice=function(n,r){var o,i,s,u,c=this.byteLength,a=t(n,c),f=c;return r!==e&&(f=t(r,c)),a>f?new ArrayBuffer(0):(o=f-a,i=new ArrayBuffer(o),s=new Uint8Array(i),u=new Uint8Array(this,a,o),s.set(u),i)}}(),f.prototype.append=function(e){return this.appendBinary(c(e)),this},f.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,o=this._buff.length;for(t=64;t<=o;t+=64)n(this._hash,r(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},f.prototype.end=function(e){var t,n,r=this._buff,o=r.length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<o;t+=1)i[t>>2]|=r.charCodeAt(t)<<(t%4<<3);return this._finish(i,o),n=u(this._hash),e&&(n=a(n)),this.reset(),n},f.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},f.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},f.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},f.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},f.prototype._finish=function(e,t){var r,o,i,s=t;if(e[s>>2]|=128<<(s%4<<3),s>55)for(n(this._hash,e),s=0;s<16;s+=1)e[s]=0;r=(r=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(r[2],16),i=parseInt(r[1],16)||0,e[14]=o,e[15]=i,n(this._hash,e)},f.hash=function(e,t){return f.hashBinary(c(e),t)},f.hashBinary=function(e,t){var n=u(i(e));return t?a(n):n},f.ArrayBuffer=function(){this.reset()},f.ArrayBuffer.prototype.append=function(e){var t,r,i,s,u,c=(r=this._buff.buffer,i=e,s=!0,(u=new Uint8Array(r.byteLength+i.byteLength)).set(new Uint8Array(r)),u.set(new Uint8Array(i),r.byteLength),s?u:u.buffer),a=c.length;for(this._length+=e.byteLength,t=64;t<=a;t+=64)n(this._hash,o(c.subarray(t-64,t)));return this._buff=t-64<a?new Uint8Array(c.buffer.slice(t-64)):new Uint8Array(0),this},f.ArrayBuffer.prototype.end=function(e){var t,n,r=this._buff,o=r.length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<o;t+=1)i[t>>2]|=r[t]<<(t%4<<3);return this._finish(i,o),n=u(this._hash),e&&(n=a(n)),this.reset(),n},f.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},f.ArrayBuffer.prototype.getState=function(){var e,t=f.prototype.getState.call(this);return t.buff=(e=t.buff,String.fromCharCode.apply(null,new Uint8Array(e))),t},f.ArrayBuffer.prototype.setState=function(e){return e.buff=function(e,t){var n,r=e.length,o=new ArrayBuffer(r),i=new Uint8Array(o);for(n=0;n<r;n+=1)i[n]=e.charCodeAt(n);return t?i:o}(e.buff,!0),f.prototype.setState.call(this,e)},f.ArrayBuffer.prototype.destroy=f.prototype.destroy,f.ArrayBuffer.prototype._finish=f.prototype._finish,f.ArrayBuffer.hash=function(e,t){var r=u(function(e){var t,r,i,s,u,c,a=e.length,f=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=a;t+=64)n(f,o(e.subarray(t-64,t)));for(r=(e=t-64<a?e.subarray(t-64):new Uint8Array(0)).length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t<r;t+=1)i[t>>2]|=e[t]<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(n(f,i),t=0;t<16;t+=1)i[t]=0;return s=(s=8*a).toString(16).match(/(.*?)(.{0,8})$/),u=parseInt(s[2],16),c=parseInt(s[1],16)||0,i[14]=u,i[15]=c,n(f,i),f}(new Uint8Array(e)));return t?a(r):r},f})},{}],3:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"v1",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(n,"v3",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(n,"v4",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(n,"v5",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(n,"NIL",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(n,"version",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(n,"validate",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(n,"stringify",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(n,"parse",{enumerable:!0,get:function(){return l.default}});var r=d(e("./v1.js")),o=d(e("./v3.js")),i=d(e("./v4.js")),s=d(e("./v5.js")),u=d(e("./nil.js")),c=d(e("./version.js")),a=d(e("./validate.js")),f=d(e("./stringify.js")),l=d(e("./parse.js"));function d(e){return e&&e.__esModule?e:{default:e}}},{"./nil.js":5,"./parse.js":6,"./stringify.js":10,"./v1.js":11,"./v3.js":12,"./v4.js":14,"./v5.js":15,"./validate.js":16,"./version.js":17}],4:[function(e,t,n){"use strict";function r(e){return 14+(e+64>>>9<<4)+1}function o(e,t){const n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function i(e,t,n,r,i,s){return o((u=o(o(t,e),o(r,s)))<<(c=i)|u>>>32-c,n);var u,c}function s(e,t,n,r,o,s,u){return i(t&n|~t&r,e,t,o,s,u)}function u(e,t,n,r,o,s,u){return i(t&r|n&~r,e,t,o,s,u)}function c(e,t,n,r,o,s,u){return i(t^n^r,e,t,o,s,u)}function a(e,t,n,r,o,s,u){return i(n^(t|~r),e,t,o,s,u)}Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var f=function(e){if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(let n=0;n<t.length;++n)e[n]=t.charCodeAt(n)}return function(e){const t=[],n=32*e.length;for(let r=0;r<n;r+=8){const n=e[r>>5]>>>r%32&255,o=parseInt("0123456789abcdef".charAt(n>>>4&15)+"0123456789abcdef".charAt(15&n),16);t.push(o)}return t}(function(e,t){e[t>>5]|=128<<t%32,e[r(t)-1]=t;let n=1732584193,i=-271733879,f=-1732584194,l=271733878;for(let t=0;t<e.length;t+=16){const r=n,d=i,y=f,p=l;n=s(n,i,f,l,e[t],7,-680876936),l=s(l,n,i,f,e[t+1],12,-389564586),f=s(f,l,n,i,e[t+2],17,606105819),i=s(i,f,l,n,e[t+3],22,-1044525330),n=s(n,i,f,l,e[t+4],7,-176418897),l=s(l,n,i,f,e[t+5],12,1200080426),f=s(f,l,n,i,e[t+6],17,-1473231341),i=s(i,f,l,n,e[t+7],22,-45705983),n=s(n,i,f,l,e[t+8],7,1770035416),l=s(l,n,i,f,e[t+9],12,-1958414417),f=s(f,l,n,i,e[t+10],17,-42063),i=s(i,f,l,n,e[t+11],22,-1990404162),n=s(n,i,f,l,e[t+12],7,1804603682),l=s(l,n,i,f,e[t+13],12,-40341101),f=s(f,l,n,i,e[t+14],17,-1502002290),i=s(i,f,l,n,e[t+15],22,1236535329),n=u(n,i,f,l,e[t+1],5,-165796510),l=u(l,n,i,f,e[t+6],9,-1069501632),f=u(f,l,n,i,e[t+11],14,643717713),i=u(i,f,l,n,e[t],20,-373897302),n=u(n,i,f,l,e[t+5],5,-701558691),l=u(l,n,i,f,e[t+10],9,38016083),f=u(f,l,n,i,e[t+15],14,-660478335),i=u(i,f,l,n,e[t+4],20,-405537848),n=u(n,i,f,l,e[t+9],5,568446438),l=u(l,n,i,f,e[t+14],9,-1019803690),f=u(f,l,n,i,e[t+3],14,-187363961),i=u(i,f,l,n,e[t+8],20,1163531501),n=u(n,i,f,l,e[t+13],5,-1444681467),l=u(l,n,i,f,e[t+2],9,-51403784),f=u(f,l,n,i,e[t+7],14,1735328473),i=u(i,f,l,n,e[t+12],20,-1926607734),n=c(n,i,f,l,e[t+5],4,-378558),l=c(l,n,i,f,e[t+8],11,-2022574463),f=c(f,l,n,i,e[t+11],16,1839030562),i=c(i,f,l,n,e[t+14],23,-35309556),n=c(n,i,f,l,e[t+1],4,-1530992060),l=c(l,n,i,f,e[t+4],11,1272893353),f=c(f,l,n,i,e[t+7],16,-155497632),i=c(i,f,l,n,e[t+10],23,-1094730640),n=c(n,i,f,l,e[t+13],4,681279174),l=c(l,n,i,f,e[t],11,-358537222),f=c(f,l,n,i,e[t+3],16,-722521979),i=c(i,f,l,n,e[t+6],23,76029189),n=c(n,i,f,l,e[t+9],4,-640364487),l=c(l,n,i,f,e[t+12],11,-421815835),f=c(f,l,n,i,e[t+15],16,530742520),i=c(i,f,l,n,e[t+2],23,-995338651),n=a(n,i,f,l,e[t],6,-198630844),l=a(l,n,i,f,e[t+7],10,1126891415),f=a(f,l,n,i,e[t+14],15,-1416354905),i=a(i,f,l,n,e[t+5],21,-57434055),n=a(n,i,f,l,e[t+12],6,1700485571),l=a(l,n,i,f,e[t+3],10,-1894986606),f=a(f,l,n,i,e[t+10],15,-1051523),i=a(i,f,l,n,e[t+1],21,-2054922799),n=a(n,i,f,l,e[t+8],6,1873313359),l=a(l,n,i,f,e[t+15],10,-30611744),f=a(f,l,n,i,e[t+6],15,-1560198380),i=a(i,f,l,n,e[t+13],21,1309151649),n=a(n,i,f,l,e[t+4],6,-145523070),l=a(l,n,i,f,e[t+11],10,-1120210379),f=a(f,l,n,i,e[t+2],15,718787259),i=a(i,f,l,n,e[t+9],21,-343485551),n=o(n,r),i=o(i,d),f=o(f,y),l=o(l,p)}return[n,i,f,l]}(function(e){if(0===e.length)return[];const t=8*e.length,n=new Uint32Array(r(t));for(let r=0;r<t;r+=8)n[r>>5]|=(255&e[r/8])<<r%32;return n}(e),8*e.length))};n.default=f},{}],5:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;n.default="00000000-0000-0000-0000-000000000000"},{}],6:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r,o=(r=e("./validate.js"))&&r.__esModule?r:{default:r};var i=function(e){if(!(0,o.default)(e))throw TypeError("Invalid UUID");let t;const n=new Uint8Array(16);return n[0]=(t=parseInt(e.slice(0,8),16))>>>24,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=255&t,n[4]=(t=parseInt(e.slice(9,13),16))>>>8,n[5]=255&t,n[6]=(t=parseInt(e.slice(14,18),16))>>>8,n[7]=255&t,n[8]=(t=parseInt(e.slice(19,23),16))>>>8,n[9]=255&t,n[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,n[11]=t/4294967296&255,n[12]=t>>>24&255,n[13]=t>>>16&255,n[14]=t>>>8&255,n[15]=255&t,n};n.default=i},{"./validate.js":16}],7:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;n.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i},{}],8:[function(e,t,n){"use strict";let r;Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(){if(!r&&(r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),!r))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(o)};const o=new Uint8Array(16)},{}],9:[function(e,t,n){"use strict";function r(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:return t^n^r;case 2:return t&n^t&r^n&r;case 3:return t^n^r}}function o(e,t){return e<<t|e>>>32-t}Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var i=function(e){const t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=[];for(let n=0;n<t.length;++n)e.push(t.charCodeAt(n))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);const i=e.length/4+2,s=Math.ceil(i/16),u=new Array(s);for(let t=0;t<s;++t){const n=new Uint32Array(16);for(let r=0;r<16;++r)n[r]=e[64*t+4*r]<<24|e[64*t+4*r+1]<<16|e[64*t+4*r+2]<<8|e[64*t+4*r+3];u[t]=n}u[s-1][14]=8*(e.length-1)/Math.pow(2,32),u[s-1][14]=Math.floor(u[s-1][14]),u[s-1][15]=8*(e.length-1)&4294967295;for(let e=0;e<s;++e){const i=new Uint32Array(80);for(let t=0;t<16;++t)i[t]=u[e][t];for(let e=16;e<80;++e)i[e]=o(i[e-3]^i[e-8]^i[e-14]^i[e-16],1);let s=n[0],c=n[1],a=n[2],f=n[3],l=n[4];for(let e=0;e<80;++e){const n=Math.floor(e/20),u=o(s,5)+r(n,c,a,f)+l+t[n]+i[e]>>>0;l=f,f=a,a=o(c,30)>>>0,c=s,s=u}n[0]=n[0]+s>>>0,n[1]=n[1]+c>>>0,n[2]=n[2]+a>>>0,n[3]=n[3]+f>>>0,n[4]=n[4]+l>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]};n.default=i},{}],10:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r,o=(r=e("./validate.js"))&&r.__esModule?r:{default:r};const i=[];for(let e=0;e<256;++e)i.push((e+256).toString(16).substr(1));var s=function(e,t=0){const n=(i[e[t+0]]+i[e[t+1]]+i[e[t+2]]+i[e[t+3]]+"-"+i[e[t+4]]+i[e[t+5]]+"-"+i[e[t+6]]+i[e[t+7]]+"-"+i[e[t+8]]+i[e[t+9]]+"-"+i[e[t+10]]+i[e[t+11]]+i[e[t+12]]+i[e[t+13]]+i[e[t+14]]+i[e[t+15]]).toLowerCase();if(!(0,o.default)(n))throw TypeError("Stringified UUID is invalid");return n};n.default=s},{"./validate.js":16}],11:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=i(e("./rng.js")),o=i(e("./stringify.js"));function i(e){return e&&e.__esModule?e:{default:e}}let s,u,c=0,a=0;var f=function(e,t,n){let i=t&&n||0;const f=t||new Array(16);let l=(e=e||{}).node||s,d=void 0!==e.clockseq?e.clockseq:u;if(null==l||null==d){const t=e.random||(e.rng||r.default)();null==l&&(l=s=[1|t[0],t[1],t[2],t[3],t[4],t[5]]),null==d&&(d=u=16383&(t[6]<<8|t[7]))}let y=void 0!==e.msecs?e.msecs:Date.now(),p=void 0!==e.nsecs?e.nsecs:a+1;const h=y-c+(p-a)/1e4;if(h<0&&void 0===e.clockseq&&(d=d+1&16383),(h<0||y>c)&&void 0===e.nsecs&&(p=0),p>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");c=y,a=p,u=d,y+=122192928e5;const v=(1e4*(268435455&y)+p)%4294967296;f[i++]=v>>>24&255,f[i++]=v>>>16&255,f[i++]=v>>>8&255,f[i++]=255&v;const g=y/4294967296*1e4&268435455;f[i++]=g>>>8&255,f[i++]=255&g,f[i++]=g>>>24&15|16,f[i++]=g>>>16&255,f[i++]=d>>>8|128,f[i++]=255&d;for(let e=0;e<6;++e)f[i+e]=l[e];return t||(0,o.default)(f)};n.default=f},{"./rng.js":8,"./stringify.js":10}],12:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=i(e("./v35.js")),o=i(e("./md5.js"));function i(e){return e&&e.__esModule?e:{default:e}}var s=(0,r.default)("v3",48,o.default);n.default=s},{"./md5.js":4,"./v35.js":13}],13:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(e,t,n){function i(e,i,s,u){if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));const t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n));return t}(e)),"string"==typeof i&&(i=(0,o.default)(i)),16!==i.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+e.length);if(c.set(i),c.set(e,i.length),c=n(c),c[6]=15&c[6]|t,c[8]=63&c[8]|128,s){u=u||0;for(let e=0;e<16;++e)s[u+e]=c[e];return s}return(0,r.default)(c)}try{i.name=e}catch(e){}return i.DNS=s,i.URL=u,i},n.URL=n.DNS=void 0;var r=i(e("./stringify.js")),o=i(e("./parse.js"));function i(e){return e&&e.__esModule?e:{default:e}}const s="6ba7b810-9dad-11d1-80b4-00c04fd430c8";n.DNS=s;const u="6ba7b811-9dad-11d1-80b4-00c04fd430c8";n.URL=u},{"./parse.js":6,"./stringify.js":10}],14:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=i(e("./rng.js")),o=i(e("./stringify.js"));function i(e){return e&&e.__esModule?e:{default:e}}var s=function(e,t,n){const i=(e=e||{}).random||(e.rng||r.default)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=i[e];return t}return(0,o.default)(i)};n.default=s},{"./rng.js":8,"./stringify.js":10}],15:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=i(e("./v35.js")),o=i(e("./sha1.js"));function i(e){return e&&e.__esModule?e:{default:e}}var s=(0,r.default)("v5",80,o.default);n.default=s},{"./sha1.js":9,"./v35.js":13}],16:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r,o=(r=e("./regex.js"))&&r.__esModule?r:{default:r};var i=function(e){return"string"==typeof e&&o.default.test(e)};n.default=i},{"./regex.js":7}],17:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r,o=(r=e("./validate.js"))&&r.__esModule?r:{default:r};var i=function(e){if(!(0,o.default)(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)};n.default=i},{"./validate.js":16}],18:[function(e,t,n){"use strict";e("events"),e("uuid");var r,o=(r=e("spark-md5"))&&"object"==typeof r&&"default"in r?r.default:r;var i=Function.prototype.toString,s=i.call(Object);function u(e){var t,n,r;if(!e||"object"!=typeof e)return e;if(Array.isArray(e)){for(t=[],n=0,r=e.length;n<r;n++)t[n]=u(e[n]);return t}if(e instanceof Date&&isFinite(e))return e.toISOString();if(function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer||"undefined"!=typeof Blob&&e instanceof Blob}(e))return function(e){return e instanceof ArrayBuffer?e.slice(0):e.slice(0,e.size,e.type)}(e);if(!function(e){var t=Object.getPrototypeOf(e);if(null===t)return!0;var n=t.constructor;return"function"==typeof n&&n instanceof n&&i.call(n)==s}(e))return e;for(n in t={},e)if(Object.prototype.hasOwnProperty.call(e,n)){var o=u(e[n]);void 0!==o&&(t[n]=o)}return t}try{localStorage.setItem("_pouch_check_localstorage",1),!!localStorage.getItem("_pouch_check_localstorage")}catch(e){!1}const c="function"==typeof queueMicrotask?queueMicrotask:function(e){Promise.resolve().then(e)};function a(e){if("undefined"!=typeof console&&"function"==typeof console[e]){var t=Array.prototype.slice.call(arguments,1);console[e].apply(console,t)}}class f extends Error{constructor(e,t,n){super(),this.status=e,this.name=t,this.message=n,this.error=!0}toString(){return JSON.stringify({status:this.status,name:this.name,message:this.message,reason:this.reason})}}new f(401,"unauthorized","Name or password is incorrect."),new f(400,"bad_request","Missing JSON list of 'docs'"),new f(404,"not_found","missing"),new f(409,"conflict","Document update conflict"),new f(400,"bad_request","_id field must contain a string"),new f(412,"missing_id","_id is required for puts"),new f(400,"bad_request","Only reserved document ids may start with underscore."),new f(412,"precondition_failed","Database not open");var l=new f(500,"unknown_error","Database encountered an unknown error");new f(500,"badarg","Some query argument is invalid"),new f(400,"invalid_request","Request was invalid"),new f(400,"query_parse_error","Some query parameter is invalid"),new f(500,"doc_validation","Bad special document member"),new f(400,"bad_request","Something wrong with the request"),new f(400,"bad_request","Document must be a JSON object"),new f(404,"not_found","Database not found"),new f(500,"indexed_db_went_bad","unknown"),new f(500,"web_sql_went_bad","unknown"),new f(500,"levelDB_went_went_bad","unknown"),new f(403,"forbidden","Forbidden by design doc validate_doc_update function"),new f(400,"bad_request","Invalid rev format"),new f(412,"file_exists","The database could not be created, the file already exists."),new f(412,"missing_stub","A pre-existing attachment stub wasn't found"),new f(413,"invalid_url","Provided URL is invalid");function d(e){if("object"!=typeof e){var t=e;(e=l).data=t}return"error"in e&&"conflict"===e.error&&(e.name="conflict",e.status=409),"name"in e||(e.name=e.error||"unknown"),"status"in e||(e.status=500),"message"in e||(e.message=e.message||e.reason),"stack"in e||(e.stack=(new Error).stack),e}function y(e){return"boolean"==typeof e._remote?e._remote:"function"==typeof e.type&&(a("warn","db.type() is deprecated and will be removed in a future version of PouchDB"),"http"===e.type())}function p(e,t,n){return e.get(t).catch(function(e){if(404!==e.status)throw e;return{}}).then(function(r){var o=r._rev,i=n(r);return i?(i._id=t,i._rev=o,function(e,t,n){return e.put(t).then(function(e){return{updated:!0,rev:e.rev}},function(r){if(409!==r.status)throw r;return p(e,t._id,n)})}(e,i,n)):{updated:!1,rev:o}})}function h(e){for(var t=e.length,n=new ArrayBuffer(t),r=new Uint8Array(n),o=0;o<t;o++)r[o]=e.charCodeAt(o);return n}function v(e,t){return function(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(o){if("TypeError"!==o.name)throw o;for(var n=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),r=0;r<e.length;r+=1)n.append(e[r]);return n.getBlob(t.type)}}([h(e)],{type:t})}function g(e,t){return v(atob(e),t)}self.setImmediate||self.setTimeout;function m(e){return o.hash(e)}function _(e,t){for(var n=e,r=0,o=t.length;r<o;r++){if(!(n=n[t[r]]))break}return n}function b(e,t,n){for(var r=0,o=t.length;r<o-1;r++){var i=t[r];e=e[i]=e[i]||{}}e[t[o-1]]=n}function w(e,t){return e<t?-1:e>t?1:0}function k(e){for(var t=[],n="",r=0,o=e.length;r<o;r++){var i=e[r];r>0&&"\\"===e[r-1]&&("$"===i||"."===i)?n=n.substring(0,n.length-1)+i:"."===i?(t.push(n),n=""):n+=i}return t.push(n),t}var j=["$or","$nor","$not"];function $(e){return j.indexOf(e)>-1}function x(e){return Object.keys(e)[0]}function O(e){return e[x(e)]}function A(e){var t={},n={$or:!0,$nor:!0};return e.forEach(function(e){Object.keys(e).forEach(function(r){var o=e[r];if("object"!=typeof o&&(o={$eq:o}),$(r))if(o instanceof Array){if(n[r])return n[r]=!1,void(t[r]=o);var i=[];t[r].forEach(function(e){Object.keys(o).forEach(function(t){var n=o[t],r=Math.max(Object.keys(e).length,Object.keys(n).length),s=A([e,n]);Object.keys(s).length<=r||i.push(s)})}),t[r]=i}else t[r]=A([o]);else{var s=t[r]=t[r]||{};Object.keys(o).forEach(function(e){var t=o[e];return"$gt"===e||"$gte"===e?function(e,t,n){if(void 0!==n.$eq)return;void 0!==n.$gte?"$gte"===e?t>n.$gte&&(n.$gte=t):t>=n.$gte&&(delete n.$gte,n.$gt=t):void 0!==n.$gt?"$gte"===e?t>n.$gt&&(delete n.$gt,n.$gte=t):t>n.$gt&&(n.$gt=t):n[e]=t}(e,t,s):"$lt"===e||"$lte"===e?function(e,t,n){if(void 0!==n.$eq)return;void 0!==n.$lte?"$lte"===e?t<n.$lte&&(n.$lte=t):t<=n.$lte&&(delete n.$lte,n.$lt=t):void 0!==n.$lt?"$lte"===e?t<n.$lt&&(delete n.$lt,n.$lte=t):t<n.$lt&&(n.$lt=t):n[e]=t}(e,t,s):"$ne"===e?function(e,t){"$ne"in t?t.$ne.push(e):t.$ne=[e]}(t,s):"$eq"===e?function(e,t){delete t.$gt,delete t.$gte,delete t.$lt,delete t.$lte,delete t.$ne,t.$eq=e}(t,s):"$regex"===e?function(e,t){"$regex"in t?t.$regex.push(e):t.$regex=[e]}(t,s):void(s[e]=t)})}})}),t}function q(e){var t=u(e);(function e(t,n){for(var r in t){"$and"===r&&(n=!0);var o=t[r];"object"==typeof o&&(n=e(o,n))}return n})(t,!1)&&"$and"in(t=function e(t){for(var n in t){if(Array.isArray(t))for(var r in t)t[r].$and&&(t[r]=A(t[r].$and));var o=t[n];"object"==typeof o&&e(o)}return t}(t))&&(t=A(t.$and)),["$or","$nor"].forEach(function(e){e in t&&t[e].forEach(function(e){for(var t=Object.keys(e),n=0;n<t.length;n++){var r=t[n],o=e[r];"object"==typeof o&&null!==o||(e[r]={$eq:o})}})}),"$not"in t&&(t.$not=A([t.$not]));for(var n=Object.keys(t),r=0;r<n.length;r++){var o=n[r],i=t[o];"object"==typeof i&&null!==i||(i={$eq:i}),t[o]=i}return function e(t){Object.keys(t).forEach(function(n){var r=t[n];Array.isArray(r)?r.forEach(function(t){t&&"object"==typeof t&&e(t)}):"$ne"===n?t.$ne=[r]:"$regex"===n?t.$regex=[r]:r&&"object"==typeof r&&e(r)})}(t),t}function M(e,t){if(e===t)return 0;e=E(e),t=E(t);var n=C(e),r=C(t);if(n-r!=0)return n-r;switch(typeof e){case"number":return e-t;case"boolean":return e<t?-1:1;case"string":return function(e,t){return e===t?0:e>t?1:-1}(e,t)}return Array.isArray(e)?function(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){var o=M(e[r],t[r]);if(0!==o)return o}return e.length===t.length?0:e.length>t.length?1:-1}(e,t):function(e,t){for(var n=Object.keys(e),r=Object.keys(t),o=Math.min(n.length,r.length),i=0;i<o;i++){var s=M(n[i],r[i]);if(0!==s)return s;if(0!==(s=M(e[n[i]],t[r[i]])))return s}return n.length===r.length?0:n.length>r.length?1:-1}(e,t)}function E(e){switch(typeof e){case"undefined":return null;case"number":return e===1/0||e===-1/0||isNaN(e)?null:e;case"object":var t=e;if(Array.isArray(e)){var n=e.length;e=new Array(n);for(var r=0;r<n;r++)e[r]=E(t[r])}else{if(e instanceof Date)return e.toJSON();if(null!==e)for(var o in e={},t)if(Object.prototype.hasOwnProperty.call(t,o)){var i=t[o];void 0!==i&&(e[o]=E(i))}}}return e}function S(e){if(null!==e)switch(typeof e){case"boolean":return e?1:0;case"number":return function(e){if(0===e)return"1";var t=e.toExponential().split(/e\+?/),n=parseInt(t[1],10),r=e<0,o=r?"0":"2",i=(s=((r?-n:n)- -324).toString(),u="0",c=3,function(e,t,n){for(var r="",o=n-e.length;r.length<o;)r+=t;return r}(s,u,c)+s);var s,u,c;o+=""+i;var a=Math.abs(parseFloat(t[0]));r&&(a=10-a);var f=a.toFixed(20);return f=f.replace(/\.?0+$/,""),o+=""+f}(e);case"string":return e.replace(/\u0002/g,"").replace(/\u0001/g,"").replace(/\u0000/g,"");case"object":var t=Array.isArray(e),n=t?e:Object.keys(e),r=-1,o=n.length,i="";if(t)for(;++r<o;)i+=B(n[r]);else for(;++r<o;){var s=n[r];i+=B(s)+B(e[s])}return i}return""}function B(e){return C(e=E(e))+""+S(e)+"\0"}function P(e,t){var n,r=t;if("1"===e[t])n=0,t++;else{var o="0"===e[t];t++;var i="",s=e.substring(t,t+3),u=parseInt(s,10)+-324;for(o&&(u=-u),t+=3;;){var c=e[t];if("\0"===c)break;i+=c,t++}n=1===(i=i.split(".")).length?parseInt(i,10):parseFloat(i[0]+"."+i[1]),o&&(n-=10),0!==u&&(n=parseFloat(n+"e"+u))}return{num:n,length:t-r}}function I(e,t){var n=e.pop();if(t.length){var r=t[t.length-1];n===r.element&&(t.pop(),r=t[t.length-1]);var o=r.element,i=r.index;if(Array.isArray(o))o.push(n);else if(i===e.length-2){o[e.pop()]=n}else e.push(n)}}function C(e){var t=["boolean","number","string","object"].indexOf(typeof e);return~t?null===e?1:Array.isArray(e)?5:t<3?t+2:t+3:Array.isArray(e)?5:void 0}function L(e,t,n){if(e=e.filter(function(e){return U(e.doc,t.selector,n)}),t.sort){var r=function(e){function t(t){return e.map(function(e){var n=k(x(e));return _(t,n)})}return function(e,n){var r=M(t(e.doc),t(n.doc));return 0!==r?r:w(e.doc._id,n.doc._id)}}(t.sort);e=e.sort(r),"string"!=typeof t.sort[0]&&"desc"===O(t.sort[0])&&(e=e.reverse())}if("limit"in t||"skip"in t){var o=t.skip||0,i=("limit"in t?t.limit:e.length)+o;e=e.slice(o,i)}return e}function U(e,t,n){return n.every(function(n){var r=t[n],o=k(n),i=_(e,o);return $(n)?function(e,t,n){if("$or"===e)return t.some(function(e){return U(n,e,Object.keys(e))});if("$not"===e)return!U(n,t,Object.keys(t));return!t.find(function(e){return U(n,e,Object.keys(e))})}(n,r,e):D(r,e,o,i)})}function D(e,t,n,r){return!e||("object"==typeof e?Object.keys(e).every(function(o){var i=e[o];if(0===o.indexOf("$"))return N(o,t,i,n,r);var s=k(o);if(void 0===r&&"object"!=typeof i&&s.length>0)return!1;var u=_(r,s);return"object"==typeof i?D(i,t,n,u):N("$eq",t,i,s,u)}):e===r)}function N(e,t,n,r,o){if(!z[e])throw new Error('unknown operator "'+e+'" - should be one of $eq, $lte, $lt, $gt, $gte, $exists, $ne, $in, $nin, $size, $mod, $regex, $elemMatch, $type, $allMatch or $all');return z[e](t,n,r,o)}function T(e){return null!=e}function F(e){return void 0!==e}function R(e,t){return t.some(function(t){return e instanceof Array?e.some(function(e){return 0===M(t,e)}):0===M(t,e)})}var z={$elemMatch:function(e,t,n,r){return!!Array.isArray(r)&&0!==r.length&&("object"==typeof r[0]&&null!==r[0]?r.some(function(e){return U(e,t,Object.keys(t))}):r.some(function(r){return D(t,e,n,r)}))},$allMatch:function(e,t,n,r){return!!Array.isArray(r)&&0!==r.length&&("object"==typeof r[0]&&null!==r[0]?r.every(function(e){return U(e,t,Object.keys(t))}):r.every(function(r){return D(t,e,n,r)}))},$eq:function(e,t,n,r){return F(r)&&0===M(r,t)},$gte:function(e,t,n,r){return F(r)&&M(r,t)>=0},$gt:function(e,t,n,r){return F(r)&&M(r,t)>0},$lte:function(e,t,n,r){return F(r)&&M(r,t)<=0},$lt:function(e,t,n,r){return F(r)&&M(r,t)<0},$exists:function(e,t,n,r){return t?F(r):!F(r)},$mod:function(e,t,n,r){return T(r)&&function(e,t){return"number"==typeof e&&parseInt(e,10)===e&&e%t[0]===t[1]}(r,t)},$ne:function(e,t,n,r){return t.every(function(e){return 0!==M(r,e)})},$in:function(e,t,n,r){return T(r)&&R(r,t)},$nin:function(e,t,n,r){return T(r)&&!R(r,t)},$size:function(e,t,n,r){return T(r)&&Array.isArray(r)&&function(e,t){return e.length===t}(r,t)},$all:function(e,t,n,r){return Array.isArray(r)&&function(e,t){return t.every(function(t){return e.some(function(e){return 0===M(t,e)})})}(r,t)},$regex:function(e,t,n,r){return T(r)&&"string"==typeof r&&t.every(function(e){return function(e,t){return new RegExp(t).test(e)}(r,e)})},$type:function(e,t,n,r){return function(e,t){switch(t){case"null":return null===e;case"boolean":return"boolean"==typeof e;case"number":return"number"==typeof e;case"string":return"string"==typeof e;case"array":return e instanceof Array;case"object":return"[object Object]"==={}.toString.call(e)}}(r,t)}};function J(e,t){if("object"!=typeof t)throw new Error("Selector error: expected a JSON object");var n=L([{doc:e}],{selector:t=q(t)},Object.keys(t));return n&&1===n.length}const V=(...e)=>{let t=[];for(const n of e)Array.isArray(n)?t=t.concat(V(...n)):t.push(n);return t},Q="function"==typeof Array.prototype.flat?(...e)=>e.flat(1/0):V;function K(e){const t={};for(const n of e)Object.assign(t,n);return t}function X(e,t){for(let n=0,r=Math.min(e.length,t.length);n<r;n++)if(e[n]!==t[n])return!1;return!0}function G(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}function W(e){return function(...t){const n=t[t.length-1];if("function"!=typeof n)return e.apply(this,t);{const r=n.bind(null,null),o=n.bind(null);e.apply(this,t.slice(0,-1)).then(r,o)}}}var Y=Headers;function H(e){(e=u(e)).index||(e.index={});for(const t of["type","name","ddoc"])e.index[t]&&(e[t]=e.index[t],delete e.index[t]);return e.fields&&(e.index.fields=e.fields,delete e.fields),e.type||(e.type="json"),e}function Z(e){return"object"==typeof e&&null!==e}function ee(e,t,n){let r="",o=t,i=!0;if(-1!==["$in","$nin","$or","$and","$mod","$nor","$all"].indexOf(e)&&(Array.isArray(t)||(r="Query operator "+e+" must be an array.")),-1!==["$not","$elemMatch","$allMatch"].indexOf(e)&&(!Array.isArray(t)&&Z(t)||(r="Query operator "+e+" must be an object.")),"$mod"===e&&Array.isArray(t))if(2!==t.length)r="Query operator $mod must be in the format [divisor, remainder], where divisor and remainder are both integers.";else{const e=t[0],n=t[1];0===e&&(r="Query operator $mod's divisor cannot be 0, cannot divide by zero.",i=!1),"number"==typeof e&&parseInt(e,10)===e||(r="Query operator $mod's divisor is not an integer.",o=e),parseInt(n,10)!==n&&(r="Query operator $mod's remainder is not an integer.",o=n)}if("$exists"===e&&"boolean"!=typeof t&&(r="Query operator $exists must be a boolean."),"$type"===e){const e=["null","boolean","number","string","array","object"],n='"'+e.slice(0,e.length-1).join('", "')+'", or "'+e[e.length-1]+'"';("string"!=typeof t||-1==e.indexOf(t))&&(r="Query operator $type must be a string. Supported values: "+n+".")}if("$size"===e&&parseInt(t,10)!==t&&(r="Query operator $size must be a integer."),"$regex"===e&&"string"!=typeof t&&(n?r="Query operator $regex must be a string.":t instanceof RegExp||(r="Query operator $regex must be a string or an instance of a javascript regular expression.")),r){if(i){r+=" Received"+(null===o?" ":Array.isArray(o)?" array":" "+typeof o)+": "+(Z(o)?JSON.stringify(o,null,"\t"):o)}throw new Error(r)}}const te=["$all","$allMatch","$and","$elemMatch","$exists","$in","$mod","$nin","$nor","$not","$or","$regex","$size","$type"],ne=["$in","$nin","$mod","$all"],re=["$eq","$gt","$gte","$lt","$lte"];function oe(e,t){if(Array.isArray(e))for(const n of e)Z(n)&&oe(n,t);else for(const[n,r]of Object.entries(e))-1!==te.indexOf(n)&&ee(n,r,t),-1===re.indexOf(n)&&-1===ne.indexOf(n)&&Z(r)&&oe(r,t)}async function ie(e,t,n){n.body&&(n.body=JSON.stringify(n.body),n.headers=new Y({"Content-type":"application/json"}));const r=await e.fetch(t,n),o=await r.json();if(!r.ok){o.status=r.status;throw d(function(e,t){function n(t){for(var n=Object.getOwnPropertyNames(e),r=0,o=n.length;r<o;r++)"function"!=typeof e[n[r]]&&(this[n[r]]=e[n[r]]);void 0===this.stack&&(this.stack=(new Error).stack),void 0!==t&&(this.reason=t)}return n.prototype=f.prototype,new n(t)}(o))}return o}async function se(e,t){return await ie(e,"_index",{method:"POST",body:H(t)})}async function ue(e,t){return oe(t.selector,!0),await ie(e,"_find",{method:"POST",body:t})}async function ce(e,t){return await ie(e,"_explain",{method:"POST",body:t})}async function ae(e){return await ie(e,"_index",{method:"GET"})}async function fe(e,t){const n=t.ddoc,r=t.type||"json",o=t.name;if(!n)throw new Error("you must provide an index's ddoc");if(!o)throw new Error("you must provide an index's name");const i="_index/"+[n,r,o].map(encodeURIComponent).join("/");return await ie(e,i,{method:"DELETE"})}class le{constructor(){this.promise=Promise.resolve()}add(e){return this.promise=this.promise.catch(()=>{}).then(()=>e()),this.promise}finish(){return this.promise}}function de(e){if(!e)return"undefined";switch(typeof e){case"function":case"string":return e.toString();default:return JSON.stringify(e)}}async function ye(e,t,n,r,o,i){const s=function(e,t){return de(e)+de(t)+"undefined"}(n,r);let u;if(!o&&(u=e._cachedViews=e._cachedViews||{},u[s]))return u[s];const c=e.info().then(async function(c){const a=c.db_name+"-mrview-"+(o?"temp":m(s));await p(e,"_local/"+i,function(e){e.views=e.views||{};let n=t;-1===n.indexOf("/")&&(n=t+"/"+t);const r=e.views[n]=e.views[n]||{};if(!r[a])return r[a]=!0,e});const f=(await e.registerDependentDatabase(a)).db;f.auto_compaction=!0;const l={name:a,db:f,sourceDB:e,adapter:e.adapter,mapFun:n,reduceFun:r};let d;try{d=await l.db.get("_local/lastSeq")}catch(e){if(404!==e.status)throw e}return l.seq=d?d.seq:0,u&&l.db.once("destroyed",function(){delete u[s]}),l});return u&&(u[s]=c),c}class pe extends Error{constructor(e){super(),this.status=400,this.name="query_parse_error",this.message=e,this.error=!0;try{Error.captureStackTrace(this,pe)}catch(e){}}}class he extends Error{constructor(e){super(),this.status=404,this.name="not_found",this.message=e,this.error=!0;try{Error.captureStackTrace(this,he)}catch(e){}}}class ve extends Error{constructor(e){super(),this.status=500,this.name="invalid_value",this.message=e,this.error=!0;try{Error.captureStackTrace(this,ve)}catch(e){}}}function ge(e,t){return t&&e.then(function(e){c(function(){t(null,e)})},function(e){c(function(){t(e)})}),e}function me(e,t){return function(){var n=arguments,r=this;return e.add(function(){return t.apply(r,n)})}}function _e(e){var t=new Set(e),n=new Array(t.size),r=-1;return t.forEach(function(e){n[++r]=e}),n}function be(e){var t=new Array(e.size),n=-1;return e.forEach(function(e,r){t[++n]=r}),t}const we={},ke=new le;function je(e){return-1===e.indexOf("/")?[e,e]:e.split("/")}function $e(e,t,n){try{e.emit("error",t)}catch(e){a("error","The user's map/reduce function threw an uncaught error.\nYou can debug this error by doing:\nmyDatabase.on('error', function (err) { debugger; });\nPlease double-check your map/reduce function."),a("error",t,n)}}function xe(e,t){for(const n of t)if(void 0===(e=e[n]))return;return e}function Oe(e,t,n){const r=function(e){return e.every(e=>-1===e.indexOf("."))}(e),o=1===e.length;return r?o?function(e,t,n){return function(r){n&&!J(r,n)||t(r[e])}}(e[0],t,n):function(e,t,n){return function(r){if(n&&!J(r,n))return;const o=e.map(e=>r[e]);t(o)}}(e,t,n):o?function(e,t,n){const r=k(e);return function(e){if(n&&!J(e,n))return;const o=xe(e,r);void 0!==o&&t(o)}}(e[0],t,n):function(e,t,n){return function(r){if(n&&!J(r,n))return;const o=[];for(const t of e){const e=xe(r,k(t));if(void 0===e)return;o.push(e)}t(o)}}(e,t,n)}const Ae=function(e,t,n,r){function o(e,t,n){try{t(n)}catch(r){$e(e,r,{fun:t,doc:n})}}function i(e,t,n,r,o){try{return{output:t(n,r,o)}}catch(i){return $e(e,i,{fun:t,keys:n,values:r,rereduce:o}),{error:i}}}function s(e,t){const n=M(e.key,t.key);return 0!==n?n:M(e.value,t.value)}function u(e,t,n){return n=n||0,"number"==typeof t?e.slice(n,t+n):n>0?e.slice(n):e}function a(e){const t=e.value;return t&&"object"==typeof t&&t._id||e.id}function f(e){return function(t){return e.include_docs&&e.attachments&&e.binary&&function(e){for(const t of e.rows){const e=t.doc&&t.doc._attachments;if(e)for(const t of Object.keys(e)){const n=e[t];e[t].data=g(n.data,n.content_type)}}}(t),t}}function l(e,t,n,r){let o=t[e];void 0!==o&&(r&&(o=encodeURIComponent(JSON.stringify(o))),n.push(e+"="+o))}function p(e){if(void 0!==e){const t=Number(e);return isNaN(t)||t!==parseInt(e,10)?e:t}}function h(e){if(e){if("number"!=typeof e)return new pe(`Invalid value for integer: "${e}"`);if(e<0)return new pe(`Invalid value for positive integer: "${e}"`)}}function v(e,t){const n=e.descending?"endkey":"startkey",r=e.descending?"startkey":"endkey";if(void 0!==e[n]&&void 0!==e[r]&&M(e[n],e[r])>0)throw new pe("No rows can match your key range, reverse your start_key and end_key or set {descending : true}");if(t.reduce&&!1!==e.reduce){if(e.include_docs)throw new pe("{include_docs:true} is invalid for reduce");if(e.keys&&e.keys.length>1&&!e.group&&!e.group_level)throw new pe("Multi-key fetches for reduce views must use {group: true}")}for(const t of["group_level","limit","skip"]){const n=h(e[t]);if(n)throw n}}function m(e){return function(t){if(404===t.status)return e;throw t}}function _(e,t,n){return e.db.get("_local/lastSeq").catch(m({_id:"_local/lastSeq",seq:0})).then(function(r){var o=be(t);return Promise.all(o.map(function(n){return async function(e,t,n){const r="_local/doc_"+e,o={_id:r,keys:[]},i=n.get(e),s=i[0],u=i[1],c=await(function(e){return 1===e.length&&/^1-/.test(e[0].rev)}(u)?Promise.resolve(o):t.db.get(r).catch(m(o)));return function(e,t){const n=[],r=new Set;for(const e of t.rows){const t=e.doc;if(t&&(n.push(t),r.add(t._id),t._deleted=!s.has(t._id),!t._deleted)){const e=s.get(t._id);"value"in e&&(t.value=e.value)}}const o=be(s);for(const e of o)if(!r.has(e)){const t={_id:e},r=s.get(e);"value"in r&&(t.value=r.value),n.push(t)}return e.keys=_e(o.concat(e.keys)),n.push(e),n}(c,await function(e){return e.keys.length?t.db.allDocs({keys:e.keys,include_docs:!0}):Promise.resolve({rows:[]})}(c))}(n,e,t)})).then(function(t){var o=t.flat();return r.seq=n,o.push(r),e.db.bulkDocs({docs:o})}).then(()=>function(e){return e.sourceDB.get("_local/purges").then(function(t){const n=t.purgeSeq;return e.db.get("_local/purgeSeq").then(function(e){return e._rev}).catch(m(void 0)).then(function(t){return e.db.put({_id:"_local/purgeSeq",_rev:t,purgeSeq:n})})}).catch(function(e){if(404!==e.status)throw e})}(e))})}function b(e){const t="string"==typeof e?e:e.name;let n=we[t];return n||(n=we[t]=new le),n}async function w(e,n){return me(b(e),function(){return async function(e,n){let r,i,u;const c=t(e.mapFun,function(e,t){const n={id:i._id,key:E(e)};null!=t&&(n.value=E(t)),r.push(n)});let a=e.seq||0;let f=0;const l={view:e.name,indexed_docs:f};e.sourceDB.emit("indexing",l);const d=new le;async function y(){return function(t,l){const h=t.results;if(!h.length&&!l.length)return;for(const e of l){if(h.findIndex(function(t){return t.id===e.docId})<0){const t={_id:e.docId,doc:{_id:e.docId,_deleted:1},changes:[]};e.doc&&(t.doc=e.doc,t.changes.push({rev:e.doc._rev})),h.push(t)}}const v=function(t){const n=new Map;for(const u of t){if("_"!==u.doc._id[0]){r=[],i=u.doc,i._deleted||o(e.sourceDB,c,i),r.sort(s);const t=p(r);n.set(u.doc._id,[t,u.changes])}a=u.seq}return n}(h);d.add(function(t,n){return function(){return _(e,t,n)}}(v,a)),f+=h.length;const g={view:e.name,last_seq:t.last_seq,results_count:h.length,indexed_docs:f};if(e.sourceDB.emit("indexing",g),e.sourceDB.activeTasks.update(u,{completed_items:f}),h.length<n.changes_batch_size)return;return y()}(await e.sourceDB.changes({return_docs:!0,conflicts:!0,include_docs:!0,style:"all_docs",since:a,limit:n.changes_batch_size}),await e.db.get("_local/purgeSeq").then(function(e){return e.purgeSeq}).catch(m(-1)).then(function(t){return e.sourceDB.get("_local/purges").then(function(n){const r=n.purges.filter(function(e,n){return n>t}).map(e=>e.docId),o=r.filter(function(e,t){return r.indexOf(e)===t});return Promise.all(o.map(function(t){return e.sourceDB.get(t).then(function(e){return{docId:t,doc:e}}).catch(m({docId:t}))}))}).catch(m([]))}))}function p(e){const t=new Map;let n;for(let r=0,o=e.length;r<o;r++){const o=e[r],i=[o.key,o.id];r>0&&0===M(o.key,n)&&i.push(r),t.set(B(i),o),n=o.key}return t}try{await e.sourceDB.info().then(function(t){u=e.sourceDB.activeTasks.add({name:"view_indexing",total_items:t.update_seq-a})}),await y(),await d.finish(),e.seq=a,e.sourceDB.activeTasks.remove(u)}catch(t){e.sourceDB.activeTasks.remove(u,t)}}(e,n)})()}function k(e,t){return me(b(e),function(){return async function(e,t){let r;const o=e.reduceFun&&!1!==t.reduce,s=t.skip||0;void 0===t.keys||t.keys.length||(t.limit=0,delete t.keys);async function c(t){t.include_docs=!0;const n=await e.db.allDocs(t);return r=n.total_rows,n.rows.map(function(e){if("value"in e.doc&&"object"==typeof e.doc.value&&null!==e.doc.value){const t=Object.keys(e.doc.value).sort(),n=["id","key","value"];if(!(t<n||t>n))return e.doc.value}const t=function(e){for(var t=[],n=[],r=0;;){var o=e[r++];if("\0"!==o)switch(o){case"1":t.push(null);break;case"2":t.push("1"===e[r]),r++;break;case"3":var i=P(e,r);t.push(i.num),r+=i.length;break;case"4":for(var s="";;){var u=e[r];if("\0"===u)break;s+=u,r++}s=s.replace(/\u0001\u0001/g,"\0").replace(/\u0001\u0002/g,"").replace(/\u0002\u0002/g,""),t.push(s);break;case"5":var c={element:[],index:t.length};t.push(c.element),n.push(c);break;case"6":var a={element:{},index:t.length};t.push(a.element),n.push(a);break;default:throw new Error("bad collationIndex or unexpectedly reached end of input: "+o)}else{if(1===t.length)return t.pop();I(t,n)}}}(e.doc._id);return{key:t[0],id:t[1],value:"value"in e.doc?e.doc.value:null}})}async function f(c){let f;if(f=o?function(e,t,r){0===r.group_level&&delete r.group_level;const o=r.group||r.group_level,s=n(e.reduceFun),c=[],a=isNaN(r.group_level)?Number.POSITIVE_INFINITY:r.group_level;for(const e of t){const t=c[c.length-1];let n=o?e.key:null;o&&Array.isArray(n)&&(n=n.slice(0,a)),t&&0===M(t.groupKey,n)?(t.keys.push([e.key,e.id]),t.values.push(e.value)):c.push({keys:[[e.key,e.id]],values:[e.value],groupKey:n})}t=[];for(const n of c){const r=i(e.sourceDB,s,n.keys,n.values,!1);if(r.error&&r.error instanceof ve)throw r.error;t.push({value:r.error?null:r.output,key:n.groupKey})}return{rows:u(t,r.limit,r.skip)}}(e,c,t):void 0===t.keys?{total_rows:r,offset:s,rows:c}:{total_rows:r,offset:s,rows:u(c,t.limit,t.skip)},t.update_seq&&(f.update_seq=e.seq),t.include_docs){const n=_e(c.map(a)),r=await e.sourceDB.allDocs({keys:n,include_docs:!0,conflicts:t.conflicts,attachments:t.attachments,binary:t.binary}),o=new Map;for(const e of r.rows)o.set(e.id,e.doc);for(const e of c){const t=a(e),n=o.get(t);n&&(e.doc=n)}}return f}if(void 0!==t.keys){const e=t.keys.map(function(e){const n={startkey:B([e]),endkey:B([e,{}])};return t.update_seq&&(n.update_seq=!0),c(n)}),n=await Promise.all(e);return f(n.flat())}{const e={descending:t.descending};let n,r;if(t.update_seq&&(e.update_seq=!0),"start_key"in t&&(n=t.start_key),"startkey"in t&&(n=t.startkey),"end_key"in t&&(r=t.end_key),"endkey"in t&&(r=t.endkey),void 0!==n&&(e.startkey=t.descending?B([n,{}]):B([n])),void 0!==r){let n=!1!==t.inclusive_end;t.descending&&(n=!n),e.endkey=B(n?[r,{}]:[r])}if(void 0!==t.key){const n=B([t.key]),r=B([t.key,{}]);e.descending?(e.endkey=n,e.startkey=r):(e.startkey=n,e.endkey=r)}o||("number"==typeof t.limit&&(e.limit=t.limit),e.skip=s);return f(await c(e))}}(e,t)})()}async function j(t,n,o){if("function"==typeof t._query)return function(e,t,n){return new Promise(function(r,o){e._query(t,n,function(e,t){if(e)return o(e);r(t)})})}(t,n,o);if(y(t))return async function(e,t,n){let r,o,i=[],s="GET";if(l("reduce",n,i),l("include_docs",n,i),l("attachments",n,i),l("limit",n,i),l("descending",n,i),l("group",n,i),l("group_level",n,i),l("skip",n,i),l("stale",n,i),l("conflicts",n,i),l("startkey",n,i,!0),l("start_key",n,i,!0),l("endkey",n,i,!0),l("end_key",n,i,!0),l("inclusive_end",n,i),l("key",n,i,!0),l("update_seq",n,i),i=i.join("&"),i=""===i?"":"?"+i,void 0!==n.keys){const e=2e3,o="keys="+encodeURIComponent(JSON.stringify(n.keys));o.length+i.length+1<=e?i+=("?"===i[0]?"&":"?")+o:(s="POST","string"==typeof t?r={keys:n.keys}:t.keys=n.keys)}if("string"==typeof t){const u=je(t),c=await e.fetch("_design/"+u[0]+"/_view/"+u[1]+i,{headers:new Y({"Content-Type":"application/json"}),method:s,body:JSON.stringify(r)});o=c.ok;const a=await c.json();if(!o)throw a.status=c.status,d(a);for(const e of a.rows)if(e.value&&e.value.error&&"builtin_reduce_error"===e.value.error)throw new Error(e.reason);return new Promise(function(e){e(a)}).then(f(n))}r=r||{};for(const e of Object.keys(t))Array.isArray(t[e])?r[e]=t[e]:r[e]=t[e].toString();const u=await e.fetch("_temp_view"+i,{headers:new Y({"Content-Type":"application/json"}),method:"POST",body:JSON.stringify(r)});o=u.ok;const c=await u.json();if(!o)throw c.status=u.status,d(c);return new Promise(function(e){e(c)}).then(f(n))}(t,n,o);const i={changes_batch_size:t.__opts.view_update_changes_batch_size||50};if("string"!=typeof n)return v(o,n),ke.add(async function(){const r=await ye(t,"temp_view/temp_view",n.map,n.reduce,!0,e);return s=w(r,i).then(function(){return k(r,o)}),u=function(){return r.db.destroy()},s.then(function(e){return u().then(function(){return e})},function(e){return u().then(function(){throw e})});var s,u}),ke.finish();{const s=n,u=je(s),a=u[0],f=u[1],l=await t.get("_design/"+a);if(!(n=l.views&&l.views[f]))throw new he(`ddoc ${l._id} has no view named ${f}`);r(l,f),v(o,n);const d=await ye(t,s,n.map,n.reduce,!1,e);return"ok"===o.stale||"update_after"===o.stale?("update_after"===o.stale&&c(function(){w(d,i)}),k(d,o)):(await w(d,i),k(d,o))}}var $;return{query:function(e,t,n){const r=this;"function"==typeof t&&(n=t,t={}),t=t?function(e){return e.group_level=p(e.group_level),e.limit=p(e.limit),e.skip=p(e.skip),e}(t):{},"function"==typeof e&&(e={map:e});const o=Promise.resolve().then(function(){return j(r,e,t)});return ge(o,n),o},viewCleanup:($=function(){const t=this;return"function"==typeof t._viewCleanup?function(e){return new Promise(function(t,n){e._viewCleanup(function(e,r){if(e)return n(e);t(r)})})}(t):y(t)?async function(e){return(await e.fetch("_view_cleanup",{headers:new Y({"Content-Type":"application/json"}),method:"POST"})).json()}(t):async function(t){try{const n=await t.get("_local/"+e),r=new Map;for(const e of Object.keys(n.views)){const t=je(e),n="_design/"+t[0],o=t[1];let i=r.get(n);i||(i=new Set,r.set(n,i)),i.add(o)}const o={keys:be(r),include_docs:!0},i=await t.allDocs(o),s={};for(const e of i.rows){const t=e.key.substring(8);for(const o of r.get(e.key)){let r=t+"/"+o;n.views[r]||(r=o);const i=Object.keys(n.views[r]),u=e.doc&&e.doc.views&&e.doc.views[o];for(const e of i)s[e]=s[e]||u}}const u=Object.keys(s).filter(function(e){return!s[e]}).map(function(e){return me(b(e),function(){return new t.constructor(e,t.__opts).destroy()})()});return Promise.all(u).then(function(){return{ok:!0}})}catch(e){if(404===e.status)return{ok:!0};throw e}}(t)},function(...e){var t=e.pop(),n=$.apply(this,e);return"function"==typeof t&&ge(n,t),n})}}("indexes",function(e,t){return Oe(Object.keys(e.fields),t,e.partial_filter_selector)},function(){throw new Error("reduce not supported")},function(e,t){const n=e.views[t];if(!n.map||!n.map.fields)throw new Error("ddoc "+e._id+" with view "+t+" doesn't have map.fields defined. maybe it wasn't created by this plugin?")});function qe(e){return e._customFindAbstractMapper?{query:function(t,n){const r=Ae.query.bind(this);return e._customFindAbstractMapper.query.call(this,t,n,r)},viewCleanup:function(){const t=Ae.viewCleanup.bind(this);return e._customFindAbstractMapper.viewCleanup.call(this,t)}}:Ae}const Me=/^_design\//;function Ee(e){return e.fields=e.fields.map(function(e){if("string"==typeof e){const t={};return t[e]="asc",t}return e}),e.partial_filter_selector&&(e.partial_filter_selector=q(e.partial_filter_selector)),e}function Se(e,t){return t.def.fields.map(t=>{const n=x(t);return _(e,k(n))})}async function Be(e,t){const n=u((t=H(t)).index);let r;function o(){return r||(r=m(JSON.stringify(t)))}t.index=Ee(t.index),function(e){const t=e.fields.filter(function(e){return"asc"===O(e)});if(0!==t.length&&t.length!==e.fields.length)throw new Error("unsupported mixed sorting")}(t.index);const i=t.name||"idx-"+o(),s=t.ddoc||"idx-"+o(),c="_design/"+s;let a=!1,f=!1;if(e.constructor.emit("debug",["find","creating index",c]),await p(e,c,function(e){return e._rev&&"query"!==e.language&&(a=!0),e.language="query",e.views=e.views||{},f=!!e.views[i],!f&&(e.views[i]={map:{fields:K(t.index.fields),partial_filter_selector:t.index.partial_filter_selector},reduce:"_count",options:{def:n}},e)}),a)throw new Error('invalid language for ddoc with id "'+c+'" (should be "query")');const l=s+"/"+i;return await qe(e).query.call(e,l,{limit:0,reduce:!1}),{id:c,name:i,result:f?"exists":"created"}}async function Pe(e){const t=await e.allDocs({startkey:"_design/",endkey:"_design/￿",include_docs:!0}),n={indexes:[{ddoc:null,name:"_all_docs",type:"special",def:{fields:[{_id:"asc"}]}}]};return n.indexes=Q(n.indexes,t.rows.filter(function(e){return"query"===e.doc.language}).map(function(e){return(void 0!==e.doc.views?Object.keys(e.doc.views):[]).map(function(t){const n=e.doc.views[t];return{ddoc:e.id,name:t,type:"json",def:Ee(n.options.def)}})})),n.indexes.sort(function(e,t){return w(e.name,t.name)}),n.total_rows=n.indexes.length,n}const Ie={"￿":{}},Ce={queryOpts:{limit:0,startkey:Ie,endkey:null},inMemoryFields:[]};function Le(e,t){return e.def.fields.some(e=>x(e)===t)}function Ue(e,t){return"$eq"!==x(e[t])}function De(e,t){const n=t.def.fields.map(x);return e.slice().sort(function(e,t){let r=n.indexOf(e),o=n.indexOf(t);return-1===r&&(r=Number.MAX_VALUE),-1===o&&(o=Number.MAX_VALUE),w(r,o)})}function Ne(e,t,n,r){const o=Q(e,function(e,t,n){let r=!1;for(let o=0,i=(n=De(n,e)).length;o<i;o++){const s=n[o];if(r||!Le(e,s))return n.slice(o);o<i-1&&Ue(t,s)&&(r=!0)}return[]}(t,n,r),function(e){const t=[];for(const[n,r]of Object.entries(e))for(const e of Object.keys(r))"$ne"===e&&t.push(n);return t}(n));return De((i=o,Array.from(new Set(i))),t);var i}function Te(e,t,n){if(t){const i=(o=e,!((r=t).length>o.length)&&X(r,o)),s=X(n,e);return i&&s}var r,o;return function(e,t){e=e.slice();for(const n of t){if(!e.length)break;const t=e.indexOf(n);if(-1===t)return!1;e.splice(t,1)}return!0}(n,e)}const Fe=["$eq","$gt","$gte","$lt","$lte"];function Re(e){return-1===Fe.indexOf(e)}function ze(e,t,n,r){const o=e.def.fields.map(x);return!!Te(o,t,n)&&function(e,t){const n=t[e[0]];return void 0===n||!(1===Object.keys(n).length&&"$ne"===x(n))}(o,r)}function Je(e,t,n,r,o){const i=function(e,t,n,r){return r.filter(function(r){return ze(r,n,t,e)})}(e,t,n,r);if(0===i.length){if(o)throw{error:"no_usable_index",message:"There is no index available for this selector."};const e=r[0];return e.defaultUsed=!0,e}if(1===i.length&&!o)return i[0];const s=function(e){const t={};for(const n of e)t[n]=!0;return t}(t);if(o){const e="_design/"+o[0],t=2===o.length&&o[1],n=i.find(function(n){return!(!t||n.ddoc!==e||t!==n.name)||n.ddoc===e});if(!n)throw{error:"unknown_error",message:"Could not find that index or could not use that index for the query"};return n}return function(e,t){let n=null,r=-1;for(const o of e){const e=t(o);e>r&&(r=e,n=o)}return n}(i,function(e){const t=e.def.fields.map(x);let n=0;for(const e of t)s[e]&&n++;return n})}function Ve(e,t){switch(e){case"$eq":return{key:t};case"$lte":return{endkey:t};case"$gte":return{startkey:t};case"$lt":return{endkey:t,inclusive_end:!1};case"$gt":return{startkey:t,inclusive_start:!1}}return{startkey:null}}function Qe(e,t){switch(e){case"$eq":return{startkey:t,endkey:t};case"$lte":return{endkey:t};case"$gte":return{startkey:t};case"$lt":return{endkey:t,inclusive_end:!1};case"$gt":return{startkey:t,inclusive_start:!1}}}function Ke(e,t){return t.defaultUsed?function(e){return{queryOpts:{startkey:null},inMemoryFields:[Object.keys(e)]}}(e):1===t.def.fields.length?function(e,t){const n=x(t.def.fields[0]),r=e[n]||{},o=[],i=Object.keys(r);let s;for(const e of i){Re(e)&&o.push(n);const t=Ve(e,r[e]);s=s?K([s,t]):t}return{queryOpts:s,inMemoryFields:o}}(e,t):function(e,t){const n=t.def.fields.map(x);let r=[];const o=[],i=[];let s,u;function c(e){!1!==s&&o.push(null),!1!==u&&i.push(Ie),r=n.slice(e)}for(let t=0,r=n.length;t<r;t++){const r=e[n[t]];if(!r||!Object.keys(r).length){c(t);break}if(Object.keys(r).some(Re)){c(t);break}if(t>0){const o="$gt"in r||"$gte"in r||"$lt"in r||"$lte"in r,i=Object.keys(e[n[t-1]]),s=G(i,["$eq"]),u=G(i,Object.keys(r));if(o&&!s&&!u){c(t);break}}const a=Object.keys(r);let f=null;for(const e of a){const t=Qe(e,r[e]);f=f?K([f,t]):t}o.push("startkey"in f?f.startkey:null),i.push("endkey"in f?f.endkey:Ie),"inclusive_start"in f&&(s=f.inclusive_start),"inclusive_end"in f&&(u=f.inclusive_end)}const a={startkey:o,endkey:i};return void 0!==s&&(a.inclusive_start=s),void 0!==u&&(a.inclusive_end=u),{queryOpts:a,inMemoryFields:r}}(e,t)}function Xe(e,t){const n=e.selector,r=e.sort;if(function(e){return Object.keys(e).map(function(t){return e[t]}).some(function(e){return"object"==typeof e&&0===Object.keys(e).length})}(n))return Object.assign({},Ce,{index:t[0]});const o=function(e,t){const n=Object.keys(e),r=t?t.map(x):[];let o;return o=n.length>=r.length?n:r,0===r.length?{fields:o}:(o=o.sort(function(e,t){let n=r.indexOf(e);-1===n&&(n=Number.MAX_VALUE);let o=r.indexOf(t);return-1===o&&(o=Number.MAX_VALUE),n<o?-1:n>o?1:0}),{fields:o,sortOrder:t.map(x)})}(n,r),i=o.fields,s=Je(n,i,o.sortOrder,t,e.use_index),u=Ke(n,s);return{queryOpts:u.queryOpts,index:s,inMemoryFields:Ne(u.inMemoryFields,s,n,i)}}async function Ge(e,t,n){return"_all_docs"===n.name?async function(e,t){const n=u(t);n.descending?("endkey"in n&&"string"!=typeof n.endkey&&(n.endkey=""),"startkey"in n&&"string"!=typeof n.startkey&&(n.limit=0)):("startkey"in n&&"string"!=typeof n.startkey&&(n.startkey=""),"endkey"in n&&"string"!=typeof n.endkey&&(n.limit=0)),"key"in n&&"string"!=typeof n.key&&(n.limit=0),n.limit>0&&n.indexes_count&&(n.original_limit=n.limit,n.limit+=n.indexes_count);const r=await e.allDocs(n);return r.rows=r.rows.filter(function(e){return!/^_design\//.test(e.id)}),n.original_limit&&(n.limit=n.original_limit),r.rows=r.rows.slice(0,n.limit),r}(e,t):qe(e).query.call(e,(r=n).ddoc.substring(8)+"/"+r.name,t);var r}async function We(e,t,n){t.selector&&(oe(t.selector,!1),t.selector=q(t.selector)),t.sort&&(t.sort=function(e){if(!Array.isArray(e))throw new Error("invalid sort json - should be an array");return e.map(function(e){if("string"==typeof e){const t={};return t[e]="asc",t}return e})}(t.sort)),t.use_index&&(t.use_index=function(e){let t=[];return"string"==typeof e?t.push(e):t=e,t.map(function(e){return e.replace(Me,"")})}(t.use_index)),"limit"in t||(t.limit=25),function(e){if("object"!=typeof e.selector)throw new Error("you must provide a selector when you find()")}(t);const r=await Pe(e);e.constructor.emit("debug",["find","planning query",t]);const o=Xe(t,r.indexes);e.constructor.emit("debug",["find","query plan",o]);const i=o.index;!function(e,t){if(t.defaultUsed&&e.sort){const t=e.sort.filter(function(e){return"_id"!==Object.keys(e)[0]}).map(function(e){return Object.keys(e)[0]});if(t.length>0)throw new Error('Cannot sort on field(s) "'+t.join(",")+'" when using the default index')}t.defaultUsed}(t,i);let s=Object.assign({include_docs:!0,reduce:!1,indexes_count:r.total_rows},o.queryOpts);if("startkey"in s&&"endkey"in s&&M(s.startkey,s.endkey)>0)return{docs:[]};if(t.sort&&"string"!=typeof t.sort[0]&&"desc"===O(t.sort[0])&&(s.descending=!0,s=function(e){const t=u(e);return delete t.startkey,delete t.endkey,delete t.inclusive_start,delete t.inclusive_end,"endkey"in e&&(t.startkey=e.endkey),"startkey"in e&&(t.endkey=e.startkey),"inclusive_start"in e&&(t.inclusive_end=e.inclusive_start),"inclusive_end"in e&&(t.inclusive_start=e.inclusive_end),t}(s)),o.inMemoryFields.length||(s.limit=t.limit,"skip"in t&&(s.skip=t.skip)),n)return Promise.resolve(o,s);const c=await Ge(e,s,i);!1===s.inclusive_start&&(c.rows=function(e,t,n){const r=n.def.fields;let o=0;for(const i of e){let e=Se(i.doc,n);if(1===r.length)e=e[0];else for(;e.length>t.length;)e.pop();if(Math.abs(M(e,t))>0)break;++o}return o>0?e.slice(o):e}(c.rows,s.startkey,i)),o.inMemoryFields.length&&(c.rows=L(c.rows,t,o.inMemoryFields));const a={docs:c.rows.map(function(e){const n=e.doc;return t.fields?function(e,t){const n={};for(const r of t){const t=k(r),o=_(e,t);void 0!==o&&b(n,t,o)}return n}(n,t.fields):n})};return i.defaultUsed&&(a.warning="No matching index found, create an index to optimize query time."),a}async function Ye(e,t){const n=await We(e,t,!0);return{dbname:e.name,index:n.index,selector:t.selector,range:{start_key:n.queryOpts.startkey,end_key:n.queryOpts.endkey},opts:{use_index:t.use_index||[],bookmark:"nil",limit:t.limit,skip:t.skip,sort:t.sort||{},fields:t.fields,conflicts:!1,r:[49]},limit:t.limit,skip:t.skip||0,fields:t.fields}}async function He(e,t){if(!t.ddoc)throw new Error("you must supply an index.ddoc when deleting");if(!t.name)throw new Error("you must supply an index.name when deleting");const n=t.ddoc,r=t.name;return await p(e,n,function(e){return 1===Object.keys(e.views).length&&e.views[r]?{_id:n,_deleted:!0}:(delete e.views[r],e)}),await qe(e).viewCleanup.apply(e),{ok:!0}}const Ze={};Ze.createIndex=W(async function(e){if("object"!=typeof e)throw new Error("you must provide an index to create");return(y(this)?se:Be)(this,e)}),Ze.find=W(async function(e){if("object"!=typeof e)throw new Error("you must provide search parameters to find()");return(y(this)?ue:We)(this,e)}),Ze.explain=W(async function(e){if("object"!=typeof e)throw new Error("you must provide search parameters to explain()");return(y(this)?ce:Ye)(this,e)}),Ze.getIndexes=W(async function(){return(y(this)?ae:Pe)(this)}),Ze.deleteIndex=W(async function(e){if("object"!=typeof e)throw new Error("you must provide an index to delete");return(y(this)?fe:He)(this,e)}),"undefined"==typeof PouchDB?a("error",'pouchdb-find plugin error: Cannot find global "PouchDB" object! Did you remember to include pouchdb.js?'):PouchDB.plugin(Ze)},{events:1,"spark-md5":2,uuid:3}]},{},[18]);(function(f){var d,e,p=function(){d=(new(window.UAParser||exports.UAParser)).getResult();e=new Detector;return this};p.prototype={getSoftwareVersion:function(){return"0.1.11"},getBrowserData:function(){return d},getFingerprint:function(){var b=d.ua,c=this.getScreenPrint(),a=this.getPlugins(),g=this.getFonts(),n=this.isLocalStorage(),f=this.isSessionStorage(),h=this.getTimeZone(),u=this.getLanguage(),m=this.getSystemLanguage(),e=this.isCookie(),C=this.getCanvasPrint();return murmurhash3_32_gc(b+"|"+c+"|"+a+"|"+g+"|"+n+"|"+f+"|"+h+"|"+u+"|"+m+"|"+e+"|"+C,256)},getCustomFingerprint:function(){for(var b="",c=0;c<arguments.length;c++)b+=arguments[c]+"|";return murmurhash3_32_gc(b,256)},getUserAgent:function(){return d.ua},getUserAgentLowerCase:function(){return d.ua.toLowerCase()},getBrowser:function(){return d.browser.name},getBrowserVersion:function(){return d.browser.version},getBrowserMajorVersion:function(){return d.browser.major},isIE:function(){return/IE/i.test(d.browser.name)},isChrome:function(){return/Chrome/i.test(d.browser.name)},isFirefox:function(){return/Firefox/i.test(d.browser.name)},isSafari:function(){return/Safari/i.test(d.browser.name)},isMobileSafari:function(){return/Mobile\sSafari/i.test(d.browser.name)},isOpera:function(){return/Opera/i.test(d.browser.name)},getEngine:function(){return d.engine.name},getEngineVersion:function(){return d.engine.version},getOS:function(){return d.os.name},getOSVersion:function(){return d.os.version},isWindows:function(){return/Windows/i.test(d.os.name)},isMac:function(){return/Mac/i.test(d.os.name)},isLinux:function(){return/Linux/i.test(d.os.name)},isUbuntu:function(){return/Ubuntu/i.test(d.os.name)},isSolaris:function(){return/Solaris/i.test(d.os.name)},getDevice:function(){return d.device.model},getDeviceType:function(){return d.device.type},getDeviceVendor:function(){return d.device.vendor},getCPU:function(){return d.cpu.architecture},isMobile:function(){var b=d.ua||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(b)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(b.substr(0,4))},isMobileMajor:function(){return this.isMobileAndroid()||this.isMobileBlackBerry()||this.isMobileIOS()||this.isMobileOpera()||this.isMobileWindows()},isMobileAndroid:function(){return d.ua.match(/Android/i)?!0:!1},isMobileOpera:function(){return d.ua.match(/Opera Mini/i)?!0:!1},isMobileWindows:function(){return d.ua.match(/IEMobile/i)?!0:!1},isMobileBlackBerry:function(){return d.ua.match(/BlackBerry/i)?!0:!1},isMobileIOS:function(){return d.ua.match(/iPhone|iPad|iPod/i)?!0:!1},isIphone:function(){return d.ua.match(/iPhone/i)?!0:!1},isIpad:function(){return d.ua.match(/iPad/i)?!0:!1},isIpod:function(){return d.ua.match(/iPod/i)?!0:!1},getScreenPrint:function(){return"Current Resolution: "+this.getCurrentResolution()+", Available Resolution: "+this.getAvailableResolution()+", Color Depth: "+this.getColorDepth()+", Device XDPI: "+this.getDeviceXDPI()+", Device YDPI: "+this.getDeviceYDPI()},getColorDepth:function(){return screen.colorDepth},getCurrentResolution:function(){return screen.width+"x"+screen.height},getAvailableResolution:function(){return screen.availWidth+"x"+screen.availHeight},getDeviceXDPI:function(){return screen.deviceXDPI},getDeviceYDPI:function(){return screen.deviceYDPI},getPlugins:function(){for(var b="",c=0;c<navigator.plugins.length;c++)b=c==navigator.plugins.length-1?b+navigator.plugins[c].name:b+(navigator.plugins[c].name+", ");return b},isJava:function(){return navigator.javaEnabled()},getJavaVersion:function(){return deployJava.getJREs().toString()},isFlash:function(){return navigator.plugins["Shockwave Flash"]?!0:!1},getFlashVersion:function(){return this.isFlash()?(objPlayerVersion=swfobject.getFlashPlayerVersion(),objPlayerVersion.major+"."+objPlayerVersion.minor+"."+objPlayerVersion.release):""},isSilverlight:function(){return navigator.plugins["Silverlight Plug-In"]?!0:!1},getSilverlightVersion:function(){return this.isSilverlight()?navigator.plugins["Silverlight Plug-In"].description:""},isMimeTypes:function(){return navigator.mimeTypes.length?!0:!1},getMimeTypes:function(){for(var b="",c=0;c<navigator.mimeTypes.length;c++)b=c==navigator.mimeTypes.length-1?b+navigator.mimeTypes[c].description:b+(navigator.mimeTypes[c].description+", ");return b},isFont:function(b){return e.detect(b)},getFonts:function(){for(var b="Abadi MT Condensed Light;Adobe Fangsong Std;Adobe Hebrew;Adobe Ming Std;Agency FB;Aharoni;Andalus;Angsana New;AngsanaUPC;Aparajita;Arab;Arabic Transparent;Arabic Typesetting;Arial Baltic;Arial Black;Arial CE;Arial CYR;Arial Greek;Arial TUR;Arial;Batang;BatangChe;Bauhaus 93;Bell MT;Bitstream Vera Serif;Bodoni MT;Bookman Old Style;Braggadocio;Broadway;Browallia New;BrowalliaUPC;Calibri Light;Calibri;Californian FB;Cambria Math;Cambria;Candara;Castellar;Casual;Centaur;Century Gothic;Chalkduster;Colonna MT;Comic Sans MS;Consolas;Constantia;Copperplate Gothic Light;Corbel;Cordia New;CordiaUPC;Courier New Baltic;Courier New CE;Courier New CYR;Courier New Greek;Courier New TUR;Courier New;DFKai-SB;DaunPenh;David;DejaVu LGC Sans Mono;Desdemona;DilleniaUPC;DokChampa;Dotum;DotumChe;Ebrima;Engravers MT;Eras Bold ITC;Estrangelo Edessa;EucrosiaUPC;Euphemia;Eurostile;FangSong;Forte;FrankRuehl;Franklin Gothic Heavy;Franklin Gothic Medium;FreesiaUPC;French Script MT;Gabriola;Gautami;Georgia;Gigi;Gisha;Goudy Old Style;Gulim;GulimChe;GungSeo;Gungsuh;GungsuhChe;Haettenschweiler;Harrington;Hei S;HeiT;Heisei Kaku Gothic;Hiragino Sans GB;Impact;Informal Roman;IrisUPC;Iskoola Pota;JasmineUPC;KacstOne;KaiTi;Kalinga;Kartika;Khmer UI;Kino MT;KodchiangUPC;Kokila;Kozuka Gothic Pr6N;Lao UI;Latha;Leelawadee;Levenim MT;LilyUPC;Lohit Gujarati;Loma;Lucida Bright;Lucida Console;Lucida Fax;Lucida Sans Unicode;MS Gothic;MS Mincho;MS PGothic;MS PMincho;MS Reference Sans Serif;MS UI Gothic;MV Boli;Magneto;Malgun Gothic;Mangal;Marlett;Matura MT Script Capitals;Meiryo UI;Meiryo;Menlo;Microsoft Himalaya;Microsoft JhengHei;Microsoft New Tai Lue;Microsoft PhagsPa;Microsoft Sans Serif;Microsoft Tai Le;Microsoft Uighur;Microsoft YaHei;Microsoft Yi Baiti;MingLiU;MingLiU-ExtB;MingLiU_HKSCS;MingLiU_HKSCS-ExtB;Miriam Fixed;Miriam;Mongolian Baiti;MoolBoran;NSimSun;Narkisim;News Gothic MT;Niagara Solid;Nyala;PMingLiU;PMingLiU-ExtB;Palace Script MT;Palatino Linotype;Papyrus;Perpetua;Plantagenet Cherokee;Playbill;Prelude Bold;Prelude Condensed Bold;Prelude Condensed Medium;Prelude Medium;PreludeCompressedWGL Black;PreludeCompressedWGL Bold;PreludeCompressedWGL Light;PreludeCompressedWGL Medium;PreludeCondensedWGL Black;PreludeCondensedWGL Bold;PreludeCondensedWGL Light;PreludeCondensedWGL Medium;PreludeWGL Black;PreludeWGL Bold;PreludeWGL Light;PreludeWGL Medium;Raavi;Rachana;Rockwell;Rod;Sakkal Majalla;Sawasdee;Script MT Bold;Segoe Print;Segoe Script;Segoe UI Light;Segoe UI Semibold;Segoe UI Symbol;Segoe UI;Shonar Bangla;Showcard Gothic;Shruti;SimHei;SimSun;SimSun-ExtB;Simplified Arabic Fixed;Simplified Arabic;Snap ITC;Sylfaen;Symbol;Tahoma;Times New Roman Baltic;Times New Roman CE;Times New Roman CYR;Times New Roman Greek;Times New Roman TUR;Times New Roman;TlwgMono;Traditional Arabic;Trebuchet MS;Tunga;Tw Cen MT Condensed Extra Bold;Ubuntu;Umpush;Univers;Utopia;Utsaah;Vani;Verdana;Vijaya;Vladimir Script;Vrinda;Webdings;Wide Latin;Wingdings".split(";"),c="",a=0;a<b.length;a++)e.detect(b[a])&&(c=a==b.length-1?c+b[a]:c+(b[a]+", "));return c},isLocalStorage:function(){try{return!!f.localStorage}catch(b){return!0}},isSessionStorage:function(){try{return!!f.sessionStorage}catch(b){return!0}},isCookie:function(){return navigator.cookieEnabled},getTimeZone:function(){return String(String(new Date).split("(")[1]).split(")")[0]},getLanguage:function(){return navigator.language},getSystemLanguage:function(){return navigator.systemLanguage},isCanvas:function(){var b=document.createElement("canvas");try{return!(!b.getContext||!b.getContext("2d"))}catch(c){return!1}},getCanvasPrint:function(){var b=document.createElement("canvas"),c;try{c=b.getContext("2d")}catch(a){return""}c.textBaseline="top";c.font="14px 'Arial'";c.textBaseline="alphabetic";c.fillStyle="#f60";c.fillRect(125,1,62,20);c.fillStyle="#069";c.fillText("ClientJS,org <canvas> 1.0",2,15);c.fillStyle="rgba(102, 204, 0, 0.7)";c.fillText("ClientJS,org <canvas> 1.0",4,17);return b.toDataURL()}};"object"===typeof module&&"undefined"!==typeof exports&&(module.exports=p);f.ClientJS=p})(window);var deployJava=function(){function f(a){c.debug&&(console.log?console.log(a):alert(a))}function d(a){if(null==a||0==a.length)return"http://java.com/dt-redirect";"&"==a.charAt(0)&&(a=a.substring(1,a.length));return"http://java.com/dt-redirect?"+a}var e=["id","class","title","style"];"classid codebase codetype data type archive declare standby height width usemap name tabindex align border hspace vspace".split(" ").concat(e,["lang","dir"],"onclick ondblclick onmousedown onmouseup onmouseover onmousemove onmouseout onkeypress onkeydown onkeyup".split(" "));var p="codebase code name archive object width height alt align hspace vspace".split(" ").concat(e),b;try{b=-1!=document.location.protocol.indexOf("http")?"//java.com/js/webstart.png":"http://java.com/js/webstart.png"}catch(a){b="http://java.com/js/webstart.png"}var c={debug:null,version:"20120801",firefoxJavaVersion:null,myInterval:null,preInstallJREList:null,returnPage:null,brand:null,locale:null,installType:null,EAInstallEnabled:!1,EarlyAccessURL:null,oldMimeType:"application/npruntime-scriptable-plugin;DeploymentToolkit",mimeType:"application/java-deployment-toolkit",launchButtonPNG:b,browserName:null,browserName2:null,getJREs:function(){var a=[];if(this.isPluginInstalled())for(var g=this.getPlugin().jvms,b=0;b<g.getLength();b++)a[b]=g.get(b).version;else g=this.getBrowser(),"MSIE"==g?this.testUsingActiveX("1.7.0")?a[0]="1.7.0":this.testUsingActiveX("1.6.0")?a[0]="1.6.0":this.testUsingActiveX("1.5.0")?a[0]="1.5.0":this.testUsingActiveX("1.4.2")?a[0]="1.4.2":this.testForMSVM()&&(a[0]="1.1"):"Netscape Family"==g&&(this.getJPIVersionUsingMimeType(),null!=this.firefoxJavaVersion?a[0]=this.firefoxJavaVersion:this.testUsingMimeTypes("1.7")?a[0]="1.7.0":this.testUsingMimeTypes("1.6")?a[0]="1.6.0":this.testUsingMimeTypes("1.5")?a[0]="1.5.0":this.testUsingMimeTypes("1.4.2")?a[0]="1.4.2":"Safari"==this.browserName2&&(this.testUsingPluginsArray("1.7.0")?a[0]="1.7.0":this.testUsingPluginsArray("1.6")?a[0]="1.6.0":this.testUsingPluginsArray("1.5")?a[0]="1.5.0":this.testUsingPluginsArray("1.4.2")&&(a[0]="1.4.2")));if(this.debug)for(b=0;b<a.length;++b)f("[getJREs()] We claim to have detected Java SE "+a[b]);return a},installJRE:function(a,g){if(this.isPluginInstalled()&&this.isAutoInstallEnabled(a)){var b=!1;if(b=this.isCallbackSupported()?this.getPlugin().installJRE(a,g):this.getPlugin().installJRE(a))this.refresh(),null!=this.returnPage&&(document.location=this.returnPage);return b}return this.installLatestJRE()},isAutoInstallEnabled:function(a){if(!this.isPluginInstalled())return!1;"undefined"==typeof a&&(a=null);if("MSIE"!=deployJava.browserName||deployJava.compareVersionToPattern(deployJava.getPlugin().version,["10","0","0"],!1,!0))a=!0;else if(null==a)a=!1;else{var g="1.6.0_33+";if(null==g||0==g.length)a=!0;else{var b=g.charAt(g.length-1);"+"!=b&&"*"!=b&&-1!=g.indexOf("_")&&"_"!=b&&(g+="*",b="*");g=g.substring(0,g.length-1);if(0<g.length){var c=g.charAt(g.length-1);if("."==c||"_"==c)g=g.substring(0,g.length-1)}a="*"==b?0==a.indexOf(g):"+"==b?g<=a:!1}a=!a}return a},isCallbackSupported:function(){return this.isPluginInstalled()&&this.compareVersionToPattern(this.getPlugin().version,["10","2","0"],!1,!0)},installLatestJRE:function(a){if(this.isPluginInstalled()&&this.isAutoInstallEnabled()){var g=!1;if(g=this.isCallbackSupported()?this.getPlugin().installLatestJRE(a):this.getPlugin().installLatestJRE())this.refresh(),null!=this.returnPage&&(document.location=this.returnPage);return g}a=this.getBrowser();g=navigator.platform.toLowerCase();if("true"==this.EAInstallEnabled&&-1!=g.indexOf("win")&&null!=this.EarlyAccessURL)this.preInstallJREList=this.getJREs(),null!=this.returnPage&&(this.myInterval=setInterval("deployJava.poll()",3e3)),location.href=this.EarlyAccessURL;else{if("MSIE"==a)return this.IEInstall();if("Netscape Family"==a&&-1!=g.indexOf("win32"))return this.FFInstall();location.href=d((null!=this.returnPage?"&returnPage="+this.returnPage:"")+(null!=this.locale?"&locale="+this.locale:"")+(null!=this.brand?"&brand="+this.brand:""))}return!1},runApplet:function(a,g,b){if("undefined"==b||null==b)b="1.1";var c=b.match("^(\\d+)(?:\\.(\\d+)(?:\\.(\\d+)(?:_(\\d+))?)?)?$");null==this.returnPage&&(this.returnPage=document.location);null!=c?"?"!=this.getBrowser()?this.versionCheck(b+"+")?this.writeAppletTag(a,g):this.installJRE(b+"+")&&(this.refresh(),location.href=document.location,this.writeAppletTag(a,g)):this.writeAppletTag(a,g):f("[runApplet()] Invalid minimumVersion argument to runApplet():"+b)},writeAppletTag:function(a,g){var b="<applet ",c="",h=!0;if(null==g||"object"!=typeof g)g={};for(var d in a){var m;a:{m=d.toLowerCase();for(var f=p.length,e=0;e<f;e++)if(p[e]===m){m=!0;break a}m=!1}m?(b+=" "+d+'="'+a[d]+'"',"code"==d&&(h=!1)):g[d]=a[d]}d=!1;for(var q in g){"codebase_lookup"==q&&(d=!0);if("object"==q||"java_object"==q||"java_code"==q)h=!1;c+='<param name="'+q+'" value="'+g[q]+'"/>'}d||(c+='<param name="codebase_lookup" value="false"/>');h&&(b+=' code="dummy"');document.write(b+">\n"+c+"\n</applet>")},versionCheck:function(a){var g=0,b=a.match("^(\\d+)(?:\\.(\\d+)(?:\\.(\\d+)(?:_(\\d+))?)?)?(\\*|\\+)?$");if(null!=b){for(var c=a=!1,h=[],d=1;d<b.length;++d)"string"==typeof b[d]&&""!=b[d]&&(h[g]=b[d],g++);"+"==h[h.length-1]?(c=!0,a=!1,h.length--):"*"==h[h.length-1]?(c=!1,a=!0,h.length--):4>h.length&&(c=!1,a=!0);g=this.getJREs();for(d=0;d<g.length;++d)if(this.compareVersionToPattern(g[d],h,a,c))return!0}else g="Invalid versionPattern passed to versionCheck: "+a,f("[versionCheck()] "+g),alert(g);return!1},isWebStartInstalled:function(a){if("?"==this.getBrowser())return!0;if("undefined"==a||null==a)a="1.4.2";var b=!1;null!=a.match("^(\\d+)(?:\\.(\\d+)(?:\\.(\\d+)(?:_(\\d+))?)?)?$")?b=this.versionCheck(a+"+"):(f("[isWebStartInstaller()] Invalid minimumVersion argument to isWebStartInstalled(): "+a),b=this.versionCheck("1.4.2+"));return b},getJPIVersionUsingMimeType:function(){for(var a=0;a<navigator.mimeTypes.length;++a){var b=navigator.mimeTypes[a].type.match(/^application\/x-java-applet;jpi-version=(.*)$/);if(null!=b&&(this.firefoxJavaVersion=b[1],"Opera"!=this.browserName2))break}},launchWebStartApplication:function(a){navigator.userAgent.toLowerCase();this.getJPIVersionUsingMimeType();if(0==this.isWebStartInstalled("1.7.0")&&(0==this.installJRE("1.7.0+")||0==this.isWebStartInstalled("1.7.0")))return!1;var b=null;document.documentURI&&(b=document.documentURI);null==b&&(b=document.URL);var c=this.getBrowser(),d;"MSIE"==c?d='<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" width="0" height="0"><PARAM name="launchjnlp" value="'+a+'"><PARAM name="docbase" value="'+b+'"></object>':"Netscape Family"==c&&(d='<embed type="application/x-java-applet;jpi-version='+this.firefoxJavaVersion+'" width="0" height="0" launchjnlp="'+a+'"docbase="'+b+'" />');"undefined"==document.body||null==document.body?(document.write(d),document.location=b):(a=document.createElement("div"),a.id="div1",a.style.position="relative",a.style.left="-10000px",a.style.margin="0px auto",a.className="dynamicDiv",a.innerHTML=d,document.body.appendChild(a))},createWebStartLaunchButtonEx:function(a,b){null==this.returnPage&&(this.returnPage=a);document.write('<a href="'+("javascript:deployJava.launchWebStartApplication('"+a+"');")+'" onMouseOver="window.status=\'\'; return true;"><img src="'+this.launchButtonPNG+'" border="0" /></a>')},createWebStartLaunchButton:function(a,b){null==this.returnPage&&(this.returnPage=a);document.write('<a href="'+("javascript:if (!deployJava.isWebStartInstalled(&quot;"+b+"&quot;)) {if (deployJava.installLatestJRE()) {if (deployJava.launch(&quot;"+a+"&quot;)) {}}} else {if (deployJava.launch(&quot;"+a+"&quot;)) {}}")+'" onMouseOver="window.status=\'\'; return true;"><img src="'+this.launchButtonPNG+'" border="0" /></a>')},launch:function(a){document.location=a;return!0},isPluginInstalled:function(){var a=this.getPlugin();return a&&a.jvms?!0:!1},isAutoUpdateEnabled:function(){return this.isPluginInstalled()?this.getPlugin().isAutoUpdateEnabled():!1},setAutoUpdateEnabled:function(){return this.isPluginInstalled()?this.getPlugin().setAutoUpdateEnabled():!1},setInstallerType:function(a){this.installType=a;return this.isPluginInstalled()?this.getPlugin().setInstallerType(a):!1},setAdditionalPackages:function(a){return this.isPluginInstalled()?this.getPlugin().setAdditionalPackages(a):!1},setEarlyAccess:function(a){this.EAInstallEnabled=a},isPlugin2:function(){if(this.isPluginInstalled()&&this.versionCheck("1.6.0_10+"))try{return this.getPlugin().isPlugin2()}catch(a){}return!1},allowPlugin:function(){this.getBrowser();return"Safari"!=this.browserName2&&"Opera"!=this.browserName2},getPlugin:function(){this.refresh();var a=null;this.allowPlugin()&&(a=document.getElementById("deployJavaPlugin"));return a},compareVersionToPattern:function(a,b,c,d){if(void 0==a||void 0==b)return!1;var h=a.match("^(\\d+)(?:\\.(\\d+)(?:\\.(\\d+)(?:_(\\d+))?)?)?$");if(null!=h){var f=0;a=[];for(var m=1;m<h.length;++m)"string"==typeof h[m]&&""!=h[m]&&(a[f]=h[m],f++);h=Math.min(a.length,b.length);if(d){for(m=0;m<h;++m){if(a[m]<b[m])return!1;if(a[m]>b[m])break}return!0}for(m=0;m<h;++m)if(a[m]!=b[m])return!1;return c?!0:a.length==b.length}return!1},getBrowser:function(){if(null==this.browserName){var a=navigator.userAgent.toLowerCase();f("[getBrowser()] navigator.userAgent.toLowerCase() -> "+a);-1!=a.indexOf("msie")&&-1==a.indexOf("opera")?this.browserName2=this.browserName="MSIE":-1!=a.indexOf("iphone")?(this.browserName="Netscape Family",this.browserName2="iPhone"):-1!=a.indexOf("firefox")&&-1==a.indexOf("opera")?(this.browserName="Netscape Family",this.browserName2="Firefox"):-1!=a.indexOf("chrome")?(this.browserName="Netscape Family",this.browserName2="Chrome"):-1!=a.indexOf("safari")?(this.browserName="Netscape Family",this.browserName2="Safari"):-1!=a.indexOf("mozilla")&&-1==a.indexOf("opera")?(this.browserName="Netscape Family",this.browserName2="Other"):-1!=a.indexOf("opera")?(this.browserName="Netscape Family",this.browserName2="Opera"):(this.browserName="?",this.browserName2="unknown");f("[getBrowser()] Detected browser name:"+this.browserName+", "+this.browserName2)}return this.browserName},testUsingActiveX:function(a){a="JavaWebStart.isInstalled."+a+".0";if("undefined"==typeof ActiveXObject||!ActiveXObject)return f("[testUsingActiveX()] Browser claims to be IE, but no ActiveXObject object?"),!1;try{return null!=new ActiveXObject(a)}catch(b){return!1}},testForMSVM:function(){if("undefined"!=typeof oClientCaps){var a=oClientCaps.getComponentVersion("{08B0E5C0-4FCB-11CF-AAA5-00401C608500}","ComponentID");return""==a||"5,0,5000,0"==a?!1:!0}return!1},testUsingMimeTypes:function(a){if(!navigator.mimeTypes)return f("[testUsingMimeTypes()] Browser claims to be Netscape family, but no mimeTypes[] array?"),!1;for(var b=0;b<navigator.mimeTypes.length;++b){s=navigator.mimeTypes[b].type;var c=s.match(/^application\/x-java-applet\x3Bversion=(1\.8|1\.7|1\.6|1\.5|1\.4\.2)$/);if(null!=c&&this.compareVersions(c[1],a))return!0}return!1},testUsingPluginsArray:function(a){if(!navigator.plugins||!navigator.plugins.length)return!1;for(var b=navigator.platform.toLowerCase(),c=0;c<navigator.plugins.length;++c)if(s=navigator.plugins[c].description,-1!=s.search(/^Java Switchable Plug-in (Cocoa)/)){if(this.compareVersions("1.5.0",a))return!0}else if(-1!=s.search(/^Java/)&&-1!=b.indexOf("win")&&(this.compareVersions("1.5.0",a)||this.compareVersions("1.6.0",a)))return!0;return this.compareVersions("1.5.0",a)?!0:!1},IEInstall:function(){location.href=d((null!=this.returnPage?"&returnPage="+this.returnPage:"")+(null!=this.locale?"&locale="+this.locale:"")+(null!=this.brand?"&brand="+this.brand:""));return!1},done:function(a,b){},FFInstall:function(){location.href=d((null!=this.returnPage?"&returnPage="+this.returnPage:"")+(null!=this.locale?"&locale="+this.locale:"")+(null!=this.brand?"&brand="+this.brand:"")+(null!=this.installType?"&type="+this.installType:""));return!1},compareVersions:function(a,b){for(var c=a.split("."),d=b.split("."),h=0;h<c.length;++h)c[h]=Number(c[h]);for(h=0;h<d.length;++h)d[h]=Number(d[h]);2==c.length&&(c[2]=0);return c[0]>d[0]?!0:c[0]<d[0]?!1:c[1]>d[1]?!0:c[1]<d[1]?!1:c[2]>d[2]?!0:c[2]<d[2]?!1:!0},enableAlerts:function(){this.browserName=null;this.debug=!0},poll:function(){this.refresh();var a=this.getJREs();0==this.preInstallJREList.length&&0!=a.length&&(clearInterval(this.myInterval),null!=this.returnPage&&(location.href=this.returnPage));0!=this.preInstallJREList.length&&0!=a.length&&this.preInstallJREList[0]!=a[0]&&(clearInterval(this.myInterval),null!=this.returnPage&&(location.href=this.returnPage))},writePluginTag:function(){var a=this.getBrowser();"MSIE"==a?document.write('<object classid="clsid:CAFEEFAC-DEC7-0000-0001-ABCDEFFEDCBA" id="deployJavaPlugin" width="0" height="0"></object>'):"Netscape Family"==a&&this.allowPlugin()&&this.writeEmbedTag()},refresh:function(){navigator.plugins.refresh(!1);"Netscape Family"==this.getBrowser()&&this.allowPlugin()&&null==document.getElementById("deployJavaPlugin")&&this.writeEmbedTag()},writeEmbedTag:function(){var a=!1;if(null!=navigator.mimeTypes){for(var b=0;b<navigator.mimeTypes.length;b++)navigator.mimeTypes[b].type==this.mimeType&&navigator.mimeTypes[b].enabledPlugin&&(document.write('<embed id="deployJavaPlugin" type="'+this.mimeType+'" hidden="true" />'),a=!0);if(!a)for(b=0;b<navigator.mimeTypes.length;b++)navigator.mimeTypes[b].type==this.oldMimeType&&navigator.mimeTypes[b].enabledPlugin&&document.write('<embed id="deployJavaPlugin" type="'+this.oldMimeType+'" hidden="true" />')}}};c.writePluginTag();if(null==c.locale){e=null;if(null==e)try{e=navigator.userLanguage}catch(a){}if(null==e)try{e=navigator.systemLanguage}catch(a){}if(null==e)try{e=navigator.language}catch(a){}null!=e&&(e.replace("-","_"),c.locale=e)}return c}();var Detector=function(){var f=["monospace","sans-serif","serif"],d=document.getElementsByTagName("body")[0],e=document.createElement("span");e.style.fontSize="72px";e.innerHTML="mmmmmmmmmmlli";var p={},b={},c;for(c in f)e.style.fontFamily=f[c],d.appendChild(e),p[f[c]]=e.offsetWidth,b[f[c]]=e.offsetHeight,d.removeChild(e);this.detect=function(a){var c=!1,n;for(n in f){e.style.fontFamily=a+","+f[n];d.appendChild(e);var v=e.offsetWidth!=p[f[n]]||e.offsetHeight!=b[f[n]];d.removeChild(e);c=c||v}return c}};function murmurhash3_32_gc(f,d){var e,p,b,c,a;e=f.length&3;p=f.length-e;b=d;for(a=0;a<p;)c=f.charCodeAt(a)&255|(f.charCodeAt(++a)&255)<<8|(f.charCodeAt(++a)&255)<<16|(f.charCodeAt(++a)&255)<<24,++a,c=3432918353*(c&65535)+((3432918353*(c>>>16)&65535)<<16)&4294967295,c=c<<15|c>>>17,c=461845907*(c&65535)+((461845907*(c>>>16)&65535)<<16)&4294967295,b^=c,b=b<<13|b>>>19,b=5*(b&65535)+((5*(b>>>16)&65535)<<16)&4294967295,b=(b&65535)+27492+(((b>>>16)+58964&65535)<<16);c=0;switch(e){case 3:c^=(f.charCodeAt(a+2)&255)<<16;case 2:c^=(f.charCodeAt(a+1)&255)<<8;case 1:c^=f.charCodeAt(a)&255,c=3432918353*(c&65535)+((3432918353*(c>>>16)&65535)<<16)&4294967295,c=c<<15|c>>>17,b^=461845907*(c&65535)+((461845907*(c>>>16)&65535)<<16)&4294967295}b^=f.length;b^=b>>>16;b=2246822507*(b&65535)+((2246822507*(b>>>16)&65535)<<16)&4294967295;b^=b>>>13;b=3266489909*(b&65535)+((3266489909*(b>>>16)&65535)<<16)&4294967295;return(b^b>>>16)>>>0}var swfobject=function(){function f(){if(!y){try{var a=l.getElementsByTagName("body")[0].appendChild(l.createElement("span"));a.parentNode.removeChild(a)}catch(b){return}y=!0;for(var a=F.length,c=0;c<a;c++)F[c]()}}function d(a){y?a():F[F.length]=a}function e(a){if("undefined"!=typeof r.addEventListener)r.addEventListener("load",a,!1);else if("undefined"!=typeof l.addEventListener)l.addEventListener("load",a,!1);else if("undefined"!=typeof r.attachEvent)B(r,"onload",a);else if("function"==typeof r.onload){var b=r.onload;r.onload=function(){b();a()}}else r.onload=a}function p(){var a=l.getElementsByTagName("body")[0],c=l.createElement("object");c.setAttribute("type","application/x-shockwave-flash");var d=a.appendChild(c);if(d){var g=0;(function(){if("undefined"!=typeof d.GetVariable){var h=d.GetVariable("$version");h&&(h=h.split(" ")[1].split(","),k.pv=[parseInt(h[0],10),parseInt(h[1],10),parseInt(h[2],10)])}else if(10>g){g++;setTimeout(arguments.callee,10);return}a.removeChild(c);d=null;b()})()}else b()}function b(){var b=x.length;if(0<b)for(var z=0;z<b;z++){var d=x[z].id,h=x[z].callbackFn,f={success:!1,id:d};if(0<k.pv[0]){var e=m(d);if(e)if(!C(x[z].swfVersion)||k.wk&&312>k.wk)if(x[z].expressInstall&&a()){f={};f.data=x[z].expressInstall;f.width=e.getAttribute("width")||"0";f.height=e.getAttribute("height")||"0";e.getAttribute("class")&&(f.styleclass=e.getAttribute("class"));e.getAttribute("align")&&(f.align=e.getAttribute("align"));for(var l={},e=e.getElementsByTagName("param"),q=e.length,u=0;u<q;u++)"movie"!=e[u].getAttribute("name").toLowerCase()&&(l[e[u].getAttribute("name")]=e[u].getAttribute("value"));g(f,l,d,h)}else n(e),h&&h(f);else A(d,!0),h&&(f.success=!0,f.ref=c(d),h(f))}else A(d,!0),h&&((d=c(d))&&"undefined"!=typeof d.SetVariable&&(f.success=!0,f.ref=d),h(f))}}function c(a){var b=null;(a=m(a))&&"OBJECT"==a.nodeName&&("undefined"!=typeof a.SetVariable?b=a:(a=a.getElementsByTagName("object")[0])&&(b=a));return b}function a(){return!G&&C("6.0.65")&&(k.win||k.mac)&&!(k.wk&&312>k.wk)}function g(a,b,c,d){G=!0;J=d||null;L={success:!1,id:c};var g=m(c);if(g){"OBJECT"==g.nodeName?(E=v(g),H=null):(E=g,H=c);a.id="SWFObjectExprInst";if("undefined"==typeof a.width||!/%$/.test(a.width)&&310>parseInt(a.width,10))a.width="310";if("undefined"==typeof a.height||!/%$/.test(a.height)&&137>parseInt(a.height,10))a.height="137";l.title=l.title.slice(0,47)+" - Flash Player Installation";d=k.ie&&k.win?"ActiveX":"PlugIn";d="MMredirectURL="+r.location.toString().replace(/&/g,"%26")+"&MMplayerType="+d+"&MMdoctitle="+l.title;b.flashvars="undefined"!=typeof b.flashvars?b.flashvars+("&"+d):d;k.ie&&k.win&&4!=g.readyState&&(d=l.createElement("div"),c+="SWFObjectNew",d.setAttribute("id",c),g.parentNode.insertBefore(d,g),g.style.display="none",function(){4==g.readyState?g.parentNode.removeChild(g):setTimeout(arguments.callee,10)}());h(a,b,c)}}function n(a){if(k.ie&&k.win&&4!=a.readyState){var b=l.createElement("div");a.parentNode.insertBefore(b,a);b.parentNode.replaceChild(v(a),b);a.style.display="none";(function(){4==a.readyState?a.parentNode.removeChild(a):setTimeout(arguments.callee,10)})()}else a.parentNode.replaceChild(v(a),a)}function v(a){var b=l.createElement("div");if(k.win&&k.ie)b.innerHTML=a.innerHTML;else if(a=a.getElementsByTagName("object")[0])if(a=a.childNodes)for(var c=a.length,d=0;d<c;d++)1==a[d].nodeType&&"PARAM"==a[d].nodeName||8==a[d].nodeType||b.appendChild(a[d].cloneNode(!0));return b}function h(a,b,c){var d,g=m(c);if(k.wk&&312>k.wk)return d;if(g)if("undefined"==typeof a.id&&(a.id=c),k.ie&&k.win){var h="",f;for(f in a)a[f]!=Object.prototype[f]&&("data"==f.toLowerCase()?b.movie=a[f]:"styleclass"==f.toLowerCase()?h+=' class="'+a[f]+'"':"classid"!=f.toLowerCase()&&(h+=" "+f+'="'+a[f]+'"'));f="";for(var e in b)b[e]!=Object.prototype[e]&&(f+='<param name="'+e+'" value="'+b[e]+'" />');g.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+h+">"+f+"</object>";I[I.length]=a.id;d=m(a.id)}else{e=l.createElement("object");e.setAttribute("type","application/x-shockwave-flash");for(var q in a)a[q]!=Object.prototype[q]&&("styleclass"==q.toLowerCase()?e.setAttribute("class",a[q]):"classid"!=q.toLowerCase()&&e.setAttribute(q,a[q]));for(h in b)b[h]!=Object.prototype[h]&&"movie"!=h.toLowerCase()&&(a=e,f=h,q=b[h],c=l.createElement("param"),c.setAttribute("name",f),c.setAttribute("value",q),a.appendChild(c));g.parentNode.replaceChild(e,g);d=e}return d}function u(a){var b=m(a);b&&"OBJECT"==b.nodeName&&(k.ie&&k.win?(b.style.display="none",function(){if(4==b.readyState){var c=m(a);if(c){for(var d in c)"function"==typeof c[d]&&(c[d]=null);c.parentNode.removeChild(c)}}else setTimeout(arguments.callee,10)}()):b.parentNode.removeChild(b))}function m(a){var b=null;try{b=l.getElementById(a)}catch(c){}return b}function B(a,b,c){a.attachEvent(b,c);D[D.length]=[a,b,c]}function C(a){var b=k.pv;a=a.split(".");a[0]=parseInt(a[0],10);a[1]=parseInt(a[1],10)||0;a[2]=parseInt(a[2],10)||0;return b[0]>a[0]||b[0]==a[0]&&b[1]>a[1]||b[0]==a[0]&&b[1]==a[1]&&b[2]>=a[2]?!0:!1}function q(a,b,c,d){if(!k.ie||!k.mac){var h=l.getElementsByTagName("head")[0];h&&(c=c&&"string"==typeof c?c:"screen",d&&(K=w=null),w&&K==c||(d=l.createElement("style"),d.setAttribute("type","text/css"),d.setAttribute("media",c),w=h.appendChild(d),k.ie&&k.win&&"undefined"!=typeof l.styleSheets&&0<l.styleSheets.length&&(w=l.styleSheets[l.styleSheets.length-1]),K=c),k.ie&&k.win?w&&"object"==typeof w.addRule&&w.addRule(a,b):w&&"undefined"!=typeof l.createTextNode&&w.appendChild(l.createTextNode(a+" {"+b+"}")))}}function A(a,b){if(M){var c=b?"visible":"hidden";y&&m(a)?m(a).style.visibility=c:q("#"+a,"visibility:"+c)}}function N(a){return null!=/[\\\"<>\.;]/.exec(a)&&"undefined"!=typeof encodeURIComponent?encodeURIComponent(a):a}var r=window,l=document,t=navigator,O=!1,F=[function(){O?p():b()}],x=[],I=[],D=[],E,H,J,L,y=!1,G=!1,w,K,M=!0,k=function(){var a="undefined"!=typeof l.getElementById&&"undefined"!=typeof l.getElementsByTagName&&"undefined"!=typeof l.createElement,b=t.userAgent.toLowerCase(),c=t.platform.toLowerCase(),d=c?/win/.test(c):/win/.test(b),c=c?/mac/.test(c):/mac/.test(b),b=/webkit/.test(b)?parseFloat(b.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):!1,h=!+"\v1",g=[0,0,0],f=null;if("undefined"!=typeof t.plugins&&"object"==typeof t.plugins["Shockwave Flash"])!(f=t.plugins["Shockwave Flash"].description)||"undefined"!=typeof t.mimeTypes&&t.mimeTypes["application/x-shockwave-flash"]&&!t.mimeTypes["application/x-shockwave-flash"].enabledPlugin||(O=!0,h=!1,f=f.replace(/^.*\s+(\S+\s+\S+$)/,"$1"),g[0]=parseInt(f.replace(/^(.*)\..*$/,"$1"),10),g[1]=parseInt(f.replace(/^.*\.(.*)\s.*$/,"$1"),10),g[2]=/[a-zA-Z]/.test(f)?parseInt(f.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0);else if("undefined"!=typeof r.ActiveXObject)try{var e=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");e&&(f=e.GetVariable("$version"))&&(h=!0,f=f.split(" ")[1].split(","),g=[parseInt(f[0],10),parseInt(f[1],10),parseInt(f[2],10)])}catch(m){}return{w3:a,pv:g,wk:b,ie:h,win:d,mac:c}}();(function(){k.w3&&(("undefined"!=typeof l.readyState&&"complete"==l.readyState||"undefined"==typeof l.readyState&&(l.getElementsByTagName("body")[0]||l.body))&&f(),y||("undefined"!=typeof l.addEventListener&&l.addEventListener("DOMContentLoaded",f,!1),k.ie&&k.win&&(l.attachEvent("onreadystatechange",function(){"complete"==l.readyState&&(l.detachEvent("onreadystatechange",arguments.callee),f())}),r==top&&function(){if(!y){try{l.documentElement.doScroll("left")}catch(a){setTimeout(arguments.callee,0);return}f()}}()),k.wk&&function(){y||(/loaded|complete/.test(l.readyState)?f():setTimeout(arguments.callee,0))}(),e(f)))})();(function(){k.ie&&k.win&&window.attachEvent("onunload",function(){for(var a=D.length,b=0;b<a;b++)D[b][0].detachEvent(D[b][1],D[b][2]);a=I.length;for(b=0;b<a;b++)u(I[b]);for(var c in k)k[c]=null;k=null;for(var d in swfobject)swfobject[d]=null;swfobject=null})})();return{registerObject:function(a,b,c,d){if(k.w3&&a&&b){var h={};h.id=a;h.swfVersion=b;h.expressInstall=c;h.callbackFn=d;x[x.length]=h;A(a,!1)}else d&&d({success:!1,id:a})},getObjectById:function(a){if(k.w3)return c(a)},embedSWF:function(b,c,f,e,m,q,l,u,p,r){var n={success:!1,id:c};k.w3&&!(k.wk&&312>k.wk)&&b&&c&&f&&e&&m?(A(c,!1),d(function(){f+="";e+="";var d={};if(p&&"object"===typeof p)for(var k in p)d[k]=p[k];d.data=b;d.width=f;d.height=e;k={};if(u&&"object"===typeof u)for(var B in u)k[B]=u[B];if(l&&"object"===typeof l)for(var t in l)k.flashvars="undefined"!=typeof k.flashvars?k.flashvars+("&"+t+"="+l[t]):t+"="+l[t];if(C(m))B=h(d,k,c),d.id==c&&A(c,!0),n.success=!0,n.ref=B;else{if(q&&a()){d.data=q;g(d,k,c,r);return}A(c,!0)}r&&r(n)})):r&&r(n)},switchOffAutoHideShow:function(){M=!1},ua:k,getFlashPlayerVersion:function(){return{major:k.pv[0],minor:k.pv[1],release:k.pv[2]}},hasFlashPlayerVersion:C,createSWF:function(a,b,c){if(k.w3)return h(a,b,c)},showExpressInstall:function(b,c,d,h){k.w3&&a()&&g(b,c,d,h)},removeSWF:function(a){k.w3&&u(a)},createCSS:function(a,b,c,d){k.w3&&q(a,b,c,d)},addDomLoadEvent:d,addLoadEvent:e,getQueryParamValue:function(a){var b=l.location.search||l.location.hash;if(b){/\?/.test(b)&&(b=b.split("?")[1]);if(null==a)return N(b);for(var b=b.split("&"),c=0;c<b.length;c++)if(b[c].substring(0,b[c].indexOf("="))==a)return N(b[c].substring(b[c].indexOf("=")+1))}return""},expressInstallCallback:function(){if(G){var a=m("SWFObjectExprInst");a&&E&&(a.parentNode.replaceChild(E,a),H&&(A(H,!0),k.ie&&k.win&&(E.style.display="block")),J&&J(L));G=!1}}}}();(function(f,d){var e={extend:function(a,b){for(var c in b)-1!=="browser cpu device engine os".indexOf(c)&&0===b[c].length%2&&(a[c]=b[c].concat(a[c]));return a},has:function(a,b){return"string"===typeof a?-1!==b.toLowerCase().indexOf(a.toLowerCase()):!1},lowerize:function(a){return a.toLowerCase()},major:function(a){return"string"===typeof a?a.split(".")[0]:d}},p=function(){for(var a,b=0,c,f,g,e,p,n,r=arguments;b<r.length&&!p;){var l=r[b],t=r[b+1];if("undefined"===typeof a)for(g in a={},t)t.hasOwnProperty(g)&&(e=t[g],"object"===typeof e?a[e[0]]=d:a[e]=d);for(c=f=0;c<l.length&&!p;)if(p=l[c++].exec(this.getUA()))for(g=0;g<t.length;g++)n=p[++f],e=t[g],"object"===typeof e&&0<e.length?2==e.length?a[e[0]]="function"==typeof e[1]?e[1].call(this,n):e[1]:3==e.length?a[e[0]]="function"!==typeof e[1]||e[1].exec&&e[1].test?n?n.replace(e[1],e[2]):d:n?e[1].call(this,n,e[2]):d:4==e.length&&(a[e[0]]=n?e[3].call(this,n.replace(e[1],e[2])):d):a[e]=n?n:d;b+=2}return a},b=function(a,b){for(var c in b)if("object"===typeof b[c]&&0<b[c].length)for(var f=0;f<b[c].length;f++){if(e.has(b[c][f],a))return"?"===c?d:c}else if(e.has(b[c],a))return"?"===c?d:c;return a},c={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},a={browser:[[/(opera\smini)\/([\w\.-]+)/i,/(opera\s[mobiletab]+).+version\/([\w\.-]+)/i,/(opera).+version\/([\w\.]+)/i,/(opera)[\/\s]+([\w\.]+)/i],["name","version"],[/\s(opr)\/([\w\.]+)/i],[["name","Opera"],"version"],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]+)*/i,/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?([\w\.]*)/i,/(?:ms|\()(ie)\s([\w\.]+)/i,/(rekonq)\/([\w\.]+)*/i,/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs)\/([\w\.-]+)/i],["name","version"],[/(trident).+rv[:\s]([\w\.]+).+like\sgecko/i],[["name","IE"],"version"],[/(edge)\/((\d+)?[\w\.]+)/i],["name","version"],[/(yabrowser)\/([\w\.]+)/i],[["name","Yandex"],"version"],[/(comodo_dragon)\/([\w\.]+)/i],[["name",/_/g," "],"version"],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i,/(qqbrowser)[\/\s]?([\w\.]+)/i],["name","version"],[/(uc\s?browser)[\/\s]?([\w\.]+)/i,/ucweb.+(ucbrowser)[\/\s]?([\w\.]+)/i,/JUC.+(ucweb)[\/\s]?([\w\.]+)/i],[["name","UCBrowser"],"version"],[/(dolfin)\/([\w\.]+)/i],[["name","Dolphin"],"version"],[/((?:android.+)crmo|crios)\/([\w\.]+)/i],[["name","Chrome"],"version"],[/XiaoMi\/MiuiBrowser\/([\w\.]+)/i],["version",["name","MIUI Browser"]],[/android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)/i],["version",["name","Android Browser"]],[/FBAV\/([\w\.]+);/i],["version",["name","Facebook"]],[/fxios\/([\w\.-]+)/i],["version",["name","Firefox"]],[/version\/([\w\.]+).+?mobile\/\w+\s(safari)/i],["version",["name","Mobile Safari"]],[/version\/([\w\.]+).+?(mobile\s?safari|safari)/i],["version","name"],[/webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i],["name",["version",b,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(konqueror)\/([\w\.]+)/i,/(webkit|khtml)\/([\w\.]+)/i],["name","version"],[/(navigator|netscape)\/([\w\.-]+)/i],[["name","Netscape"],"version"],[/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/([\w\.-]+)/i,/(mozilla)\/([\w\.]+).+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir)[\/\s]?([\w\.]+)/i,/(links)\s\(([\w\.]+)/i,/(gobrowser)\/?([\w\.]+)*/i,/(ice\s?browser)\/v?([\w\._]+)/i,/(mosaic)[\/\s]([\w\.]+)/i],["name","version"]],cpu:[[/(?:(amd|x(?:(?:86|64)[_-])?|wow|win)64)[;\)]/i],[["architecture","amd64"]],[/(ia32(?=;))/i],[["architecture",e.lowerize]],[/((?:i[346]|x)86)[;\)]/i],[["architecture","ia32"]],[/windows\s(ce|mobile);\sppc;/i],[["architecture","arm"]],[/((?:ppc|powerpc)(?:64)?)(?:\smac|;|\))/i],[["architecture",/ower/,"",e.lowerize]],[/(sun4\w)[;\)]/i],[["architecture","sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|arm(?:64|(?=v\d+;))|(?=atmel\s)avr|(?:irix|mips|sparc)(?:64)?(?=;)|pa-risc)/i],[["architecture",e.lowerize]]],device:[[/\((ipad|playbook);[\w\s\);-]+(rim|apple)/i],["model","vendor",["type","tablet"]],[/applecoremedia\/[\w\.]+ \((ipad)/],["model",["vendor","Apple"],["type","tablet"]],[/(apple\s{0,1}tv)/i],[["model","Apple TV"],["vendor","Apple"]],[/(archos)\s(gamepad2?)/i,/(hp).+(touchpad)/i,/(kindle)\/([\w\.]+)/i,/\s(nook)[\w\s]+build\/(\w+)/i,/(dell)\s(strea[kpr\s\d]*[\dko])/i],["vendor","model",["type","tablet"]],[/(kf[A-z]+)\sbuild\/[\w\.]+.*silk\//i],["model",["vendor","Amazon"],["type","tablet"]],[/(sd|kf)[0349hijorstuw]+\sbuild\/[\w\.]+.*silk\//i],[["model",b,{"Fire Phone":["SD","KF"]}],["vendor","Amazon"],["type","mobile"]],[/\((ip[honed|\s\w*]+);.+(apple)/i],["model","vendor",["type","mobile"]],[/\((ip[honed|\s\w*]+);/i],["model",["vendor","Apple"],["type","mobile"]],[/(blackberry)[\s-]?(\w+)/i,/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|huawei|meizu|motorola|polytron)[\s_-]?([\w-]+)*/i,/(hp)\s([\w\s]+\w)/i,/(asus)-?(\w+)/i],["vendor","model",["type","mobile"]],[/\(bb10;\s(\w+)/i],["model",["vendor","BlackBerry"],["type","mobile"]],[/android.+(transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus 7)/i],["model",["vendor","Asus"],["type","tablet"]],[/(sony)\s(tablet\s[ps])\sbuild\//i,/(sony)?(?:sgp.+)\sbuild\//i],[["vendor","Sony"],["model","Xperia Tablet"],["type","tablet"]],[/(?:sony)?(?:(?:(?:c|d)\d{4})|(?:so[-l].+))\sbuild\//i],[["vendor","Sony"],["model","Xperia Phone"],["type","mobile"]],[/\s(ouya)\s/i,/(nintendo)\s([wids3u]+)/i],["vendor","model",["type","console"]],[/android.+;\s(shield)\sbuild/i],["model",["vendor","Nvidia"],["type","console"]],[/(playstation\s[34portablevi]+)/i],["model",["vendor","Sony"],["type","console"]],[/(sprint\s(\w+))/i],[["vendor",b,{HTC:"APA",Sprint:"Sprint"}],["model",b,{"Evo Shift 4G":"7373KT"}],["type","mobile"]],[/(lenovo)\s?(S(?:5000|6000)+(?:[-][\w+]))/i],["vendor","model",["type","tablet"]],[/(htc)[;_\s-]+([\w\s]+(?=\))|\w+)*/i,/(zte)-(\w+)*/i,/(alcatel|geeksphone|huawei|lenovo|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]+)*/i],["vendor",["model",/_/g," "],["type","mobile"]],[/(nexus\s9)/i],["model",["vendor","HTC"],["type","tablet"]],[/[\s\(;](xbox(?:\sone)?)[\s\);]/i],["model",["vendor","Microsoft"],["type","console"]],[/(kin\.[onetw]{3})/i],[["model",/\./g," "],["vendor","Microsoft"],["type","mobile"]],[/\s(milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?(:?\s4g)?)[\w\s]+build\//i,/mot[\s-]?(\w+)*/i,/(XT\d{3,4}) build\//i,/(nexus\s[6])/i],["model",["vendor","Motorola"],["type","mobile"]],[/android.+\s(mz60\d|xoom[\s2]{0,2})\sbuild\//i],["model",["vendor","Motorola"],["type","tablet"]],[/android.+((sch-i[89]0\d|shw-m380s|gt-p\d{4}|gt-n8000|sgh-t8[56]9|nexus 10))/i,/((SM-T\w+))/i],[["vendor","Samsung"],"model",["type","tablet"]],[/((s[cgp]h-\w+|gt-\w+|galaxy\snexus|sm-n900))/i,/(sam[sung]*)[\s-]*(\w+-?[\w-]*)*/i,/sec-((sgh\w+))/i],[["vendor","Samsung"],"model",["type","mobile"]],[/(samsung);smarttv/i],["vendor","model",["type","smarttv"]],[/\(dtv[\);].+(aquos)/i],["model",["vendor","Sharp"],["type","smarttv"]],[/sie-(\w+)*/i],["model",["vendor","Siemens"],["type","mobile"]],[/(maemo|nokia).*(n900|lumia\s\d+)/i,/(nokia)[\s_-]?([\w-]+)*/i],[["vendor","Nokia"],"model",["type","mobile"]],[/android\s3\.[\s\w;-]{10}(a\d{3})/i],["model",["vendor","Acer"],["type","tablet"]],[/android\s3\.[\s\w;-]{10}(lg?)-([06cv9]{3,4})/i],[["vendor","LG"],"model",["type","tablet"]],[/(lg) netcast\.tv/i],["vendor","model",["type","smarttv"]],[/(nexus\s[45])/i,/lg[e;\s\/-]+(\w+)*/i],["model",["vendor","LG"],["type","mobile"]],[/android.+(ideatab[a-z0-9\-\s]+)/i],["model",["vendor","Lenovo"],["type","tablet"]],[/linux;.+((jolla));/i],["vendor","model",["type","mobile"]],[/((pebble))app\/[\d\.]+\s/i],["vendor","model",["type","wearable"]],[/android.+;\s(glass)\s\d/i],["model",["vendor","Google"],["type","wearable"]],[/android.+(\w+)\s+build\/hm\1/i,/android.+(hm[\s\-_]*note?[\s_]*(?:\d\w)?)\s+build/i,/android.+(mi[\s\-_]*(?:one|one[\s_]plus)?[\s_]*(?:\d\w)?)\s+build/i],[["model",/_/g," "],["vendor","Xiaomi"],["type","mobile"]],[/\s(tablet)[;\/\s]/i,/\s(mobile)[;\/\s]/i],[["type",e.lowerize],"vendor","model"]],engine:[[/windows.+\sedge\/([\w\.]+)/i],["version",["name","EdgeHTML"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i,/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,/(icab)[\/\s]([23]\.[\d\.]+)/i],["name","version"],[/rv\:([\w\.]+).*(gecko)/i],["version","name"]],os:[[/microsoft\s(windows)\s(vista|xp)/i],["name","version"],[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone(?:\sos)*|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i],["name",["version",b,c]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[["name","Windows"],["version",b,c]],[/\((bb)(10);/i],[["name","BlackBerry"],"version"],[/(blackberry)\w*\/?([\w\.]+)*/i,/(tizen)[\/\s]([\w\.]+)/i,/(android|webos|palm\sos|qnx|bada|rim\stablet\sos|meego|contiki)[\/\s-]?([\w\.]+)*/i,/linux;.+(sailfish);/i],["name","version"],[/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i],[["name","Symbian"],"version"],[/\((series40);/i],["name"],[/mozilla.+\(mobile;.+gecko.+firefox/i],[["name","Firefox OS"],"version"],[/(nintendo|playstation)\s([wids34portablevu]+)/i,/(mint)[\/\s\(]?(\w+)*/i,/(mageia|vectorlinux)[;\s]/i,/(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|(?=\s)arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?([\w\.-]+)*/i,/(hurd|linux)\s?([\w\.]+)*/i,/(gnu)\s?([\w\.]+)*/i],["name","version"],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[["name","Chromium OS"],"version"],[/(sunos)\s?([\w\.]+\d)*/i],[["name","Solaris"],"version"],[/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i],["name","version"],[/(ip[honead]+)(?:.*os\s([\w]+)*\slike\smac|;\sopera)/i],[["name","iOS"],["version",/_/g,"."]],[/(mac\sos\sx)\s?([\w\s\.]+\w)*/i,/(macintosh|mac(?=_powerpc)\s)/i],[["name","Mac OS"],["version",/_/g,"."]],[/((?:open)?solaris)[\/\s-]?([\w\.]+)*/i,/(haiku)\s(\w+)/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i,/(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i,/(unix)\s?([\w\.]+)*/i],["name","version"]]},g=function(b,c){if(!(this instanceof g))return new g(b,c).getResult();var d=b||(f&&f.navigator&&f.navigator.userAgent?f.navigator.userAgent:""),n=c?e.extend(a,c):a;this.getBrowser=function(){var a=p.apply(this,n.browser);a.major=e.major(a.version);return a};this.getCPU=function(){return p.apply(this,n.cpu)};this.getDevice=function(){return p.apply(this,n.device)};this.getEngine=function(){return p.apply(this,n.engine)};this.getOS=function(){return p.apply(this,n.os)};this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}};this.getUA=function(){return d};this.setUA=function(a){d=a;return this};this.setUA(d);return this};g.VERSION="0.7.10";g.BROWSER={NAME:"name",MAJOR:"major",VERSION:"version"};g.CPU={ARCHITECTURE:"architecture"};g.DEVICE={MODEL:"model",VENDOR:"vendor",TYPE:"type",CONSOLE:"console",MOBILE:"mobile",SMARTTV:"smarttv",TABLET:"tablet",WEARABLE:"wearable",EMBEDDED:"embedded"};g.ENGINE={NAME:"name",VERSION:"version"};g.OS={NAME:"name",VERSION:"version"};"undefined"!==typeof exports?("undefined"!==typeof module&&module.exports&&(exports=module.exports=g),exports.UAParser=g):"function"===typeof define&&define.amd?define(function(){return g}):f.UAParser=g;var n=f.jQuery||f.Zepto;if("undefined"!==typeof n){var v=new g;n.ua=v.getResult();n.ua.get=function(){return v.getUA()};n.ua.set=function(a){v.setUA(a);a=v.getResult();for(var b in a)n.ua[b]=a[b]}}})("object"===typeof window?window:this);!function(e,t){"use strict";"undefined"!=typeof window&&"function"==typeof define&&define.amd?define(t):"undefined"!=typeof module&&module.exports?module.exports=t():e.exports?e.exports=t():e.Fingerprint2=t()}(this,function(){"use strict";void 0===Array.isArray&&(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)});function d(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]+t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]+t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]+t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]+t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]}function f(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]*t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]*t[3],n[1]+=n[2]>>>16,n[2]&=65535,n[2]+=e[3]*t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]*t[3],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[2]*t[2],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[3]*t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]*t[3]+e[1]*t[2]+e[2]*t[1]+e[3]*t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]}function g(e,t){return 32===(t%=64)?[e[1],e[0]]:t<32?[e[0]<<t|e[1]>>>32-t,e[1]<<t|e[0]>>>32-t]:(t-=32,[e[1]<<t|e[0]>>>32-t,e[0]<<t|e[1]>>>32-t])}function h(e,t){return 0===(t%=64)?e:t<32?[e[0]<<t|e[1]>>>32-t,e[1]<<t]:[e[1]<<t-32,0]}function m(e,t){return[e[0]^t[0],e[1]^t[1]]}function p(e){return e=m(e,[0,e[0]>>>1]),e=f(e,[4283543511,3981806797]),e=m(e,[0,e[0]>>>1]),e=f(e,[3301882366,444984403]),e=m(e,[0,e[0]>>>1])}function l(e,t){t=t||0;for(var n=(e=e||"").length%16,a=e.length-n,r=[0,t],i=[0,t],o=[0,0],l=[0,0],s=[2277735313,289559509],c=[1291169091,658871167],u=0;u<a;u+=16)o=[255&e.charCodeAt(u+4)|(255&e.charCodeAt(u+5))<<8|(255&e.charCodeAt(u+6))<<16|(255&e.charCodeAt(u+7))<<24,255&e.charCodeAt(u)|(255&e.charCodeAt(u+1))<<8|(255&e.charCodeAt(u+2))<<16|(255&e.charCodeAt(u+3))<<24],l=[255&e.charCodeAt(u+12)|(255&e.charCodeAt(u+13))<<8|(255&e.charCodeAt(u+14))<<16|(255&e.charCodeAt(u+15))<<24,255&e.charCodeAt(u+8)|(255&e.charCodeAt(u+9))<<8|(255&e.charCodeAt(u+10))<<16|(255&e.charCodeAt(u+11))<<24],o=f(o,s),o=g(o,31),o=f(o,c),r=m(r,o),r=g(r,27),r=d(r,i),r=d(f(r,[0,5]),[0,1390208809]),l=f(l,c),l=g(l,33),l=f(l,s),i=m(i,l),i=g(i,31),i=d(i,r),i=d(f(i,[0,5]),[0,944331445]);switch(o=[0,0],l=[0,0],n){case 15:l=m(l,h([0,e.charCodeAt(u+14)],48));case 14:l=m(l,h([0,e.charCodeAt(u+13)],40));case 13:l=m(l,h([0,e.charCodeAt(u+12)],32));case 12:l=m(l,h([0,e.charCodeAt(u+11)],24));case 11:l=m(l,h([0,e.charCodeAt(u+10)],16));case 10:l=m(l,h([0,e.charCodeAt(u+9)],8));case 9:l=m(l,[0,e.charCodeAt(u+8)]),l=f(l,c),l=g(l,33),l=f(l,s),i=m(i,l);case 8:o=m(o,h([0,e.charCodeAt(u+7)],56));case 7:o=m(o,h([0,e.charCodeAt(u+6)],48));case 6:o=m(o,h([0,e.charCodeAt(u+5)],40));case 5:o=m(o,h([0,e.charCodeAt(u+4)],32));case 4:o=m(o,h([0,e.charCodeAt(u+3)],24));case 3:o=m(o,h([0,e.charCodeAt(u+2)],16));case 2:o=m(o,h([0,e.charCodeAt(u+1)],8));case 1:o=m(o,[0,e.charCodeAt(u)]),o=f(o,s),o=g(o,31),o=f(o,c),r=m(r,o)}return r=m(r,[0,e.length]),i=m(i,[0,e.length]),r=d(r,i),i=d(i,r),r=p(r),i=p(i),r=d(r,i),i=d(i,r),("00000000"+(r[0]>>>0).toString(16)).slice(-8)+("00000000"+(r[1]>>>0).toString(16)).slice(-8)+("00000000"+(i[0]>>>0).toString(16)).slice(-8)+("00000000"+(i[1]>>>0).toString(16)).slice(-8)}function c(e,t){if(Array.prototype.forEach&&e.forEach===Array.prototype.forEach)e.forEach(t);else if(e.length===+e.length)for(var n=0,a=e.length;n<a;n++)t(e[n],n,e);else for(var r in e)e.hasOwnProperty(r)&&t(e[r],r,e)}function s(e,a){var r=[];return null==e?r:Array.prototype.map&&e.map===Array.prototype.map?e.map(a):(c(e,function(e,t,n){r.push(a(e,t,n))}),r)}function a(e){throw new Error("'new Fingerprint()' is deprecated, see https://github.com/fingerprintjs/fingerprintjs#upgrade-guide-from-182-to-200")}var e={preprocessor:null,audio:{timeout:1e3,excludeIOS11:!0},fonts:{swfContainerId:"fingerprintjs2",swfPath:"flash/compiled/FontList.swf",userDefinedFonts:[],extendedJsFonts:!1},screen:{detectScreenOrientation:!0},plugins:{sortPluginsFor:[/palemoon/i],excludeIE:!1},extraComponents:[],excludes:{enumerateDevices:!0,pixelRatio:!0,doNotTrack:!0,fontsFlash:!0,adBlock:!0},NOT_AVAILABLE:"not available",ERROR:"error",EXCLUDED:"excluded"},n=function(){return navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices},r=function(e){var t=[window.screen.width,window.screen.height];return e.screen.detectScreenOrientation&&t.sort().reverse(),t},i=function(e){if(window.screen.availWidth&&window.screen.availHeight){var t=[window.screen.availHeight,window.screen.availWidth];return e.screen.detectScreenOrientation&&t.sort().reverse(),t}return e.NOT_AVAILABLE},o=function(e){if(null==navigator.plugins)return e.NOT_AVAILABLE;for(var t=[],n=0,a=navigator.plugins.length;n<a;n++)navigator.plugins[n]&&t.push(navigator.plugins[n]);return T(e)&&(t=t.sort(function(e,t){return e.name>t.name?1:e.name<t.name?-1:0})),s(t,function(e){var t=s(e,function(e){return[e.type,e.suffixes]});return[e.name,e.description,t]})},u=function(t){var e=[];return Object.getOwnPropertyDescriptor&&Object.getOwnPropertyDescriptor(window,"ActiveXObject")||"ActiveXObject"in window?e=s(["AcroPDF.PDF","Adodb.Stream","AgControl.AgControl","DevalVRXCtrl.DevalVRXCtrl.1","MacromediaFlashPaper.MacromediaFlashPaper","Msxml2.DOMDocument","Msxml2.XMLHTTP","PDF.PdfCtrl","QuickTime.QuickTime","QuickTimeCheckObject.QuickTimeCheck.1","RealPlayer","RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)","RealVideo.RealVideo(tm) ActiveX Control (32-bit)","Scripting.Dictionary","SWCtl.SWCtl","Shell.UIHelper","ShockwaveFlash.ShockwaveFlash","Skype.Detection","TDCCtl.TDCCtl","WMPlayer.OCX","rmocx.RealPlayer G2 Control","rmocx.RealPlayer G2 Control.1"],function(e){try{return new window.ActiveXObject(e),e}catch(e){return t.ERROR}}):e.push(t.NOT_AVAILABLE),navigator.plugins&&(e=e.concat(o(t))),e},T=function(e){for(var t=!1,n=0,a=e.plugins.sortPluginsFor.length;n<a;n++){var r=e.plugins.sortPluginsFor[n];if(navigator.userAgent.match(r)){t=!0;break}}return t},A=function(t){try{return!!window.sessionStorage}catch(e){return t.ERROR}},v=function(t){try{return!!window.localStorage}catch(e){return t.ERROR}},S=function(t){if(N())return t.EXCLUDED;try{return!!window.indexedDB}catch(e){return t.ERROR}},C=function(e){return navigator.hardwareConcurrency?navigator.hardwareConcurrency:e.NOT_AVAILABLE},w=function(e){return navigator.cpuClass||e.NOT_AVAILABLE},B=function(e){return navigator.platform?navigator.platform:e.NOT_AVAILABLE},y=function(e){return navigator.doNotTrack?navigator.doNotTrack:navigator.msDoNotTrack?navigator.msDoNotTrack:window.doNotTrack?window.doNotTrack:e.NOT_AVAILABLE},t=function(){var t,e=0;void 0!==navigator.maxTouchPoints?e=navigator.maxTouchPoints:void 0!==navigator.msMaxTouchPoints&&(e=navigator.msMaxTouchPoints);try{document.createEvent("TouchEvent"),t=!0}catch(e){t=!1}return[e,t,"ontouchstart"in window]},E=function(e){var t=[],n=document.createElement("canvas");n.width=2e3,n.height=200,n.style.display="inline";var a=n.getContext("2d");return a.rect(0,0,10,10),a.rect(2,2,6,6),t.push("canvas winding:"+(!1===a.isPointInPath(5,5,"evenodd")?"yes":"no")),a.textBaseline="alphabetic",a.fillStyle="#f60",a.fillRect(125,1,62,20),a.fillStyle="#069",e.dontUseFakeFontInCanvas?a.font="11pt Arial":a.font="11pt no-real-font-123",a.fillText("Cwm fjordbank glyphs vext quiz, 😃",2,15),a.fillStyle="rgba(102, 204, 0, 0.2)",a.font="18pt Arial",a.fillText("Cwm fjordbank glyphs vext quiz, 😃",4,45),a.globalCompositeOperation="multiply",a.fillStyle="rgb(255,0,255)",a.beginPath(),a.arc(50,50,50,0,2*Math.PI,!0),a.closePath(),a.fill(),a.fillStyle="rgb(0,255,255)",a.beginPath(),a.arc(100,50,50,0,2*Math.PI,!0),a.closePath(),a.fill(),a.fillStyle="rgb(255,255,0)",a.beginPath(),a.arc(75,100,50,0,2*Math.PI,!0),a.closePath(),a.fill(),a.fillStyle="rgb(255,0,255)",a.arc(75,75,75,0,2*Math.PI,!0),a.arc(75,75,25,0,2*Math.PI,!0),a.fill("evenodd"),n.toDataURL&&t.push("canvas fp:"+n.toDataURL()),t},x=function(){function e(e){return o.clearColor(0,0,0,1),o.enable(o.DEPTH_TEST),o.depthFunc(o.LEQUAL),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT),"["+e[0]+", "+e[1]+"]"}var o=U();if(!o)return null;var l=[],t=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,t);var n=new Float32Array([-.2,-.9,0,.4,-.26,0,0,.732134444,0]);o.bufferData(o.ARRAY_BUFFER,n,o.STATIC_DRAW),t.itemSize=3,t.numItems=3;var a=o.createProgram(),r=o.createShader(o.VERTEX_SHADER);o.shaderSource(r,"attribute vec2 attrVertex;varying vec2 varyinTexCoordinate;uniform vec2 uniformOffset;void main(){varyinTexCoordinate=attrVertex+uniformOffset;gl_Position=vec4(attrVertex,0,1);}"),o.compileShader(r);var i=o.createShader(o.FRAGMENT_SHADER);o.shaderSource(i,"precision mediump float;varying vec2 varyinTexCoordinate;void main() {gl_FragColor=vec4(varyinTexCoordinate,0,1);}"),o.compileShader(i),o.attachShader(a,r),o.attachShader(a,i),o.linkProgram(a),o.useProgram(a),a.vertexPosAttrib=o.getAttribLocation(a,"attrVertex"),a.offsetUniform=o.getUniformLocation(a,"uniformOffset"),o.enableVertexAttribArray(a.vertexPosArray),o.vertexAttribPointer(a.vertexPosAttrib,t.itemSize,o.FLOAT,!1,0,0),o.uniform2f(a.offsetUniform,1,1),o.drawArrays(o.TRIANGLE_STRIP,0,t.numItems);try{l.push(o.canvas.toDataURL())}catch(e){}l.push("extensions:"+(o.getSupportedExtensions()||[]).join(";")),l.push("webgl aliased line width range:"+e(o.getParameter(o.ALIASED_LINE_WIDTH_RANGE))),l.push("webgl aliased point size range:"+e(o.getParameter(o.ALIASED_POINT_SIZE_RANGE))),l.push("webgl alpha bits:"+o.getParameter(o.ALPHA_BITS)),l.push("webgl antialiasing:"+(o.getContextAttributes().antialias?"yes":"no")),l.push("webgl blue bits:"+o.getParameter(o.BLUE_BITS)),l.push("webgl depth bits:"+o.getParameter(o.DEPTH_BITS)),l.push("webgl green bits:"+o.getParameter(o.GREEN_BITS)),l.push("webgl max anisotropy:"+function(e){var t=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic");if(t){var n=e.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT);return 0===n&&(n=2),n}return null}(o)),l.push("webgl max combined texture image units:"+o.getParameter(o.MAX_COMBINED_TEXTURE_IMAGE_UNITS)),l.push("webgl max cube map texture size:"+o.getParameter(o.MAX_CUBE_MAP_TEXTURE_SIZE)),l.push("webgl max fragment uniform vectors:"+o.getParameter(o.MAX_FRAGMENT_UNIFORM_VECTORS)),l.push("webgl max render buffer size:"+o.getParameter(o.MAX_RENDERBUFFER_SIZE)),l.push("webgl max texture image units:"+o.getParameter(o.MAX_TEXTURE_IMAGE_UNITS)),l.push("webgl max texture size:"+o.getParameter(o.MAX_TEXTURE_SIZE)),l.push("webgl max varying vectors:"+o.getParameter(o.MAX_VARYING_VECTORS)),l.push("webgl max vertex attribs:"+o.getParameter(o.MAX_VERTEX_ATTRIBS)),l.push("webgl max vertex texture image units:"+o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)),l.push("webgl max vertex uniform vectors:"+o.getParameter(o.MAX_VERTEX_UNIFORM_VECTORS)),l.push("webgl max viewport dims:"+e(o.getParameter(o.MAX_VIEWPORT_DIMS))),l.push("webgl red bits:"+o.getParameter(o.RED_BITS)),l.push("webgl renderer:"+o.getParameter(o.RENDERER)),l.push("webgl shading language version:"+o.getParameter(o.SHADING_LANGUAGE_VERSION)),l.push("webgl stencil bits:"+o.getParameter(o.STENCIL_BITS)),l.push("webgl vendor:"+o.getParameter(o.VENDOR)),l.push("webgl version:"+o.getParameter(o.VERSION));try{var s=o.getExtension("WEBGL_debug_renderer_info");s&&(l.push("webgl unmasked vendor:"+o.getParameter(s.UNMASKED_VENDOR_WEBGL)),l.push("webgl unmasked renderer:"+o.getParameter(s.UNMASKED_RENDERER_WEBGL)))}catch(e){}return o.getShaderPrecisionFormat&&c(["FLOAT","INT"],function(i){c(["VERTEX","FRAGMENT"],function(r){c(["HIGH","MEDIUM","LOW"],function(a){c(["precision","rangeMin","rangeMax"],function(e){var t=o.getShaderPrecisionFormat(o[r+"_SHADER"],o[a+"_"+i])[e];"precision"!==e&&(e="precision "+e);var n=["webgl ",r.toLowerCase()," shader ",a.toLowerCase()," ",i.toLowerCase()," ",e,":",t].join("");l.push(n)})})})}),V(o),l},O=function(){try{var e=U(),t=e.getExtension("WEBGL_debug_renderer_info"),n=e.getParameter(t.UNMASKED_VENDOR_WEBGL)+"~"+e.getParameter(t.UNMASKED_RENDERER_WEBGL);return V(e),n}catch(e){return null}},M=function(){var e=document.createElement("div");e.innerHTML="&nbsp;";var t=!(e.className="adsbox");try{document.body.appendChild(e),t=0===document.getElementsByClassName("adsbox")[0].offsetHeight,document.body.removeChild(e)}catch(e){t=!1}return t},P=function(){if(void 0!==navigator.languages)try{if(navigator.languages[0].substr(0,2)!==navigator.language.substr(0,2))return!0}catch(e){return!0}return!1},b=function(){return window.screen.width<window.screen.availWidth||window.screen.height<window.screen.availHeight},L=function(){var e=navigator.userAgent.toLowerCase(),t=navigator.oscpu,n=navigator.platform.toLowerCase(),a=0<=e.indexOf("windows phone")?"Windows Phone":0<=e.indexOf("windows")||0<=e.indexOf("win16")||0<=e.indexOf("win32")||0<=e.indexOf("win64")||0<=e.indexOf("win95")||0<=e.indexOf("win98")||0<=e.indexOf("winnt")||0<=e.indexOf("wow64")?"Windows":0<=e.indexOf("android")?"Android":0<=e.indexOf("linux")||0<=e.indexOf("cros")||0<=e.indexOf("x11")?"Linux":0<=e.indexOf("iphone")||0<=e.indexOf("ipad")||0<=e.indexOf("ipod")||0<=e.indexOf("crios")||0<=e.indexOf("fxios")?"iOS":0<=e.indexOf("macintosh")||0<=e.indexOf("mac_powerpc)")?"Mac":"Other";if(("ontouchstart"in window||0<navigator.maxTouchPoints||0<navigator.msMaxTouchPoints)&&"Windows"!==a&&"Windows Phone"!==a&&"Android"!==a&&"iOS"!==a&&"Other"!==a&&-1===e.indexOf("cros"))return!0;if(void 0!==t){if(0<=(t=t.toLowerCase()).indexOf("win")&&"Windows"!==a&&"Windows Phone"!==a)return!0;if(0<=t.indexOf("linux")&&"Linux"!==a&&"Android"!==a)return!0;if(0<=t.indexOf("mac")&&"Mac"!==a&&"iOS"!==a)return!0;if((-1===t.indexOf("win")&&-1===t.indexOf("linux")&&-1===t.indexOf("mac"))!=("Other"===a))return!0}return 0<=n.indexOf("win")&&"Windows"!==a&&"Windows Phone"!==a||(0<=n.indexOf("linux")||0<=n.indexOf("android")||0<=n.indexOf("pike"))&&"Linux"!==a&&"Android"!==a||(0<=n.indexOf("mac")||0<=n.indexOf("ipad")||0<=n.indexOf("ipod")||0<=n.indexOf("iphone"))&&"Mac"!==a&&"iOS"!==a||!(0<=n.indexOf("arm")&&"Windows Phone"===a)&&!(0<=n.indexOf("pike")&&0<=e.indexOf("opera mini"))&&((n.indexOf("win")<0&&n.indexOf("linux")<0&&n.indexOf("mac")<0&&n.indexOf("iphone")<0&&n.indexOf("ipad")<0&&n.indexOf("ipod")<0)!=("Other"===a)||void 0===navigator.plugins&&"Windows"!==a&&"Windows Phone"!==a)},I=function(){var e,t=navigator.userAgent.toLowerCase(),n=navigator.productSub;if(0<=t.indexOf("edge/")||0<=t.indexOf("iemobile/"))return!1;if(0<=t.indexOf("opera mini"))return!1;if(("Chrome"===(e=0<=t.indexOf("firefox/")?"Firefox":0<=t.indexOf("opera/")||0<=t.indexOf(" opr/")?"Opera":0<=t.indexOf("chrome/")?"Chrome":0<=t.indexOf("safari/")?0<=t.indexOf("android 1.")||0<=t.indexOf("android 2.")||0<=t.indexOf("android 3.")||0<=t.indexOf("android 4.")?"AOSP":"Safari":0<=t.indexOf("trident/")?"Internet Explorer":"Other")||"Safari"===e||"Opera"===e)&&"20030107"!==n)return!0;var a,r=eval.toString().length;if(37===r&&"Safari"!==e&&"Firefox"!==e&&"Other"!==e)return!0;if(39===r&&"Internet Explorer"!==e&&"Other"!==e)return!0;if(33===r&&"Chrome"!==e&&"AOSP"!==e&&"Opera"!==e&&"Other"!==e)return!0;try{throw"a"}catch(e){try{e.toSource(),a=!0}catch(e){a=!1}}return a&&"Firefox"!==e&&"Other"!==e},k=function(){var e=document.createElement("canvas");return!(!e.getContext||!e.getContext("2d"))},D=function(){if(!k())return!1;var e=U(),t=!!window.WebGLRenderingContext&&!!e;return V(e),t},R=function(){return"Microsoft Internet Explorer"===navigator.appName||!("Netscape"!==navigator.appName||!/Trident/.test(navigator.userAgent))},N=function(){return 2<=("msWriteProfilerMark"in window)+("msLaunchUri"in navigator)+("msSaveBlob"in navigator)},_=function(){return void 0!==window.swfobject},F=function(){return window.swfobject.hasFlashPlayerVersion("9.0.0")},G=function(t,e){var n="___fp_swf_loaded";window[n]=function(e){t(e)};var a,r,i=e.fonts.swfContainerId;(r=document.createElement("div")).setAttribute("id",a.fonts.swfContainerId),document.body.appendChild(r);var o={onReady:n};window.swfobject.embedSWF(e.fonts.swfPath,i,"1","1","9.0.0",!1,o,{allowScriptAccess:"always",menu:"false"},{})},U=function(){var e=document.createElement("canvas"),t=null;try{t=e.getContext("webgl")||e.getContext("experimental-webgl")}catch(e){}return t=t||null},V=function(e){var t=e.getExtension("WEBGL_lose_context");null!=t&&t.loseContext()},H=[{key:"userAgent",getData:function(e){e(navigator.userAgent)}},{key:"webdriver",getData:function(e,t){e(null==navigator.webdriver?t.NOT_AVAILABLE:navigator.webdriver)}},{key:"language",getData:function(e,t){e(navigator.language||navigator.userLanguage||navigator.browserLanguage||navigator.systemLanguage||t.NOT_AVAILABLE)}},{key:"colorDepth",getData:function(e,t){e(window.screen.colorDepth||t.NOT_AVAILABLE)}},{key:"deviceMemory",getData:function(e,t){e(navigator.deviceMemory||t.NOT_AVAILABLE)}},{key:"pixelRatio",getData:function(e,t){e(window.devicePixelRatio||t.NOT_AVAILABLE)}},{key:"hardwareConcurrency",getData:function(e,t){e(C(t))}},{key:"screenResolution",getData:function(e,t){e(r(t))}},{key:"availableScreenResolution",getData:function(e,t){e(i(t))}},{key:"timezoneOffset",getData:function(e){e((new Date).getTimezoneOffset())}},{key:"timezone",getData:function(e,t){window.Intl&&window.Intl.DateTimeFormat?e((new window.Intl.DateTimeFormat).resolvedOptions().timeZone||t.NOT_AVAILABLE):e(t.NOT_AVAILABLE)}},{key:"sessionStorage",getData:function(e,t){e(A(t))}},{key:"localStorage",getData:function(e,t){e(v(t))}},{key:"indexedDb",getData:function(e,t){e(S(t))}},{key:"addBehavior",getData:function(e){e(!!window.HTMLElement.prototype.addBehavior)}},{key:"openDatabase",getData:function(e){e(!!window.openDatabase)}},{key:"cpuClass",getData:function(e,t){e(w(t))}},{key:"platform",getData:function(e,t){e(B(t))}},{key:"doNotTrack",getData:function(e,t){e(y(t))}},{key:"plugins",getData:function(e,t){R()?t.plugins.excludeIE?e(t.EXCLUDED):e(u(t)):e(o(t))}},{key:"canvas",getData:function(e,t){k()?e(E(t)):e(t.NOT_AVAILABLE)}},{key:"webgl",getData:function(e,t){D()?e(x()):e(t.NOT_AVAILABLE)}},{key:"webglVendorAndRenderer",getData:function(e){D()?e(O()):e()}},{key:"adBlock",getData:function(e){e(M())}},{key:"hasLiedLanguages",getData:function(e){e(P())}},{key:"hasLiedResolution",getData:function(e){e(b())}},{key:"hasLiedOs",getData:function(e){e(L())}},{key:"hasLiedBrowser",getData:function(e){e(I())}},{key:"touchSupport",getData:function(e){e(t())}},{key:"fonts",getData:function(e,t){var u=["monospace","sans-serif","serif"],d=["Andale Mono","Arial","Arial Black","Arial Hebrew","Arial MT","Arial Narrow","Arial Rounded MT Bold","Arial Unicode MS","Bitstream Vera Sans Mono","Book Antiqua","Bookman Old Style","Calibri","Cambria","Cambria Math","Century","Century Gothic","Century Schoolbook","Comic Sans","Comic Sans MS","Consolas","Courier","Courier New","Geneva","Georgia","Helvetica","Helvetica Neue","Impact","Lucida Bright","Lucida Calligraphy","Lucida Console","Lucida Fax","LUCIDA GRANDE","Lucida Handwriting","Lucida Sans","Lucida Sans Typewriter","Lucida Sans Unicode","Microsoft Sans Serif","Monaco","Monotype Corsiva","MS Gothic","MS Outlook","MS PGothic","MS Reference Sans Serif","MS Sans Serif","MS Serif","MYRIAD","MYRIAD PRO","Palatino","Palatino Linotype","Segoe Print","Segoe Script","Segoe UI","Segoe UI Light","Segoe UI Semibold","Segoe UI Symbol","Tahoma","Times","Times New Roman","Times New Roman PS","Trebuchet MS","Verdana","Wingdings","Wingdings 2","Wingdings 3"];t.fonts.extendedJsFonts&&(d=d.concat(["Abadi MT Condensed Light","Academy Engraved LET","ADOBE CASLON PRO","Adobe Garamond","ADOBE GARAMOND PRO","Agency FB","Aharoni","Albertus Extra Bold","Albertus Medium","Algerian","Amazone BT","American Typewriter","American Typewriter Condensed","AmerType Md BT","Andalus","Angsana New","AngsanaUPC","Antique Olive","Aparajita","Apple Chancery","Apple Color Emoji","Apple SD Gothic Neo","Arabic Typesetting","ARCHER","ARNO PRO","Arrus BT","Aurora Cn BT","AvantGarde Bk BT","AvantGarde Md BT","AVENIR","Ayuthaya","Bandy","Bangla Sangam MN","Bank Gothic","BankGothic Md BT","Baskerville","Baskerville Old Face","Batang","BatangChe","Bauer Bodoni","Bauhaus 93","Bazooka","Bell MT","Bembo","Benguiat Bk BT","Berlin Sans FB","Berlin Sans FB Demi","Bernard MT Condensed","BernhardFashion BT","BernhardMod BT","Big Caslon","BinnerD","Blackadder ITC","BlairMdITC TT","Bodoni 72","Bodoni 72 Oldstyle","Bodoni 72 Smallcaps","Bodoni MT","Bodoni MT Black","Bodoni MT Condensed","Bodoni MT Poster Compressed","Bookshelf Symbol 7","Boulder","Bradley Hand","Bradley Hand ITC","Bremen Bd BT","Britannic Bold","Broadway","Browallia New","BrowalliaUPC","Brush Script MT","Californian FB","Calisto MT","Calligrapher","Candara","CaslonOpnface BT","Castellar","Centaur","Cezanne","CG Omega","CG Times","Chalkboard","Chalkboard SE","Chalkduster","Charlesworth","Charter Bd BT","Charter BT","Chaucer","ChelthmITC Bk BT","Chiller","Clarendon","Clarendon Condensed","CloisterBlack BT","Cochin","Colonna MT","Constantia","Cooper Black","Copperplate","Copperplate Gothic","Copperplate Gothic Bold","Copperplate Gothic Light","CopperplGoth Bd BT","Corbel","Cordia New","CordiaUPC","Cornerstone","Coronet","Cuckoo","Curlz MT","DaunPenh","Dauphin","David","DB LCD Temp","DELICIOUS","Denmark","DFKai-SB","Didot","DilleniaUPC","DIN","DokChampa","Dotum","DotumChe","Ebrima","Edwardian Script ITC","Elephant","English 111 Vivace BT","Engravers MT","EngraversGothic BT","Eras Bold ITC","Eras Demi ITC","Eras Light ITC","Eras Medium ITC","EucrosiaUPC","Euphemia","Euphemia UCAS","EUROSTILE","Exotc350 Bd BT","FangSong","Felix Titling","Fixedsys","FONTIN","Footlight MT Light","Forte","FrankRuehl","Fransiscan","Freefrm721 Blk BT","FreesiaUPC","Freestyle Script","French Script MT","FrnkGothITC Bk BT","Fruitger","FRUTIGER","Futura","Futura Bk BT","Futura Lt BT","Futura Md BT","Futura ZBlk BT","FuturaBlack BT","Gabriola","Galliard BT","Gautami","Geeza Pro","Geometr231 BT","Geometr231 Hv BT","Geometr231 Lt BT","GeoSlab 703 Lt BT","GeoSlab 703 XBd BT","Gigi","Gill Sans","Gill Sans MT","Gill Sans MT Condensed","Gill Sans MT Ext Condensed Bold","Gill Sans Ultra Bold","Gill Sans Ultra Bold Condensed","Gisha","Gloucester MT Extra Condensed","GOTHAM","GOTHAM BOLD","Goudy Old Style","Goudy Stout","GoudyHandtooled BT","GoudyOLSt BT","Gujarati Sangam MN","Gulim","GulimChe","Gungsuh","GungsuhChe","Gurmukhi MN","Haettenschweiler","Harlow Solid Italic","Harrington","Heather","Heiti SC","Heiti TC","HELV","Herald","High Tower Text","Hiragino Kaku Gothic ProN","Hiragino Mincho ProN","Hoefler Text","Humanst 521 Cn BT","Humanst521 BT","Humanst521 Lt BT","Imprint MT Shadow","Incised901 Bd BT","Incised901 BT","Incised901 Lt BT","INCONSOLATA","Informal Roman","Informal011 BT","INTERSTATE","IrisUPC","Iskoola Pota","JasmineUPC","Jazz LET","Jenson","Jester","Jokerman","Juice ITC","Kabel Bk BT","Kabel Ult BT","Kailasa","KaiTi","Kalinga","Kannada Sangam MN","Kartika","Kaufmann Bd BT","Kaufmann BT","Khmer UI","KodchiangUPC","Kokila","Korinna BT","Kristen ITC","Krungthep","Kunstler Script","Lao UI","Latha","Leelawadee","Letter Gothic","Levenim MT","LilyUPC","Lithograph","Lithograph Light","Long Island","Lydian BT","Magneto","Maiandra GD","Malayalam Sangam MN","Malgun Gothic","Mangal","Marigold","Marion","Marker Felt","Market","Marlett","Matisse ITC","Matura MT Script Capitals","Meiryo","Meiryo UI","Microsoft Himalaya","Microsoft JhengHei","Microsoft New Tai Lue","Microsoft PhagsPa","Microsoft Tai Le","Microsoft Uighur","Microsoft YaHei","Microsoft Yi Baiti","MingLiU","MingLiU_HKSCS","MingLiU_HKSCS-ExtB","MingLiU-ExtB","Minion","Minion Pro","Miriam","Miriam Fixed","Mistral","Modern","Modern No. 20","Mona Lisa Solid ITC TT","Mongolian Baiti","MONO","MoolBoran","Mrs Eaves","MS LineDraw","MS Mincho","MS PMincho","MS Reference Specialty","MS UI Gothic","MT Extra","MUSEO","MV Boli","Nadeem","Narkisim","NEVIS","News Gothic","News GothicMT","NewsGoth BT","Niagara Engraved","Niagara Solid","Noteworthy","NSimSun","Nyala","OCR A Extended","Old Century","Old English Text MT","Onyx","Onyx BT","OPTIMA","Oriya Sangam MN","OSAKA","OzHandicraft BT","Palace Script MT","Papyrus","Parchment","Party LET","Pegasus","Perpetua","Perpetua Titling MT","PetitaBold","Pickwick","Plantagenet Cherokee","Playbill","PMingLiU","PMingLiU-ExtB","Poor Richard","Poster","PosterBodoni BT","PRINCETOWN LET","Pristina","PTBarnum BT","Pythagoras","Raavi","Rage Italic","Ravie","Ribbon131 Bd BT","Rockwell","Rockwell Condensed","Rockwell Extra Bold","Rod","Roman","Sakkal Majalla","Santa Fe LET","Savoye LET","Sceptre","Script","Script MT Bold","SCRIPTINA","Serifa","Serifa BT","Serifa Th BT","ShelleyVolante BT","Sherwood","Shonar Bangla","Showcard Gothic","Shruti","Signboard","SILKSCREEN","SimHei","Simplified Arabic","Simplified Arabic Fixed","SimSun","SimSun-ExtB","Sinhala Sangam MN","Sketch Rockwell","Skia","Small Fonts","Snap ITC","Snell Roundhand","Socket","Souvenir Lt BT","Staccato222 BT","Steamer","Stencil","Storybook","Styllo","Subway","Swis721 BlkEx BT","Swiss911 XCm BT","Sylfaen","Synchro LET","System","Tamil Sangam MN","Technical","Teletype","Telugu Sangam MN","Tempus Sans ITC","Terminal","Thonburi","Traditional Arabic","Trajan","TRAJAN PRO","Tristan","Tubular","Tunga","Tw Cen MT","Tw Cen MT Condensed","Tw Cen MT Condensed Extra Bold","TypoUpright BT","Unicorn","Univers","Univers CE 55 Medium","Univers Condensed","Utsaah","Vagabond","Vani","Vijaya","Viner Hand ITC","VisualUI","Vivaldi","Vladimir Script","Vrinda","Westminster","WHITNEY","Wide Latin","ZapfEllipt BT","ZapfHumnst BT","ZapfHumnst Dm BT","Zapfino","Zurich BlkEx BT","Zurich Ex BT","ZWAdobeF"])),d=(d=d.concat(t.fonts.userDefinedFonts)).filter(function(e,t){return d.indexOf(e)===t});function f(){var e=document.createElement("span");return e.style.position="absolute",e.style.left="-9999px",e.style.fontSize="72px",e.style.fontStyle="normal",e.style.fontWeight="normal",e.style.letterSpacing="normal",e.style.lineBreak="auto",e.style.lineHeight="normal",e.style.textTransform="none",e.style.textAlign="left",e.style.textDecoration="none",e.style.textShadow="none",e.style.whiteSpace="normal",e.style.wordBreak="normal",e.style.wordSpacing="normal",e.innerHTML="mmmmmmmmmmlli",e}function n(e){for(var t=!1,n=0;n<u.length;n++)if(t=e[n].offsetWidth!==i[u[n]]||e[n].offsetHeight!==o[u[n]])return t;return t}var a=document.getElementsByTagName("body")[0],r=document.createElement("div"),g=document.createElement("div"),i={},o={},l=function(){for(var e=[],t=0,n=u.length;t<n;t++){var a=f();a.style.fontFamily=u[t],r.appendChild(a),e.push(a)}return e}();a.appendChild(r);for(var s=0,c=u.length;s<c;s++)i[u[s]]=l[s].offsetWidth,o[u[s]]=l[s].offsetHeight;var h=function(){for(var e,t,n,a={},r=0,i=d.length;r<i;r++){for(var o=[],l=0,s=u.length;l<s;l++){var c=(e=d[r],t=u[l],n=void 0,(n=f()).style.fontFamily="'"+e+"',"+t,n);g.appendChild(c),o.push(c)}a[d[r]]=o}return a}();a.appendChild(g);for(var m=[],p=0,T=d.length;p<T;p++)n(h[d[p]])&&m.push(d[p]);a.removeChild(g),a.removeChild(r),e(m)},pauseBefore:!0},{key:"fontsFlash",getData:function(t,e){return _()?F()?e.fonts.swfPath?void G(function(e){t(e)},e):t("missing options.fonts.swfPath"):t("flash not installed"):t("swf object not loaded")},pauseBefore:!0},{key:"audio",getData:function(n,e){var t=e.audio;if(t.excludeIOS11&&navigator.userAgent.match(/OS 11.+Version\/11.+Safari/))return n(e.EXCLUDED);var a=window.OfflineAudioContext||window.webkitOfflineAudioContext;if(null==a)return n(e.NOT_AVAILABLE);var r=new a(1,44100,44100),i=r.createOscillator();i.type="triangle",i.frequency.setValueAtTime(1e4,r.currentTime);var o=r.createDynamicsCompressor();c([["threshold",-50],["knee",40],["ratio",12],["reduction",-20],["attack",0],["release",.25]],function(e){void 0!==o[e[0]]&&"function"==typeof o[e[0]].setValueAtTime&&o[e[0]].setValueAtTime(e[1],r.currentTime)}),i.connect(o),o.connect(r.destination),i.start(0),r.startRendering();var l=setTimeout(function(){return console.warn('Audio fingerprint timed out. Please report bug at https://github.com/fingerprintjs/fingerprintjs with your user agent: "'+navigator.userAgent+'".'),r.oncomplete=function(){},r=null,n("audioTimeout")},t.timeout);r.oncomplete=function(e){var t;try{clearTimeout(l),t=e.renderedBuffer.getChannelData(0).slice(4500,5e3).reduce(function(e,t){return e+Math.abs(t)},0).toString(),i.disconnect(),o.disconnect()}catch(e){return void n(e)}n(t)}}},{key:"enumerateDevices",getData:function(t,e){if(!n())return t(e.NOT_AVAILABLE);navigator.mediaDevices.enumerateDevices().then(function(e){t(e.map(function(e){return"id="+e.deviceId+";gid="+e.groupId+";"+e.kind+";"+e.label}))}).catch(function(e){t(e)})}}];return a.get=function(n,a){(function(e,t){if(null==t)return;var n,a;for(a in t)null==(n=t[a])||Object.prototype.hasOwnProperty.call(e,a)||(e[a]=n)})(n=a?n||{}:(a=n,{}),e),n.components=n.extraComponents.concat(H);var r={data:[],addPreprocessedComponent:function(e,t){"function"==typeof n.preprocessor&&(t=n.preprocessor(e,t)),r.data.push({key:e,value:t})}},i=-1,o=function(e){if((i+=1)>=n.components.length)a(r.data);else{var t=n.components[i];if(n.excludes[t.key])o(!1);else{if(!e&&t.pauseBefore)return--i,void setTimeout(function(){o(!0)},1);try{t.getData(function(e){r.addPreprocessedComponent(t.key,e),o(!1)},n)}catch(e){r.addPreprocessedComponent(t.key,String(e)),o(!1)}}}};o(!1)},a.getPromise=function(n){return new Promise(function(e,t){a.get(n,e)})},a.getV18=function(i,o){return null==o&&(o=i,i={}),a.get(i,function(e){for(var t=[],n=0;n<e.length;n++){var a=e[n];if(a.value===(i.NOT_AVAILABLE||"not available"))t.push({key:a.key,value:"unknown"});else if("plugins"===a.key)t.push({key:"plugins",value:s(a.value,function(e){var t=s(e[2],function(e){return e.join?e.join("~"):e}).join(",");return[e[0],e[1],t].join("::")})});else if(-1!==["canvas","webgl"].indexOf(a.key)&&Array.isArray(a.value))t.push({key:a.key,value:a.value.join("~")});else if(-1!==["sessionStorage","localStorage","indexedDb","addBehavior","openDatabase"].indexOf(a.key)){if(!a.value)continue;t.push({key:a.key,value:1})}else a.value?t.push(a.value.join?{key:a.key,value:a.value.join(";")}:a):t.push({key:a.key,value:a.value})}var r=l(s(t,function(e){return e.value}).join("~~~"),31);o(r,t)})},a.x64hash128=l,a.VERSION="2.1.4",a});!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.io=e():t.io=e()}(window,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=17)}([function(t,e,n){function r(t){if(t)return function(t){for(var e in r.prototype)t[e]=r.prototype[e];return t}(t)}t.exports=r,r.prototype.on=r.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},r.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+t];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var o=0;o<r.length;o++)if((n=r[o])===e||n.fn===e){r.splice(o,1);break}return 0===r.length&&delete this._callbacks["$"+t],this},r.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),n=this._callbacks["$"+t],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(n){r=0;for(var o=(n=n.slice(0)).length;r<o;++r)n[r].apply(this,e)}return this},r.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},r.prototype.hasListeners=function(t){return!!this.listeners(t).length}},function(t,e,n){var r=n(23),o=n(24),i=String.fromCharCode(30);t.exports={protocol:4,encodePacket:r,encodePayload:function(t,e){var n=t.length,o=new Array(n),s=0;t.forEach(function(t,c){r(t,!1,function(t){o[c]=t,++s===n&&e(o.join(i))})})},decodePacket:o,decodePayload:function(t,e){for(var n=t.split(i),r=[],s=0;s<n.length;s++){var c=o(n[s],e);if(r.push(c),"error"===c.type)break}return r}}},function(t,e){t.exports="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")()},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function s(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var n,r=a(t);if(e){var o=a(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return c(this,n)}}function c(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var u=n(1),f=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}(a,t);var e,n,r,c=s(a);function a(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),(e=c.call(this)).opts=t,e.query=t.query,e.readyState="",e.socket=t.socket,e}return e=a,(n=[{key:"onError",value:function(t,e){var n=new Error(t);return n.type="TransportError",n.description=e,this.emit("error",n),this}},{key:"open",value:function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this}},{key:"close",value:function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}},{key:"send",value:function(t){if("open"!==this.readyState)throw new Error("Transport not open");this.write(t)}},{key:"onOpen",value:function(){this.readyState="open",this.writable=!0,this.emit("open")}},{key:"onData",value:function(t){var e=u.decodePacket(t,this.socket.binaryType);this.onPacket(e)}},{key:"onPacket",value:function(t){this.emit("packet",t)}},{key:"onClose",value:function(){this.readyState="closed",this.emit("close")}}])&&o(e.prototype,n),r&&o(e,r),a}(n(0));t.exports=f},function(t,e){e.encode=function(t){var e="";for(var n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e},e.decode=function(t){for(var e={},n=t.split("&"),r=0,o=n.length;r<o;r++){var i=n[r].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e,n){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=a(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(n):o.value}})(t,e,n||t)}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function s(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var n,r=a(t);if(e){var o=a(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return c(this,n)}}function c(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function f(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function p(t,e,n){return e&&f(t.prototype,e),n&&f(t,n),t}Object.defineProperty(e,"__esModule",{value:!0}),e.Decoder=e.Encoder=e.PacketType=e.protocol=void 0;var l,h=n(0),y=n(29),d=n(15);e.protocol=5,function(t){t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK"}(l=e.PacketType||(e.PacketType={}));var v=function(){function t(){u(this,t)}return p(t,[{key:"encode",value:function(t){return t.type!==l.EVENT&&t.type!==l.ACK||!d.hasBinary(t)?[this.encodeAsString(t)]:(t.type=t.type===l.EVENT?l.BINARY_EVENT:l.BINARY_ACK,this.encodeAsBinary(t))}},{key:"encodeAsString",value:function(t){var e=""+t.type;return t.type!==l.BINARY_EVENT&&t.type!==l.BINARY_ACK||(e+=t.attachments+"-"),t.nsp&&"/"!==t.nsp&&(e+=t.nsp+","),null!=t.id&&(e+=t.id),null!=t.data&&(e+=JSON.stringify(t.data)),e}},{key:"encodeAsBinary",value:function(t){var e=y.deconstructPacket(t),n=this.encodeAsString(e.packet),r=e.buffers;return r.unshift(n),r}}]),t}();e.Encoder=v;var b=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}(n,t);var e=s(n);function n(){return u(this,n),e.call(this)}return p(n,[{key:"add",value:function(t){var e;if("string"==typeof t)(e=this.decodeString(t)).type===l.BINARY_EVENT||e.type===l.BINARY_ACK?(this.reconstructor=new m(e),0===e.attachments&&o(a(n.prototype),"emit",this).call(this,"decoded",e)):o(a(n.prototype),"emit",this).call(this,"decoded",e);else{if(!d.isBinary(t)&&!t.base64)throw new Error("Unknown type: "+t);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");(e=this.reconstructor.takeBinaryData(t))&&(this.reconstructor=null,o(a(n.prototype),"emit",this).call(this,"decoded",e))}}},{key:"decodeString",value:function(t){var e=0,r={type:Number(t.charAt(0))};if(void 0===l[r.type])throw new Error("unknown packet type "+r.type);if(r.type===l.BINARY_EVENT||r.type===l.BINARY_ACK){for(var o=e+1;"-"!==t.charAt(++e)&&e!=t.length;);var i=t.substring(o,e);if(i!=Number(i)||"-"!==t.charAt(e))throw new Error("Illegal attachments");r.attachments=Number(i)}if("/"===t.charAt(e+1)){for(var s=e+1;++e;){if(","===t.charAt(e))break;if(e===t.length)break}r.nsp=t.substring(s,e)}else r.nsp="/";var c=t.charAt(e+1);if(""!==c&&Number(c)==c){for(var a=e+1;++e;){var u=t.charAt(e);if(null==u||Number(u)!=u){--e;break}if(e===t.length)break}r.id=Number(t.substring(a,e+1))}if(t.charAt(++e)){var f=function(t){try{return JSON.parse(t)}catch(t){return!1}}(t.substr(e));if(!n.isPayloadValid(r.type,f))throw new Error("invalid payload");r.data=f}return r}},{key:"destroy",value:function(){this.reconstructor&&this.reconstructor.finishedReconstruction()}}],[{key:"isPayloadValid",value:function(t,e){switch(t){case l.CONNECT:return"object"===r(e);case l.DISCONNECT:return void 0===e;case l.CONNECT_ERROR:return"string"==typeof e||"object"===r(e);case l.EVENT:case l.BINARY_EVENT:return Array.isArray(e)&&"string"==typeof e[0];case l.ACK:case l.BINARY_ACK:return Array.isArray(e)}}}]),n}(h);e.Decoder=b;var m=function(){function t(e){u(this,t),this.packet=e,this.buffers=[],this.reconPack=e}return p(t,[{key:"takeBinaryData",value:function(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){var e=y.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}},{key:"finishedReconstruction",value:function(){this.reconPack=null,this.buffers=[]}}]),t}()},function(t,e){var n=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,r=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];t.exports=function(t){var e=t,o=t.indexOf("["),i=t.indexOf("]");-1!=o&&-1!=i&&(t=t.substring(0,o)+t.substring(o,i).replace(/:/g,";")+t.substring(i,t.length));for(var s,c,a=n.exec(t||""),u={},f=14;f--;)u[r[f]]=a[f]||"";return-1!=o&&-1!=i&&(u.source=e,u.host=u.host.substring(1,u.host.length-1).replace(/;/g,":"),u.authority=u.authority.replace("[","").replace("]","").replace(/;/g,":"),u.ipv6uri=!0),u.pathNames=function(t,e){var n=e.replace(/\/{2,9}/g,"/").split("/");"/"!=e.substr(0,1)&&0!==e.length||n.splice(0,1);"/"==e.substr(e.length-1,1)&&n.splice(n.length-1,1);return n}(0,u.path),u.queryKey=(s=u.query,c={},s.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(t,e,n){e&&(c[e]=n)}),c),u}},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function i(t,e,n){return(i="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=u(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(n):o.value}})(t,e,n||t)}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function c(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var n,r=u(t);if(e){var o=u(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return a(this,n)}}function a(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.Manager=void 0;var f=n(19),p=n(14),l=n(0),h=n(5),y=n(16),d=n(30),v=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&s(t,e)}(v,t);var e,n,a,l=c(v);function v(t,e){var n;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,v),(n=l.call(this)).nsps={},n.subs=[],t&&"object"===r(t)&&(e=t,t=void 0),(e=e||{}).path=e.path||"/socket.io",n.opts=e,n.reconnection(!1!==e.reconnection),n.reconnectionAttempts(e.reconnectionAttempts||1/0),n.reconnectionDelay(e.reconnectionDelay||1e3),n.reconnectionDelayMax(e.reconnectionDelayMax||5e3),n.randomizationFactor(e.randomizationFactor||.5),n.backoff=new d({min:n.reconnectionDelay(),max:n.reconnectionDelayMax(),jitter:n.randomizationFactor()}),n.timeout(null==e.timeout?2e4:e.timeout),n._readyState="closed",n.uri=t;var o=e.parser||h;return n.encoder=new o.Encoder,n.decoder=new o.Decoder,n._autoConnect=!1!==e.autoConnect,n._autoConnect&&n.open(),n}return e=v,(n=[{key:"reconnection",value:function(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection}},{key:"reconnectionAttempts",value:function(t){return void 0===t?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}},{key:"reconnectionDelay",value:function(t){var e;return void 0===t?this._reconnectionDelay:(this._reconnectionDelay=t,null===(e=this.backoff)||void 0===e||e.setMin(t),this)}},{key:"randomizationFactor",value:function(t){var e;return void 0===t?this._randomizationFactor:(this._randomizationFactor=t,null===(e=this.backoff)||void 0===e||e.setJitter(t),this)}},{key:"reconnectionDelayMax",value:function(t){var e;return void 0===t?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,null===(e=this.backoff)||void 0===e||e.setMax(t),this)}},{key:"timeout",value:function(t){return arguments.length?(this._timeout=t,this):this._timeout}},{key:"maybeReconnectOnOpen",value:function(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}},{key:"open",value:function(t){var e=this;if(~this._readyState.indexOf("open"))return this;this.engine=f(this.uri,this.opts);var n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;var o=y.on(n,"open",function(){r.onopen(),t&&t()}),s=y.on(n,"error",function(n){r.cleanup(),r._readyState="closed",i(u(v.prototype),"emit",e).call(e,"error",n),t?t(n):r.maybeReconnectOnOpen()});if(!1!==this._timeout){var c=this._timeout;0===c&&o();var a=setTimeout(function(){o(),n.close(),n.emit("error",new Error("timeout"))},c);this.subs.push(function(){clearTimeout(a)})}return this.subs.push(o),this.subs.push(s),this}},{key:"connect",value:function(t){return this.open(t)}},{key:"onopen",value:function(){this.cleanup(),this._readyState="open",i(u(v.prototype),"emit",this).call(this,"open");var t=this.engine;this.subs.push(y.on(t,"ping",this.onping.bind(this)),y.on(t,"data",this.ondata.bind(this)),y.on(t,"error",this.onerror.bind(this)),y.on(t,"close",this.onclose.bind(this)),y.on(this.decoder,"decoded",this.ondecoded.bind(this)))}},{key:"onping",value:function(){i(u(v.prototype),"emit",this).call(this,"ping")}},{key:"ondata",value:function(t){this.decoder.add(t)}},{key:"ondecoded",value:function(t){i(u(v.prototype),"emit",this).call(this,"packet",t)}},{key:"onerror",value:function(t){i(u(v.prototype),"emit",this).call(this,"error",t)}},{key:"socket",value:function(t,e){var n=this.nsps[t];return n||(n=new p.Socket(this,t,e),this.nsps[t]=n),n}},{key:"_destroy",value:function(t){for(var e=0,n=Object.keys(this.nsps);e<n.length;e++){var r=n[e];if(this.nsps[r].active)return}this._close()}},{key:"_packet",value:function(t){t.query&&0===t.type&&(t.nsp+="?"+t.query);for(var e=this.encoder.encode(t),n=0;n<e.length;n++)this.engine.write(e[n],t.options)}},{key:"cleanup",value:function(){this.subs.forEach(function(t){return t()}),this.subs.length=0,this.decoder.destroy()}},{key:"_close",value:function(){this.skipReconnect=!0,this._reconnecting=!1,"opening"===this._readyState&&this.cleanup(),this.backoff.reset(),this._readyState="closed",this.engine&&this.engine.close()}},{key:"disconnect",value:function(){return this._close()}},{key:"onclose",value:function(t){this.cleanup(),this.backoff.reset(),this._readyState="closed",i(u(v.prototype),"emit",this).call(this,"close",t),this._reconnection&&!this.skipReconnect&&this.reconnect()}},{key:"reconnect",value:function(){var t=this;if(this._reconnecting||this.skipReconnect)return this;var e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),i(u(v.prototype),"emit",this).call(this,"reconnect_failed"),this._reconnecting=!1;else{var n=this.backoff.duration();this._reconnecting=!0;var r=setTimeout(function(){e.skipReconnect||(i(u(v.prototype),"emit",t).call(t,"reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open(function(n){n?(e._reconnecting=!1,e.reconnect(),i(u(v.prototype),"emit",t).call(t,"reconnect_error",n)):e.onreconnect()}))},n);this.subs.push(function(){clearTimeout(r)})}}},{key:"onreconnect",value:function(){var t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),i(u(v.prototype),"emit",this).call(this,"reconnect",t)}}])&&o(e.prototype,n),a&&o(e,a),v}(l);e.Manager=v},function(t,e,n){var r=n(9),o=n(22),i=n(26),s=n(27);e.polling=function(t){var e=!1,n=!1,s=!1!==t.jsonp;if("undefined"!=typeof location){var c="https:"===location.protocol,a=location.port;a||(a=c?443:80),e=t.hostname!==location.hostname||a!==t.port,n=t.secure!==c}if(t.xdomain=e,t.xscheme=n,"open"in new r(t)&&!t.forceJSONP)return new o(t);if(!s)throw new Error("JSONP disabled");return new i(t)},e.websocket=s},function(t,e,n){var r=n(21),o=n(2);t.exports=function(t){var e=t.xdomain,n=t.xscheme,i=t.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!e||r))return new XMLHttpRequest}catch(t){}try{if("undefined"!=typeof XDomainRequest&&!n&&i)return new XDomainRequest}catch(t){}if(!e)try{return new o[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch(t){}}},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function c(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var n,r=u(t);if(e){var o=u(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return a(this,n)}}function a(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=n(3),p=n(4),l=n(1),h=n(12),y=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&s(t,e)}(u,t);var e,n,r,a=c(u);function u(){return o(this,u),a.apply(this,arguments)}return e=u,(n=[{key:"doOpen",value:function(){this.poll()}},{key:"pause",value:function(t){var e=this;function n(){e.readyState="paused",t()}if(this.readyState="pausing",this.polling||!this.writable){var r=0;this.polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}},{key:"poll",value:function(){this.polling=!0,this.doPoll(),this.emit("poll")}},{key:"onData",value:function(t){var e=this;l.decodePayload(t,this.socket.binaryType).forEach(function(t,n,r){if("opening"===e.readyState&&"open"===t.type&&e.onOpen(),"close"===t.type)return e.onClose(),!1;e.onPacket(t)}),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState&&this.poll())}},{key:"doClose",value:function(){var t=this;function e(){t.write([{type:"close"}])}"open"===this.readyState?e():this.once("open",e)}},{key:"write",value:function(t){var e=this;this.writable=!1,l.encodePayload(t,function(t){e.doWrite(t,function(){e.writable=!0,e.emit("drain")})})}},{key:"uri",value:function(){var t=this.query||{},e=this.opts.secure?"https":"http",n="";return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=h()),this.supportsBinary||t.sid||(t.b64=1),t=p.encode(t),this.opts.port&&("https"===e&&443!==Number(this.opts.port)||"http"===e&&80!==Number(this.opts.port))&&(n=":"+this.opts.port),t.length&&(t="?"+t),e+"://"+(-1!==this.opts.hostname.indexOf(":")?"["+this.opts.hostname+"]":this.opts.hostname)+n+this.opts.path+t}},{key:"name",get:function(){return"polling"}}])&&i(e.prototype,n),r&&i(e,r),u}(f);t.exports=y},function(t,e){var n=Object.create(null);n.open="0",n.close="1",n.ping="2",n.pong="3",n.message="4",n.upgrade="5",n.noop="6";var r=Object.create(null);Object.keys(n).forEach(function(t){r[n[t]]=t});t.exports={PACKET_TYPES:n,PACKET_TYPES_REVERSE:r,ERROR_PACKET:{type:"error",data:"parser error"}}},function(t,e,n){"use strict";var r,o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),i={},s=0,c=0;function a(t){var e="";do{e=o[t%64]+e,t=Math.floor(t/64)}while(t>0);return e}function u(){var t=a(+new Date);return t!==r?(s=0,r=t):t+"."+a(s++)}for(;c<64;c++)i[o[c]]=c;u.encode=a,u.decode=function(t){var e=0;for(c=0;c<t.length;c++)e=64*e+i[t.charAt(c)];return e},t.exports=u},function(t,e){t.exports.pick=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return n.reduce(function(e,n){return e[n]=t[n],e},{})}},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return i(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,c=!0,a=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return c=t.done,t},e:function(t){a=!0,s=t},f:function(){try{c||null==n.return||n.return()}finally{if(a)throw s}}}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function c(t,e,n){return(c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=p(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(n):o.value}})(t,e,n||t)}function a(t,e){return(a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function u(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var n,r=p(t);if(e){var o=p(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return f(this,n)}}function f(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.Socket=void 0;var l=n(5),h=n(0),y=n(16),d=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),v=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&a(t,e)}(f,t);var e,n,r,i=u(f);function f(t,e,n){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,f),(r=i.call(this)).receiveBuffer=[],r.sendBuffer=[],r.ids=0,r.acks={},r.flags={},r.io=t,r.nsp=e,r.ids=0,r.acks={},r.receiveBuffer=[],r.sendBuffer=[],r.connected=!1,r.disconnected=!0,r.flags={},n&&n.auth&&(r.auth=n.auth),r.io._autoConnect&&r.open(),r}return e=f,(n=[{key:"subEvents",value:function(){if(!this.subs){var t=this.io;this.subs=[y.on(t,"open",this.onopen.bind(this)),y.on(t,"packet",this.onpacket.bind(this)),y.on(t,"error",this.onerror.bind(this)),y.on(t,"close",this.onclose.bind(this))]}}},{key:"connect",value:function(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}},{key:"open",value:function(){return this.connect()}},{key:"send",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return e.unshift("message"),this.emit.apply(this,e),this}},{key:"emit",value:function(t){if(d.hasOwnProperty(t))throw new Error('"'+t+'" is a reserved event name');for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];n.unshift(t);var o={type:l.PacketType.EVENT,data:n,options:{}};o.options.compress=!1!==this.flags.compress,"function"==typeof n[n.length-1]&&(this.acks[this.ids]=n.pop(),o.id=this.ids++);var i=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable,s=this.flags.volatile&&(!i||!this.connected);return s||(this.connected?this.packet(o):this.sendBuffer.push(o)),this.flags={},this}},{key:"packet",value:function(t){t.nsp=this.nsp,this.io._packet(t)}},{key:"onopen",value:function(){var t=this;"function"==typeof this.auth?this.auth(function(e){t.packet({type:l.PacketType.CONNECT,data:e})}):this.packet({type:l.PacketType.CONNECT,data:this.auth})}},{key:"onerror",value:function(t){this.connected||c(p(f.prototype),"emit",this).call(this,"connect_error",t)}},{key:"onclose",value:function(t){this.connected=!1,this.disconnected=!0,delete this.id,c(p(f.prototype),"emit",this).call(this,"disconnect",t)}},{key:"onpacket",value:function(t){if(t.nsp===this.nsp)switch(t.type){case l.PacketType.CONNECT:if(t.data&&t.data.sid){var e=t.data.sid;this.onconnect(e)}else c(p(f.prototype),"emit",this).call(this,"connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case l.PacketType.EVENT:case l.PacketType.BINARY_EVENT:this.onevent(t);break;case l.PacketType.ACK:case l.PacketType.BINARY_ACK:this.onack(t);break;case l.PacketType.DISCONNECT:this.ondisconnect();break;case l.PacketType.CONNECT_ERROR:var n=new Error(t.data.message);n.data=t.data.data,c(p(f.prototype),"emit",this).call(this,"connect_error",n)}}},{key:"onevent",value:function(t){var e=t.data||[];null!=t.id&&e.push(this.ack(t.id)),this.connected?this.emitEvent(e):this.receiveBuffer.push(Object.freeze(e))}},{key:"emitEvent",value:function(t){if(this._anyListeners&&this._anyListeners.length){var e,n=o(this._anyListeners.slice());try{for(n.s();!(e=n.n()).done;)e.value.apply(this,t)}catch(t){n.e(t)}finally{n.f()}}c(p(f.prototype),"emit",this).apply(this,t)}},{key:"ack",value:function(t){var e=this,n=!1;return function(){if(!n){n=!0;for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];e.packet({type:l.PacketType.ACK,id:t,data:o})}}}},{key:"onack",value:function(t){var e=this.acks[t.id];"function"==typeof e&&(e.apply(this,t.data),delete this.acks[t.id])}},{key:"onconnect",value:function(t){this.id=t,this.connected=!0,this.disconnected=!1,c(p(f.prototype),"emit",this).call(this,"connect"),this.emitBuffered()}},{key:"emitBuffered",value:function(){var t=this;this.receiveBuffer.forEach(function(e){return t.emitEvent(e)}),this.receiveBuffer=[],this.sendBuffer.forEach(function(e){return t.packet(e)}),this.sendBuffer=[]}},{key:"ondisconnect",value:function(){this.destroy(),this.onclose("io server disconnect")}},{key:"destroy",value:function(){this.subs&&(this.subs.forEach(function(t){return t()}),this.subs=void 0),this.io._destroy(this)}},{key:"disconnect",value:function(){return this.connected&&this.packet({type:l.PacketType.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}},{key:"close",value:function(){return this.disconnect()}},{key:"compress",value:function(t){return this.flags.compress=t,this}},{key:"onAny",value:function(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}},{key:"prependAny",value:function(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}},{key:"offAny",value:function(t){if(!this._anyListeners)return this;if(t){for(var e=this._anyListeners,n=0;n<e.length;n++)if(t===e[n])return e.splice(n,1),this}else this._anyListeners=[];return this}},{key:"listenersAny",value:function(){return this._anyListeners||[]}},{key:"active",get:function(){return!!this.subs}},{key:"volatile",get:function(){return this.flags.volatile=!0,this}}])&&s(e.prototype,n),r&&s(e,r),f}(h);e.Socket=v},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.hasBinary=e.isBinary=void 0;var o="function"==typeof ArrayBuffer,i=Object.prototype.toString,s="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===i.call(Blob),c="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===i.call(File);function a(t){return o&&(t instanceof ArrayBuffer||function(t){return"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer}(t))||s&&t instanceof Blob||c&&t instanceof File}e.isBinary=a,e.hasBinary=function t(e,n){if(!e||"object"!==r(e))return!1;if(Array.isArray(e)){for(var o=0,i=e.length;o<i;o++)if(t(e[o]))return!0;return!1}if(a(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return t(e.toJSON(),!0);for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&t(e[s]))return!0;return!1}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.on=void 0,e.on=function(t,e,n){return t.on(e,n),function(){t.off(e,n)}}},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.Socket=e.io=e.Manager=e.protocol=void 0;var o=n(18),i=n(7),s=n(14);Object.defineProperty(e,"Socket",{enumerable:!0,get:function(){return s.Socket}}),t.exports=e=a;var c=e.managers={};function a(t,e){"object"===r(t)&&(e=t,t=void 0),e=e||{};var n,s=o.url(t),a=s.source,u=s.id,f=s.path,p=c[u]&&f in c[u].nsps;return e.forceNew||e["force new connection"]||!1===e.multiplex||p?n=new i.Manager(a,e):(c[u]||(c[u]=new i.Manager(a,e)),n=c[u]),s.query&&!e.query&&(e.query=s.query),n.socket(s.path,e)}e.io=a;var u=n(5);Object.defineProperty(e,"protocol",{enumerable:!0,get:function(){return u.protocol}}),e.connect=a;var f=n(7);Object.defineProperty(e,"Manager",{enumerable:!0,get:function(){return f.Manager}})},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.url=void 0;var r=n(6);e.url=function(t,e){var n=t;e=e||"undefined"!=typeof location&&location,null==t&&(t=e.protocol+"//"+e.host),"string"==typeof t&&("/"===t.charAt(0)&&(t="/"===t.charAt(1)?e.protocol+t:e.host+t),/^(https?|wss?):\/\//.test(t)||(t=void 0!==e?e.protocol+"//"+t:"https://"+t),n=r(t)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";var o=-1!==n.host.indexOf(":")?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+o+":"+n.port,n.href=n.protocol+"://"+o+(e&&e.port===n.port?"":":"+n.port),n}},function(t,e,n){var r=n(20);t.exports=function(t,e){return new r(t,e)},t.exports.Socket=r,t.exports.protocol=r.protocol,t.exports.Transport=n(3),t.exports.transports=n(8),t.exports.parser=n(1)},function(t,e,n){function r(){return(r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function c(t,e){return(c=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var n,r=f(t);if(e){var o=f(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return u(this,n)}}function u(t,e){return!e||"object"!==o(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function f(t){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var p=n(8),l=n(0),h=n(1),y=n(6),d=n(4),v=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&c(t,e)}(l,t);var e,n,u,f=a(l);function l(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return i(this,l),e=f.call(this),t&&"object"===o(t)&&(n=t,t=null),t?(t=y(t),n.hostname=t.host,n.secure="https"===t.protocol||"wss"===t.protocol,n.port=t.port,t.query&&(n.query=t.query)):n.host&&(n.hostname=y(n.host).host),e.secure=null!=n.secure?n.secure:"undefined"!=typeof location&&"https:"===location.protocol,n.hostname&&!n.port&&(n.port=e.secure?"443":"80"),e.hostname=n.hostname||("undefined"!=typeof location?location.hostname:"localhost"),e.port=n.port||("undefined"!=typeof location&&location.port?location.port:e.secure?443:80),e.transports=n.transports||["polling","websocket"],e.readyState="",e.writeBuffer=[],e.prevBufferLen=0,e.opts=r({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,jsonp:!0,timestampParam:"t",rememberUpgrade:!1,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{}},n),e.opts.path=e.opts.path.replace(/\/$/,"")+"/","string"==typeof e.opts.query&&(e.opts.query=d.decode(e.opts.query)),e.id=null,e.upgrades=null,e.pingInterval=null,e.pingTimeout=null,e.pingTimeoutTimer=null,e.open(),e}return e=l,(n=[{key:"createTransport",value:function(t){var e=function(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}(this.opts.query);e.EIO=h.protocol,e.transport=t,this.id&&(e.sid=this.id);var n=r({},this.opts.transportOptions[t],this.opts,{query:e,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new p[t](n)}},{key:"open",value:function(){var t;if(this.opts.rememberUpgrade&&l.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))t="websocket";else{if(0===this.transports.length){var e=this;return void setTimeout(function(){e.emit("error","No transports available")},0)}t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(t){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)}},{key:"setTransport",value:function(t){var e=this;this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",function(){e.onDrain()}).on("packet",function(t){e.onPacket(t)}).on("error",function(t){e.onError(t)}).on("close",function(){e.onClose("transport close")})}},{key:"probe",value:function(t){var e=this.createTransport(t,{probe:1}),n=!1,r=this;function o(){if(r.onlyBinaryUpgrades){var t=!this.supportsBinary&&r.transport.supportsBinary;n=n||t}n||(e.send([{type:"ping",data:"probe"}]),e.once("packet",function(t){if(!n)if("pong"===t.type&&"probe"===t.data){if(r.upgrading=!0,r.emit("upgrading",e),!e)return;l.priorWebsocketSuccess="websocket"===e.name,r.transport.pause(function(){n||"closed"!==r.readyState&&(f(),r.setTransport(e),e.send([{type:"upgrade"}]),r.emit("upgrade",e),e=null,r.upgrading=!1,r.flush())})}else{var o=new Error("probe error");o.transport=e.name,r.emit("upgradeError",o)}}))}function i(){n||(n=!0,f(),e.close(),e=null)}function s(t){var n=new Error("probe error: "+t);n.transport=e.name,i(),r.emit("upgradeError",n)}function c(){s("transport closed")}function a(){s("socket closed")}function u(t){e&&t.name!==e.name&&i()}function f(){e.removeListener("open",o),e.removeListener("error",s),e.removeListener("close",c),r.removeListener("close",a),r.removeListener("upgrading",u)}l.priorWebsocketSuccess=!1,e.once("open",o),e.once("error",s),e.once("close",c),this.once("close",a),this.once("upgrading",u),e.open()}},{key:"onOpen",value:function(){if(this.readyState="open",l.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade&&this.transport.pause)for(var t=0,e=this.upgrades.length;t<e;t++)this.probe(this.upgrades[t])}},{key:"onPacket",value:function(t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emit("packet",t),this.emit("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this.resetPingTimeout(),this.sendPacket("pong"),this.emit("pong");break;case"error":var e=new Error("server error");e.code=t.data,this.onError(e);break;case"message":this.emit("data",t.data),this.emit("message",t.data)}}},{key:"onHandshake",value:function(t){this.emit("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.onOpen(),"closed"!==this.readyState&&this.resetPingTimeout()}},{key:"resetPingTimeout",value:function(){var t=this;clearTimeout(this.pingTimeoutTimer),this.pingTimeoutTimer=setTimeout(function(){t.onClose("ping timeout")},this.pingInterval+this.pingTimeout)}},{key:"onDrain",value:function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emit("drain"):this.flush()}},{key:"flush",value:function(){"closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))}},{key:"write",value:function(t,e,n){return this.sendPacket("message",t,e,n),this}},{key:"send",value:function(t,e,n){return this.sendPacket("message",t,e,n),this}},{key:"sendPacket",value:function(t,e,n,r){if("function"==typeof e&&(r=e,e=void 0),"function"==typeof n&&(r=n,n=null),"closing"!==this.readyState&&"closed"!==this.readyState){(n=n||{}).compress=!1!==n.compress;var o={type:t,data:e,options:n};this.emit("packetCreate",o),this.writeBuffer.push(o),r&&this.once("flush",r),this.flush()}}},{key:"close",value:function(){var t=this;function e(){t.onClose("forced close"),t.transport.close()}function n(){t.removeListener("upgrade",n),t.removeListener("upgradeError",n),e()}function r(){t.once("upgrade",n),t.once("upgradeError",n)}return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",function(){this.upgrading?r():e()}):this.upgrading?r():e()),this}},{key:"onError",value:function(t){l.priorWebsocketSuccess=!1,this.emit("error",t),this.onClose("transport error",t)}},{key:"onClose",value:function(t,e){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),this.readyState="closed",this.id=null,this.emit("close",t,e),this.writeBuffer=[],this.prevBufferLen=0)}},{key:"filterUpgrades",value:function(t){for(var e=[],n=0,r=t.length;n<r;n++)~this.transports.indexOf(t[n])&&e.push(t[n]);return e}}])&&s(e.prototype,n),u&&s(e,u),l}(l);v.priorWebsocketSuccess=!1,v.protocol=h.protocol,t.exports=v},function(t,e){try{t.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){t.exports=!1}},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(){return(o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function c(t,e,n){return e&&s(t.prototype,e),n&&s(t,n),t}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&u(t,e)}function u(t,e){return(u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function f(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var n,r=l(t);if(e){var o=l(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return p(this,n)}}function p(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=n(9),y=n(10),d=n(0),v=n(13).pick,b=n(2);function m(){}var g=null!=new h({xdomain:!1}).responseType,k=function(t){a(n,t);var e=f(n);function n(t){var r;if(i(this,n),r=e.call(this,t),"undefined"!=typeof location){var o="https:"===location.protocol,s=location.port;s||(s=o?443:80),r.xd="undefined"!=typeof location&&t.hostname!==location.hostname||s!==t.port,r.xs=t.secure!==o}var c=t&&t.forceBase64;return r.supportsBinary=g&&!c,r}return c(n,[{key:"request",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return o(t,{xd:this.xd,xs:this.xs},this.opts),new w(this.uri(),t)}},{key:"doWrite",value:function(t,e){var n=this.request({method:"POST",data:t}),r=this;n.on("success",e),n.on("error",function(t){r.onError("xhr post error",t)})}},{key:"doPoll",value:function(){var t=this.request(),e=this;t.on("data",function(t){e.onData(t)}),t.on("error",function(t){e.onError("xhr poll error",t)}),this.pollXhr=t}}]),n}(y),w=function(t){a(n,t);var e=f(n);function n(t,r){var o;return i(this,n),(o=e.call(this)).opts=r,o.method=r.method||"GET",o.uri=t,o.async=!1!==r.async,o.data=void 0!==r.data?r.data:null,o.create(),o}return c(n,[{key:"create",value:function(){var t=v(this.opts,"agent","enablesXDR","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized");t.xdomain=!!this.opts.xd,t.xscheme=!!this.opts.xs;var e=this.xhr=new h(t),r=this;try{e.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders)for(var o in e.setDisableHeaderCheck&&e.setDisableHeaderCheck(!0),this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(o)&&e.setRequestHeader(o,this.opts.extraHeaders[o])}catch(t){}if("POST"===this.method)try{e.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(t){}try{e.setRequestHeader("Accept","*/*")}catch(t){}"withCredentials"in e&&(e.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(e.timeout=this.opts.requestTimeout),this.hasXDR()?(e.onload=function(){r.onLoad()},e.onerror=function(){r.onError(e.responseText)}):e.onreadystatechange=function(){4===e.readyState&&(200===e.status||1223===e.status?r.onLoad():setTimeout(function(){r.onError("number"==typeof e.status?e.status:0)},0))},e.send(this.data)}catch(t){return void setTimeout(function(){r.onError(t)},0)}"undefined"!=typeof document&&(this.index=n.requestsCount++,n.requests[this.index]=this)}},{key:"onSuccess",value:function(){this.emit("success"),this.cleanup()}},{key:"onData",value:function(t){this.emit("data",t),this.onSuccess()}},{key:"onError",value:function(t){this.emit("error",t),this.cleanup(!0)}},{key:"cleanup",value:function(t){if(void 0!==this.xhr&&null!==this.xhr){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=m:this.xhr.onreadystatechange=m,t)try{this.xhr.abort()}catch(t){}"undefined"!=typeof document&&delete n.requests[this.index],this.xhr=null}}},{key:"onLoad",value:function(){var t=this.xhr.responseText;null!==t&&this.onData(t)}},{key:"hasXDR",value:function(){return"undefined"!=typeof XDomainRequest&&!this.xs&&this.enablesXDR}},{key:"abort",value:function(){this.cleanup()}}]),n}(d);if(w.requestsCount=0,w.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",_);else if("function"==typeof addEventListener){addEventListener("onpagehide"in b?"pagehide":"unload",_,!1)}function _(){for(var t in w.requests)w.requests.hasOwnProperty(t)&&w.requests[t].abort()}t.exports=k,t.exports.Request=w},function(t,e,n){var r=n(11).PACKET_TYPES,o="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),i="function"==typeof ArrayBuffer,s=function(t,e){var n=new FileReader;return n.onload=function(){var t=n.result.split(",")[1];e("b"+t)},n.readAsDataURL(t)};t.exports=function(t,e,n){var c,a=t.type,u=t.data;return o&&u instanceof Blob?e?n(u):s(u,n):i&&(u instanceof ArrayBuffer||(c=u,"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(c):c&&c.buffer instanceof ArrayBuffer))?e?n(u instanceof ArrayBuffer?u:u.buffer):s(new Blob([u]),n):n(r[a]+(u||""))}},function(t,e,n){var r,o=n(11),i=o.PACKET_TYPES_REVERSE,s=o.ERROR_PACKET;"function"==typeof ArrayBuffer&&(r=n(25));var c=function(t,e){if(r){var n=r.decode(t);return a(n,e)}return{base64:!0,data:t}},a=function(t,e){switch(e){case"blob":return t instanceof ArrayBuffer?new Blob([t]):t;case"arraybuffer":default:return t}};t.exports=function(t,e){if("string"!=typeof t)return{type:"message",data:a(t,e)};var n=t.charAt(0);return"b"===n?{type:"message",data:c(t.substring(1),e)}:i[n]?t.length>1?{type:i[n],data:t.substring(1)}:{type:i[n]}:s}},function(t,e){!function(t){"use strict";e.encode=function(e){var n,r=new Uint8Array(e),o=r.length,i="";for(n=0;n<o;n+=3)i+=t[r[n]>>2],i+=t[(3&r[n])<<4|r[n+1]>>4],i+=t[(15&r[n+1])<<2|r[n+2]>>6],i+=t[63&r[n+2]];return o%3==2?i=i.substring(0,i.length-1)+"=":o%3==1&&(i=i.substring(0,i.length-2)+"=="),i},e.decode=function(e){var n,r,o,i,s,c=.75*e.length,a=e.length,u=0;"="===e[e.length-1]&&(c--,"="===e[e.length-2]&&c--);var f=new ArrayBuffer(c),p=new Uint8Array(f);for(n=0;n<a;n+=4)r=t.indexOf(e[n]),o=t.indexOf(e[n+1]),i=t.indexOf(e[n+2]),s=t.indexOf(e[n+3]),p[u++]=r<<2|o>>4,p[u++]=(15&o)<<4|i>>2,p[u++]=(3&i)<<6|63&s;return f}}("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function i(t,e,n){return(i="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=f(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(n):o.value}})(t,e,n||t)}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function c(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var n,r=f(t);if(e){var o=f(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return a(this,n)}}function a(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?u(t):e}function u(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function f(t){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var p,l=n(10),h=n(2),y=/\n/g,d=/\\n/g;function v(){}var b=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&s(t,e)}(l,t);var e,n,r,a=c(l);function l(t){var e;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,l),(e=a.call(this,t)).query=e.query||{},p||(p=h.___eio=h.___eio||[]),e.index=p.length;var n=u(e);return p.push(function(t){n.onData(t)}),e.query.j=e.index,"function"==typeof addEventListener&&addEventListener("beforeunload",function(){n.script&&(n.script.onerror=v)},!1),e}return e=l,(n=[{key:"doClose",value:function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),i(f(l.prototype),"doClose",this).call(this)}},{key:"doPoll",value:function(){var t=this,e=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),e.async=!0,e.src=this.uri(),e.onerror=function(e){t.onError("jsonp poll error",e)};var n=document.getElementsByTagName("script")[0];n?n.parentNode.insertBefore(e,n):(document.head||document.body).appendChild(e),this.script=e,"undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent)&&setTimeout(function(){var t=document.createElement("iframe");document.body.appendChild(t),document.body.removeChild(t)},100)}},{key:"doWrite",value:function(t,e){var n,r=this;if(!this.form){var o=document.createElement("form"),i=document.createElement("textarea"),s=this.iframeId="eio_iframe_"+this.index;o.className="socketio",o.style.position="absolute",o.style.top="-1000px",o.style.left="-1000px",o.target=s,o.method="POST",o.setAttribute("accept-charset","utf-8"),i.name="d",o.appendChild(i),document.body.appendChild(o),this.form=o,this.area=i}function c(){a(),e()}function a(){if(r.iframe)try{r.form.removeChild(r.iframe)}catch(t){r.onError("jsonp polling iframe removal error",t)}try{var t='<iframe src="javascript:0" name="'+r.iframeId+'">';n=document.createElement(t)}catch(t){(n=document.createElement("iframe")).name=r.iframeId,n.src="javascript:0"}n.id=r.iframeId,r.form.appendChild(n),r.iframe=n}this.form.action=this.uri(),a(),t=t.replace(d,"\\\n"),this.area.value=t.replace(y,"\\n");try{this.form.submit()}catch(t){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===r.iframe.readyState&&c()}:this.iframe.onload=c}},{key:"supportsBinary",get:function(){return!1}}])&&o(e.prototype,n),r&&o(e,r),l}(l);t.exports=b},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function s(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var n,r=a(t);if(e){var o=a(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return c(this,n)}}function c(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var u=n(3),f=n(1),p=n(4),l=n(12),h=n(13).pick,y=n(28),d=y.WebSocket,v=y.usingBrowserWebSocket,b=y.defaultBinaryType,m="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),g=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}(a,t);var e,n,r,c=s(a);function a(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),(e=c.call(this,t)).supportsBinary=!t.forceBase64,e}return e=a,(n=[{key:"doOpen",value:function(){if(this.check()){var t=this.uri(),e=this.opts.protocols,n=m?{}:h(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=v&&!m?e?new d(t,e):new d(t):new d(t,e,n)}catch(t){return this.emit("error",t)}this.ws.binaryType=this.socket.binaryType||b,this.addEventListeners()}}},{key:"addEventListeners",value:function(){var t=this;this.ws.onopen=function(){t.onOpen()},this.ws.onclose=function(){t.onClose()},this.ws.onmessage=function(e){t.onData(e.data)},this.ws.onerror=function(e){t.onError("websocket error",e)}}},{key:"write",value:function(t){var e=this;this.writable=!1;for(var n=t.length,r=0,o=n;r<o;r++)!function(t){f.encodePacket(t,e.supportsBinary,function(r){var o={};v||(t.options&&(o.compress=t.options.compress),e.opts.perMessageDeflate&&("string"==typeof r?Buffer.byteLength(r):r.length)<e.opts.perMessageDeflate.threshold&&(o.compress=!1));try{v?e.ws.send(r):e.ws.send(r,o)}catch(t){}--n||(e.emit("flush"),setTimeout(function(){e.writable=!0,e.emit("drain")},0))})}(t[r])}},{key:"onClose",value:function(){u.prototype.onClose.call(this)}},{key:"doClose",value:function(){void 0!==this.ws&&this.ws.close()}},{key:"uri",value:function(){var t=this.query||{},e=this.opts.secure?"wss":"ws",n="";return this.opts.port&&("wss"===e&&443!==Number(this.opts.port)||"ws"===e&&80!==Number(this.opts.port))&&(n=":"+this.opts.port),this.opts.timestampRequests&&(t[this.opts.timestampParam]=l()),this.supportsBinary||(t.b64=1),(t=p.encode(t)).length&&(t="?"+t),e+"://"+(-1!==this.opts.hostname.indexOf(":")?"["+this.opts.hostname+"]":this.opts.hostname)+n+this.opts.path+t}},{key:"check",value:function(){return!(!d||"__initialize"in d&&this.name===a.prototype.name)}},{key:"name",get:function(){return"websocket"}}])&&o(e.prototype,n),r&&o(e,r),a}(u);t.exports=g},function(t,e,n){var r=n(2);t.exports={WebSocket:r.WebSocket||r.MozWebSocket,usingBrowserWebSocket:!0,defaultBinaryType:"arraybuffer"}},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.reconstructPacket=e.deconstructPacket=void 0;var o=n(15);e.deconstructPacket=function(t){var e=[],n=t.data,i=t;return i.data=function t(e,n){if(!e)return e;if(o.isBinary(e)){var i={_placeholder:!0,num:n.length};return n.push(e),i}if(Array.isArray(e)){for(var s=new Array(e.length),c=0;c<e.length;c++)s[c]=t(e[c],n);return s}if("object"===r(e)&&!(e instanceof Date)){var a={};for(var u in e)e.hasOwnProperty(u)&&(a[u]=t(e[u],n));return a}return e}(n,e),i.attachments=e.length,{packet:i,buffers:e}},e.reconstructPacket=function(t,e){return t.data=function t(e,n){if(!e)return e;if(e&&e._placeholder)return n[e.num];if(Array.isArray(e))for(var o=0;o<e.length;o++)e[o]=t(e[o],n);else if("object"===r(e))for(var i in e)e.hasOwnProperty(i)&&(e[i]=t(e[i],n));return e}(t.data,e),t.attachments=void 0,t}},function(t,e){function n(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}t.exports=n,n.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=0==(1&Math.floor(10*e))?t-n:t+n}return 0|Math.min(t,this.max)},n.prototype.reset=function(){this.attempts=0},n.prototype.setMin=function(t){this.ms=t},n.prototype.setMax=function(t){this.max=t},n.prototype.setJitter=function(t){this.jitter=t}}])});(()=>{function e(e,t,n,r){Object.defineProperty(e,t,{get:n,set:r,enumerable:!0,configurable:!0})}function t(e){return e&&e.__esModule?e.default:e}class n{constructor(){this.chunkedMTU=16300,this._dataCount=1,this.chunk=e=>{let t=[],n=e.byteLength,r=Math.ceil(n/this.chunkedMTU),i=0,o=0;for(;o<n;){let s=Math.min(n,o+this.chunkedMTU),a=e.slice(o,s),c={__peerData:this._dataCount,n:i,data:a,total:r};t.push(c),o=s,i++}return this._dataCount++,t}}}class r{append_buffer(e){this.flush(),this._parts.push(e)}append(e){this._pieces.push(e)}flush(){if(this._pieces.length>0){let e=new Uint8Array(this._pieces);this._parts.push(e),this._pieces=[]}}toArrayBuffer(){let e=[];for(let t of this._parts)e.push(t);return function(e){let t=0;for(let n of e)t+=n.byteLength;let n=new Uint8Array(t),r=0;for(let t of e){let e=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);n.set(e,r),r+=t.byteLength}return n}(e).buffer}constructor(){this.encoder=new TextEncoder,this._pieces=[],this._parts=[]}}function i(e){return new s(e).unpack()}function o(e){let t=new a,n=t.pack(e);return n instanceof Promise?n.then(()=>t.getBuffer()):t.getBuffer()}class s{unpack(){let e;let t=this.unpack_uint8();if(t<128)return t;if((224^t)<32)return(224^t)-32;if((e=160^t)<=15)return this.unpack_raw(e);if((e=176^t)<=15)return this.unpack_string(e);if((e=144^t)<=15)return this.unpack_array(e);if((e=128^t)<=15)return this.unpack_map(e);switch(t){case 192:return null;case 193:case 212:case 213:case 214:case 215:return;case 194:return!1;case 195:return!0;case 202:return this.unpack_float();case 203:return this.unpack_double();case 204:return this.unpack_uint8();case 205:return this.unpack_uint16();case 206:return this.unpack_uint32();case 207:return this.unpack_uint64();case 208:return this.unpack_int8();case 209:return this.unpack_int16();case 210:return this.unpack_int32();case 211:return this.unpack_int64();case 216:return e=this.unpack_uint16(),this.unpack_string(e);case 217:return e=this.unpack_uint32(),this.unpack_string(e);case 218:return e=this.unpack_uint16(),this.unpack_raw(e);case 219:return e=this.unpack_uint32(),this.unpack_raw(e);case 220:return e=this.unpack_uint16(),this.unpack_array(e);case 221:return e=this.unpack_uint32(),this.unpack_array(e);case 222:return e=this.unpack_uint16(),this.unpack_map(e);case 223:return e=this.unpack_uint32(),this.unpack_map(e)}}unpack_uint8(){let e=255&this.dataView[this.index];return this.index++,e}unpack_uint16(){let e=this.read(2),t=(255&e[0])*256+(255&e[1]);return this.index+=2,t}unpack_uint32(){let e=this.read(4),t=((256*e[0]+e[1])*256+e[2])*256+e[3];return this.index+=4,t}unpack_uint64(){let e=this.read(8),t=((((((256*e[0]+e[1])*256+e[2])*256+e[3])*256+e[4])*256+e[5])*256+e[6])*256+e[7];return this.index+=8,t}unpack_int8(){let e=this.unpack_uint8();return e<128?e:e-256}unpack_int16(){let e=this.unpack_uint16();return e<32768?e:e-65536}unpack_int32(){let e=this.unpack_uint32();return e<2147483648?e:e-4294967296}unpack_int64(){let e=this.unpack_uint64();return e<0x8000000000000000?e:e-0x10000000000000000}unpack_raw(e){if(this.length<this.index+e)throw Error(`BinaryPackFailure: index is out of range ${this.index} ${e} ${this.length}`);let t=this.dataBuffer.slice(this.index,this.index+e);return this.index+=e,t}unpack_string(e){let t,n;let r=this.read(e),i=0,o="";for(;i<e;)(t=r[i])<160?(n=t,i++):(192^t)<32?(n=(31&t)<<6|63&r[i+1],i+=2):(224^t)<16?(n=(15&t)<<12|(63&r[i+1])<<6|63&r[i+2],i+=3):(n=(7&t)<<18|(63&r[i+1])<<12|(63&r[i+2])<<6|63&r[i+3],i+=4),o+=String.fromCodePoint(n);return this.index+=e,o}unpack_array(e){let t=Array(e);for(let n=0;n<e;n++)t[n]=this.unpack();return t}unpack_map(e){let t={};for(let n=0;n<e;n++)t[this.unpack()]=this.unpack();return t}unpack_float(){let e=this.unpack_uint32();return(0==e>>31?1:-1)*(8388607&e|8388608)*2**((e>>23&255)-127-23)}unpack_double(){let e=this.unpack_uint32(),t=this.unpack_uint32(),n=(e>>20&2047)-1023;return(0==e>>31?1:-1)*((1048575&e|1048576)*2**(n-20)+t*2**(n-52))}read(e){let t=this.index;if(t+e<=this.length)return this.dataView.subarray(t,t+e);throw Error("BinaryPackFailure: read index out of range")}constructor(e){this.index=0,this.dataBuffer=e,this.dataView=new Uint8Array(this.dataBuffer),this.length=this.dataBuffer.byteLength}}class a{getBuffer(){return this._bufferBuilder.toArrayBuffer()}pack(e){if("string"==typeof e)this.pack_string(e);else if("number"==typeof e)Math.floor(e)===e?this.pack_integer(e):this.pack_double(e);else if("boolean"==typeof e)!0===e?this._bufferBuilder.append(195):!1===e&&this._bufferBuilder.append(194);else if(void 0===e)this._bufferBuilder.append(192);else if("object"==typeof e){if(null===e)this._bufferBuilder.append(192);else{let t=e.constructor;if(e instanceof Array){let t=this.pack_array(e);if(t instanceof Promise)return t.then(()=>this._bufferBuilder.flush())}else if(e instanceof ArrayBuffer)this.pack_bin(new Uint8Array(e));else if("BYTES_PER_ELEMENT"in e)this.pack_bin(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));else if(e instanceof Date)this.pack_string(e.toString());else if(e instanceof Blob)return e.arrayBuffer().then(e=>{this.pack_bin(new Uint8Array(e)),this._bufferBuilder.flush()});else if(t==Object||t.toString().startsWith("class")){let t=this.pack_object(e);if(t instanceof Promise)return t.then(()=>this._bufferBuilder.flush())}else throw Error(`Type "${t.toString()}" not yet supported`)}}else throw Error(`Type "${typeof e}" not yet supported`);this._bufferBuilder.flush()}pack_bin(e){let t=e.length;if(t<=15)this.pack_uint8(160+t);else if(t<=65535)this._bufferBuilder.append(218),this.pack_uint16(t);else if(t<=4294967295)this._bufferBuilder.append(219),this.pack_uint32(t);else throw Error("Invalid length");this._bufferBuilder.append_buffer(e)}pack_string(e){let t=this._textEncoder.encode(e),n=t.length;if(n<=15)this.pack_uint8(176+n);else if(n<=65535)this._bufferBuilder.append(216),this.pack_uint16(n);else if(n<=4294967295)this._bufferBuilder.append(217),this.pack_uint32(n);else throw Error("Invalid length");this._bufferBuilder.append_buffer(t)}pack_array(e){let t=e.length;if(t<=15)this.pack_uint8(144+t);else if(t<=65535)this._bufferBuilder.append(220),this.pack_uint16(t);else if(t<=4294967295)this._bufferBuilder.append(221),this.pack_uint32(t);else throw Error("Invalid length");let n=r=>{if(r<t){let t=this.pack(e[r]);return t instanceof Promise?t.then(()=>n(r+1)):n(r+1)}};return n(0)}pack_integer(e){if(e>=-32&&e<=127)this._bufferBuilder.append(255&e);else if(e>=0&&e<=255)this._bufferBuilder.append(204),this.pack_uint8(e);else if(e>=-128&&e<=127)this._bufferBuilder.append(208),this.pack_int8(e);else if(e>=0&&e<=65535)this._bufferBuilder.append(205),this.pack_uint16(e);else if(e>=-32768&&e<=32767)this._bufferBuilder.append(209),this.pack_int16(e);else if(e>=0&&e<=4294967295)this._bufferBuilder.append(206),this.pack_uint32(e);else if(e>=-2147483648&&e<=2147483647)this._bufferBuilder.append(210),this.pack_int32(e);else if(e>=-0x8000000000000000&&e<=0x8000000000000000)this._bufferBuilder.append(211),this.pack_int64(e);else if(e>=0&&e<=0x10000000000000000)this._bufferBuilder.append(207),this.pack_uint64(e);else throw Error("Invalid integer")}pack_double(e){let t=0;e<0&&(t=1,e=-e);let n=Math.floor(Math.log(e)/Math.LN2),r=Math.floor((e/2**n-1)*4503599627370496),i=t<<31|n+1023<<20|r/4294967296&1048575;this._bufferBuilder.append(203),this.pack_int32(i),this.pack_int32(r%4294967296)}pack_object(e){let t=Object.keys(e),n=t.length;if(n<=15)this.pack_uint8(128+n);else if(n<=65535)this._bufferBuilder.append(222),this.pack_uint16(n);else if(n<=4294967295)this._bufferBuilder.append(223),this.pack_uint32(n);else throw Error("Invalid length");let r=n=>{if(n<t.length){let i=t[n];if(e.hasOwnProperty(i)){this.pack(i);let t=this.pack(e[i]);if(t instanceof Promise)return t.then(()=>r(n+1))}return r(n+1)}};return r(0)}pack_uint8(e){this._bufferBuilder.append(e)}pack_uint16(e){this._bufferBuilder.append(e>>8),this._bufferBuilder.append(255&e)}pack_uint32(e){let t=4294967295&e;this._bufferBuilder.append((4278190080&t)>>>24),this._bufferBuilder.append((16711680&t)>>>16),this._bufferBuilder.append((65280&t)>>>8),this._bufferBuilder.append(255&t)}pack_uint64(e){let t=e/4294967296,n=e%4294967296;this._bufferBuilder.append((4278190080&t)>>>24),this._bufferBuilder.append((16711680&t)>>>16),this._bufferBuilder.append((65280&t)>>>8),this._bufferBuilder.append(255&t),this._bufferBuilder.append((4278190080&n)>>>24),this._bufferBuilder.append((16711680&n)>>>16),this._bufferBuilder.append((65280&n)>>>8),this._bufferBuilder.append(255&n)}pack_int8(e){this._bufferBuilder.append(255&e)}pack_int16(e){this._bufferBuilder.append((65280&e)>>8),this._bufferBuilder.append(255&e)}pack_int32(e){this._bufferBuilder.append(e>>>24&255),this._bufferBuilder.append((16711680&e)>>>16),this._bufferBuilder.append((65280&e)>>>8),this._bufferBuilder.append(255&e)}pack_int64(e){let t=Math.floor(e/4294967296),n=e%4294967296;this._bufferBuilder.append((4278190080&t)>>>24),this._bufferBuilder.append((16711680&t)>>>16),this._bufferBuilder.append((65280&t)>>>8),this._bufferBuilder.append(255&t),this._bufferBuilder.append((4278190080&n)>>>24),this._bufferBuilder.append((16711680&n)>>>16),this._bufferBuilder.append((65280&n)>>>8),this._bufferBuilder.append(255&n)}constructor(){this._bufferBuilder=new r,this._textEncoder=new TextEncoder}}let c=!0,l=!0;function p(e,t,n){let r=e.match(t);return r&&r.length>=n&&parseInt(r[n],10)}function d(e,t,n){if(!e.RTCPeerConnection)return;let r=e.RTCPeerConnection.prototype,i=r.addEventListener;r.addEventListener=function(e,r){if(e!==t)return i.apply(this,arguments);let o=e=>{let t=n(e);t&&(r.handleEvent?r.handleEvent(t):r(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(r,o),i.apply(this,[e,o])};let o=r.removeEventListener;r.removeEventListener=function(e,n){if(e!==t||!this._eventMap||!this._eventMap[t]||!this._eventMap[t].has(n))return o.apply(this,arguments);let r=this._eventMap[t].get(n);return this._eventMap[t].delete(n),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,r])},Object.defineProperty(r,"on"+t,{get(){return this["_on"+t]},set(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}function h(e){return"boolean"!=typeof e?Error("Argument type: "+typeof e+". Please use a boolean."):(c=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function u(e){return"boolean"!=typeof e?Error("Argument type: "+typeof e+". Please use a boolean."):(l=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function f(){"object"!=typeof window||c||"undefined"==typeof console||"function"!=typeof console.log||console.log.apply(console,arguments)}function m(e,t){l&&console.warn(e+" is deprecated, please use "+t+" instead.")}function g(e){return"[object Object]"===Object.prototype.toString.call(e)}function y(e,t,n){let r=n?"outbound-rtp":"inbound-rtp",i=new Map;if(null===t)return i;let o=[];return e.forEach(e=>{"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)}),o.forEach(t=>{e.forEach(n=>{n.type===r&&n.trackId===t.id&&function e(t,n,r){!n||r.has(n.id)||(r.set(n.id,n),Object.keys(n).forEach(i=>{i.endsWith("Id")?e(t,t.get(n[i]),r):i.endsWith("Ids")&&n[i].forEach(n=>{e(t,t.get(n),r)})}))}(e,n,i)})}),i}var _,C,v,b,k,S,T,R,w,P,E,D,x,I,M,O,j={};function L(e,t){let n=e&&e.navigator;if(!n.mediaDevices)return;let r=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;let t={};return Object.keys(e).forEach(n=>{if("require"===n||"advanced"===n||"mediaSource"===n)return;let r="object"==typeof e[n]?e[n]:{ideal:e[n]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);let i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==r.ideal){t.optional=t.optional||[];let e={};"number"==typeof r.ideal?(e[i("min",n)]=r.ideal,t.optional.push(e),(e={})[i("max",n)]=r.ideal):e[i("",n)]=r.ideal,t.optional.push(e)}void 0!==r.exact&&"number"!=typeof r.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",n)]=r.exact):["min","max"].forEach(e=>{void 0!==r[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,n)]=r[e])})}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){let t=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])};t((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),t(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=r(e.audio)}if(e&&"object"==typeof e.video){let o=e.video.facingMode;o=o&&("object"==typeof o?o:{ideal:o});let s=t.version<66;if(o&&("user"===o.exact||"environment"===o.exact||"user"===o.ideal||"environment"===o.ideal)&&!(n.mediaDevices.getSupportedConstraints&&n.mediaDevices.getSupportedConstraints().facingMode&&!s)){let t;if(delete e.video.facingMode,"environment"===o.exact||"environment"===o.ideal?t=["back","rear"]:("user"===o.exact||"user"===o.ideal)&&(t=["front"]),t)return n.mediaDevices.enumerateDevices().then(n=>{let s=(n=n.filter(e=>"videoinput"===e.kind)).find(e=>t.some(t=>e.label.toLowerCase().includes(t)));return!s&&n.length&&t.includes("back")&&(s=n[n.length-1]),s&&(e.video.deviceId=o.exact?{exact:s.deviceId}:{ideal:s.deviceId}),e.video=r(e.video),f("chrome: "+JSON.stringify(e)),i(e)})}e.video=r(e.video)}return f("chrome: "+JSON.stringify(e)),i(e)},o=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(n.getUserMedia=function(e,t,r){i(e,e=>{n.webkitGetUserMedia(e,t,e=>{r&&r(o(e))})})}.bind(n),n.mediaDevices.getUserMedia){let e=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(t){return i(t,t=>e(t).then(e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach(e=>{e.stop()}),new DOMException("","NotFoundError");return e},e=>Promise.reject(o(e))))}}}function A(e,t){if((!e.navigator.mediaDevices||!("getDisplayMedia"in e.navigator.mediaDevices))&&e.navigator.mediaDevices){if("function"!=typeof t){console.error("shimGetDisplayMedia: getSourceId argument is not a function");return}e.navigator.mediaDevices.getDisplayMedia=function(n){return t(n).then(t=>{let r=n.video&&n.video.width,i=n.video&&n.video.height,o=n.video&&n.video.frameRate;return n.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},r&&(n.video.mandatory.maxWidth=r),i&&(n.video.mandatory.maxHeight=i),e.navigator.mediaDevices.getUserMedia(n)})}}}function B(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function F(e){if("object"!=typeof e||!e.RTCPeerConnection||"ontrack"in e.RTCPeerConnection.prototype)d(e,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e));else{Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});let t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.track.id):{track:n.track};let i=new Event("track");i.track=n.track,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)}),t.stream.getTracks().forEach(n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.id):{track:n};let i=new Event("track");i.track=n,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)})},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}}function U(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){let t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};let n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){let i=n.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};let r=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){r.apply(this,arguments);let t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}let n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach(e=>{this._senders.push(t(this,e))})};let r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach(e=>{let t=this._senders.find(t=>t.track===e);t&&this._senders.splice(this._senders.indexOf(t),1)})}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){let t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function z(e){if(!e.RTCPeerConnection)return;let t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){let[e,n,r]=arguments;if(arguments.length>0&&"function"==typeof e)return t.apply(this,arguments);if(0===t.length&&(0==arguments.length||"function"!=typeof e))return t.apply(this,[]);let i=function(e){let t={};return e.result().forEach(e=>{let n={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach(t=>{n[t]=e.stat(t)}),t[n.id]=n}),t},o=function(e){return new Map(Object.keys(e).map(t=>[t,e[t]]))};return arguments.length>=2?t.apply(this,[function(e){n(o(i(e)))},e]):new Promise((e,n)=>{t.apply(this,[function(t){e(o(i(t)))},n])}).then(n,r)}}function N(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!("getStats"in e.RTCRtpSender.prototype)){let t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});let n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){let e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){let e=this;return this._pc.getStats().then(t=>y(t,e.track,!0))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){let t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),d(e,"track",e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){let e=this;return this._pc.getStats().then(t=>y(t,e.track,!1))}}if(!("getStats"in e.RTCRtpSender.prototype&&"getStats"in e.RTCRtpReceiver.prototype))return;let t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){let e,t,n;let r=arguments[0];return(this.getSenders().forEach(t=>{t.track===r&&(e?n=!0:e=t)}),this.getReceivers().forEach(e=>(e.track===r&&(t?n=!0:t=e),e.track===r)),n||e&&t)?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):e?e.getStats():t?t.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function $(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(e=>this._shimmedLocalStreams[e][0])};let t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){if(!n)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};let r=t.apply(this,arguments);return this._shimmedLocalStreams[n.id]?-1===this._shimmedLocalStreams[n.id].indexOf(r)&&this._shimmedLocalStreams[n.id].push(r):this._shimmedLocalStreams[n.id]=[n,r],r};let n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException("Track already exists.","InvalidAccessError")});let t=this.getSenders();n.apply(this,arguments);let r=this.getSenders().filter(e=>-1===t.indexOf(e));this._shimmedLocalStreams[e.id]=[e].concat(r)};let r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],r.apply(this,arguments)};let i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach(t=>{let n=this._shimmedLocalStreams[t].indexOf(e);-1!==n&&this._shimmedLocalStreams[t].splice(n,1),1===this._shimmedLocalStreams[t].length&&delete this._shimmedLocalStreams[t]}),i.apply(this,arguments)}}function J(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return $(e);let n=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){let e=n.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map(e=>this._reverseStreams[e.id])};let r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[t.id]){let n=new e.MediaStream(t.getTracks());this._streams[t.id]=n,this._reverseStreams[n.id]=t,t=n}r.apply(this,[t])};let i=e.RTCPeerConnection.prototype.removeStream;function o(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{let r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(RegExp(i.id,"g"),r.id)}),new RTCSessionDescription({type:t.type,sdp:n})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,n){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");let r=[].slice.call(arguments,1);if(1!==r.length||!r[0].getTracks().find(e=>e===t))throw new DOMException("The adapter.js addTrack polyfill only supports a single  stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(e=>e.track===t))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};let i=this._streams[n.id];if(i)i.addTrack(t),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{let r=new e.MediaStream([t]);this._streams[n.id]=r,this._reverseStreams[r.id]=n,this.addStream(r)}return this.getSenders().find(e=>e.track===t)},["createOffer","createAnswer"].forEach(function(t){let n=e.RTCPeerConnection.prototype[t];e.RTCPeerConnection.prototype[t]={[t](){let e=arguments,t=arguments.length&&"function"==typeof arguments[0];return t?n.apply(this,[t=>{let n=o(this,t);e[0].apply(null,[n])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):n.apply(this,arguments).then(e=>o(this,e))}}[t]});let s=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){var e,t;let n;return arguments.length&&arguments[0].type&&(arguments[0]=(e=this,t=arguments[0],n=t.sdp,Object.keys(e._reverseStreams||[]).forEach(t=>{let r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(RegExp(r.id,"g"),i.id)}),new RTCSessionDescription({type:t.type,sdp:n}))),s.apply(this,arguments)};let a=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){let e=a.get.apply(this);return""===e.type?e:o(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){let t;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(e._pc!==this)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{},Object.keys(this._streams).forEach(n=>{this._streams[n].getTracks().find(t=>e.track===t)&&(t=this._streams[n])}),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function V(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){let n=e.RTCPeerConnection.prototype[t];e.RTCPeerConnection.prototype[t]={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}}[t]})}function G(e,t){d(e,"negotiationneeded",e=>{let n=e.target;if(!(t.version<72)&&(!n.getConfiguration||"plan-b"!==n.getConfiguration().sdpSemantics)||"stable"===n.signalingState)return e})}e(j,"shimMediaStream",()=>B),e(j,"shimOnTrack",()=>F),e(j,"shimGetSendersWithDtmf",()=>U),e(j,"shimGetStats",()=>z),e(j,"shimSenderReceiverGetStats",()=>N),e(j,"shimAddTrackRemoveTrackWithNative",()=>$),e(j,"shimAddTrackRemoveTrack",()=>J),e(j,"shimPeerConnection",()=>V),e(j,"fixNegotiationNeeded",()=>G),e(j,"shimGetUserMedia",()=>L),e(j,"shimGetDisplayMedia",()=>A);var W={};function H(e,t){let n=e&&e.navigator,r=e&&e.MediaStreamTrack;if(n.getUserMedia=function(e,t,r){m("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(e).then(t,r)},!(t.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){let e=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])},t=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(n){return"object"==typeof n&&"object"==typeof n.audio&&(e((n=JSON.parse(JSON.stringify(n))).audio,"autoGainControl","mozAutoGainControl"),e(n.audio,"noiseSuppression","mozNoiseSuppression")),t(n)},r&&r.prototype.getSettings){let t=r.prototype.getSettings;r.prototype.getSettings=function(){let n=t.apply(this,arguments);return e(n,"mozAutoGainControl","autoGainControl"),e(n,"mozNoiseSuppression","noiseSuppression"),n}}if(r&&r.prototype.applyConstraints){let t=r.prototype.applyConstraints;r.prototype.applyConstraints=function(n){return"audio"===this.kind&&"object"==typeof n&&(e(n=JSON.parse(JSON.stringify(n)),"autoGainControl","mozAutoGainControl"),e(n,"noiseSuppression","mozNoiseSuppression")),t.apply(this,[n])}}}}function Y(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||!e.navigator.mediaDevices||(e.navigator.mediaDevices.getDisplayMedia=function(n){if(!(n&&n.video)){let e=new DOMException("getDisplayMedia without video constraints is undefined");return e.name="NotFoundError",e.code=8,Promise.reject(e)}return!0===n.video?n.video={mediaSource:t}:n.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(n)})}function K(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function X(e,t){if("object"!=typeof e||!(e.RTCPeerConnection||e.mozRTCPeerConnection))return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){let n=e.RTCPeerConnection.prototype[t];e.RTCPeerConnection.prototype[t]={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}}[t]});let n={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},r=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){let[e,i,o]=arguments;return r.apply(this,[e||null]).then(e=>{if(t.version<53&&!i)try{e.forEach(e=>{e.type=n[e.type]||e.type})}catch(t){if("TypeError"!==t.name)throw t;e.forEach((t,r)=>{e.set(r,Object.assign({},t,{type:n[t.type]||t.type}))})}return e}).then(i,o)}}function q(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender)||e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype)return;let t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});let n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){let e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function Q(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender)||e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype)return;let t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),d(e,"track",e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function Z(e){!e.RTCPeerConnection||"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){m("removeStream","removeTrack"),this.getSenders().forEach(t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)})})}function ee(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function et(e){if(!("object"==typeof e&&e.RTCPeerConnection))return;let t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let e=arguments[1]&&arguments[1].sendEncodings;void 0===e&&(e=[]);let n=(e=[...e]).length>0;n&&e.forEach(e=>{if("rid"in e&&!/^[a-z0-9]{0,16}$/i.test(e.rid))throw TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw RangeError("max_framerate must be >= 0.0")});let r=t.apply(this,arguments);if(n){let{sender:t}=r,n=t.getParameters();"encodings"in n&&(1!==n.encodings.length||0!==Object.keys(n.encodings[0]).length)||(n.encodings=e,t.sendEncodings=e,this.setParametersPromises.push(t.setParameters(n).then(()=>{delete t.sendEncodings}).catch(()=>{delete t.sendEncodings})))}return r})}function en(e){if(!("object"==typeof e&&e.RTCRtpSender))return;let t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){let e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function er(e){if(!("object"==typeof e&&e.RTCPeerConnection))return;let t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}function ei(e){if(!("object"==typeof e&&e.RTCPeerConnection))return;let t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}e(W,"shimOnTrack",()=>K),e(W,"shimPeerConnection",()=>X),e(W,"shimSenderGetStats",()=>q),e(W,"shimReceiverGetStats",()=>Q),e(W,"shimRemoveStream",()=>Z),e(W,"shimRTCDataChannel",()=>ee),e(W,"shimAddTransceiver",()=>et),e(W,"shimGetParameters",()=>en),e(W,"shimCreateOffer",()=>er),e(W,"shimCreateAnswer",()=>ei),e(W,"shimGetUserMedia",()=>H),e(W,"shimGetDisplayMedia",()=>Y);var eo={};function es(e){if("object"==typeof e&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){let t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach(n=>t.call(this,n,e)),e.getVideoTracks().forEach(n=>t.call(this,n,e))},e.RTCPeerConnection.prototype.addTrack=function(e,...n){return n&&n.forEach(e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]}),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);let t=this._localStreams.indexOf(e);if(-1===t)return;this._localStreams.splice(t,1);let n=e.getTracks();this.getSenders().forEach(e=>{n.includes(e.track)&&this.removeTrack(e)})})}}function ea(e){if("object"==typeof e&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=e=>{e.streams.forEach(e=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(e))return;this._remoteStreams.push(e);let t=new Event("addstream");t.stream=e,this.dispatchEvent(t)})})}});let t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){let e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach(t=>{if(e._remoteStreams||(e._remoteStreams=[]),e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);let n=new Event("addstream");n.stream=t,e.dispatchEvent(n)})}),t.apply(e,arguments)}}}function ec(e){if("object"!=typeof e||!e.RTCPeerConnection)return;let t=e.RTCPeerConnection.prototype,n=t.createOffer,r=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,s=t.addIceCandidate;t.createOffer=function(e,t){let r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){let n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i};let a=function(e,t,n){let r=i.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r};t.setLocalDescription=a,a=function(e,t,n){let r=o.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.setRemoteDescription=a,a=function(e,t,n){let r=s.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.addIceCandidate=a}function el(e){let t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){let e=t.mediaDevices,n=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>n(ep(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,n,r){t.mediaDevices.getUserMedia(e).then(n,r)}.bind(t))}function ep(e){return e&&void 0!==e.video?Object.assign({},e,{video:function e(t){return g(t)?Object.keys(t).reduce(function(n,r){let i=g(t[r]),o=i?e(t[r]):t[r],s=i&&!Object.keys(o).length;return void 0===o||s?n:Object.assign(n,{[r]:o})},{}):t}(e.video)}):e}function ed(e){if(!e.RTCPeerConnection)return;let t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,n){if(e&&e.iceServers){let t=[];for(let n=0;n<e.iceServers.length;n++){let r=e.iceServers[n];void 0===r.urls&&r.url?(m("RTCIceServer.url","RTCIceServer.urls"),(r=JSON.parse(JSON.stringify(r))).urls=r.url,delete r.url,t.push(r)):t.push(e.iceServers[n])}e.iceServers=t}return new t(e,n)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:()=>t.generateCertificate})}function eh(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function eu(e){let t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);let t=this.getTransceivers().find(e=>"audio"===e.receiver.track.kind);!1===e.offerToReceiveAudio&&t?"sendrecv"===t.direction?t.setDirection?t.setDirection("sendonly"):t.direction="sendonly":"recvonly"===t.direction&&(t.setDirection?t.setDirection("inactive"):t.direction="inactive"):!0!==e.offerToReceiveAudio||t||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);let n=this.getTransceivers().find(e=>"video"===e.receiver.track.kind);!1===e.offerToReceiveVideo&&n?"sendrecv"===n.direction?n.setDirection?n.setDirection("sendonly"):n.direction="sendonly":"recvonly"===n.direction&&(n.setDirection?n.setDirection("inactive"):n.direction="inactive"):!0!==e.offerToReceiveVideo||n||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function ef(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}e(eo,"shimLocalStreamsAPI",()=>es),e(eo,"shimRemoteStreamsAPI",()=>ea),e(eo,"shimCallbacksAPI",()=>ec),e(eo,"shimGetUserMedia",()=>el),e(eo,"shimConstraints",()=>ep),e(eo,"shimRTCIceServerUrls",()=>ed),e(eo,"shimTrackEventTransceiver",()=>eh),e(eo,"shimCreateOfferLegacy",()=>eu),e(eo,"shimAudioContext",()=>ef);var em={};e(em,"shimRTCIceCandidate",()=>e_),e(em,"shimRTCIceCandidateRelayProtocol",()=>eC),e(em,"shimMaxMessageSize",()=>ev),e(em,"shimSendThrowTypeError",()=>eb),e(em,"shimConnectionState",()=>ek),e(em,"removeExtmapAllowMixed",()=>eS),e(em,"shimAddIceCandidateNullOrEmpty",()=>eT),e(em,"shimParameterlessSetLocalDescription",()=>eR);var eg={};let ey={};function e_(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)return;let n=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==typeof e&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substring(2)),e.candidate&&e.candidate.length){let r=new n(e),i=t(eg).parseCandidate(e.candidate);for(let e in i)e in r||Object.defineProperty(r,e,{value:i[e]});return r.toJSON=function(){return{candidate:r.candidate,sdpMid:r.sdpMid,sdpMLineIndex:r.sdpMLineIndex,usernameFragment:r.usernameFragment}},r}return new n(e)},e.RTCIceCandidate.prototype=n.prototype,d(e,"icecandidate",t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t))}function eC(e){!e.RTCIceCandidate||e.RTCIceCandidate&&"relayProtocol"in e.RTCIceCandidate.prototype||d(e,"icecandidate",e=>{if(e.candidate){let n=t(eg).parseCandidate(e.candidate.candidate);"relay"===n.type&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[n.priority>>24])}return e})}function ev(e,n){if(!e.RTCPeerConnection)return;"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});let r=function(e){if(!e||!e.sdp)return!1;let n=t(eg).splitSections(e.sdp);return n.shift(),n.some(e=>{let n=t(eg).parseMLine(e);return n&&"application"===n.kind&&-1!==n.protocol.indexOf("SCTP")})},i=function(e){let t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;let n=parseInt(t[1],10);return n!=n?-1:n},o=function(e){let t=65536;return"firefox"===n.browser&&(t=n.version<57?-1===e?16384:2147483637:n.version<60?57===n.version?65535:65536:2147483637),t},s=function(e,r){let i=65536;"firefox"===n.browser&&57===n.version&&(i=65535);let o=t(eg).matchPrefix(e.sdp,"a=max-message-size:");return o.length>0?i=parseInt(o[0].substring(19),10):"firefox"===n.browser&&-1!==r&&(i=2147483637),i},a=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===n.browser&&n.version>=76){let{sdpSemantics:e}=this.getConfiguration();"plan-b"===e&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(r(arguments[0])){let e;let t=i(arguments[0]),n=o(t),r=s(arguments[0],t);e=0===n&&0===r?Number.POSITIVE_INFINITY:0===n||0===r?Math.max(n,r):Math.min(n,r);let a={};Object.defineProperty(a,"maxMessageSize",{get:()=>e}),this._sctp=a}return a.apply(this,arguments)}}function eb(e){if(!(e.RTCPeerConnection&&"createDataChannel"in e.RTCPeerConnection.prototype))return;function t(e,t){let n=e.send;e.send=function(){let r=arguments[0],i=r.length||r.size||r.byteLength;if("open"===e.readyState&&t.sctp&&i>t.sctp.maxMessageSize)throw TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return n.apply(e,arguments)}}let n=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){let e=n.apply(this,arguments);return t(e,this),e},d(e,"datachannel",e=>(t(e.channel,e.target),e))}function ek(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;let t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(e=>{let n=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=e=>{let t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;let n=new Event("connectionstatechange",e);t.dispatchEvent(n)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),n.apply(this,arguments)}})}function eS(e,t){if(!e.RTCPeerConnection||"chrome"===t.browser&&t.version>=71||"safari"===t.browser&&t.version>=605)return;let n=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){let n=t.sdp.split("\n").filter(e=>"a=extmap-allow-mixed"!==e.trim()).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:n}):t.sdp=n}return n.apply(this,arguments)}}function eT(e,t){if(!(e.RTCPeerConnection&&e.RTCPeerConnection.prototype))return;let n=e.RTCPeerConnection.prototype.addIceCandidate;n&&0!==n.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():n.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function eR(e,t){if(!(e.RTCPeerConnection&&e.RTCPeerConnection.prototype))return;let n=e.RTCPeerConnection.prototype.setLocalDescription;n&&0!==n.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){let e=arguments[0]||{};if("object"!=typeof e||e.type&&e.sdp)return n.apply(this,arguments);if(!(e={type:e.type,sdp:e.sdp}).type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":e.type="offer";break;default:e.type="answer"}return e.sdp||"offer"!==e.type&&"answer"!==e.type?n.apply(this,[e]):("offer"===e.type?this.createOffer:this.createAnswer).apply(this).then(e=>n.apply(this,[e]))})}ey.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)},ey.localCName=ey.generateIdentifier(),ey.splitLines=function(e){return e.trim().split("\n").map(e=>e.trim())},ey.splitSections=function(e){return e.split("\nm=").map((e,t)=>(t>0?"m="+e:e).trim()+"\r\n")},ey.getDescription=function(e){let t=ey.splitSections(e);return t&&t[0]},ey.getMediaSections=function(e){let t=ey.splitSections(e);return t.shift(),t},ey.matchPrefix=function(e,t){return ey.splitLines(e).filter(e=>0===e.indexOf(t))},ey.parseCandidate=function(e){let t;let n={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]};for(let e=8;e<t.length;e+=2)switch(t[e]){case"raddr":n.relatedAddress=t[e+1];break;case"rport":n.relatedPort=parseInt(t[e+1],10);break;case"tcptype":n.tcpType=t[e+1];break;case"ufrag":n.ufrag=t[e+1],n.usernameFragment=t[e+1];break;default:void 0===n[t[e]]&&(n[t[e]]=t[e+1])}return n},ey.writeCandidate=function(e){let t=[];t.push(e.foundation);let n=e.component;"rtp"===n?t.push(1):"rtcp"===n?t.push(2):t.push(n),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);let r=e.type;return t.push("typ"),t.push(r),"host"!==r&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},ey.parseIceOptions=function(e){return e.substring(14).split(" ")},ey.parseRtpMap=function(e){let t=e.substring(9).split(" "),n={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),n.name=t[0],n.clockRate=parseInt(t[1],10),n.channels=3===t.length?parseInt(t[2],10):1,n.numChannels=n.channels,n},ey.writeRtpMap=function(e){let t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);let n=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==n?"/"+n:"")+"\r\n"},ey.parseExtmap=function(e){let t=e.substring(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1],attributes:t.slice(2).join(" ")}},ey.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+(e.attributes?" "+e.attributes:"")+"\r\n"},ey.parseFmtp=function(e){let t;let n={},r=e.substring(e.indexOf(" ")+1).split(";");for(let e=0;e<r.length;e++)n[(t=r[e].trim().split("="))[0].trim()]=t[1];return n},ey.writeFmtp=function(e){let t="",n=e.payloadType;if(void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){let r=[];Object.keys(e.parameters).forEach(t=>{void 0!==e.parameters[t]?r.push(t+"="+e.parameters[t]):r.push(t)}),t+="a=fmtp:"+n+" "+r.join(";")+"\r\n"}return t},ey.parseRtcpFb=function(e){let t=e.substring(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},ey.writeRtcpFb=function(e){let t="",n=e.payloadType;return void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach(e=>{t+="a=rtcp-fb:"+n+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"}),t},ey.parseSsrcMedia=function(e){let t=e.indexOf(" "),n={ssrc:parseInt(e.substring(7,t),10)},r=e.indexOf(":",t);return r>-1?(n.attribute=e.substring(t+1,r),n.value=e.substring(r+1)):n.attribute=e.substring(t+1),n},ey.parseSsrcGroup=function(e){let t=e.substring(13).split(" ");return{semantics:t.shift(),ssrcs:t.map(e=>parseInt(e,10))}},ey.getMid=function(e){let t=ey.matchPrefix(e,"a=mid:")[0];if(t)return t.substring(6)},ey.parseFingerprint=function(e){let t=e.substring(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},ey.getDtlsParameters=function(e,t){return{role:"auto",fingerprints:ey.matchPrefix(e+t,"a=fingerprint:").map(ey.parseFingerprint)}},ey.writeDtlsParameters=function(e,t){let n="a=setup:"+t+"\r\n";return e.fingerprints.forEach(e=>{n+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"}),n},ey.parseCryptoLine=function(e){let t=e.substring(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},ey.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?ey.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},ey.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;let t=e.substring(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},ey.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},ey.getCryptoParameters=function(e,t){return ey.matchPrefix(e+t,"a=crypto:").map(ey.parseCryptoLine)},ey.getIceParameters=function(e,t){let n=ey.matchPrefix(e+t,"a=ice-ufrag:")[0],r=ey.matchPrefix(e+t,"a=ice-pwd:")[0];return n&&r?{usernameFragment:n.substring(12),password:r.substring(10)}:null},ey.writeIceParameters=function(e){let t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},ey.parseRtpParameters=function(e){let t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},n=ey.splitLines(e)[0].split(" ");t.profile=n[2];for(let r=3;r<n.length;r++){let i=n[r],o=ey.matchPrefix(e,"a=rtpmap:"+i+" ")[0];if(o){let n=ey.parseRtpMap(o),r=ey.matchPrefix(e,"a=fmtp:"+i+" ");switch(n.parameters=r.length?ey.parseFmtp(r[0]):{},n.rtcpFeedback=ey.matchPrefix(e,"a=rtcp-fb:"+i+" ").map(ey.parseRtcpFb),t.codecs.push(n),n.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(n.name.toUpperCase())}}}ey.matchPrefix(e,"a=extmap:").forEach(e=>{t.headerExtensions.push(ey.parseExtmap(e))});let r=ey.matchPrefix(e,"a=rtcp-fb:* ").map(ey.parseRtcpFb);return t.codecs.forEach(e=>{r.forEach(t=>{e.rtcpFeedback.find(e=>e.type===t.type&&e.parameter===t.parameter)||e.rtcpFeedback.push(t)})}),t},ey.writeRtpDescription=function(e,t){let n="";n+="m="+e+" "+(t.codecs.length>0?"9":"0")+" "+(t.profile||"UDP/TLS/RTP/SAVPF")+" "+t.codecs.map(e=>void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType).join(" ")+"\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\n",t.codecs.forEach(e=>{n+=ey.writeRtpMap(e)+ey.writeFmtp(e)+ey.writeRtcpFb(e)});let r=0;return t.codecs.forEach(e=>{e.maxptime>r&&(r=e.maxptime)}),r>0&&(n+="a=maxptime:"+r+"\r\n"),t.headerExtensions&&t.headerExtensions.forEach(e=>{n+=ey.writeExtmap(e)}),n},ey.parseRtpEncodingParameters=function(e){let t;let n=[],r=ey.parseRtpParameters(e),i=-1!==r.fecMechanisms.indexOf("RED"),o=-1!==r.fecMechanisms.indexOf("ULPFEC"),s=ey.matchPrefix(e,"a=ssrc:").map(e=>ey.parseSsrcMedia(e)).filter(e=>"cname"===e.attribute),a=s.length>0&&s[0].ssrc,c=ey.matchPrefix(e,"a=ssrc-group:FID").map(e=>e.substring(17).split(" ").map(e=>parseInt(e,10)));c.length>0&&c[0].length>1&&c[0][0]===a&&(t=c[0][1]),r.codecs.forEach(e=>{if("RTX"===e.name.toUpperCase()&&e.parameters.apt){let r={ssrc:a,codecPayloadType:parseInt(e.parameters.apt,10)};a&&t&&(r.rtx={ssrc:t}),n.push(r),i&&((r=JSON.parse(JSON.stringify(r))).fec={ssrc:a,mechanism:o?"red+ulpfec":"red"},n.push(r))}}),0===n.length&&a&&n.push({ssrc:a});let l=ey.matchPrefix(e,"b=");return l.length&&(l=0===l[0].indexOf("b=TIAS:")?parseInt(l[0].substring(7),10):0===l[0].indexOf("b=AS:")?950*parseInt(l[0].substring(5),10)-16e3:void 0,n.forEach(e=>{e.maxBitrate=l})),n},ey.parseRtcpParameters=function(e){let t={},n=ey.matchPrefix(e,"a=ssrc:").map(e=>ey.parseSsrcMedia(e)).filter(e=>"cname"===e.attribute)[0];n&&(t.cname=n.value,t.ssrc=n.ssrc);let r=ey.matchPrefix(e,"a=rtcp-rsize");t.reducedSize=r.length>0,t.compound=0===r.length;let i=ey.matchPrefix(e,"a=rtcp-mux");return t.mux=i.length>0,t},ey.writeRtcpParameters=function(e){let t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},ey.parseMsid=function(e){let t;let n=ey.matchPrefix(e,"a=msid:");if(1===n.length)return{stream:(t=n[0].substring(7).split(" "))[0],track:t[1]};let r=ey.matchPrefix(e,"a=ssrc:").map(e=>ey.parseSsrcMedia(e)).filter(e=>"msid"===e.attribute);if(r.length>0)return{stream:(t=r[0].value.split(" "))[0],track:t[1]}},ey.parseSctpDescription=function(e){let t;let n=ey.parseMLine(e),r=ey.matchPrefix(e,"a=max-message-size:");r.length>0&&(t=parseInt(r[0].substring(19),10)),isNaN(t)&&(t=65536);let i=ey.matchPrefix(e,"a=sctp-port:");if(i.length>0)return{port:parseInt(i[0].substring(12),10),protocol:n.fmt,maxMessageSize:t};let o=ey.matchPrefix(e,"a=sctpmap:");if(o.length>0){let e=o[0].substring(10).split(" ");return{port:parseInt(e[0],10),protocol:e[1],maxMessageSize:t}}},ey.writeSctpDescription=function(e,t){let n=[];return n="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&n.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),n.join("")},ey.generateSessionId=function(){return Math.random().toString().substr(2,22)},ey.writeSessionBoilerplate=function(e,t,n){return"v=0\r\no="+(n||"thisisadapterortc")+" "+(e||ey.generateSessionId())+" "+(void 0!==t?t:2)+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},ey.getDirection=function(e,t){let n=ey.splitLines(e);for(let e=0;e<n.length;e++)switch(n[e]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return n[e].substring(2)}return t?ey.getDirection(t):"sendrecv"},ey.getKind=function(e){return ey.splitLines(e)[0].split(" ")[0].substring(2)},ey.isRejected=function(e){return"0"===e.split(" ",2)[1]},ey.parseMLine=function(e){let t=ey.splitLines(e)[0].substring(2).split(" ");return{kind:t[0],port:parseInt(t[1],10),protocol:t[2],fmt:t.slice(3).join(" ")}},ey.parseOLine=function(e){let t=ey.matchPrefix(e,"o=")[0].substring(2).split(" ");return{username:t[0],sessionId:t[1],sessionVersion:parseInt(t[2],10),netType:t[3],addressType:t[4],address:t[5]}},ey.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;let t=ey.splitLines(e);for(let e=0;e<t.length;e++)if(t[e].length<2||"="!==t[e].charAt(1))return!1;return!0},eg=ey;let ew=function({window:e}={},t={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){let n=function(e){let t={browser:null,version:null};if(void 0===e||!e.navigator||!e.navigator.userAgent)return t.browser="Not a browser.",t;let{navigator:n}=e;return n.mozGetUserMedia?(t.browser="firefox",t.version=p(n.userAgent,/Firefox\/(\d+)\./,1)):n.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection?(t.browser="chrome",t.version=p(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2)):e.RTCPeerConnection&&n.userAgent.match(/AppleWebKit\/(\d+)\./)?(t.browser="safari",t.version=p(n.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype):t.browser="Not a supported browser.",t}(e),r={browserDetails:n,commonShim:em,extractVersion:p,disableLog:h,disableWarnings:u,sdp:eg};switch(n.browser){case"chrome":if(!j||!j.shimPeerConnection||!t.shimChrome){f("Chrome shim is not included in this adapter release.");break}if(null===n.version){f("Chrome shim can not determine version, not shimming.");break}f("adapter.js shimming chrome."),r.browserShim=j,eT(e,n),eR(e,n),j.shimGetUserMedia(e,n),j.shimMediaStream(e,n),j.shimPeerConnection(e,n),j.shimOnTrack(e,n),j.shimAddTrackRemoveTrack(e,n),j.shimGetSendersWithDtmf(e,n),j.shimGetStats(e,n),j.shimSenderReceiverGetStats(e,n),j.fixNegotiationNeeded(e,n),e_(e,n),eC(e,n),ek(e,n),ev(e,n),eb(e,n),eS(e,n);break;case"firefox":if(!W||!W.shimPeerConnection||!t.shimFirefox){f("Firefox shim is not included in this adapter release.");break}f("adapter.js shimming firefox."),r.browserShim=W,eT(e,n),eR(e,n),W.shimGetUserMedia(e,n),W.shimPeerConnection(e,n),W.shimOnTrack(e,n),W.shimRemoveStream(e,n),W.shimSenderGetStats(e,n),W.shimReceiverGetStats(e,n),W.shimRTCDataChannel(e,n),W.shimAddTransceiver(e,n),W.shimGetParameters(e,n),W.shimCreateOffer(e,n),W.shimCreateAnswer(e,n),e_(e,n),ek(e,n),ev(e,n),eb(e,n);break;case"safari":if(!eo||!t.shimSafari){f("Safari shim is not included in this adapter release.");break}f("adapter.js shimming safari."),r.browserShim=eo,eT(e,n),eR(e,n),eo.shimRTCIceServerUrls(e,n),eo.shimCreateOfferLegacy(e,n),eo.shimCallbacksAPI(e,n),eo.shimLocalStreamsAPI(e,n),eo.shimRemoteStreamsAPI(e,n),eo.shimTrackEventTransceiver(e,n),eo.shimGetUserMedia(e,n),eo.shimAudioContext(e,n),e_(e,n),eC(e,n),ev(e,n),eb(e,n),eS(e,n);break;default:f("Unsupported browser!")}return r}({window:"undefined"==typeof window?void 0:window}),eP=ew.default||ew,eE=new class{isWebRTCSupported(){return"undefined"!=typeof RTCPeerConnection}isBrowserSupported(){let e=this.getBrowser(),t=this.getVersion();return!!this.supportedBrowsers.includes(e)&&("chrome"===e?t>=this.minChromeVersion:"firefox"===e?t>=this.minFirefoxVersion:"safari"===e&&!this.isIOS&&t>=this.minSafariVersion)}getBrowser(){return eP.browserDetails.browser}getVersion(){return eP.browserDetails.version||0}isUnifiedPlanSupported(){let e;let t=this.getBrowser(),n=eP.browserDetails.version||0;if("chrome"===t&&n<this.minChromeVersion)return!1;if("firefox"===t&&n>=this.minFirefoxVersion)return!0;if(!window.RTCRtpTransceiver||!("currentDirection"in RTCRtpTransceiver.prototype))return!1;let r=!1;try{(e=new RTCPeerConnection).addTransceiver("audio"),r=!0}catch(e){}finally{e&&e.close()}return r}toString(){return`Supports:
    browser:${this.getBrowser()}
    version:${this.getVersion()}
    isIOS:${this.isIOS}
    isWebRTCSupported:${this.isWebRTCSupported()}
    isBrowserSupported:${this.isBrowserSupported()}
    isUnifiedPlanSupported:${this.isUnifiedPlanSupported()}`}constructor(){this.isIOS=["iPad","iPhone","iPod"].includes(navigator.platform),this.supportedBrowsers=["firefox","chrome","safari"],this.minFirefoxVersion=59,this.minChromeVersion=72,this.minSafariVersion=605}},eD=e=>!e||/^[A-Za-z0-9]+(?:[ _-][A-Za-z0-9]+)*$/.test(e),ex=()=>Math.random().toString(36).slice(2),eI={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:["turn:eu-0.turn.peerjs.com:3478","turn:us-0.turn.peerjs.com:3478"],username:"peerjs",credential:"peerjsp"}],sdpSemantics:"unified-plan"},eM=new class extends n{noop(){}blobToArrayBuffer(e,t){let n=new FileReader;return n.onload=function(e){e.target&&t(e.target.result)},n.readAsArrayBuffer(e),n}binaryStringToArrayBuffer(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=255&e.charCodeAt(n);return t.buffer}isSecure(){return"https:"===location.protocol}constructor(...e){super(...e),this.CLOUD_HOST="0.peerjs.com",this.CLOUD_PORT=443,this.chunkedBrowsers={Chrome:1,chrome:1},this.defaultConfig=eI,this.browser=eE.getBrowser(),this.browserVersion=eE.getVersion(),this.pack=o,this.unpack=i,this.supports=function(){let e;let t={browser:eE.isBrowserSupported(),webRTC:eE.isWebRTCSupported(),audioVideo:!1,data:!1,binaryBlob:!1,reliable:!1};if(!t.webRTC)return t;try{let n;e=new RTCPeerConnection(eI),t.audioVideo=!0;try{n=e.createDataChannel("_PEERJSTEST",{ordered:!0}),t.data=!0,t.reliable=!!n.ordered;try{n.binaryType="blob",t.binaryBlob=!eE.isIOS}catch(e){}}catch(e){}finally{n&&n.close()}}catch(e){}finally{e&&e.close()}return t}(),this.validateId=eD,this.randomToken=ex}};(_=w||(w={}))[_.Disabled=0]="Disabled",_[_.Errors=1]="Errors",_[_.Warnings=2]="Warnings",_[_.All=3]="All";var eO=new class{get logLevel(){return this._logLevel}set logLevel(e){this._logLevel=e}log(...e){this._logLevel>=3&&this._print(3,...e)}warn(...e){this._logLevel>=2&&this._print(2,...e)}error(...e){this._logLevel>=1&&this._print(1,...e)}setLogFunction(e){this._print=e}_print(e,...t){let n=["PeerJS: ",...t];for(let e in n)n[e]instanceof Error&&(n[e]="("+n[e].name+") "+n[e].message);e>=3?console.log(...n):e>=2?console.warn("WARNING",...n):e>=1&&console.error("ERROR",...n)}constructor(){this._logLevel=0}},ej={},eL=Object.prototype.hasOwnProperty,eA="~";function eB(){}function eF(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function eU(e,t,n,r,i){if("function"!=typeof n)throw TypeError("The listener must be a function");var o=new eF(n,r||e,i),s=eA?eA+t:t;return e._events[s]?e._events[s].fn?e._events[s]=[e._events[s],o]:e._events[s].push(o):(e._events[s]=o,e._eventsCount++),e}function ez(e,t){0==--e._eventsCount?e._events=new eB:delete e._events[t]}function eN(){this._events=new eB,this._eventsCount=0}Object.create&&(eB.prototype=Object.create(null),(new eB).__proto__||(eA=!1)),eN.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)eL.call(e,t)&&n.push(eA?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},eN.prototype.listeners=function(e){var t=eA?eA+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,i=n.length,o=Array(i);r<i;r++)o[r]=n[r].fn;return o},eN.prototype.listenerCount=function(e){var t=eA?eA+e:e,n=this._events[t];return n?n.fn?1:n.length:0},eN.prototype.emit=function(e,t,n,r,i,o){var s=eA?eA+e:e;if(!this._events[s])return!1;var a,c,l=this._events[s],p=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),p){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,n),!0;case 4:return l.fn.call(l.context,t,n,r),!0;case 5:return l.fn.call(l.context,t,n,r,i),!0;case 6:return l.fn.call(l.context,t,n,r,i,o),!0}for(c=1,a=Array(p-1);c<p;c++)a[c-1]=arguments[c];l.fn.apply(l.context,a)}else{var d,h=l.length;for(c=0;c<h;c++)switch(l[c].once&&this.removeListener(e,l[c].fn,void 0,!0),p){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,t);break;case 3:l[c].fn.call(l[c].context,t,n);break;case 4:l[c].fn.call(l[c].context,t,n,r);break;default:if(!a)for(d=1,a=Array(p-1);d<p;d++)a[d-1]=arguments[d];l[c].fn.apply(l[c].context,a)}}return!0},eN.prototype.on=function(e,t,n){return eU(this,e,t,n,!1)},eN.prototype.once=function(e,t,n){return eU(this,e,t,n,!0)},eN.prototype.removeListener=function(e,t,n,r){var i=eA?eA+e:e;if(!this._events[i])return this;if(!t)return ez(this,i),this;var o=this._events[i];if(o.fn)o.fn!==t||r&&!o.once||n&&o.context!==n||ez(this,i);else{for(var s=0,a=[],c=o.length;s<c;s++)(o[s].fn!==t||r&&!o[s].once||n&&o[s].context!==n)&&a.push(o[s]);a.length?this._events[i]=1===a.length?a[0]:a:ez(this,i)}return this},eN.prototype.removeAllListeners=function(e){var t;return e?(t=eA?eA+e:e,this._events[t]&&ez(this,t)):(this._events=new eB,this._eventsCount=0),this},eN.prototype.off=eN.prototype.removeListener,eN.prototype.addListener=eN.prototype.on,eN.prefixed=eA,eN.EventEmitter=eN,ej=eN,(C=P||(P={})).Data="data",C.Media="media",(v=E||(E={})).BrowserIncompatible="browser-incompatible",v.Disconnected="disconnected",v.InvalidID="invalid-id",v.InvalidKey="invalid-key",v.Network="network",v.PeerUnavailable="peer-unavailable",v.SslUnavailable="ssl-unavailable",v.ServerError="server-error",v.SocketError="socket-error",v.SocketClosed="socket-closed",v.UnavailableID="unavailable-id",v.WebRTC="webrtc",(b=D||(D={})).NegotiationFailed="negotiation-failed",b.ConnectionClosed="connection-closed",(k=x||(x={})).NotOpenYet="not-open-yet",k.MessageToBig="message-too-big",(S=I||(I={})).Binary="binary",S.BinaryUTF8="binary-utf8",S.JSON="json",S.None="raw",(T=M||(M={})).Message="message",T.Disconnected="disconnected",T.Error="error",T.Close="close",(R=O||(O={})).Heartbeat="HEARTBEAT",R.Candidate="CANDIDATE",R.Offer="OFFER",R.Answer="ANSWER",R.Open="OPEN",R.Error="ERROR",R.IdTaken="ID-TAKEN",R.InvalidKey="INVALID-KEY",R.Leave="LEAVE",R.Expire="EXPIRE";var e$={};e$=JSON.parse('{"name":"peerjs","version":"1.5.2","keywords":["peerjs","webrtc","p2p","rtc"],"description":"PeerJS client","homepage":"https://peerjs.com","bugs":{"url":"https://github.com/peers/peerjs/issues"},"repository":{"type":"git","url":"https://github.com/peers/peerjs"},"license":"MIT","contributors":["Michelle Bu <michelle@michellebu.com>","afrokick <devbyru@gmail.com>","ericz <really.ez@gmail.com>","Jairo <kidandcat@gmail.com>","Jonas Gloning <34194370+jonasgloning@users.noreply.github.com>","Jairo Caro-Accino Viciana <jairo@galax.be>","Carlos Caballero <carlos.caballero.gonzalez@gmail.com>","hc <hheennrryy@gmail.com>","Muhammad Asif <capripio@gmail.com>","PrashoonB <prashoonbhattacharjee@gmail.com>","Harsh Bardhan Mishra <47351025+HarshCasper@users.noreply.github.com>","akotynski <aleksanderkotbury@gmail.com>","lmb <i@lmb.io>","Jairooo <jairocaro@msn.com>","Moritz Stückler <moritz.stueckler@gmail.com>","Simon <crydotsnakegithub@gmail.com>","Denis Lukov <denismassters@gmail.com>","Philipp Hancke <fippo@andyet.net>","Hans Oksendahl <hansoksendahl@gmail.com>","Jess <jessachandler@gmail.com>","khankuan <khankuan@gmail.com>","DUODVK <kurmanov.work@gmail.com>","XiZhao <kwang1imsa@gmail.com>","Matthias Lohr <matthias@lohr.me>","=frank tree <=frnktrb@googlemail.com>","Andre Eckardt <aeckardt@outlook.com>","Chris Cowan <agentme49@gmail.com>","Alex Chuev <alex@chuev.com>","alxnull <alxnull@e.mail.de>","Yemel Jardi <angel.jardi@gmail.com>","Ben Parnell <benjaminparnell.94@gmail.com>","Benny Lichtner <bennlich@gmail.com>","fresheneesz <bitetrudpublic@gmail.com>","bob.barstead@exaptive.com <bob.barstead@exaptive.com>","chandika <chandika@gmail.com>","emersion <contact@emersion.fr>","Christopher Van <cvan@users.noreply.github.com>","eddieherm <edhermoso@gmail.com>","Eduardo Pinho <enet4mikeenet@gmail.com>","Evandro Zanatta <ezanatta@tray.net.br>","Gardner Bickford <gardner@users.noreply.github.com>","Gian Luca <gianluca.cecchi@cynny.com>","PatrickJS <github@gdi2290.com>","jonnyf <github@jonathanfoss.co.uk>","Hizkia Felix <hizkifw@gmail.com>","Hristo Oskov <hristo.oskov@gmail.com>","Isaac Madwed <i.madwed@gmail.com>","Ilya Konanykhin <ilya.konanykhin@gmail.com>","jasonbarry <jasbarry@me.com>","Jonathan Burke <jonathan.burke.1311@googlemail.com>","Josh Hamit <josh.hamit@gmail.com>","Jordan Austin <jrax86@gmail.com>","Joel Wetzell <jwetzell@yahoo.com>","xizhao <kevin.wang@cloudera.com>","Alberto Torres <kungfoobar@gmail.com>","Jonathan Mayol <mayoljonathan@gmail.com>","Jefferson Felix <me@jsfelix.dev>","Rolf Erik Lekang <me@rolflekang.com>","Kevin Mai-Husan Chia <mhchia@users.noreply.github.com>","Pepijn de Vos <pepijndevos@gmail.com>","JooYoung <qkdlql@naver.com>","Tobias Speicher <rootcommander@gmail.com>","Steve Blaurock <sblaurock@gmail.com>","Kyrylo Shegeda <shegeda@ualberta.ca>","Diwank Singh Tomer <singh@diwank.name>","Sören Balko <Soeren.Balko@gmail.com>","Arpit Solanki <solankiarpit1997@gmail.com>","Yuki Ito <yuki@gnnk.net>","Artur Zayats <zag2art@gmail.com>"],"funding":{"type":"opencollective","url":"https://opencollective.com/peer"},"collective":{"type":"opencollective","url":"https://opencollective.com/peer"},"files":["dist/*"],"sideEffects":["lib/global.ts","lib/supports.ts"],"main":"dist/bundler.cjs","module":"dist/bundler.mjs","browser-minified":"dist/peerjs.min.js","browser-unminified":"dist/peerjs.js","browser-minified-cbor":"dist/serializer.cbor.mjs","browser-minified-msgpack":"dist/serializer.msgpack.mjs","types":"dist/types.d.ts","engines":{"node":">= 14"},"targets":{"types":{"source":"lib/exports.ts"},"main":{"source":"lib/exports.ts","sourceMap":{"inlineSources":true}},"module":{"source":"lib/exports.ts","includeNodeModules":["eventemitter3"],"sourceMap":{"inlineSources":true}},"browser-minified":{"context":"browser","outputFormat":"global","optimize":true,"engines":{"browsers":"chrome >= 83, edge >= 83, firefox >= 80, safari >= 15"},"source":"lib/global.ts"},"browser-unminified":{"context":"browser","outputFormat":"global","optimize":false,"engines":{"browsers":"chrome >= 83, edge >= 83, firefox >= 80, safari >= 15"},"source":"lib/global.ts"},"browser-minified-cbor":{"context":"browser","outputFormat":"esmodule","isLibrary":true,"optimize":true,"engines":{"browsers":"chrome >= 83, edge >= 83, firefox >= 102, safari >= 15"},"source":"lib/dataconnection/StreamConnection/Cbor.ts"},"browser-minified-msgpack":{"context":"browser","outputFormat":"esmodule","isLibrary":true,"optimize":true,"engines":{"browsers":"chrome >= 83, edge >= 83, firefox >= 102, safari >= 15"},"source":"lib/dataconnection/StreamConnection/MsgPack.ts"}},"scripts":{"contributors":"git-authors-cli --print=false && prettier --write package.json && git add package.json package-lock.json && git commit -m \\"chore(contributors): update and sort contributors list\\"","check":"tsc --noEmit && tsc -p e2e/tsconfig.json --noEmit","watch":"parcel watch","build":"rm -rf dist && parcel build","prepublishOnly":"npm run build","test":"jest","test:watch":"jest --watch","coverage":"jest --coverage --collectCoverageFrom=\\"./lib/**\\"","format":"prettier --write .","format:check":"prettier --check .","semantic-release":"semantic-release","e2e":"wdio run e2e/wdio.local.conf.ts","e2e:bstack":"wdio run e2e/wdio.bstack.conf.ts"},"devDependencies":{"@parcel/config-default":"^2.9.3","@parcel/packager-ts":"^2.9.3","@parcel/transformer-typescript-tsc":"^2.9.3","@parcel/transformer-typescript-types":"^2.9.3","@semantic-release/changelog":"^6.0.1","@semantic-release/git":"^10.0.1","@swc/core":"^1.3.27","@swc/jest":"^0.2.24","@types/jasmine":"^4.3.4","@wdio/browserstack-service":"^8.11.2","@wdio/cli":"^8.11.2","@wdio/globals":"^8.11.2","@wdio/jasmine-framework":"^8.11.2","@wdio/local-runner":"^8.11.2","@wdio/spec-reporter":"^8.11.2","@wdio/types":"^8.10.4","http-server":"^14.1.1","jest":"^29.3.1","jest-environment-jsdom":"^29.3.1","mock-socket":"^9.0.0","parcel":"^2.9.3","prettier":"^3.0.0","semantic-release":"^21.0.0","ts-node":"^10.9.1","typescript":"^5.0.0","wdio-geckodriver-service":"^5.0.1"},"dependencies":{"@msgpack/msgpack":"^2.8.0","cbor-x":"1.5.4","eventemitter3":"^4.0.7","peerjs-js-binarypack":"^2.1.0","webrtc-adapter":"^8.0.0"},"alias":{"process":false,"buffer":false}}');class eJ extends ej.EventEmitter{start(e,t){this._id=e;let n=`${this._baseUrl}&id=${e}&token=${t}`;!this._socket&&this._disconnected&&(this._socket=new WebSocket(n+"&version="+e$.version),this._disconnected=!1,this._socket.onmessage=e=>{let t;try{t=JSON.parse(e.data),eO.log("Server message received:",t)}catch(t){eO.log("Invalid server message",e.data);return}this.emit(M.Message,t)},this._socket.onclose=e=>{this._disconnected||(eO.log("Socket closed.",e),this._cleanup(),this._disconnected=!0,this.emit(M.Disconnected))},this._socket.onopen=()=>{this._disconnected||(this._sendQueuedMessages(),eO.log("Socket open"),this._scheduleHeartbeat())})}_scheduleHeartbeat(){this._wsPingTimer=setTimeout(()=>{this._sendHeartbeat()},this.pingInterval)}_sendHeartbeat(){if(!this._wsOpen()){eO.log("Cannot send heartbeat, because socket closed");return}let e=JSON.stringify({type:O.Heartbeat});this._socket.send(e),this._scheduleHeartbeat()}_wsOpen(){return!!this._socket&&1===this._socket.readyState}_sendQueuedMessages(){let e=[...this._messagesQueue];for(let t of(this._messagesQueue=[],e))this.send(t)}send(e){if(this._disconnected)return;if(!this._id){this._messagesQueue.push(e);return}if(!e.type){this.emit(M.Error,"Invalid message");return}if(!this._wsOpen())return;let t=JSON.stringify(e);this._socket.send(t)}close(){this._disconnected||(this._cleanup(),this._disconnected=!0)}_cleanup(){this._socket&&(this._socket.onopen=this._socket.onmessage=this._socket.onclose=null,this._socket.close(),this._socket=void 0),clearTimeout(this._wsPingTimer)}constructor(e,t,n,r,i,o=5e3){super(),this.pingInterval=o,this._disconnected=!0,this._messagesQueue=[],this._baseUrl=(e?"wss://":"ws://")+t+":"+n+r+"peerjs?key="+i}}class eV{startConnection(e){let t=this._startPeerConnection();if(this.connection.peerConnection=t,this.connection.type===P.Media&&e._stream&&this._addTracksToConnection(e._stream,t),e.originator){let n=this.connection,r={ordered:!!e.reliable},i=t.createDataChannel(n.label,r);n._initializeDataChannel(i),this._makeOffer()}else this.handleSDP("OFFER",e.sdp)}_startPeerConnection(){eO.log("Creating RTCPeerConnection.");let e=new RTCPeerConnection(this.connection.provider.options.config);return this._setupListeners(e),e}_setupListeners(e){let t=this.connection.peer,n=this.connection.connectionId,r=this.connection.type,i=this.connection.provider;eO.log("Listening for ICE candidates."),e.onicecandidate=e=>{e.candidate&&e.candidate.candidate&&(eO.log(`Received ICE candidates for ${t}:`,e.candidate),i.socket.send({type:O.Candidate,payload:{candidate:e.candidate,type:r,connectionId:n},dst:t}))},e.oniceconnectionstatechange=()=>{switch(e.iceConnectionState){case"failed":eO.log("iceConnectionState is failed, closing connections to "+t),this.connection.emitError(D.NegotiationFailed,"Negotiation of connection to "+t+" failed."),this.connection.close();break;case"closed":eO.log("iceConnectionState is closed, closing connections to "+t),this.connection.emitError(D.ConnectionClosed,"Connection to "+t+" closed."),this.connection.close();break;case"disconnected":eO.log("iceConnectionState changed to disconnected on the connection with "+t);break;case"completed":e.onicecandidate=()=>{}}this.connection.emit("iceStateChanged",e.iceConnectionState)},eO.log("Listening for data channel"),e.ondatachannel=e=>{eO.log("Received data channel");let r=e.channel;i.getConnection(t,n)._initializeDataChannel(r)},eO.log("Listening for remote stream"),e.ontrack=e=>{eO.log("Received remote stream");let r=e.streams[0],o=i.getConnection(t,n);o.type===P.Media&&this._addStreamToMediaConnection(r,o)}}cleanup(){eO.log("Cleaning up PeerConnection to "+this.connection.peer);let e=this.connection.peerConnection;if(!e)return;this.connection.peerConnection=null,e.onicecandidate=e.oniceconnectionstatechange=e.ondatachannel=e.ontrack=()=>{};let t="closed"!==e.signalingState,n=!1,r=this.connection.dataChannel;r&&(n=!!r.readyState&&"closed"!==r.readyState),(t||n)&&e.close()}async _makeOffer(){let e=this.connection.peerConnection,t=this.connection.provider;try{let n=await e.createOffer(this.connection.options.constraints);eO.log("Created offer."),this.connection.options.sdpTransform&&"function"==typeof this.connection.options.sdpTransform&&(n.sdp=this.connection.options.sdpTransform(n.sdp)||n.sdp);try{await e.setLocalDescription(n),eO.log("Set localDescription:",n,`for:${this.connection.peer}`);let r={sdp:n,type:this.connection.type,connectionId:this.connection.connectionId,metadata:this.connection.metadata};if(this.connection.type===P.Data){let e=this.connection;r={...r,label:e.label,reliable:e.reliable,serialization:e.serialization}}t.socket.send({type:O.Offer,payload:r,dst:this.connection.peer})}catch(e){"OperationError: Failed to set local offer sdp: Called in wrong state: kHaveRemoteOffer"!=e&&(t.emitError(E.WebRTC,e),eO.log("Failed to setLocalDescription, ",e))}}catch(e){t.emitError(E.WebRTC,e),eO.log("Failed to createOffer, ",e)}}async _makeAnswer(){let e=this.connection.peerConnection,t=this.connection.provider;try{let n=await e.createAnswer();eO.log("Created answer."),this.connection.options.sdpTransform&&"function"==typeof this.connection.options.sdpTransform&&(n.sdp=this.connection.options.sdpTransform(n.sdp)||n.sdp);try{await e.setLocalDescription(n),eO.log("Set localDescription:",n,`for:${this.connection.peer}`),t.socket.send({type:O.Answer,payload:{sdp:n,type:this.connection.type,connectionId:this.connection.connectionId},dst:this.connection.peer})}catch(e){t.emitError(E.WebRTC,e),eO.log("Failed to setLocalDescription, ",e)}}catch(e){t.emitError(E.WebRTC,e),eO.log("Failed to create answer, ",e)}}async handleSDP(e,t){t=new RTCSessionDescription(t);let n=this.connection.peerConnection,r=this.connection.provider;eO.log("Setting remote description",t);try{await n.setRemoteDescription(t),eO.log(`Set remoteDescription:${e} for:${this.connection.peer}`),"OFFER"===e&&await this._makeAnswer()}catch(e){r.emitError(E.WebRTC,e),eO.log("Failed to setRemoteDescription, ",e)}}async handleCandidate(e){eO.log("handleCandidate:",e);try{await this.connection.peerConnection.addIceCandidate(e),eO.log(`Added ICE candidate for:${this.connection.peer}`)}catch(e){this.connection.provider.emitError(E.WebRTC,e),eO.log("Failed to handleCandidate, ",e)}}_addTracksToConnection(e,t){if(eO.log(`add tracks from stream ${e.id} to peer connection`),!t.addTrack)return eO.error("Your browser does't support RTCPeerConnection#addTrack. Ignored.");e.getTracks().forEach(n=>{t.addTrack(n,e)})}_addStreamToMediaConnection(e,t){eO.log(`add stream ${e.id} to media connection ${t.connectionId}`),t.addStream(e)}constructor(e){this.connection=e}}class eG extends ej.EventEmitter{emitError(e,t){eO.error("Error:",t),this.emit("error",new eW(`${e}`,t))}}class eW extends Error{constructor(e,t){"string"==typeof t?super(t):(super(),Object.assign(this,t)),this.type=e}}class eH extends eG{get open(){return this._open}constructor(e,t,n){super(),this.peer=e,this.provider=t,this.options=n,this._open=!1,this.metadata=n.metadata}}class eY extends eH{get type(){return P.Media}get localStream(){return this._localStream}get remoteStream(){return this._remoteStream}_initializeDataChannel(e){this.dataChannel=e,this.dataChannel.onopen=()=>{eO.log(`DC#${this.connectionId} dc connection success`),this.emit("willCloseOnRemote")},this.dataChannel.onclose=()=>{eO.log(`DC#${this.connectionId} dc closed for:`,this.peer),this.close()}}addStream(e){eO.log("Receiving stream",e),this._remoteStream=e,super.emit("stream",e)}handleMessage(e){let t=e.type,n=e.payload;switch(e.type){case O.Answer:this._negotiator.handleSDP(t,n.sdp),this._open=!0;break;case O.Candidate:this._negotiator.handleCandidate(n.candidate);break;default:eO.warn(`Unrecognized message type:${t} from peer:${this.peer}`)}}answer(e,t={}){if(this._localStream){eO.warn("Local stream already exists on this MediaConnection. Are you answering a call twice?");return}for(let n of(this._localStream=e,t&&t.sdpTransform&&(this.options.sdpTransform=t.sdpTransform),this._negotiator.startConnection({...this.options._payload,_stream:e}),this.provider._getMessages(this.connectionId)))this.handleMessage(n);this._open=!0}close(){this._negotiator&&(this._negotiator.cleanup(),this._negotiator=null),this._localStream=null,this._remoteStream=null,this.provider&&(this.provider._removeConnection(this),this.provider=null),this.options&&this.options._stream&&(this.options._stream=null),this.open&&(this._open=!1,super.emit("close"))}constructor(e,t,n){super(e,t,n),this._localStream=this.options._stream,this.connectionId=this.options.connectionId||eY.ID_PREFIX+eM.randomToken(),this._negotiator=new eV(this),this._localStream&&this._negotiator.startConnection({_stream:this._localStream,originator:!0})}}eY.ID_PREFIX="mc_";class eK{_buildRequest(e){let t=this._options.secure?"https":"http",{host:n,port:r,path:i,key:o}=this._options,s=new URL(`${t}://${n}:${r}${i}${o}/${e}`);return s.searchParams.set("ts",`${Date.now()}${Math.random()}`),s.searchParams.set("version",e$.version),fetch(s.href,{referrerPolicy:this._options.referrerPolicy})}async retrieveId(){try{let e=await this._buildRequest("id");if(200!==e.status)throw Error(`Error. Status:${e.status}`);return e.text()}catch(t){eO.error("Error retrieving ID",t);let e="";throw"/"===this._options.path&&this._options.host!==eM.CLOUD_HOST&&(e=" If you passed in a `path` to your self-hosted PeerServer, you'll also need to pass in that same path when creating a new Peer."),Error("Could not get an ID from the server."+e)}}async listAllPeers(){try{let e=await this._buildRequest("peers");if(200!==e.status){if(401===e.status){let e="";throw e=this._options.host===eM.CLOUD_HOST?"It looks like you're using the cloud server. You can email team@peerjs.com to enable peer listing for your API key.":"You need to enable `allow_discovery` on your self-hosted PeerServer to use this feature.",Error("It doesn't look like you have permission to list peers IDs. "+e)}throw Error(`Error. Status:${e.status}`)}return e.json()}catch(e){throw eO.error("Error retrieving list peers",e),Error("Could not get list peers from the server."+e)}}constructor(e){this._options=e}}class eX extends eH{get type(){return P.Data}_initializeDataChannel(e){this.dataChannel=e,this.dataChannel.onopen=()=>{eO.log(`DC#${this.connectionId} dc connection success`),this._open=!0,this.emit("open")},this.dataChannel.onmessage=e=>{eO.log(`DC#${this.connectionId} dc onmessage:`,e.data)},this.dataChannel.onclose=()=>{eO.log(`DC#${this.connectionId} dc closed for:`,this.peer),this.close()}}close(e){if(e?.flush){this.send({__peerData:{type:"close"}});return}this._negotiator&&(this._negotiator.cleanup(),this._negotiator=null),this.provider&&(this.provider._removeConnection(this),this.provider=null),this.dataChannel&&(this.dataChannel.onopen=null,this.dataChannel.onmessage=null,this.dataChannel.onclose=null,this.dataChannel=null),this.open&&(this._open=!1,super.emit("close"))}send(e,t=!1){if(!this.open){this.emitError(x.NotOpenYet,"Connection is not open. You should listen for the `open` event before sending messages.");return}return this._send(e,t)}async handleMessage(e){let t=e.payload;switch(e.type){case O.Answer:await this._negotiator.handleSDP(e.type,t.sdp);break;case O.Candidate:await this._negotiator.handleCandidate(t.candidate);break;default:eO.warn("Unrecognized message type:",e.type,"from peer:",this.peer)}}constructor(e,t,n){super(e,t,n),this.connectionId=this.options.connectionId||eX.ID_PREFIX+ex(),this.label=this.options.label||this.connectionId,this.reliable=!!this.options.reliable,this._negotiator=new eV(this),this._negotiator.startConnection(this.options._payload||{originator:!0,reliable:this.reliable})}}eX.ID_PREFIX="dc_",eX.MAX_BUFFERED_AMOUNT=8388608;class eq extends eX{get bufferSize(){return this._bufferSize}_initializeDataChannel(e){super._initializeDataChannel(e),this.dataChannel.binaryType="arraybuffer",this.dataChannel.addEventListener("message",e=>this._handleDataMessage(e))}_bufferedSend(e){(this._buffering||!this._trySend(e))&&(this._buffer.push(e),this._bufferSize=this._buffer.length)}_trySend(e){if(!this.open)return!1;if(this.dataChannel.bufferedAmount>eX.MAX_BUFFERED_AMOUNT)return this._buffering=!0,setTimeout(()=>{this._buffering=!1,this._tryBuffer()},50),!1;try{this.dataChannel.send(e)}catch(e){return eO.error(`DC#:${this.connectionId} Error when sending:`,e),this._buffering=!0,this.close(),!1}return!0}_tryBuffer(){if(!this.open||0===this._buffer.length)return;let e=this._buffer[0];this._trySend(e)&&(this._buffer.shift(),this._bufferSize=this._buffer.length,this._tryBuffer())}close(e){if(e?.flush){this.send({__peerData:{type:"close"}});return}this._buffer=[],this._bufferSize=0,super.close()}constructor(...e){super(...e),this._buffer=[],this._bufferSize=0,this._buffering=!1}}class eQ extends eq{close(e){super.close(e),this._chunkedData={}}_handleDataMessage({data:e}){let t=i(e),n=t.__peerData;if(n){if("close"===n.type){this.close();return}this._handleChunk(t);return}this.emit("data",t)}_handleChunk(e){let t=e.__peerData,n=this._chunkedData[t]||{data:[],count:0,total:e.total};if(n.data[e.n]=new Uint8Array(e.data),n.count++,this._chunkedData[t]=n,n.total===n.count){delete this._chunkedData[t];let e=function(e){let t=0;for(let n of e)t+=n.byteLength;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.byteLength;return n}(n.data);this._handleDataMessage({data:e})}}_send(e,t){let n=o(e);if(n instanceof Promise)return this._send_blob(n);if(!t&&n.byteLength>this.chunker.chunkedMTU){this._sendChunks(n);return}this._bufferedSend(n)}async _send_blob(e){let t=await e;if(t.byteLength>this.chunker.chunkedMTU){this._sendChunks(t);return}this._bufferedSend(t)}_sendChunks(e){let t=this.chunker.chunk(e);for(let e of(eO.log(`DC#${this.connectionId} Try to send ${t.length} chunks...`),t))this.send(e,!0)}constructor(e,t,r){super(e,t,r),this.chunker=new n,this.serialization=I.Binary,this._chunkedData={}}}class eZ extends eq{_handleDataMessage({data:e}){super.emit("data",e)}_send(e,t){this._bufferedSend(e)}constructor(...e){super(...e),this.serialization=I.None}}class e0 extends eq{_handleDataMessage({data:e}){let t=this.parse(this.decoder.decode(e)),n=t.__peerData;if(n&&"close"===n.type){this.close();return}this.emit("data",t)}_send(e,t){let n=this.encoder.encode(this.stringify(e));if(n.byteLength>=eM.chunkedMTU){this.emitError(x.MessageToBig,"Message too big for JSON channel");return}this._bufferedSend(n)}constructor(...e){super(...e),this.serialization=I.JSON,this.encoder=new TextEncoder,this.decoder=new TextDecoder,this.stringify=JSON.stringify,this.parse=JSON.parse}}class e1 extends eG{get id(){return this._id}get options(){return this._options}get open(){return this._open}get socket(){return this._socket}get connections(){let e=Object.create(null);for(let[t,n]of this._connections)e[t]=n;return e}get destroyed(){return this._destroyed}get disconnected(){return this._disconnected}_createServerConnection(){let e=new eJ(this._options.secure,this._options.host,this._options.port,this._options.path,this._options.key,this._options.pingInterval);return e.on(M.Message,e=>{this._handleMessage(e)}),e.on(M.Error,e=>{this._abort(E.SocketError,e)}),e.on(M.Disconnected,()=>{this.disconnected||(this.emitError(E.Network,"Lost connection to server."),this.disconnect())}),e.on(M.Close,()=>{this.disconnected||this._abort(E.SocketClosed,"Underlying socket is already closed.")}),e}_initialize(e){this._id=e,this.socket.start(e,this._options.token)}_handleMessage(e){let t=e.type,n=e.payload,r=e.src;switch(t){case O.Open:this._lastServerId=this.id,this._open=!0,this.emit("open",this.id);break;case O.Error:this._abort(E.ServerError,n.msg);break;case O.IdTaken:this._abort(E.UnavailableID,`ID "${this.id}" is taken`);break;case O.InvalidKey:this._abort(E.InvalidKey,`API KEY "${this._options.key}" is invalid`);break;case O.Leave:eO.log(`Received leave message from ${r}`),this._cleanupPeer(r),this._connections.delete(r);break;case O.Expire:this.emitError(E.PeerUnavailable,`Could not connect to peer ${r}`);break;case O.Offer:{let e=n.connectionId,t=this.getConnection(r,e);if(t&&(t.close(),eO.warn(`Offer received for existing Connection ID:${e}`)),n.type===P.Media){let i=new eY(r,this,{connectionId:e,_payload:n,metadata:n.metadata});t=i,this._addConnection(r,t),this.emit("call",i)}else if(n.type===P.Data){let i=new this._serializers[n.serialization](r,this,{connectionId:e,_payload:n,metadata:n.metadata,label:n.label,serialization:n.serialization,reliable:n.reliable});t=i,this._addConnection(r,t),this.emit("connection",i)}else{eO.warn(`Received malformed connection type:${n.type}`);return}for(let n of this._getMessages(e))t.handleMessage(n);break}default:{if(!n){eO.warn(`You received a malformed message from ${r} of type ${t}`);return}let i=n.connectionId,o=this.getConnection(r,i);o&&o.peerConnection?o.handleMessage(e):i?this._storeMessage(i,e):eO.warn("You received an unrecognized message:",e)}}}_storeMessage(e,t){this._lostMessages.has(e)||this._lostMessages.set(e,[]),this._lostMessages.get(e).push(t)}_getMessages(e){let t=this._lostMessages.get(e);return t?(this._lostMessages.delete(e),t):[]}connect(e,t={}){if(t={serialization:"default",...t},this.disconnected){eO.warn("You cannot connect to a new Peer because you called .disconnect() on this Peer and ended your connection with the server. You can create a new Peer to reconnect, or call reconnect on this peer if you believe its ID to still be available."),this.emitError(E.Disconnected,"Cannot connect to new Peer after disconnecting from server.");return}let n=new this._serializers[t.serialization](e,this,t);return this._addConnection(e,n),n}call(e,t,n={}){if(this.disconnected){eO.warn("You cannot connect to a new Peer because you called .disconnect() on this Peer and ended your connection with the server. You can create a new Peer to reconnect."),this.emitError(E.Disconnected,"Cannot connect to new Peer after disconnecting from server.");return}if(!t){eO.error("To call a peer, you must provide a stream from your browser's `getUserMedia`.");return}let r=new eY(e,this,{...n,_stream:t});return this._addConnection(e,r),r}_addConnection(e,t){eO.log(`add connection ${t.type}:${t.connectionId} to peerId:${e}`),this._connections.has(e)||this._connections.set(e,[]),this._connections.get(e).push(t)}_removeConnection(e){let t=this._connections.get(e.peer);if(t){let n=t.indexOf(e);-1!==n&&t.splice(n,1)}this._lostMessages.delete(e.connectionId)}getConnection(e,t){let n=this._connections.get(e);if(!n)return null;for(let e of n)if(e.connectionId===t)return e;return null}_delayedAbort(e,t){setTimeout(()=>{this._abort(e,t)},0)}_abort(e,t){eO.error("Aborting!"),this.emitError(e,t),this._lastServerId?this.disconnect():this.destroy()}destroy(){this.destroyed||(eO.log(`Destroy peer with ID:${this.id}`),this.disconnect(),this._cleanup(),this._destroyed=!0,this.emit("close"))}_cleanup(){for(let e of this._connections.keys())this._cleanupPeer(e),this._connections.delete(e);this.socket.removeAllListeners()}_cleanupPeer(e){let t=this._connections.get(e);if(t)for(let e of t)e.close()}disconnect(){if(this.disconnected)return;let e=this.id;eO.log(`Disconnect peer with ID:${e}`),this._disconnected=!0,this._open=!1,this.socket.close(),this._lastServerId=e,this._id=null,this.emit("disconnected",e)}reconnect(){if(this.disconnected&&!this.destroyed)eO.log(`Attempting reconnection to server with ID ${this._lastServerId}`),this._disconnected=!1,this._initialize(this._lastServerId);else if(this.destroyed)throw Error("This peer cannot reconnect to the server. It has already been destroyed.");else if(this.disconnected||this.open)throw Error(`Peer ${this.id} cannot reconnect because it is not disconnected from the server!`);else eO.error("In a hurry? We're still trying to make the initial connection!")}listAllPeers(e=e=>{}){this._api.listAllPeers().then(t=>e(t)).catch(e=>this._abort(E.ServerError,e))}constructor(e,t){let n;if(super(),this._serializers={raw:eZ,json:e0,binary:eQ,"binary-utf8":eQ,default:eQ},this._id=null,this._lastServerId=null,this._destroyed=!1,this._disconnected=!1,this._open=!1,this._connections=new Map,this._lostMessages=new Map,e&&e.constructor==Object?t=e:e&&(n=e.toString()),t={debug:0,host:eM.CLOUD_HOST,port:eM.CLOUD_PORT,path:"/",key:e1.DEFAULT_KEY,token:eM.randomToken(),config:eM.defaultConfig,referrerPolicy:"strict-origin-when-cross-origin",serializers:{},...t},this._options=t,this._serializers={...this._serializers,...this.options.serializers},"/"===this._options.host&&(this._options.host=window.location.hostname),this._options.path&&("/"!==this._options.path[0]&&(this._options.path="/"+this._options.path),"/"!==this._options.path[this._options.path.length-1]&&(this._options.path+="/")),void 0===this._options.secure&&this._options.host!==eM.CLOUD_HOST?this._options.secure=eM.isSecure():this._options.host==eM.CLOUD_HOST&&(this._options.secure=!0),this._options.logFunction&&eO.setLogFunction(this._options.logFunction),eO.logLevel=this._options.debug||0,this._api=new eK(t),this._socket=this._createServerConnection(),!eM.supports.audioVideo&&!eM.supports.data){this._delayedAbort(E.BrowserIncompatible,"The current browser does not support WebRTC");return}if(n&&!eM.validateId(n)){this._delayedAbort(E.InvalidID,`ID "${n}" is invalid`);return}n?this._initialize(n):this._api.retrieveId().then(e=>this._initialize(e)).catch(e=>this._abort(E.ServerError,e))}}e1.DEFAULT_KEY="peerjs",window.peerjs={Peer:e1,util:eM},window.Peer=e1})();(function(){function n(n,t,r){switch(r.length){case 0:return n.call(t);case 1:return n.call(t,r[0]);case 2:return n.call(t,r[0],r[1]);case 3:return n.call(t,r[0],r[1],r[2])}return n.apply(t,r)}function t(n,t,r,e){for(var u=-1,i=null==n?0:n.length;++u<i;){var o=n[u];t(e,o,r(o),n)}return e}function r(n,t){for(var r=-1,e=null==n?0:n.length;++r<e&&false!==t(n[r],r,n););return n}function e(n,t){for(var r=null==n?0:n.length;r--&&false!==t(n[r],r,n););return n}function u(n,t){for(var r=-1,e=null==n?0:n.length;++r<e;)if(!t(n[r],r,n))return false;return true}function i(n,t){for(var r=-1,e=null==n?0:n.length,u=0,i=[];++r<e;){var o=n[r];t(o,r,n)&&(i[u++]=o)}return i}function o(n,t){return!(null==n||!n.length)&&-1<v(n,t,0)}function f(n,t,r){for(var e=-1,u=null==n?0:n.length;++e<u;)if(r(t,n[e]))return true;return false}function c(n,t){for(var r=-1,e=null==n?0:n.length,u=Array(e);++r<e;)u[r]=t(n[r],r,n);return u}function a(n,t){for(var r=-1,e=t.length,u=n.length;++r<e;)n[u+r]=t[r];return n}function l(n,t,r,e){var u=-1,i=null==n?0:n.length;for(e&&i&&(r=n[++u]);++u<i;)r=t(r,n[u],u,n);return r}function s(n,t,r,e){var u=null==n?0:n.length;for(e&&u&&(r=n[--u]);u--;)r=t(r,n[u],u,n);return r}function h(n,t){for(var r=-1,e=null==n?0:n.length;++r<e;)if(t(n[r],r,n))return true;return false}function p(n,t,r){var e;return r(n,function(n,r,u){if(t(n,r,u))return e=r,false}),e}function _(n,t,r,e){var u=n.length;for(r+=e?1:-1;e?r--:++r<u;)if(t(n[r],r,n))return r;return-1}function v(n,t,r){if(t===t)n:{--r;for(var e=n.length;++r<e;)if(n[r]===t){n=r;break n}n=-1}else n=_(n,d,r);return n}function g(n,t,r,e){--r;for(var u=n.length;++r<u;)if(e(n[r],t))return r;return-1}function d(n){return n!==n}function y(n,t){var r=null==n?0:n.length;return r?m(n,t)/r:F}function b(n){return function(t){return null==t?T:t[n]}}function x(n){return function(t){return null==n?T:n[t]}}function j(n,t,r,e,u){return u(n,function(n,u,i){r=e?(e=false,n):t(r,n,u,i)}),r}function w(n,t){var r=n.length;for(n.sort(t);r--;)n[r]=n[r].c;return n}function m(n,t){for(var r,e=-1,u=n.length;++e<u;){var i=t(n[e]);i!==T&&(r=r===T?i:r+i)}return r}function A(n,t){for(var r=-1,e=Array(n);++r<n;)e[r]=t(r);return e}function E(n,t){return c(t,function(t){return[t,n[t]]})}function k(n){return function(t){return n(t)}}function S(n,t){return c(t,function(t){return n[t]})}function O(n,t){return n.has(t)}function I(n,t){for(var r=-1,e=n.length;++r<e&&-1<v(t,n[r],0););return r}function R(n,t){for(var r=n.length;r--&&-1<v(t,n[r],0););return r}function z(n){return"\\"+Un[n]}function W(n){var t=-1,r=Array(n.size);return n.forEach(function(n,e){r[++t]=[e,n]}),r}function B(n,t){return function(r){return n(t(r))}}function L(n,t){for(var r=-1,e=n.length,u=0,i=[];++r<e;){var o=n[r];o!==t&&"__lodash_placeholder__"!==o||(n[r]="__lodash_placeholder__",i[u++]=r)}return i}function U(n){var t=-1,r=Array(n.size);return n.forEach(function(n){r[++t]=n}),r}function C(n){var t=-1,r=Array(n.size);return n.forEach(function(n){r[++t]=[n,n]}),r}function D(n){if(Rn.test(n)){for(var t=On.lastIndex=0;On.test(n);)++t;n=t}else n=Qn(n);return n}function M(n){return Rn.test(n)?n.match(On)||[]:n.split("")}var T,$=1/0,F=NaN,N=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],P=/\b__p\+='';/g,Z=/\b(__p\+=)''\+/g,q=/(__e\(.*?\)|\b__t\))\+'';/g,V=/&(?:amp|lt|gt|quot|#39);/g,K=/[&<>"']/g,G=RegExp(V.source),H=RegExp(K.source),J=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Q=/<%=([\s\S]+?)%>/g,X=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nn=/^\w*$/,tn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,rn=/[\\^$.*+?()[\]{}|]/g,en=RegExp(rn.source),un=/^\s+|\s+$/g,on=/^\s+/,fn=/\s+$/,cn=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,an=/\{\n\/\* \[wrapped with (.+)\] \*/,ln=/,? & /,sn=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,hn=/\\(\\)?/g,pn=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,_n=/\w*$/,vn=/^[-+]0x[0-9a-f]+$/i,gn=/^0b[01]+$/i,dn=/^\[object .+?Constructor\]$/,yn=/^0o[0-7]+$/i,bn=/^(?:0|[1-9]\d*)$/,xn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,jn=/($^)/,wn=/['\n\r\u2028\u2029\\]/g,mn="[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?(?:\\u200d(?:[^\\ud800-\\udfff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?)*",An="(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])"+mn,En="(?:[^\\ud800-\\udfff][\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]?|[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\ud800-\\udfff])",kn=RegExp("['’]","g"),Sn=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g"),On=RegExp("\\ud83c[\\udffb-\\udfff](?=\\ud83c[\\udffb-\\udfff])|"+En+mn,"g"),In=RegExp(["[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde]|$)|(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde](?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])|$)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?(?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\\xc0-\\xd6\\xd8-\\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])|\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])|\\d+",An].join("|"),"g"),Rn=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),zn=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Wn="Array Buffer DataView Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Map Math Object Promise RegExp Set String Symbol TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap _ clearTimeout isFinite parseInt setTimeout".split(" "),Bn={};Bn["[object Float32Array]"]=Bn["[object Float64Array]"]=Bn["[object Int8Array]"]=Bn["[object Int16Array]"]=Bn["[object Int32Array]"]=Bn["[object Uint8Array]"]=Bn["[object Uint8ClampedArray]"]=Bn["[object Uint16Array]"]=Bn["[object Uint32Array]"]=true,Bn["[object Arguments]"]=Bn["[object Array]"]=Bn["[object ArrayBuffer]"]=Bn["[object Boolean]"]=Bn["[object DataView]"]=Bn["[object Date]"]=Bn["[object Error]"]=Bn["[object Function]"]=Bn["[object Map]"]=Bn["[object Number]"]=Bn["[object Object]"]=Bn["[object RegExp]"]=Bn["[object Set]"]=Bn["[object String]"]=Bn["[object WeakMap]"]=false;var Ln={};Ln["[object Arguments]"]=Ln["[object Array]"]=Ln["[object ArrayBuffer]"]=Ln["[object DataView]"]=Ln["[object Boolean]"]=Ln["[object Date]"]=Ln["[object Float32Array]"]=Ln["[object Float64Array]"]=Ln["[object Int8Array]"]=Ln["[object Int16Array]"]=Ln["[object Int32Array]"]=Ln["[object Map]"]=Ln["[object Number]"]=Ln["[object Object]"]=Ln["[object RegExp]"]=Ln["[object Set]"]=Ln["[object String]"]=Ln["[object Symbol]"]=Ln["[object Uint8Array]"]=Ln["[object Uint8ClampedArray]"]=Ln["[object Uint16Array]"]=Ln["[object Uint32Array]"]=true,Ln["[object Error]"]=Ln["[object Function]"]=Ln["[object WeakMap]"]=false;var Un={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Cn=parseFloat,Dn=parseInt,Mn=typeof global=="object"&&global&&global.Object===Object&&global,Tn=typeof self=="object"&&self&&self.Object===Object&&self,$n=Mn||Tn||Function("return this")(),Fn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Nn=Fn&&typeof module=="object"&&module&&!module.nodeType&&module,Pn=Nn&&Nn.exports===Fn,Zn=Pn&&Mn.process,qn=function(){try{var n=Nn&&Nn.f&&Nn.f("util").types;return n?n:Zn&&Zn.binding&&Zn.binding("util")}catch(n){}}(),Vn=qn&&qn.isArrayBuffer,Kn=qn&&qn.isDate,Gn=qn&&qn.isMap,Hn=qn&&qn.isRegExp,Jn=qn&&qn.isSet,Yn=qn&&qn.isTypedArray,Qn=b("length"),Xn=x({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),nt=x({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}),tt=x({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),rt=function x(mn){function An(n){if(yu(n)&&!ff(n)&&!(n instanceof Un)){if(n instanceof On)return n;if(oi.call(n,"__wrapped__"))return Fe(n)}return new On(n)}function En(){}function On(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=T}function Un(n){this.__wrapped__=n,this.__actions__=[],this.__dir__=1,this.__filtered__=false,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Mn(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function Tn(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function Fn(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function Nn(n){var t=-1,r=null==n?0:n.length;for(this.__data__=new Fn;++t<r;)this.add(n[t])}function Zn(n){this.size=(this.__data__=new Tn(n)).size}function qn(n,t){var r,e=ff(n),u=!e&&of(n),i=!e&&!u&&af(n),o=!e&&!u&&!i&&_f(n),u=(e=e||u||i||o)?A(n.length,ni):[],f=u.length;for(r in n)!t&&!oi.call(n,r)||e&&("length"==r||i&&("offset"==r||"parent"==r)||o&&("buffer"==r||"byteLength"==r||"byteOffset"==r)||Se(r,f))||u.push(r);return u}function Qn(n){var t=n.length;return t?n[ir(0,t-1)]:T}function et(n,t){return De(Ur(n),pt(t,0,n.length))}function ut(n){return De(Ur(n))}function it(n,t,r){(r===T||lu(n[t],r))&&(r!==T||t in n)||st(n,t,r)}function ot(n,t,r){var e=n[t];oi.call(n,t)&&lu(e,r)&&(r!==T||t in n)||st(n,t,r)}function ft(n,t){for(var r=n.length;r--;)if(lu(n[r][0],t))return r;return-1}function ct(n,t,r,e){return uo(n,function(n,u,i){t(e,n,r(n),i)}),e}function at(n,t){return n&&Cr(t,Wu(t),n)}function lt(n,t){return n&&Cr(t,Bu(t),n)}function st(n,t,r){"__proto__"==t&&Ai?Ai(n,t,{configurable:true,enumerable:true,value:r,writable:true}):n[t]=r}function ht(n,t){for(var r=-1,e=t.length,u=Ku(e),i=null==n;++r<e;)u[r]=i?T:Ru(n,t[r]);return u}function pt(n,t,r){return n===n&&(r!==T&&(n=n<=r?n:r),t!==T&&(n=n>=t?n:t)),n}function _t(n,t,e,u,i,o){var f,c=1&t,a=2&t,l=4&t;if(e&&(f=i?e(n,u,i,o):e(n)),f!==T)return f;if(!du(n))return n;if(u=ff(n)){if(f=me(n),!c)return Ur(n,f)}else{var s=vo(n),h="[object Function]"==s||"[object GeneratorFunction]"==s;if(af(n))return Ir(n,c);if("[object Object]"==s||"[object Arguments]"==s||h&&!i){if(f=a||h?{}:Ae(n),!c)return a?Mr(n,lt(f,n)):Dr(n,at(f,n))}else{if(!Ln[s])return i?n:{};f=Ee(n,s,c)}}if(o||(o=new Zn),i=o.get(n))return i;o.set(n,f),pf(n)?n.forEach(function(r){f.add(_t(r,t,e,r,n,o))}):sf(n)&&n.forEach(function(r,u){f.set(u,_t(r,t,e,u,n,o))});var a=l?a?ve:_e:a?Bu:Wu,p=u?T:a(n);return r(p||n,function(r,u){p&&(u=r,r=n[u]),ot(f,u,_t(r,t,e,u,n,o))}),f}function vt(n){var t=Wu(n);return function(r){return gt(r,n,t)}}function gt(n,t,r){var e=r.length;if(null==n)return!e;for(n=Qu(n);e--;){var u=r[e],i=t[u],o=n[u];if(o===T&&!(u in n)||!i(o))return false}return true}function dt(n,t,r){if(typeof n!="function")throw new ti("Expected a function");return bo(function(){n.apply(T,r)},t)}function yt(n,t,r,e){var u=-1,i=o,a=true,l=n.length,s=[],h=t.length;if(!l)return s;r&&(t=c(t,k(r))),e?(i=f,a=false):200<=t.length&&(i=O,a=false,t=new Nn(t));n:for(;++u<l;){var p=n[u],_=null==r?p:r(p),p=e||0!==p?p:0;if(a&&_===_){for(var v=h;v--;)if(t[v]===_)continue n;s.push(p)}else i(t,_,e)||s.push(p)}return s}function bt(n,t){var r=true;return uo(n,function(n,e,u){return r=!!t(n,e,u)}),r}function xt(n,t,r){for(var e=-1,u=n.length;++e<u;){var i=n[e],o=t(i);if(null!=o&&(f===T?o===o&&!wu(o):r(o,f)))var f=o,c=i}return c}function jt(n,t){var r=[];return uo(n,function(n,e,u){t(n,e,u)&&r.push(n)}),r}function wt(n,t,r,e,u){var i=-1,o=n.length;for(r||(r=ke),u||(u=[]);++i<o;){var f=n[i];0<t&&r(f)?1<t?wt(f,t-1,r,e,u):a(u,f):e||(u[u.length]=f)}return u}function mt(n,t){return n&&oo(n,t,Wu)}function At(n,t){return n&&fo(n,t,Wu)}function Et(n,t){return i(t,function(t){return _u(n[t])})}function kt(n,t){t=Sr(t,n);for(var r=0,e=t.length;null!=n&&r<e;)n=n[Me(t[r++])];return r&&r==e?n:T}function St(n,t,r){return t=t(n),ff(n)?t:a(t,r(n))}function Ot(n){if(null==n)n=n===T?"[object Undefined]":"[object Null]";else if(mi&&mi in Qu(n)){var t=oi.call(n,mi),r=n[mi];try{n[mi]=T;var e=true}catch(n){}var u=ai.call(n);e&&(t?n[mi]=r:delete n[mi]),n=u}else n=ai.call(n);return n}function It(n,t){return n>t}function Rt(n,t){return null!=n&&oi.call(n,t)}function zt(n,t){return null!=n&&t in Qu(n)}function Wt(n,t,r){for(var e=r?f:o,u=n[0].length,i=n.length,a=i,l=Ku(i),s=1/0,h=[];a--;){var p=n[a];a&&t&&(p=c(p,k(t))),s=Ci(p.length,s),l[a]=!r&&(t||120<=u&&120<=p.length)?new Nn(a&&p):T}var p=n[0],_=-1,v=l[0];n:for(;++_<u&&h.length<s;){var g=p[_],d=t?t(g):g,g=r||0!==g?g:0;if(v?!O(v,d):!e(h,d,r)){for(a=i;--a;){var y=l[a];if(y?!O(y,d):!e(n[a],d,r))continue n}v&&v.push(d),h.push(g)}}return h}function Bt(n,t,r){var e={};return mt(n,function(n,u,i){t(e,r(n),u,i)}),e}function Lt(t,r,e){return r=Sr(r,t),t=2>r.length?t:kt(t,hr(r,0,-1)),r=null==t?t:t[Me(Ve(r))],null==r?T:n(r,t,e)}function Ut(n){return yu(n)&&"[object Arguments]"==Ot(n)}function Ct(n){return yu(n)&&"[object ArrayBuffer]"==Ot(n)}function Dt(n){return yu(n)&&"[object Date]"==Ot(n)}function Mt(n,t,r,e,u){if(n===t)t=true;else if(null==n||null==t||!yu(n)&&!yu(t))t=n!==n&&t!==t;else n:{var i=ff(n),o=ff(t),f=i?"[object Array]":vo(n),c=o?"[object Array]":vo(t),f="[object Arguments]"==f?"[object Object]":f,c="[object Arguments]"==c?"[object Object]":c,a="[object Object]"==f,o="[object Object]"==c;if((c=f==c)&&af(n)){if(!af(t)){t=false;break n}i=true,a=false}if(c&&!a)u||(u=new Zn),t=i||_f(n)?se(n,t,r,e,Mt,u):he(n,t,f,r,e,Mt,u);else{if(!(1&r)&&(i=a&&oi.call(n,"__wrapped__"),f=o&&oi.call(t,"__wrapped__"),i||f)){n=i?n.value():n,t=f?t.value():t,u||(u=new Zn),t=Mt(n,t,r,e,u);break n}if(c)t:if(u||(u=new Zn),i=1&r,f=_e(n),o=f.length,c=_e(t).length,o==c||i){for(a=o;a--;){var l=f[a];if(!(i?l in t:oi.call(t,l))){t=false;break t}}if((c=u.get(n))&&u.get(t))t=c==t;else{c=true,u.set(n,t),u.set(t,n);for(var s=i;++a<o;){var l=f[a],h=n[l],p=t[l];if(e)var _=i?e(p,h,l,t,n,u):e(h,p,l,n,t,u);if(_===T?h!==p&&!Mt(h,p,r,e,u):!_){c=false;break}s||(s="constructor"==l)}c&&!s&&(r=n.constructor,e=t.constructor,r!=e&&"constructor"in n&&"constructor"in t&&!(typeof r=="function"&&r instanceof r&&typeof e=="function"&&e instanceof e)&&(c=false)),u.delete(n),u.delete(t),t=c}}else t=false;else t=false}}return t}function Tt(n){return yu(n)&&"[object Map]"==vo(n)}function $t(n,t,r,e){var u=r.length,i=u,o=!e;if(null==n)return!i;for(n=Qu(n);u--;){var f=r[u];if(o&&f[2]?f[1]!==n[f[0]]:!(f[0]in n))return false}for(;++u<i;){var f=r[u],c=f[0],a=n[c],l=f[1];if(o&&f[2]){if(a===T&&!(c in n))return false}else{if(f=new Zn,e)var s=e(a,l,c,n,t,f);if(s===T?!Mt(l,a,3,e,f):!s)return false}}return true}function Ft(n){return!(!du(n)||ci&&ci in n)&&(_u(n)?hi:dn).test(Te(n))}function Nt(n){return yu(n)&&"[object RegExp]"==Ot(n)}function Pt(n){return yu(n)&&"[object Set]"==vo(n)}function Zt(n){return yu(n)&&gu(n.length)&&!!Bn[Ot(n)]}function qt(n){return typeof n=="function"?n:null==n?$u:typeof n=="object"?ff(n)?Jt(n[0],n[1]):Ht(n):Zu(n)}function Vt(n){if(!ze(n))return Li(n);var t,r=[];for(t in Qu(n))oi.call(n,t)&&"constructor"!=t&&r.push(t);return r}function Kt(n,t){return n<t}function Gt(n,t){var r=-1,e=su(n)?Ku(n.length):[];return uo(n,function(n,u,i){e[++r]=t(n,u,i)}),e}function Ht(n){var t=xe(n);return 1==t.length&&t[0][2]?We(t[0][0],t[0][1]):function(r){return r===n||$t(r,n,t)}}function Jt(n,t){return Ie(n)&&t===t&&!du(t)?We(Me(n),t):function(r){var e=Ru(r,n);return e===T&&e===t?zu(r,n):Mt(t,e,3)}}function Yt(n,t,r,e,u){n!==t&&oo(t,function(i,o){if(u||(u=new Zn),du(i)){var f=u,c=Le(n,o),a=Le(t,o),l=f.get(a);if(l)it(n,o,l);else{var l=e?e(c,a,o+"",n,t,f):T,s=l===T;if(s){var h=ff(a),p=!h&&af(a),_=!h&&!p&&_f(a),l=a;h||p||_?ff(c)?l=c:hu(c)?l=Ur(c):p?(s=false,l=Ir(a,true)):_?(s=false,l=zr(a,true)):l=[]:xu(a)||of(a)?(l=c,of(c)?l=Ou(c):du(c)&&!_u(c)||(l=Ae(a))):s=false}s&&(f.set(a,l),Yt(l,a,r,e,f),f.delete(a)),it(n,o,l)}}else f=e?e(Le(n,o),i,o+"",n,t,u):T,f===T&&(f=i),it(n,o,f)},Bu)}function Qt(n,t){var r=n.length;if(r)return t+=0>t?r:0,Se(t,r)?n[t]:T}function Xt(n,t,r){var e=-1;return t=c(t.length?t:[$u],k(ye())),n=Gt(n,function(n){return{a:c(t,function(t){return t(n)}),b:++e,c:n}}),w(n,function(n,t){var e;n:{e=-1;for(var u=n.a,i=t.a,o=u.length,f=r.length;++e<o;){var c=Wr(u[e],i[e]);if(c){e=e>=f?c:c*("desc"==r[e]?-1:1);break n}}e=n.b-t.b}return e})}function nr(n,t){return tr(n,t,function(t,r){return zu(n,r)})}function tr(n,t,r){for(var e=-1,u=t.length,i={};++e<u;){var o=t[e],f=kt(n,o);r(f,o)&&lr(i,Sr(o,n),f)}return i}function rr(n){return function(t){return kt(t,n)}}function er(n,t,r,e){var u=e?g:v,i=-1,o=t.length,f=n;for(n===t&&(t=Ur(t)),r&&(f=c(n,k(r)));++i<o;)for(var a=0,l=t[i],l=r?r(l):l;-1<(a=u(f,l,a,e));)f!==n&&xi.call(f,a,1),xi.call(n,a,1);return n}function ur(n,t){for(var r=n?t.length:0,e=r-1;r--;){var u=t[r];if(r==e||u!==i){var i=u;Se(u)?xi.call(n,u,1):xr(n,u)}}}function ir(n,t){return n+Ii(Ti()*(t-n+1))}function or(n,t){var r="";if(!n||1>t||9007199254740991<t)return r;do{t%2&&(r+=n),(t=Ii(t/2))&&(n+=n)}while(t);return r}function fr(n,t){return xo(Be(n,t,$u),n+"")}function cr(n){return Qn(Uu(n))}function ar(n,t){var r=Uu(n);return De(r,pt(t,0,r.length))}function lr(n,t,r,e){if(!du(n))return n;t=Sr(t,n);for(var u=-1,i=t.length,o=i-1,f=n;null!=f&&++u<i;){var c=Me(t[u]),a=r;if(u!=o){var l=f[c],a=e?e(l,c,f):T;a===T&&(a=du(l)?l:Se(t[u+1])?[]:{})}ot(f,c,a),f=f[c]}return n}function sr(n){return De(Uu(n))}function hr(n,t,r){var e=-1,u=n.length;for(0>t&&(t=-t>u?0:u+t),r=r>u?u:r,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Ku(u);++e<u;)r[e]=n[e+t];return r}function pr(n,t){var r;return uo(n,function(n,e,u){return r=t(n,e,u),!r}),!!r}function _r(n,t,r){var e=0,u=null==n?e:n.length;if(typeof t=="number"&&t===t&&2147483647>=u){for(;e<u;){var i=e+u>>>1,o=n[i];null!==o&&!wu(o)&&(r?o<=t:o<t)?e=i+1:u=i}return u}return vr(n,t,$u,r)}function vr(n,t,r,e){t=r(t);for(var u=0,i=null==n?0:n.length,o=t!==t,f=null===t,c=wu(t),a=t===T;u<i;){var l=Ii((u+i)/2),s=r(n[l]),h=s!==T,p=null===s,_=s===s,v=wu(s);(o?e||_:a?_&&(e||h):f?_&&h&&(e||!p):c?_&&h&&!p&&(e||!v):p||v?0:e?s<=t:s<t)?u=l+1:i=l}return Ci(i,4294967294)}function gr(n,t){for(var r=-1,e=n.length,u=0,i=[];++r<e;){var o=n[r],f=t?t(o):o;if(!r||!lu(f,c)){var c=f;i[u++]=0===o?0:o}}return i}function dr(n){return typeof n=="number"?n:wu(n)?F:+n}function yr(n){if(typeof n=="string")return n;if(ff(n))return c(n,yr)+"";if(wu(n))return ro?ro.call(n):"";var t=n+"";return"0"==t&&1/n==-$?"-0":t}function br(n,t,r){var e=-1,u=o,i=n.length,c=true,a=[],l=a;if(r)c=false,u=f;else if(200<=i){if(u=t?null:so(n))return U(u);c=false,u=O,l=new Nn}else l=t?[]:a;n:for(;++e<i;){var s=n[e],h=t?t(s):s,s=r||0!==s?s:0;if(c&&h===h){for(var p=l.length;p--;)if(l[p]===h)continue n;t&&l.push(h),a.push(s)}else u(l,h,r)||(l!==a&&l.push(h),a.push(s))}return a}function xr(n,t){return t=Sr(t,n),n=2>t.length?n:kt(n,hr(t,0,-1)),null==n||delete n[Me(Ve(t))]}function jr(n,t,r,e){for(var u=n.length,i=e?u:-1;(e?i--:++i<u)&&t(n[i],i,n););return r?hr(n,e?0:i,e?i+1:u):hr(n,e?i+1:0,e?u:i)}function wr(n,t){var r=n;return r instanceof Un&&(r=r.value()),l(t,function(n,t){return t.func.apply(t.thisArg,a([n],t.args))},r)}function mr(n,t,r){var e=n.length;if(2>e)return e?br(n[0]):[];for(var u=-1,i=Ku(e);++u<e;)for(var o=n[u],f=-1;++f<e;)f!=u&&(i[u]=yt(i[u]||o,n[f],t,r));return br(wt(i,1),t,r)}function Ar(n,t,r){for(var e=-1,u=n.length,i=t.length,o={};++e<u;)r(o,n[e],e<i?t[e]:T);return o}function Er(n){return hu(n)?n:[]}function kr(n){return typeof n=="function"?n:$u}function Sr(n,t){return ff(n)?n:Ie(n,t)?[n]:jo(Iu(n))}function Or(n,t,r){var e=n.length;return r=r===T?e:r,!t&&r>=e?n:hr(n,t,r)}function Ir(n,t){if(t)return n.slice();var r=n.length,r=gi?gi(r):new n.constructor(r);return n.copy(r),r}function Rr(n){var t=new n.constructor(n.byteLength);return new vi(t).set(new vi(n)),t}function zr(n,t){return new n.constructor(t?Rr(n.buffer):n.buffer,n.byteOffset,n.length)}function Wr(n,t){if(n!==t){var r=n!==T,e=null===n,u=n===n,i=wu(n),o=t!==T,f=null===t,c=t===t,a=wu(t);if(!f&&!a&&!i&&n>t||i&&o&&c&&!f&&!a||e&&o&&c||!r&&c||!u)return 1;if(!e&&!i&&!a&&n<t||a&&r&&u&&!e&&!i||f&&r&&u||!o&&u||!c)return-1}return 0}function Br(n,t,r,e){var u=-1,i=n.length,o=r.length,f=-1,c=t.length,a=Ui(i-o,0),l=Ku(c+a);for(e=!e;++f<c;)l[f]=t[f];for(;++u<o;)(e||u<i)&&(l[r[u]]=n[u]);for(;a--;)l[f++]=n[u++];return l}function Lr(n,t,r,e){var u=-1,i=n.length,o=-1,f=r.length,c=-1,a=t.length,l=Ui(i-f,0),s=Ku(l+a);for(e=!e;++u<l;)s[u]=n[u];for(l=u;++c<a;)s[l+c]=t[c];for(;++o<f;)(e||u<i)&&(s[l+r[o]]=n[u++]);return s}function Ur(n,t){var r=-1,e=n.length;for(t||(t=Ku(e));++r<e;)t[r]=n[r];return t}function Cr(n,t,r,e){var u=!r;r||(r={});for(var i=-1,o=t.length;++i<o;){var f=t[i],c=e?e(r[f],n[f],f,r,n):T;c===T&&(c=n[f]),u?st(r,f,c):ot(r,f,c)}return r}function Dr(n,t){return Cr(n,po(n),t)}function Mr(n,t){return Cr(n,_o(n),t)}function Tr(n,r){return function(e,u){var i=ff(e)?t:ct,o=r?r():{};return i(e,n,ye(u,2),o)}}function $r(n){return fr(function(t,r){var e=-1,u=r.length,i=1<u?r[u-1]:T,o=2<u?r[2]:T,i=3<n.length&&typeof i=="function"?(u--,i):T;for(o&&Oe(r[0],r[1],o)&&(i=3>u?T:i,u=1),t=Qu(t);++e<u;)(o=r[e])&&n(t,o,e,i);return t})}function Fr(n,t){return function(r,e){if(null==r)return r;if(!su(r))return n(r,e);for(var u=r.length,i=t?u:-1,o=Qu(r);(t?i--:++i<u)&&false!==e(o[i],i,o););return r}}function Nr(n){return function(t,r,e){var u=-1,i=Qu(t);e=e(t);for(var o=e.length;o--;){var f=e[n?o:++u];if(false===r(i[f],f,i))break}return t}}function Pr(n,t,r){function e(){return(this&&this!==$n&&this instanceof e?i:n).apply(u?r:this,arguments)}var u=1&t,i=Vr(n);return e}function Zr(n){return function(t){t=Iu(t);var r=Rn.test(t)?M(t):T,e=r?r[0]:t.charAt(0);return t=r?Or(r,1).join(""):t.slice(1),e[n]()+t}}function qr(n){return function(t){return l(Mu(Du(t).replace(kn,"")),n,"")}}function Vr(n){return function(){var t=arguments;switch(t.length){case 0:return new n;case 1:return new n(t[0]);case 2:return new n(t[0],t[1]);case 3:return new n(t[0],t[1],t[2]);case 4:return new n(t[0],t[1],t[2],t[3]);case 5:return new n(t[0],t[1],t[2],t[3],t[4]);case 6:return new n(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new n(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=eo(n.prototype),t=n.apply(r,t);return du(t)?t:r}}function Kr(t,r,e){function u(){for(var o=arguments.length,f=Ku(o),c=o,a=de(u);c--;)f[c]=arguments[c];return c=3>o&&f[0]!==a&&f[o-1]!==a?[]:L(f,a),o-=c.length,o<e?ue(t,r,Jr,u.placeholder,T,f,c,T,T,e-o):n(this&&this!==$n&&this instanceof u?i:t,this,f)}var i=Vr(t);return u}function Gr(n){return function(t,r,e){var u=Qu(t);if(!su(t)){var i=ye(r,3);t=Wu(t),r=function(n){return i(u[n],n,u)}}return r=n(t,r,e),-1<r?u[i?t[r]:r]:T}}function Hr(n){return pe(function(t){var r=t.length,e=r,u=On.prototype.thru;for(n&&t.reverse();e--;){var i=t[e];if(typeof i!="function")throw new ti("Expected a function");if(u&&!o&&"wrapper"==ge(i))var o=new On([],true)}for(e=o?e:r;++e<r;)var i=t[e],u=ge(i),f="wrapper"==u?ho(i):T,o=f&&Re(f[0])&&424==f[1]&&!f[4].length&&1==f[9]?o[ge(f[0])].apply(o,f[3]):1==i.length&&Re(i)?o[u]():o.thru(i);return function(){var n=arguments,e=n[0];if(o&&1==n.length&&ff(e))return o.plant(e).value();for(var u=0,n=r?t[u].apply(this,n):e;++u<r;)n=t[u].call(this,n);return n}})}function Jr(n,t,r,e,u,i,o,f,c,a){function l(){for(var d=arguments.length,y=Ku(d),b=d;b--;)y[b]=arguments[b];if(_){var x,j=de(l),b=y.length;for(x=0;b--;)y[b]===j&&++x}if(e&&(y=Br(y,e,u,_)),i&&(y=Lr(y,i,o,_)),d-=x,_&&d<a)return j=L(y,j),ue(n,t,Jr,l.placeholder,r,y,j,f,c,a-d);if(j=h?r:this,b=p?j[n]:n,d=y.length,f){x=y.length;for(var w=Ci(f.length,x),m=Ur(y);w--;){var A=f[w];y[w]=Se(A,x)?m[A]:T}}else v&&1<d&&y.reverse();return s&&c<d&&(y.length=c),this&&this!==$n&&this instanceof l&&(b=g||Vr(b)),b.apply(j,y)}var s=128&t,h=1&t,p=2&t,_=24&t,v=512&t,g=p?T:Vr(n);return l}function Yr(n,t){return function(r,e){return Bt(r,n,t(e))}}function Qr(n,t){return function(r,e){var u;if(r===T&&e===T)return t;if(r!==T&&(u=r),e!==T){if(u===T)return e;typeof r=="string"||typeof e=="string"?(r=yr(r),e=yr(e)):(r=dr(r),e=dr(e)),u=n(r,e)}return u}}function Xr(t){return pe(function(r){return r=c(r,k(ye())),fr(function(e){var u=this;return t(r,function(t){return n(t,u,e)})})})}function ne(n,t){t=t===T?" ":yr(t);var r=t.length;return 2>r?r?or(t,n):t:(r=or(t,Oi(n/D(t))),Rn.test(t)?Or(M(r),0,n).join(""):r.slice(0,n))}function te(t,r,e,u){function i(){for(var r=-1,c=arguments.length,a=-1,l=u.length,s=Ku(l+c),h=this&&this!==$n&&this instanceof i?f:t;++a<l;)s[a]=u[a];for(;c--;)s[a++]=arguments[++r];return n(h,o?e:this,s)}var o=1&r,f=Vr(t);return i}function re(n){return function(t,r,e){e&&typeof e!="number"&&Oe(t,r,e)&&(r=e=T),t=Au(t),r===T?(r=t,t=0):r=Au(r),e=e===T?t<r?1:-1:Au(e);var u=-1;r=Ui(Oi((r-t)/(e||1)),0);for(var i=Ku(r);r--;)i[n?r:++u]=t,t+=e;return i}}function ee(n){return function(t,r){return typeof t=="string"&&typeof r=="string"||(t=Su(t),r=Su(r)),n(t,r)}}function ue(n,t,r,e,u,i,o,f,c,a){var l=8&t,s=l?o:T;o=l?T:o;var h=l?i:T;return i=l?T:i,t=(t|(l?32:64))&~(l?64:32),4&t||(t&=-4),u=[n,t,u,h,s,i,o,f,c,a],r=r.apply(T,u),Re(n)&&yo(r,u),r.placeholder=e,Ue(r,n,t)}function ie(n){var t=Yu[n];return function(n,r){if(n=Su(n),(r=null==r?0:Ci(Eu(r),292))&&Wi(n)){var e=(Iu(n)+"e").split("e"),e=t(e[0]+"e"+(+e[1]+r)),e=(Iu(e)+"e").split("e");return+(e[0]+"e"+(+e[1]-r))}return t(n)}}function oe(n){return function(t){var r=vo(t);return"[object Map]"==r?W(t):"[object Set]"==r?C(t):E(t,n(t))}}function fe(n,t,r,e,u,i,o,f){var c=2&t;if(!c&&typeof n!="function")throw new ti("Expected a function");var a=e?e.length:0;if(a||(t&=-97,e=u=T),o=o===T?o:Ui(Eu(o),0),f=f===T?f:Eu(f),a-=u?u.length:0,64&t){var l=e,s=u;e=u=T}var h=c?T:ho(n);return i=[n,t,r,e,u,l,s,i,o,f],h&&(r=i[1],n=h[1],t=r|n,e=128==n&&8==r||128==n&&256==r&&i[7].length<=h[8]||384==n&&h[7].length<=h[8]&&8==r,131>t||e)&&(1&n&&(i[2]=h[2],t|=1&r?0:4),(r=h[3])&&(e=i[3],i[3]=e?Br(e,r,h[4]):r,i[4]=e?L(i[3],"__lodash_placeholder__"):h[4]),(r=h[5])&&(e=i[5],i[5]=e?Lr(e,r,h[6]):r,i[6]=e?L(i[5],"__lodash_placeholder__"):h[6]),(r=h[7])&&(i[7]=r),128&n&&(i[8]=null==i[8]?h[8]:Ci(i[8],h[8])),null==i[9]&&(i[9]=h[9]),i[0]=h[0],i[1]=t),n=i[0],t=i[1],r=i[2],e=i[3],u=i[4],f=i[9]=i[9]===T?c?0:n.length:Ui(i[9]-a,0),!f&&24&t&&(t&=-25),Ue((h?co:yo)(t&&1!=t?8==t||16==t?Kr(n,t,f):32!=t&&33!=t||u.length?Jr.apply(T,i):te(n,t,r,e):Pr(n,t,r),i),n,t)}function ce(n,t,r,e){return n===T||lu(n,ei[r])&&!oi.call(e,r)?t:n}function ae(n,t,r,e,u,i){return du(n)&&du(t)&&(i.set(t,n),Yt(n,t,T,ae,i),i.delete(t)),n}function le(n){return xu(n)?T:n}function se(n,t,r,e,u,i){var o=1&r,f=n.length,c=t.length;if(f!=c&&!(o&&c>f))return false;if((c=i.get(n))&&i.get(t))return c==t;var c=-1,a=true,l=2&r?new Nn:T;for(i.set(n,t),i.set(t,n);++c<f;){var s=n[c],p=t[c];if(e)var _=o?e(p,s,c,t,n,i):e(s,p,c,n,t,i);if(_!==T){if(_)continue;a=false;break}if(l){if(!h(t,function(n,t){if(!O(l,t)&&(s===n||u(s,n,r,e,i)))return l.push(t)})){a=false;break}}else if(s!==p&&!u(s,p,r,e,i)){a=false;break}}return i.delete(n),i.delete(t),a}function he(n,t,r,e,u,i,o){switch(r){case"[object DataView]":if(n.byteLength!=t.byteLength||n.byteOffset!=t.byteOffset)break;n=n.buffer,t=t.buffer;case"[object ArrayBuffer]":if(n.byteLength!=t.byteLength||!i(new vi(n),new vi(t)))break;return true;case"[object Boolean]":case"[object Date]":case"[object Number]":return lu(+n,+t);case"[object Error]":return n.name==t.name&&n.message==t.message;case"[object RegExp]":case"[object String]":return n==t+"";case"[object Map]":var f=W;case"[object Set]":if(f||(f=U),n.size!=t.size&&!(1&e))break;return(r=o.get(n))?r==t:(e|=2,o.set(n,t),t=se(f(n),f(t),e,u,i,o),o.delete(n),t);case"[object Symbol]":if(to)return to.call(n)==to.call(t)}return false}function pe(n){return xo(Be(n,T,Ze),n+"")}function _e(n){return St(n,Wu,po)}function ve(n){return St(n,Bu,_o)}function ge(n){for(var t=n.name+"",r=Gi[t],e=oi.call(Gi,t)?r.length:0;e--;){var u=r[e],i=u.func;if(null==i||i==n)return u.name}return t}function de(n){return(oi.call(An,"placeholder")?An:n).placeholder}function ye(){var n=An.iteratee||Fu,n=n===Fu?qt:n;return arguments.length?n(arguments[0],arguments[1]):n}function be(n,t){var r=n.__data__,e=typeof t;return("string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t)?r[typeof t=="string"?"string":"hash"]:r.map}function xe(n){for(var t=Wu(n),r=t.length;r--;){var e=t[r],u=n[e];t[r]=[e,u,u===u&&!du(u)]}return t}function je(n,t){var r=null==n?T:n[t];return Ft(r)?r:T}function we(n,t,r){t=Sr(t,n);for(var e=-1,u=t.length,i=false;++e<u;){var o=Me(t[e]);if(!(i=null!=n&&r(n,o)))break;n=n[o]}return i||++e!=u?i:(u=null==n?0:n.length,!!u&&gu(u)&&Se(o,u)&&(ff(n)||of(n)))}function me(n){var t=n.length,r=new n.constructor(t);return t&&"string"==typeof n[0]&&oi.call(n,"index")&&(r.index=n.index,r.input=n.input),r}function Ae(n){return typeof n.constructor!="function"||ze(n)?{}:eo(di(n))}function Ee(n,t,r){var e=n.constructor;switch(t){case"[object ArrayBuffer]":return Rr(n);case"[object Boolean]":case"[object Date]":return new e(+n);case"[object DataView]":return t=r?Rr(n.buffer):n.buffer,new n.constructor(t,n.byteOffset,n.byteLength);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return zr(n,r);case"[object Map]":return new e;case"[object Number]":case"[object String]":return new e(n);case"[object RegExp]":return t=new n.constructor(n.source,_n.exec(n)),t.lastIndex=n.lastIndex,t;case"[object Set]":return new e;case"[object Symbol]":return to?Qu(to.call(n)):{}}}function ke(n){return ff(n)||of(n)||!!(ji&&n&&n[ji])}function Se(n,t){var r=typeof n;return t=null==t?9007199254740991:t,!!t&&("number"==r||"symbol"!=r&&bn.test(n))&&-1<n&&0==n%1&&n<t}function Oe(n,t,r){if(!du(r))return false;var e=typeof t;return!!("number"==e?su(r)&&Se(t,r.length):"string"==e&&t in r)&&lu(r[t],n)}function Ie(n,t){if(ff(n))return false;var r=typeof n;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=n&&!wu(n))||(nn.test(n)||!X.test(n)||null!=t&&n in Qu(t))}function Re(n){var t=ge(n),r=An[t];return typeof r=="function"&&t in Un.prototype&&(n===r||(t=ho(r),!!t&&n===t[0]))}function ze(n){var t=n&&n.constructor;return n===(typeof t=="function"&&t.prototype||ei)}function We(n,t){return function(r){return null!=r&&(r[n]===t&&(t!==T||n in Qu(r)))}}function Be(t,r,e){return r=Ui(r===T?t.length-1:r,0),function(){for(var u=arguments,i=-1,o=Ui(u.length-r,0),f=Ku(o);++i<o;)f[i]=u[r+i];for(i=-1,o=Ku(r+1);++i<r;)o[i]=u[i];return o[r]=e(f),n(t,this,o)}}function Le(n,t){if(("constructor"!==t||"function"!=typeof n[t])&&"__proto__"!=t)return n[t]}function Ue(n,t,r){var e=t+"";t=xo;var u,i=$e;return u=(u=e.match(an))?u[1].split(ln):[],r=i(u,r),(i=r.length)&&(u=i-1,r[u]=(1<i?"& ":"")+r[u],r=r.join(2<i?", ":" "),e=e.replace(cn,"{\n/* [wrapped with "+r+"] */\n")),t(n,e)}function Ce(n){var t=0,r=0;return function(){var e=Di(),u=16-(e-r);if(r=e,0<u){if(800<=++t)return arguments[0]}else t=0;return n.apply(T,arguments)}}function De(n,t){var r=-1,e=n.length,u=e-1;for(t=t===T?e:t;++r<t;){var e=ir(r,u),i=n[e];n[e]=n[r],n[r]=i}return n.length=t,n}function Me(n){if(typeof n=="string"||wu(n))return n;var t=n+"";return"0"==t&&1/n==-$?"-0":t}function Te(n){if(null!=n){try{return ii.call(n)}catch(n){}return n+""}return""}function $e(n,t){return r(N,function(r){var e="_."+r[0];t&r[1]&&!o(n,e)&&n.push(e)}),n.sort()}function Fe(n){if(n instanceof Un)return n.clone();var t=new On(n.__wrapped__,n.__chain__);return t.__actions__=Ur(n.__actions__),t.__index__=n.__index__,t.__values__=n.__values__,t}function Ne(n,t,r){var e=null==n?0:n.length;return e?(r=null==r?0:Eu(r),0>r&&(r=Ui(e+r,0)),_(n,ye(t,3),r)):-1}function Pe(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e-1;return r!==T&&(u=Eu(r),u=0>r?Ui(e+u,0):Ci(u,e-1)),_(n,ye(t,3),u,true)}function Ze(n){return(null==n?0:n.length)?wt(n,1):[]}function qe(n){return n&&n.length?n[0]:T}function Ve(n){var t=null==n?0:n.length;return t?n[t-1]:T}function Ke(n,t){return n&&n.length&&t&&t.length?er(n,t):n}function Ge(n){return null==n?n:$i.call(n)}function He(n){if(!n||!n.length)return[];var t=0;return n=i(n,function(n){if(hu(n))return t=Ui(n.length,t),true}),A(t,function(t){return c(n,b(t))})}function Je(t,r){if(!t||!t.length)return[];var e=He(t);return null==r?e:c(e,function(t){return n(r,T,t)})}function Ye(n){return n=An(n),n.__chain__=true,n}function Qe(n,t){return t(n)}function Xe(){return this}function nu(n,t){return(ff(n)?r:uo)(n,ye(t,3))}function tu(n,t){return(ff(n)?e:io)(n,ye(t,3))}function ru(n,t){return(ff(n)?c:Gt)(n,ye(t,3))}function eu(n,t,r){return t=r?T:t,t=n&&null==t?n.length:t,fe(n,128,T,T,T,T,t)}function uu(n,t){var r;if(typeof t!="function")throw new ti("Expected a function");return n=Eu(n),function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=T),r}}function iu(n,t,r){return t=r?T:t,n=fe(n,8,T,T,T,T,T,t),n.placeholder=iu.placeholder,n}function ou(n,t,r){return t=r?T:t,n=fe(n,16,T,T,T,T,T,t),n.placeholder=ou.placeholder,n}function fu(n,t,r){function e(t){var r=c,e=a;return c=a=T,_=t,s=n.apply(e,r)}function u(n){var r=n-p;return n-=_,p===T||r>=t||0>r||g&&n>=l}function i(){var n=Go();if(u(n))return o(n);var r,e=bo;r=n-_,n=t-(n-p),r=g?Ci(n,l-r):n,h=e(i,r)}function o(n){return h=T,d&&c?e(n):(c=a=T,s)}function f(){var n=Go(),r=u(n);if(c=arguments,a=this,p=n,r){if(h===T)return _=n=p,h=bo(i,t),v?e(n):s;if(g)return lo(h),h=bo(i,t),e(p)}return h===T&&(h=bo(i,t)),s}var c,a,l,s,h,p,_=0,v=false,g=false,d=true;if(typeof n!="function")throw new ti("Expected a function");return t=Su(t)||0,du(r)&&(v=!!r.leading,l=(g="maxWait"in r)?Ui(Su(r.maxWait)||0,t):l,d="trailing"in r?!!r.trailing:d),f.cancel=function(){h!==T&&lo(h),_=0,c=p=a=h=T},f.flush=function(){return h===T?s:o(Go())},f}function cu(n,t){function r(){var e=arguments,u=t?t.apply(this,e):e[0],i=r.cache;return i.has(u)?i.get(u):(e=n.apply(this,e),r.cache=i.set(u,e)||i,e)}if(typeof n!="function"||null!=t&&typeof t!="function")throw new ti("Expected a function");return r.cache=new(cu.Cache||Fn),r}function au(n){if(typeof n!="function")throw new ti("Expected a function");return function(){var t=arguments;switch(t.length){case 0:return!n.call(this);case 1:return!n.call(this,t[0]);case 2:return!n.call(this,t[0],t[1]);case 3:return!n.call(this,t[0],t[1],t[2])}return!n.apply(this,t)}}function lu(n,t){return n===t||n!==n&&t!==t}function su(n){return null!=n&&gu(n.length)&&!_u(n)}function hu(n){return yu(n)&&su(n)}function pu(n){if(!yu(n))return false;var t=Ot(n);return"[object Error]"==t||"[object DOMException]"==t||typeof n.message=="string"&&typeof n.name=="string"&&!xu(n)}function _u(n){return!!du(n)&&(n=Ot(n),"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n)}function vu(n){return typeof n=="number"&&n==Eu(n)}function gu(n){return typeof n=="number"&&-1<n&&0==n%1&&9007199254740991>=n}function du(n){var t=typeof n;return null!=n&&("object"==t||"function"==t)}function yu(n){return null!=n&&typeof n=="object"}function bu(n){return typeof n=="number"||yu(n)&&"[object Number]"==Ot(n)}function xu(n){return!(!yu(n)||"[object Object]"!=Ot(n))&&(n=di(n),null===n||(n=oi.call(n,"constructor")&&n.constructor,typeof n=="function"&&n instanceof n&&ii.call(n)==li))}function ju(n){return typeof n=="string"||!ff(n)&&yu(n)&&"[object String]"==Ot(n)}function wu(n){return typeof n=="symbol"||yu(n)&&"[object Symbol]"==Ot(n)}function mu(n){if(!n)return[];if(su(n))return ju(n)?M(n):Ur(n);if(wi&&n[wi]){n=n[wi]();for(var t,r=[];!(t=n.next()).done;)r.push(t.value);return r}return t=vo(n),("[object Map]"==t?W:"[object Set]"==t?U:Uu)(n)}function Au(n){return n?(n=Su(n),n===$||n===-$?17976931348623157e292*(0>n?-1:1):n===n?n:0):0===n?n:0}function Eu(n){n=Au(n);var t=n%1;return n===n?t?n-t:n:0}function ku(n){return n?pt(Eu(n),0,4294967295):0}function Su(n){if(typeof n=="number")return n;if(wu(n))return F;if(du(n)&&(n=typeof n.valueOf=="function"?n.valueOf():n,n=du(n)?n+"":n),typeof n!="string")return 0===n?n:+n;n=n.replace(un,"");var t=gn.test(n);return t||yn.test(n)?Dn(n.slice(2),t?2:8):vn.test(n)?F:+n}function Ou(n){return Cr(n,Bu(n))}function Iu(n){return null==n?"":yr(n)}function Ru(n,t,r){return n=null==n?T:kt(n,t),n===T?r:n}function zu(n,t){return null!=n&&we(n,t,zt)}function Wu(n){return su(n)?qn(n):Vt(n)}function Bu(n){if(su(n))n=qn(n,true);else if(du(n)){var t,r=ze(n),e=[];for(t in n)("constructor"!=t||!r&&oi.call(n,t))&&e.push(t);n=e}else{if(t=[],null!=n)for(r in Qu(n))t.push(r);n=t}return n}function Lu(n,t){if(null==n)return{};var r=c(ve(n),function(n){return[n]});return t=ye(t),tr(n,r,function(n,r){return t(n,r[0])})}function Uu(n){return null==n?[]:S(n,Wu(n))}function Cu(n){return $f(Iu(n).toLowerCase())}function Du(n){return(n=Iu(n))&&n.replace(xn,Xn).replace(Sn,"")}function Mu(n,t,r){return n=Iu(n),t=r?T:t,t===T?zn.test(n)?n.match(In)||[]:n.match(sn)||[]:n.match(t)||[]}function Tu(n){return function(){return n}}function $u(n){return n}function Fu(n){return qt(typeof n=="function"?n:_t(n,1))}function Nu(n,t,e){var u=Wu(t),i=Et(t,u);null!=e||du(t)&&(i.length||!u.length)||(e=t,t=n,n=this,i=Et(t,Wu(t)));var o=!(du(e)&&"chain"in e&&!e.chain),f=_u(n);return r(i,function(r){var e=t[r];n[r]=e,f&&(n.prototype[r]=function(){var t=this.__chain__;if(o||t){var r=n(this.__wrapped__);return(r.__actions__=Ur(this.__actions__)).push({func:e,args:arguments,thisArg:n}),r.__chain__=t,r}return e.apply(n,a([this.value()],arguments))})}),n}function Pu(){}function Zu(n){return Ie(n)?b(Me(n)):rr(n)}function qu(){return[]}function Vu(){return false}mn=null==mn?$n:rt.defaults($n.Object(),mn,rt.pick($n,Wn));var Ku=mn.Array,Gu=mn.Date,Hu=mn.Error,Ju=mn.Function,Yu=mn.Math,Qu=mn.Object,Xu=mn.RegExp,ni=mn.String,ti=mn.TypeError,ri=Ku.prototype,ei=Qu.prototype,ui=mn["__core-js_shared__"],ii=Ju.prototype.toString,oi=ei.hasOwnProperty,fi=0,ci=function(){var n=/[^.]+$/.exec(ui&&ui.keys&&ui.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}(),ai=ei.toString,li=ii.call(Qu),si=$n._,hi=Xu("^"+ii.call(oi).replace(rn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),pi=Pn?mn.Buffer:T,_i=mn.Symbol,vi=mn.Uint8Array,gi=pi?pi.g:T,di=B(Qu.getPrototypeOf,Qu),yi=Qu.create,bi=ei.propertyIsEnumerable,xi=ri.splice,ji=_i?_i.isConcatSpreadable:T,wi=_i?_i.iterator:T,mi=_i?_i.toStringTag:T,Ai=function(){try{var n=je(Qu,"defineProperty");return n({},"",{}),n}catch(n){}}(),Ei=mn.clearTimeout!==$n.clearTimeout&&mn.clearTimeout,ki=Gu&&Gu.now!==$n.Date.now&&Gu.now,Si=mn.setTimeout!==$n.setTimeout&&mn.setTimeout,Oi=Yu.ceil,Ii=Yu.floor,Ri=Qu.getOwnPropertySymbols,zi=pi?pi.isBuffer:T,Wi=mn.isFinite,Bi=ri.join,Li=B(Qu.keys,Qu),Ui=Yu.max,Ci=Yu.min,Di=Gu.now,Mi=mn.parseInt,Ti=Yu.random,$i=ri.reverse,Fi=je(mn,"DataView"),Ni=je(mn,"Map"),Pi=je(mn,"Promise"),Zi=je(mn,"Set"),qi=je(mn,"WeakMap"),Vi=je(Qu,"create"),Ki=qi&&new qi,Gi={},Hi=Te(Fi),Ji=Te(Ni),Yi=Te(Pi),Qi=Te(Zi),Xi=Te(qi),no=_i?_i.prototype:T,to=no?no.valueOf:T,ro=no?no.toString:T,eo=function(){function n(){}return function(t){return du(t)?yi?yi(t):(n.prototype=t,t=new n,n.prototype=T,t):{}}}();An.templateSettings={escape:J,evaluate:Y,interpolate:Q,variable:"",imports:{_:An}},An.prototype=En.prototype,An.prototype.constructor=An,On.prototype=eo(En.prototype),On.prototype.constructor=On,Un.prototype=eo(En.prototype),Un.prototype.constructor=Un,Mn.prototype.clear=function(){this.__data__=Vi?Vi(null):{},this.size=0},Mn.prototype.delete=function(n){return n=this.has(n)&&delete this.__data__[n],this.size-=n?1:0,n},Mn.prototype.get=function(n){var t=this.__data__;return Vi?(n=t[n],"__lodash_hash_undefined__"===n?T:n):oi.call(t,n)?t[n]:T},Mn.prototype.has=function(n){var t=this.__data__;return Vi?t[n]!==T:oi.call(t,n)},Mn.prototype.set=function(n,t){var r=this.__data__;return this.size+=this.has(n)?0:1,r[n]=Vi&&t===T?"__lodash_hash_undefined__":t,this},Tn.prototype.clear=function(){this.__data__=[],this.size=0},Tn.prototype.delete=function(n){var t=this.__data__;return n=ft(t,n),!(0>n)&&(n==t.length-1?t.pop():xi.call(t,n,1),--this.size,true)},Tn.prototype.get=function(n){var t=this.__data__;return n=ft(t,n),0>n?T:t[n][1]},Tn.prototype.has=function(n){return-1<ft(this.__data__,n)},Tn.prototype.set=function(n,t){var r=this.__data__,e=ft(r,n);return 0>e?(++this.size,r.push([n,t])):r[e][1]=t,this},Fn.prototype.clear=function(){this.size=0,this.__data__={hash:new Mn,map:new(Ni||Tn),string:new Mn}},Fn.prototype.delete=function(n){return n=be(this,n).delete(n),this.size-=n?1:0,n},Fn.prototype.get=function(n){return be(this,n).get(n)},Fn.prototype.has=function(n){return be(this,n).has(n)},Fn.prototype.set=function(n,t){var r=be(this,n),e=r.size;return r.set(n,t),this.size+=r.size==e?0:1,this},Nn.prototype.add=Nn.prototype.push=function(n){return this.__data__.set(n,"__lodash_hash_undefined__"),this},Nn.prototype.has=function(n){return this.__data__.has(n)},Zn.prototype.clear=function(){this.__data__=new Tn,this.size=0},Zn.prototype.delete=function(n){var t=this.__data__;return n=t.delete(n),this.size=t.size,n},Zn.prototype.get=function(n){return this.__data__.get(n)},Zn.prototype.has=function(n){return this.__data__.has(n)},Zn.prototype.set=function(n,t){var r=this.__data__;if(r instanceof Tn){var e=r.__data__;if(!Ni||199>e.length)return e.push([n,t]),this.size=++r.size,this;r=this.__data__=new Fn(e)}return r.set(n,t),this.size=r.size,this};var uo=Fr(mt),io=Fr(At,true),oo=Nr(),fo=Nr(true),co=Ki?function(n,t){return Ki.set(n,t),n}:$u,ao=Ai?function(n,t){return Ai(n,"toString",{configurable:true,enumerable:false,value:Tu(t),writable:true})}:$u,lo=Ei||function(n){return $n.clearTimeout(n)},so=Zi&&1/U(new Zi([,-0]))[1]==$?function(n){return new Zi(n)}:Pu,ho=Ki?function(n){return Ki.get(n)}:Pu,po=Ri?function(n){return null==n?[]:(n=Qu(n),i(Ri(n),function(t){return bi.call(n,t)}))}:qu,_o=Ri?function(n){for(var t=[];n;)a(t,po(n)),n=di(n);return t}:qu,vo=Ot;(Fi&&"[object DataView]"!=vo(new Fi(new ArrayBuffer(1)))||Ni&&"[object Map]"!=vo(new Ni)||Pi&&"[object Promise]"!=vo(Pi.resolve())||Zi&&"[object Set]"!=vo(new Zi)||qi&&"[object WeakMap]"!=vo(new qi))&&(vo=function(n){var t=Ot(n);if(n=(n="[object Object]"==t?n.constructor:T)?Te(n):"")switch(n){case Hi:return"[object DataView]";case Ji:return"[object Map]";case Yi:return"[object Promise]";case Qi:return"[object Set]";case Xi:return"[object WeakMap]"}return t});var go=ui?_u:Vu,yo=Ce(co),bo=Si||function(n,t){return $n.setTimeout(n,t)},xo=Ce(ao),jo=function(n){n=cu(n,function(n){return 500===t.size&&t.clear(),n});var t=n.cache;return n}(function(n){var t=[];return 46===n.charCodeAt(0)&&t.push(""),n.replace(tn,function(n,r,e,u){t.push(e?u.replace(hn,"$1"):r||n)}),t}),wo=fr(function(n,t){return hu(n)?yt(n,wt(t,1,hu,true)):[]}),mo=fr(function(n,t){var r=Ve(t);return hu(r)&&(r=T),hu(n)?yt(n,wt(t,1,hu,true),ye(r,2)):[]}),Ao=fr(function(n,t){var r=Ve(t);return hu(r)&&(r=T),hu(n)?yt(n,wt(t,1,hu,true),T,r):[]}),Eo=fr(function(n){var t=c(n,Er);return t.length&&t[0]===n[0]?Wt(t):[]}),ko=fr(function(n){var t=Ve(n),r=c(n,Er);return t===Ve(r)?t=T:r.pop(),r.length&&r[0]===n[0]?Wt(r,ye(t,2)):[]}),So=fr(function(n){var t=Ve(n),r=c(n,Er);return(t=typeof t=="function"?t:T)&&r.pop(),r.length&&r[0]===n[0]?Wt(r,T,t):[]}),Oo=fr(Ke),Io=pe(function(n,t){var r=null==n?0:n.length,e=ht(n,t);return ur(n,c(t,function(n){return Se(n,r)?+n:n}).sort(Wr)),e}),Ro=fr(function(n){return br(wt(n,1,hu,true))}),zo=fr(function(n){var t=Ve(n);return hu(t)&&(t=T),br(wt(n,1,hu,true),ye(t,2))}),Wo=fr(function(n){var t=Ve(n),t=typeof t=="function"?t:T;return br(wt(n,1,hu,true),T,t)}),Bo=fr(function(n,t){return hu(n)?yt(n,t):[]}),Lo=fr(function(n){return mr(i(n,hu))}),Uo=fr(function(n){var t=Ve(n);return hu(t)&&(t=T),mr(i(n,hu),ye(t,2))}),Co=fr(function(n){var t=Ve(n),t=typeof t=="function"?t:T;return mr(i(n,hu),T,t)}),Do=fr(He),Mo=fr(function(n){var t=n.length,t=1<t?n[t-1]:T,t=typeof t=="function"?(n.pop(),t):T;return Je(n,t)}),To=pe(function(n){function t(t){return ht(t,n)}var r=n.length,e=r?n[0]:0,u=this.__wrapped__;return!(1<r||this.__actions__.length)&&u instanceof Un&&Se(e)?(u=u.slice(e,+e+(r?1:0)),u.__actions__.push({func:Qe,args:[t],thisArg:T}),new On(u,this.__chain__).thru(function(n){return r&&!n.length&&n.push(T),n})):this.thru(t)}),$o=Tr(function(n,t,r){oi.call(n,r)?++n[r]:st(n,r,1)}),Fo=Gr(Ne),No=Gr(Pe),Po=Tr(function(n,t,r){oi.call(n,r)?n[r].push(t):st(n,r,[t])}),Zo=fr(function(t,r,e){var u=-1,i=typeof r=="function",o=su(t)?Ku(t.length):[];return uo(t,function(t){o[++u]=i?n(r,t,e):Lt(t,r,e)}),o}),qo=Tr(function(n,t,r){st(n,r,t)}),Vo=Tr(function(n,t,r){n[r?0:1].push(t)},function(){return[[],[]]}),Ko=fr(function(n,t){if(null==n)return[];var r=t.length;return 1<r&&Oe(n,t[0],t[1])?t=[]:2<r&&Oe(t[0],t[1],t[2])&&(t=[t[0]]),Xt(n,wt(t,1),[])}),Go=ki||function(){return $n.Date.now()},Ho=fr(function(n,t,r){var e=1;if(r.length)var u=L(r,de(Ho)),e=32|e;return fe(n,e,t,r,u)}),Jo=fr(function(n,t,r){var e=3;if(r.length)var u=L(r,de(Jo)),e=32|e;return fe(t,e,n,r,u)}),Yo=fr(function(n,t){return dt(n,1,t)}),Qo=fr(function(n,t,r){return dt(n,Su(t)||0,r)});cu.Cache=Fn;var Xo=fr(function(t,r){r=1==r.length&&ff(r[0])?c(r[0],k(ye())):c(wt(r,1),k(ye()));var e=r.length;return fr(function(u){for(var i=-1,o=Ci(u.length,e);++i<o;)u[i]=r[i].call(this,u[i]);return n(t,this,u)})}),nf=fr(function(n,t){return fe(n,32,T,t,L(t,de(nf)))}),tf=fr(function(n,t){return fe(n,64,T,t,L(t,de(tf)))}),rf=pe(function(n,t){return fe(n,256,T,T,T,t)}),ef=ee(It),uf=ee(function(n,t){return n>=t}),of=Ut(function(){return arguments}())?Ut:function(n){return yu(n)&&oi.call(n,"callee")&&!bi.call(n,"callee")},ff=Ku.isArray,cf=Vn?k(Vn):Ct,af=zi||Vu,lf=Kn?k(Kn):Dt,sf=Gn?k(Gn):Tt,hf=Hn?k(Hn):Nt,pf=Jn?k(Jn):Pt,_f=Yn?k(Yn):Zt,vf=ee(Kt),gf=ee(function(n,t){return n<=t}),df=$r(function(n,t){if(ze(t)||su(t))Cr(t,Wu(t),n);else for(var r in t)oi.call(t,r)&&ot(n,r,t[r])}),yf=$r(function(n,t){Cr(t,Bu(t),n)}),bf=$r(function(n,t,r,e){Cr(t,Bu(t),n,e)}),xf=$r(function(n,t,r,e){Cr(t,Wu(t),n,e)}),jf=pe(ht),wf=fr(function(n,t){n=Qu(n);var r=-1,e=t.length,u=2<e?t[2]:T;for(u&&Oe(t[0],t[1],u)&&(e=1);++r<e;)for(var u=t[r],i=Bu(u),o=-1,f=i.length;++o<f;){var c=i[o],a=n[c];(a===T||lu(a,ei[c])&&!oi.call(n,c))&&(n[c]=u[c])}return n}),mf=fr(function(t){return t.push(T,ae),n(Of,T,t)}),Af=Yr(function(n,t,r){null!=t&&typeof t.toString!="function"&&(t=ai.call(t)),n[t]=r},Tu($u)),Ef=Yr(function(n,t,r){null!=t&&typeof t.toString!="function"&&(t=ai.call(t)),oi.call(n,t)?n[t].push(r):n[t]=[r]},ye),kf=fr(Lt),Sf=$r(function(n,t,r){Yt(n,t,r)}),Of=$r(function(n,t,r,e){Yt(n,t,r,e)}),If=pe(function(n,t){var r={};if(null==n)return r;var e=false;t=c(t,function(t){return t=Sr(t,n),e||(e=1<t.length),t}),Cr(n,ve(n),r),e&&(r=_t(r,7,le));for(var u=t.length;u--;)xr(r,t[u]);return r}),Rf=pe(function(n,t){return null==n?{}:nr(n,t)}),zf=oe(Wu),Wf=oe(Bu),Bf=qr(function(n,t,r){return t=t.toLowerCase(),n+(r?Cu(t):t)}),Lf=qr(function(n,t,r){return n+(r?"-":"")+t.toLowerCase()}),Uf=qr(function(n,t,r){return n+(r?" ":"")+t.toLowerCase()}),Cf=Zr("toLowerCase"),Df=qr(function(n,t,r){return n+(r?"_":"")+t.toLowerCase()}),Mf=qr(function(n,t,r){return n+(r?" ":"")+$f(t)}),Tf=qr(function(n,t,r){return n+(r?" ":"")+t.toUpperCase()}),$f=Zr("toUpperCase"),Ff=fr(function(t,r){try{return n(t,T,r)}catch(n){return pu(n)?n:new Hu(n)}}),Nf=pe(function(n,t){return r(t,function(t){t=Me(t),st(n,t,Ho(n[t],n))}),n}),Pf=Hr(),Zf=Hr(true),qf=fr(function(n,t){return function(r){return Lt(r,n,t)}}),Vf=fr(function(n,t){return function(r){return Lt(n,r,t)}}),Kf=Xr(c),Gf=Xr(u),Hf=Xr(h),Jf=re(),Yf=re(true),Qf=Qr(function(n,t){return n+t},0),Xf=ie("ceil"),nc=Qr(function(n,t){return n/t},1),tc=ie("floor"),rc=Qr(function(n,t){return n*t},1),ec=ie("round"),uc=Qr(function(n,t){return n-t},0);return An.after=function(n,t){if(typeof t!="function")throw new ti("Expected a function");return n=Eu(n),function(){if(1>--n)return t.apply(this,arguments)}},An.ary=eu,An.assign=df,An.assignIn=yf,An.assignInWith=bf,An.assignWith=xf,An.at=jf,An.before=uu,An.bind=Ho,An.bindAll=Nf,An.bindKey=Jo,An.castArray=function(){if(!arguments.length)return[];var n=arguments[0];return ff(n)?n:[n]},An.chain=Ye,An.chunk=function(n,t,r){if(t=(r?Oe(n,t,r):t===T)?1:Ui(Eu(t),0),r=null==n?0:n.length,!r||1>t)return[];for(var e=0,u=0,i=Ku(Oi(r/t));e<r;)i[u++]=hr(n,e,e+=t);return i},An.compact=function(n){for(var t=-1,r=null==n?0:n.length,e=0,u=[];++t<r;){var i=n[t];i&&(u[e++]=i)}return u},An.concat=function(){var n=arguments.length;if(!n)return[];for(var t=Ku(n-1),r=arguments[0];n--;)t[n-1]=arguments[n];return a(ff(r)?Ur(r):[r],wt(t,1))},An.cond=function(t){var r=null==t?0:t.length,e=ye();return t=r?c(t,function(n){if("function"!=typeof n[1])throw new ti("Expected a function");return[e(n[0]),n[1]]}):[],fr(function(e){for(var u=-1;++u<r;){var i=t[u];if(n(i[0],this,e))return n(i[1],this,e)}})},An.conforms=function(n){return vt(_t(n,1))},An.constant=Tu,An.countBy=$o,An.create=function(n,t){var r=eo(n);return null==t?r:at(r,t)},An.curry=iu,An.curryRight=ou,An.debounce=fu,An.defaults=wf,An.defaultsDeep=mf,An.defer=Yo,An.delay=Qo,An.difference=wo,An.differenceBy=mo,An.differenceWith=Ao,An.drop=function(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===T?1:Eu(t),hr(n,0>t?0:t,e)):[]},An.dropRight=function(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===T?1:Eu(t),t=e-t,hr(n,0,0>t?0:t)):[]},An.dropRightWhile=function(n,t){return n&&n.length?jr(n,ye(t,3),true,true):[]},An.dropWhile=function(n,t){return n&&n.length?jr(n,ye(t,3),true):[]},An.fill=function(n,t,r,e){var u=null==n?0:n.length;if(!u)return[];for(r&&typeof r!="number"&&Oe(n,t,r)&&(r=0,e=u),u=n.length,r=Eu(r),0>r&&(r=-r>u?0:u+r),e=e===T||e>u?u:Eu(e),0>e&&(e+=u),e=r>e?0:ku(e);r<e;)n[r++]=t;return n},An.filter=function(n,t){return(ff(n)?i:jt)(n,ye(t,3))},An.flatMap=function(n,t){return wt(ru(n,t),1)},An.flatMapDeep=function(n,t){return wt(ru(n,t),$)},An.flatMapDepth=function(n,t,r){return r=r===T?1:Eu(r),wt(ru(n,t),r)},An.flatten=Ze,An.flattenDeep=function(n){return(null==n?0:n.length)?wt(n,$):[]},An.flattenDepth=function(n,t){return null!=n&&n.length?(t=t===T?1:Eu(t),wt(n,t)):[]},An.flip=function(n){return fe(n,512)},An.flow=Pf,An.flowRight=Zf,An.fromPairs=function(n){for(var t=-1,r=null==n?0:n.length,e={};++t<r;){var u=n[t];e[u[0]]=u[1]}return e},An.functions=function(n){return null==n?[]:Et(n,Wu(n))},An.functionsIn=function(n){return null==n?[]:Et(n,Bu(n))},An.groupBy=Po,An.initial=function(n){return(null==n?0:n.length)?hr(n,0,-1):[]},An.intersection=Eo,An.intersectionBy=ko,An.intersectionWith=So,An.invert=Af,An.invertBy=Ef,An.invokeMap=Zo,An.iteratee=Fu,An.keyBy=qo,An.keys=Wu,An.keysIn=Bu,An.map=ru,An.mapKeys=function(n,t){var r={};return t=ye(t,3),mt(n,function(n,e,u){st(r,t(n,e,u),n)}),r},An.mapValues=function(n,t){var r={};return t=ye(t,3),mt(n,function(n,e,u){st(r,e,t(n,e,u))}),r},An.matches=function(n){return Ht(_t(n,1))},An.matchesProperty=function(n,t){return Jt(n,_t(t,1))},An.memoize=cu,An.merge=Sf,An.mergeWith=Of,An.method=qf,An.methodOf=Vf,An.mixin=Nu,An.negate=au,An.nthArg=function(n){return n=Eu(n),fr(function(t){return Qt(t,n)})},An.omit=If,An.omitBy=function(n,t){return Lu(n,au(ye(t)))},An.once=function(n){return uu(2,n)},An.orderBy=function(n,t,r,e){return null==n?[]:(ff(t)||(t=null==t?[]:[t]),r=e?T:r,ff(r)||(r=null==r?[]:[r]),Xt(n,t,r))},An.over=Kf,An.overArgs=Xo,An.overEvery=Gf,An.overSome=Hf,An.partial=nf,An.partialRight=tf,An.partition=Vo,An.pick=Rf,An.pickBy=Lu,An.property=Zu,An.propertyOf=function(n){return function(t){return null==n?T:kt(n,t)}},An.pull=Oo,An.pullAll=Ke,An.pullAllBy=function(n,t,r){return n&&n.length&&t&&t.length?er(n,t,ye(r,2)):n},An.pullAllWith=function(n,t,r){return n&&n.length&&t&&t.length?er(n,t,T,r):n},An.pullAt=Io,An.range=Jf,An.rangeRight=Yf,An.rearg=rf,An.reject=function(n,t){return(ff(n)?i:jt)(n,au(ye(t,3)))},An.remove=function(n,t){var r=[];if(!n||!n.length)return r;var e=-1,u=[],i=n.length;for(t=ye(t,3);++e<i;){var o=n[e];t(o,e,n)&&(r.push(o),u.push(e))}return ur(n,u),r},An.rest=function(n,t){if(typeof n!="function")throw new ti("Expected a function");return t=t===T?t:Eu(t),fr(n,t)},An.reverse=Ge,An.sampleSize=function(n,t,r){return t=(r?Oe(n,t,r):t===T)?1:Eu(t),(ff(n)?et:ar)(n,t)},An.set=function(n,t,r){return null==n?n:lr(n,t,r)},An.setWith=function(n,t,r,e){return e=typeof e=="function"?e:T,null==n?n:lr(n,t,r,e)},An.shuffle=function(n){return(ff(n)?ut:sr)(n)},An.slice=function(n,t,r){var e=null==n?0:n.length;return e?(r&&typeof r!="number"&&Oe(n,t,r)?(t=0,r=e):(t=null==t?0:Eu(t),r=r===T?e:Eu(r)),hr(n,t,r)):[]},An.sortBy=Ko,An.sortedUniq=function(n){return n&&n.length?gr(n):[]},An.sortedUniqBy=function(n,t){return n&&n.length?gr(n,ye(t,2)):[]},An.split=function(n,t,r){return r&&typeof r!="number"&&Oe(n,t,r)&&(t=r=T),r=r===T?4294967295:r>>>0,r?(n=Iu(n))&&(typeof t=="string"||null!=t&&!hf(t))&&(t=yr(t),!t&&Rn.test(n))?Or(M(n),0,r):n.split(t,r):[]},An.spread=function(t,r){if(typeof t!="function")throw new ti("Expected a function");return r=null==r?0:Ui(Eu(r),0),fr(function(e){var u=e[r];return e=Or(e,0,r),u&&a(e,u),n(t,this,e)})},An.tail=function(n){var t=null==n?0:n.length;return t?hr(n,1,t):[]},An.take=function(n,t,r){return n&&n.length?(t=r||t===T?1:Eu(t),hr(n,0,0>t?0:t)):[]},An.takeRight=function(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===T?1:Eu(t),t=e-t,hr(n,0>t?0:t,e)):[]},An.takeRightWhile=function(n,t){return n&&n.length?jr(n,ye(t,3),false,true):[]},An.takeWhile=function(n,t){return n&&n.length?jr(n,ye(t,3)):[]},An.tap=function(n,t){return t(n),n},An.throttle=function(n,t,r){var e=true,u=true;if(typeof n!="function")throw new ti("Expected a function");return du(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),fu(n,t,{leading:e,maxWait:t,trailing:u})},An.thru=Qe,An.toArray=mu,An.toPairs=zf,An.toPairsIn=Wf,An.toPath=function(n){return ff(n)?c(n,Me):wu(n)?[n]:Ur(jo(Iu(n)))},An.toPlainObject=Ou,An.transform=function(n,t,e){var u=ff(n),i=u||af(n)||_f(n);if(t=ye(t,4),null==e){var o=n&&n.constructor;e=i?u?new o:[]:du(n)&&_u(o)?eo(di(n)):{}}return(i?r:mt)(n,function(n,r,u){return t(e,n,r,u)}),e},An.unary=function(n){return eu(n,1)},An.union=Ro,An.unionBy=zo,An.unionWith=Wo,An.uniq=function(n){return n&&n.length?br(n):[]},An.uniqBy=function(n,t){return n&&n.length?br(n,ye(t,2)):[]},An.uniqWith=function(n,t){return t=typeof t=="function"?t:T,n&&n.length?br(n,T,t):[]},An.unset=function(n,t){return null==n||xr(n,t)},An.unzip=He,An.unzipWith=Je,An.update=function(n,t,r){return null==n?n:lr(n,t,kr(r)(kt(n,t)),void 0)},An.updateWith=function(n,t,r,e){return e=typeof e=="function"?e:T,null!=n&&(n=lr(n,t,kr(r)(kt(n,t)),e)),n},An.values=Uu,An.valuesIn=function(n){return null==n?[]:S(n,Bu(n))},An.without=Bo,An.words=Mu,An.wrap=function(n,t){return nf(kr(t),n)},An.xor=Lo,An.xorBy=Uo,An.xorWith=Co,An.zip=Do,An.zipObject=function(n,t){return Ar(n||[],t||[],ot)},An.zipObjectDeep=function(n,t){return Ar(n||[],t||[],lr)},An.zipWith=Mo,An.entries=zf,An.entriesIn=Wf,An.extend=yf,An.extendWith=bf,Nu(An,An),An.add=Qf,An.attempt=Ff,An.camelCase=Bf,An.capitalize=Cu,An.ceil=Xf,An.clamp=function(n,t,r){return r===T&&(r=t,t=T),r!==T&&(r=Su(r),r=r===r?r:0),t!==T&&(t=Su(t),t=t===t?t:0),pt(Su(n),t,r)},An.clone=function(n){return _t(n,4)},An.cloneDeep=function(n){return _t(n,5)},An.cloneDeepWith=function(n,t){return t=typeof t=="function"?t:T,_t(n,5,t)},An.cloneWith=function(n,t){return t=typeof t=="function"?t:T,_t(n,4,t)},An.conformsTo=function(n,t){return null==t||gt(n,t,Wu(t))},An.deburr=Du,An.defaultTo=function(n,t){return null==n||n!==n?t:n},An.divide=nc,An.endsWith=function(n,t,r){n=Iu(n),t=yr(t);var e=n.length,e=r=r===T?e:pt(Eu(r),0,e);return r-=t.length,0<=r&&n.slice(r,e)==t},An.eq=lu,An.escape=function(n){return(n=Iu(n))&&H.test(n)?n.replace(K,nt):n},An.escapeRegExp=function(n){return(n=Iu(n))&&en.test(n)?n.replace(rn,"\\$&"):n},An.every=function(n,t,r){var e=ff(n)?u:bt;return r&&Oe(n,t,r)&&(t=T),e(n,ye(t,3))},An.find=Fo,An.findIndex=Ne,An.findKey=function(n,t){return p(n,ye(t,3),mt)},An.findLast=No,An.findLastIndex=Pe,An.findLastKey=function(n,t){return p(n,ye(t,3),At)},An.floor=tc,An.forEach=nu,An.forEachRight=tu,An.forIn=function(n,t){return null==n?n:oo(n,ye(t,3),Bu)},An.forInRight=function(n,t){return null==n?n:fo(n,ye(t,3),Bu)},An.forOwn=function(n,t){return n&&mt(n,ye(t,3))},An.forOwnRight=function(n,t){return n&&At(n,ye(t,3))},An.get=Ru,An.gt=ef,An.gte=uf,An.has=function(n,t){return null!=n&&we(n,t,Rt)},An.hasIn=zu,An.head=qe,An.identity=$u,An.includes=function(n,t,r,e){return n=su(n)?n:Uu(n),r=r&&!e?Eu(r):0,e=n.length,0>r&&(r=Ui(e+r,0)),ju(n)?r<=e&&-1<n.indexOf(t,r):!!e&&-1<v(n,t,r)},An.indexOf=function(n,t,r){var e=null==n?0:n.length;return e?(r=null==r?0:Eu(r),0>r&&(r=Ui(e+r,0)),v(n,t,r)):-1},An.inRange=function(n,t,r){return t=Au(t),r===T?(r=t,t=0):r=Au(r),n=Su(n),n>=Ci(t,r)&&n<Ui(t,r)},An.invoke=kf,An.isArguments=of,An.isArray=ff,An.isArrayBuffer=cf,An.isArrayLike=su,An.isArrayLikeObject=hu,An.isBoolean=function(n){return true===n||false===n||yu(n)&&"[object Boolean]"==Ot(n)},An.isBuffer=af,An.isDate=lf,An.isElement=function(n){return yu(n)&&1===n.nodeType&&!xu(n)},An.isEmpty=function(n){if(null==n)return true;if(su(n)&&(ff(n)||typeof n=="string"||typeof n.splice=="function"||af(n)||_f(n)||of(n)))return!n.length;var t=vo(n);if("[object Map]"==t||"[object Set]"==t)return!n.size;if(ze(n))return!Vt(n).length;for(var r in n)if(oi.call(n,r))return false;return true},An.isEqual=function(n,t){return Mt(n,t)},An.isEqualWith=function(n,t,r){var e=(r=typeof r=="function"?r:T)?r(n,t):T;return e===T?Mt(n,t,T,r):!!e},An.isError=pu,An.isFinite=function(n){return typeof n=="number"&&Wi(n)},An.isFunction=_u,An.isInteger=vu,An.isLength=gu,An.isMap=sf,An.isMatch=function(n,t){return n===t||$t(n,t,xe(t))},An.isMatchWith=function(n,t,r){return r=typeof r=="function"?r:T,$t(n,t,xe(t),r)},An.isNaN=function(n){return bu(n)&&n!=+n},An.isNative=function(n){if(go(n))throw new Hu("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Ft(n)},An.isNil=function(n){return null==n},An.isNull=function(n){return null===n},An.isNumber=bu,An.isObject=du,An.isObjectLike=yu,An.isPlainObject=xu,An.isRegExp=hf,An.isSafeInteger=function(n){return vu(n)&&-9007199254740991<=n&&9007199254740991>=n},An.isSet=pf,An.isString=ju,An.isSymbol=wu,An.isTypedArray=_f,An.isUndefined=function(n){return n===T},An.isWeakMap=function(n){return yu(n)&&"[object WeakMap]"==vo(n)},An.isWeakSet=function(n){return yu(n)&&"[object WeakSet]"==Ot(n)},An.join=function(n,t){return null==n?"":Bi.call(n,t)},An.kebabCase=Lf,An.last=Ve,An.lastIndexOf=function(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e;if(r!==T&&(u=Eu(r),u=0>u?Ui(e+u,0):Ci(u,e-1)),t===t){for(r=u+1;r--&&n[r]!==t;);n=r}else n=_(n,d,u,true);return n},An.lowerCase=Uf,An.lowerFirst=Cf,An.lt=vf,An.lte=gf,An.max=function(n){return n&&n.length?xt(n,$u,It):T},An.maxBy=function(n,t){return n&&n.length?xt(n,ye(t,2),It):T},An.mean=function(n){return y(n,$u)},An.meanBy=function(n,t){return y(n,ye(t,2))},An.min=function(n){return n&&n.length?xt(n,$u,Kt):T},An.minBy=function(n,t){return n&&n.length?xt(n,ye(t,2),Kt):T},An.stubArray=qu,An.stubFalse=Vu,An.stubObject=function(){return{}},An.stubString=function(){return""},An.stubTrue=function(){return true},An.multiply=rc,An.nth=function(n,t){return n&&n.length?Qt(n,Eu(t)):T},An.noConflict=function(){return $n._===this&&($n._=si),this},An.noop=Pu,An.now=Go,An.pad=function(n,t,r){n=Iu(n);var e=(t=Eu(t))?D(n):0;return!t||e>=t?n:(t=(t-e)/2,ne(Ii(t),r)+n+ne(Oi(t),r))},An.padEnd=function(n,t,r){n=Iu(n);var e=(t=Eu(t))?D(n):0;return t&&e<t?n+ne(t-e,r):n},An.padStart=function(n,t,r){n=Iu(n);var e=(t=Eu(t))?D(n):0;return t&&e<t?ne(t-e,r)+n:n},An.parseInt=function(n,t,r){return r||null==t?t=0:t&&(t=+t),Mi(Iu(n).replace(on,""),t||0)},An.random=function(n,t,r){if(r&&typeof r!="boolean"&&Oe(n,t,r)&&(t=r=T),r===T&&(typeof t=="boolean"?(r=t,t=T):typeof n=="boolean"&&(r=n,n=T)),n===T&&t===T?(n=0,t=1):(n=Au(n),t===T?(t=n,n=0):t=Au(t)),n>t){var e=n;n=t,t=e}return r||n%1||t%1?(r=Ti(),Ci(n+r*(t-n+Cn("1e-"+((r+"").length-1))),t)):ir(n,t)},An.reduce=function(n,t,r){var e=ff(n)?l:j,u=3>arguments.length;return e(n,ye(t,4),r,u,uo)},An.reduceRight=function(n,t,r){var e=ff(n)?s:j,u=3>arguments.length;return e(n,ye(t,4),r,u,io)},An.repeat=function(n,t,r){return t=(r?Oe(n,t,r):t===T)?1:Eu(t),or(Iu(n),t)},An.replace=function(){var n=arguments,t=Iu(n[0]);return 3>n.length?t:t.replace(n[1],n[2])},An.result=function(n,t,r){t=Sr(t,n);var e=-1,u=t.length;for(u||(u=1,n=T);++e<u;){var i=null==n?T:n[Me(t[e])];i===T&&(e=u,i=r),n=_u(i)?i.call(n):i}return n},An.round=ec,An.runInContext=x,An.sample=function(n){return(ff(n)?Qn:cr)(n)},An.size=function(n){if(null==n)return 0;if(su(n))return ju(n)?D(n):n.length;var t=vo(n);return"[object Map]"==t||"[object Set]"==t?n.size:Vt(n).length},An.snakeCase=Df,An.some=function(n,t,r){var e=ff(n)?h:pr;return r&&Oe(n,t,r)&&(t=T),e(n,ye(t,3))},An.sortedIndex=function(n,t){return _r(n,t)},An.sortedIndexBy=function(n,t,r){return vr(n,t,ye(r,2))},An.sortedIndexOf=function(n,t){var r=null==n?0:n.length;if(r){var e=_r(n,t);if(e<r&&lu(n[e],t))return e}return-1},An.sortedLastIndex=function(n,t){return _r(n,t,true)},An.sortedLastIndexBy=function(n,t,r){return vr(n,t,ye(r,2),true)},An.sortedLastIndexOf=function(n,t){if(null==n?0:n.length){var r=_r(n,t,true)-1;if(lu(n[r],t))return r}return-1},An.startCase=Mf,An.startsWith=function(n,t,r){return n=Iu(n),r=null==r?0:pt(Eu(r),0,n.length),t=yr(t),n.slice(r,r+t.length)==t},An.subtract=uc,An.sum=function(n){return n&&n.length?m(n,$u):0},An.sumBy=function(n,t){return n&&n.length?m(n,ye(t,2)):0},An.template=function(n,t,r){var e=An.templateSettings;r&&Oe(n,t,r)&&(t=T),n=Iu(n),t=bf({},t,e,ce),r=bf({},t.imports,e.imports,ce);var u,i,o=Wu(r),f=S(r,o),c=0;r=t.interpolate||jn;var a="__p+='";r=Xu((t.escape||jn).source+"|"+r.source+"|"+(r===Q?pn:jn).source+"|"+(t.evaluate||jn).source+"|$","g");var l=oi.call(t,"sourceURL")?"//# sourceURL="+(t.sourceURL+"").replace(/[\r\n]/g," ")+"\n":"";if(n.replace(r,function(t,r,e,o,f,l){return e||(e=o),a+=n.slice(c,l).replace(wn,z),r&&(u=true,a+="'+__e("+r+")+'"),f&&(i=true,a+="';"+f+";\n__p+='"),e&&(a+="'+((__t=("+e+"))==null?'':__t)+'"),c=l+t.length,t}),a+="';",(t=oi.call(t,"variable")&&t.variable)||(a="with(obj){"+a+"}"),a=(i?a.replace(P,""):a).replace(Z,"$1").replace(q,"$1;"),a="function("+(t||"obj")+"){"+(t?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(i?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+a+"return __p}",t=Ff(function(){return Ju(o,l+"return "+a).apply(T,f)}),t.source=a,pu(t))throw t;return t},An.times=function(n,t){if(n=Eu(n),1>n||9007199254740991<n)return[];var r=4294967295,e=Ci(n,4294967295);for(t=ye(t),n-=4294967295,e=A(e,t);++r<n;)t(r);return e},An.toFinite=Au,An.toInteger=Eu,An.toLength=ku,An.toLower=function(n){return Iu(n).toLowerCase()},An.toNumber=Su,An.toSafeInteger=function(n){return n?pt(Eu(n),-9007199254740991,9007199254740991):0===n?n:0},An.toString=Iu,An.toUpper=function(n){return Iu(n).toUpperCase()},An.trim=function(n,t,r){return(n=Iu(n))&&(r||t===T)?n.replace(un,""):n&&(t=yr(t))?(n=M(n),r=M(t),t=I(n,r),r=R(n,r)+1,Or(n,t,r).join("")):n},An.trimEnd=function(n,t,r){return(n=Iu(n))&&(r||t===T)?n.replace(fn,""):n&&(t=yr(t))?(n=M(n),t=R(n,M(t))+1,Or(n,0,t).join("")):n},An.trimStart=function(n,t,r){return(n=Iu(n))&&(r||t===T)?n.replace(on,""):n&&(t=yr(t))?(n=M(n),t=I(n,M(t)),Or(n,t).join("")):n},An.truncate=function(n,t){var r=30,e="...";if(du(t))var u="separator"in t?t.separator:u,r="length"in t?Eu(t.length):r,e="omission"in t?yr(t.omission):e;n=Iu(n);var i=n.length;if(Rn.test(n))var o=M(n),i=o.length;if(r>=i)return n;if(i=r-D(e),1>i)return e;if(r=o?Or(o,0,i).join(""):n.slice(0,i),u===T)return r+e;if(o&&(i+=r.length-i),hf(u)){if(n.slice(i).search(u)){var f=r;for(u.global||(u=Xu(u.source,Iu(_n.exec(u))+"g")),u.lastIndex=0;o=u.exec(f);)var c=o.index;r=r.slice(0,c===T?i:c)}}else n.indexOf(yr(u),i)!=i&&(u=r.lastIndexOf(u),-1<u&&(r=r.slice(0,u)));return r+e},An.unescape=function(n){return(n=Iu(n))&&G.test(n)?n.replace(V,tt):n},An.uniqueId=function(n){var t=++fi;return Iu(n)+t},An.upperCase=Tf,An.upperFirst=$f,An.each=nu,An.eachRight=tu,An.first=qe,Nu(An,function(){var n={};return mt(An,function(t,r){oi.call(An.prototype,r)||(n[r]=t)}),n}(),{chain:false}),An.VERSION="4.17.15",r("bind bindKey curry curryRight partial partialRight".split(" "),function(n){An[n].placeholder=An}),r(["drop","take"],function(n,t){Un.prototype[n]=function(r){r=r===T?1:Ui(Eu(r),0);var e=this.__filtered__&&!t?new Un(this):this.clone();return e.__filtered__?e.__takeCount__=Ci(r,e.__takeCount__):e.__views__.push({size:Ci(r,4294967295),type:n+(0>e.__dir__?"Right":"")}),e},Un.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}}),r(["filter","map","takeWhile"],function(n,t){var r=t+1,e=1==r||3==r;Un.prototype[n]=function(n){var t=this.clone();return t.__iteratees__.push({iteratee:ye(n,3),type:r}),t.__filtered__=t.__filtered__||e,t}}),r(["head","last"],function(n,t){var r="take"+(t?"Right":"");Un.prototype[n]=function(){return this[r](1).value()[0]}}),r(["initial","tail"],function(n,t){var r="drop"+(t?"":"Right");Un.prototype[n]=function(){return this.__filtered__?new Un(this):this[r](1)}}),Un.prototype.compact=function(){return this.filter($u)},Un.prototype.find=function(n){return this.filter(n).head()},Un.prototype.findLast=function(n){return this.reverse().find(n)},Un.prototype.invokeMap=fr(function(n,t){return typeof n=="function"?new Un(this):this.map(function(r){return Lt(r,n,t)})}),Un.prototype.reject=function(n){return this.filter(au(ye(n)))},Un.prototype.slice=function(n,t){n=Eu(n);var r=this;return r.__filtered__&&(0<n||0>t)?new Un(r):(0>n?r=r.takeRight(-n):n&&(r=r.drop(n)),t!==T&&(t=Eu(t),r=0>t?r.dropRight(-t):r.take(t-n)),r)},Un.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},Un.prototype.toArray=function(){return this.take(4294967295)},mt(Un.prototype,function(n,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),e=/^(?:head|last)$/.test(t),u=An[e?"take"+("last"==t?"Right":""):t],i=e||/^find/.test(t);u&&(An.prototype[t]=function(){function t(n){return n=u.apply(An,a([n],f)),e&&h?n[0]:n}var o=this.__wrapped__,f=e?[1]:arguments,c=o instanceof Un,l=f[0],s=c||ff(o);s&&r&&typeof l=="function"&&1!=l.length&&(c=s=false);var h=this.__chain__,p=!!this.__actions__.length,l=i&&!h,c=c&&!p;return!i&&s?(o=c?o:new Un(this),o=n.apply(o,f),o.__actions__.push({func:Qe,args:[t],thisArg:T}),new On(o,h)):l&&c?n.apply(this,f):(o=this.thru(t),l?e?o.value()[0]:o.value():o)})}),r("pop push shift sort splice unshift".split(" "),function(n){var t=ri[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|shift)$/.test(n);An.prototype[n]=function(){var n=arguments;if(e&&!this.__chain__){var u=this.value();return t.apply(ff(u)?u:[],n)}return this[r](function(r){return t.apply(ff(r)?r:[],n)})}}),mt(Un.prototype,function(n,t){var r=An[t];if(r){var e=r.name+"";oi.call(Gi,e)||(Gi[e]=[]),Gi[e].push({name:t,func:r})}}),Gi[Jr(T,2).name]=[{name:"wrapper",func:T}],Un.prototype.clone=function(){var n=new Un(this.__wrapped__);return n.__actions__=Ur(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=Ur(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=Ur(this.__views__),n},Un.prototype.reverse=function(){if(this.__filtered__){var n=new Un(this);n.__dir__=-1,n.__filtered__=true}else n=this.clone(),n.__dir__*=-1;return n},Un.prototype.value=function(){var n,t=this.__wrapped__.value(),r=this.__dir__,e=ff(t),u=0>r,i=e?t.length:0;n=i;for(var o=this.__views__,f=0,c=-1,a=o.length;++c<a;){var l=o[c],s=l.size;switch(l.type){case"drop":f+=s;break;case"dropRight":n-=s;break;case"take":n=Ci(n,f+s);break;case"takeRight":f=Ui(f,n-s)}}if(n={start:f,end:n},o=n.start,f=n.end,n=f-o,o=u?f:o-1,f=this.__iteratees__,c=f.length,a=0,l=Ci(n,this.__takeCount__),!e||!u&&i==n&&l==n)return wr(t,this.__actions__);e=[];n:for(;n--&&a<l;){for(o+=r,u=-1,i=t[o];++u<c;){var h=f[u],s=h.type,h=(0,h.iteratee)(i);if(2==s)i=h;else if(!h){if(1==s)continue n;break n}}e[a++]=i}return e},An.prototype.at=To,An.prototype.chain=function(){return Ye(this)},An.prototype.commit=function(){return new On(this.value(),this.__chain__)},An.prototype.next=function(){this.__values__===T&&(this.__values__=mu(this.value()));var n=this.__index__>=this.__values__.length;return{done:n,value:n?T:this.__values__[this.__index__++]}},An.prototype.plant=function(n){for(var t,r=this;r instanceof En;){var e=Fe(r);e.__index__=0,e.__values__=T,t?u.__wrapped__=e:t=e;var u=e,r=r.__wrapped__}return u.__wrapped__=n,t},An.prototype.reverse=function(){var n=this.__wrapped__;return n instanceof Un?(this.__actions__.length&&(n=new Un(this)),n=n.reverse(),n.__actions__.push({func:Qe,args:[Ge],thisArg:T}),new On(n,this.__chain__)):this.thru(Ge)},An.prototype.toJSON=An.prototype.valueOf=An.prototype.value=function(){return wr(this.__wrapped__,this.__actions__)},An.prototype.first=An.prototype.head,wi&&(An.prototype[wi]=Xe),An}();typeof define=="function"&&typeof define.amd=="object"&&define.amd?($n._=rt,define(function(){return rt})):Nn?((Nn.exports=rt)._=rt,Fn._=rt):$n._=rt}).call(this);!function(u,D){"object"==typeof exports&&"undefined"!=typeof module?module.exports=D():"function"==typeof define&&define.amd?define(D):u.JSON5=D()}(this,function(){"use strict";function u(u,D){return u(D={exports:{}},D.exports),D.exports}var D=u(function(u){var D=u.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=D)}),e=u(function(u){var D=u.exports={version:"2.6.5"};"number"==typeof __e&&(__e=D)}),r=(e.version,function(u){return"object"==typeof u?null!==u:"function"==typeof u}),t=function(u){if(!r(u))throw TypeError(u+" is not an object!");return u},n=function(u){try{return!!u()}catch(u){return!0}},F=!n(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),C=D.document,A=r(C)&&r(C.createElement),i=!F&&!n(function(){return 7!=Object.defineProperty((u="div",A?C.createElement(u):{}),"a",{get:function(){return 7}}).a;var u}),E=Object.defineProperty,o={f:F?Object.defineProperty:function(u,D,e){if(t(u),D=function(u,D){if(!r(u))return u;var e,t;if(D&&"function"==typeof(e=u.toString)&&!r(t=e.call(u)))return t;if("function"==typeof(e=u.valueOf)&&!r(t=e.call(u)))return t;if(!D&&"function"==typeof(e=u.toString)&&!r(t=e.call(u)))return t;throw TypeError("Can't convert object to primitive value")}(D,!0),t(e),i)try{return E(u,D,e)}catch(u){}if("get"in e||"set"in e)throw TypeError("Accessors not supported!");return"value"in e&&(u[D]=e.value),u}},a=F?function(u,D,e){return o.f(u,D,function(u,D){return{enumerable:!(1&u),configurable:!(2&u),writable:!(4&u),value:D}}(1,e))}:function(u,D,e){return u[D]=e,u},c={}.hasOwnProperty,B=function(u,D){return c.call(u,D)},s=0,f=Math.random(),l=u(function(u){var r=D["__core-js_shared__"]||(D["__core-js_shared__"]={});(u.exports=function(u,D){return r[u]||(r[u]=void 0!==D?D:{})})("versions",[]).push({version:e.version,mode:"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})})("native-function-to-string",Function.toString),d=u(function(u){var r,t="Symbol(".concat(void 0===(r="src")?"":r,")_",(++s+f).toString(36)),n=(""+l).split("toString");e.inspectSource=function(u){return l.call(u)},(u.exports=function(u,e,r,F){var C="function"==typeof r;C&&(B(r,"name")||a(r,"name",e)),u[e]!==r&&(C&&(B(r,t)||a(r,t,u[e]?""+u[e]:n.join(String(e)))),u===D?u[e]=r:F?u[e]?u[e]=r:a(u,e,r):(delete u[e],a(u,e,r)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[t]||l.call(this)})}),v=function(u,D,e){if(function(u){if("function"!=typeof u)throw TypeError(u+" is not a function!")}(u),void 0===D)return u;switch(e){case 1:return function(e){return u.call(D,e)};case 2:return function(e,r){return u.call(D,e,r)};case 3:return function(e,r,t){return u.call(D,e,r,t)}}return function(){return u.apply(D,arguments)}},p=function(u,r,t){var n,F,C,A,i=u&p.F,E=u&p.G,o=u&p.S,c=u&p.P,B=u&p.B,s=E?D:o?D[r]||(D[r]={}):(D[r]||{}).prototype,f=E?e:e[r]||(e[r]={}),l=f.prototype||(f.prototype={});for(n in E&&(t=r),t)C=((F=!i&&s&&void 0!==s[n])?s:t)[n],A=B&&F?v(C,D):c&&"function"==typeof C?v(Function.call,C):C,s&&d(s,n,C,u&p.U),f[n]!=C&&a(f,n,A),c&&l[n]!=C&&(l[n]=C)};D.core=e,p.F=1,p.G=2,p.S=4,p.P=8,p.B=16,p.W=32,p.U=64,p.R=128;var h,m=p,g=Math.ceil,y=Math.floor,w=function(u){return isNaN(u=+u)?0:(u>0?y:g)(u)},b=(h=!1,function(u,D){var e,r,t=String(function(u){if(null==u)throw TypeError("Can't call method on  "+u);return u}(u)),n=w(D),F=t.length;return n<0||n>=F?h?"":void 0:(e=t.charCodeAt(n))<55296||e>56319||n+1===F||(r=t.charCodeAt(n+1))<56320||r>57343?h?t.charAt(n):e:h?t.slice(n,n+2):r-56320+(e-55296<<10)+65536});m(m.P,"String",{codePointAt:function(u){return b(this,u)}});e.String.codePointAt;var S=Math.max,x=Math.min,N=String.fromCharCode,P=String.fromCodePoint;m(m.S+m.F*(!!P&&1!=P.length),"String",{fromCodePoint:function(u){for(var D,e,r,t=arguments,n=[],F=arguments.length,C=0;F>C;){if(D=+t[C++],r=1114111,((e=w(e=D))<0?S(e+r,0):x(e,r))!==D)throw RangeError(D+" is not a valid code point");n.push(D<65536?N(D):N(55296+((D-=65536)>>10),D%1024+56320))}return n.join("")}});e.String.fromCodePoint;var _,O,j,I,V,J,M,k,L,T,z,H,$,R,G={Space_Separator:/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,ID_Start:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,ID_Continue:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/},U={isSpaceSeparator:function(u){return"string"==typeof u&&G.Space_Separator.test(u)},isIdStartChar:function(u){return"string"==typeof u&&(u>="a"&&u<="z"||u>="A"&&u<="Z"||"$"===u||"_"===u||G.ID_Start.test(u))},isIdContinueChar:function(u){return"string"==typeof u&&(u>="a"&&u<="z"||u>="A"&&u<="Z"||u>="0"&&u<="9"||"$"===u||"_"===u||"‌"===u||"‍"===u||G.ID_Continue.test(u))},isDigit:function(u){return"string"==typeof u&&/[0-9]/.test(u)},isHexDigit:function(u){return"string"==typeof u&&/[0-9A-Fa-f]/.test(u)}};function Z(){for(T="default",z="",H=!1,$=1;;){R=q();var u=X[T]();if(u)return u}}function q(){if(_[I])return String.fromCodePoint(_.codePointAt(I))}function W(){var u=q();return"\n"===u?(V++,J=0):u?J+=u.length:J++,u&&(I+=u.length),u}var X={default:function(){switch(R){case"\t":case"\v":case"\f":case" ":case" ":case"\ufeff":case"\n":case"\r":case"\u2028":case"\u2029":return void W();case"/":return W(),void(T="comment");case void 0:return W(),K("eof")}if(!U.isSpaceSeparator(R))return X[O]();W()},comment:function(){switch(R){case"*":return W(),void(T="multiLineComment");case"/":return W(),void(T="singleLineComment")}throw ru(W())},multiLineComment:function(){switch(R){case"*":return W(),void(T="multiLineCommentAsterisk");case void 0:throw ru(W())}W()},multiLineCommentAsterisk:function(){switch(R){case"*":return void W();case"/":return W(),void(T="default");case void 0:throw ru(W())}W(),T="multiLineComment"},singleLineComment:function(){switch(R){case"\n":case"\r":case"\u2028":case"\u2029":return W(),void(T="default");case void 0:return W(),K("eof")}W()},value:function(){switch(R){case"{":case"[":return K("punctuator",W());case"n":return W(),Q("ull"),K("null",null);case"t":return W(),Q("rue"),K("boolean",!0);case"f":return W(),Q("alse"),K("boolean",!1);case"-":case"+":return"-"===W()&&($=-1),void(T="sign");case".":return z=W(),void(T="decimalPointLeading");case"0":return z=W(),void(T="zero");case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return z=W(),void(T="decimalInteger");case"I":return W(),Q("nfinity"),K("numeric",1/0);case"N":return W(),Q("aN"),K("numeric",NaN);case'"':case"'":return H='"'===W(),z="",void(T="string")}throw ru(W())},identifierNameStartEscape:function(){if("u"!==R)throw ru(W());W();var u=Y();switch(u){case"$":case"_":break;default:if(!U.isIdStartChar(u))throw nu()}z+=u,T="identifierName"},identifierName:function(){switch(R){case"$":case"_":case"‌":case"‍":return void(z+=W());case"\\":return W(),void(T="identifierNameEscape")}if(!U.isIdContinueChar(R))return K("identifier",z);z+=W()},identifierNameEscape:function(){if("u"!==R)throw ru(W());W();var u=Y();switch(u){case"$":case"_":case"‌":case"‍":break;default:if(!U.isIdContinueChar(u))throw nu()}z+=u,T="identifierName"},sign:function(){switch(R){case".":return z=W(),void(T="decimalPointLeading");case"0":return z=W(),void(T="zero");case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return z=W(),void(T="decimalInteger");case"I":return W(),Q("nfinity"),K("numeric",$*(1/0));case"N":return W(),Q("aN"),K("numeric",NaN)}throw ru(W())},zero:function(){switch(R){case".":return z+=W(),void(T="decimalPoint");case"e":case"E":return z+=W(),void(T="decimalExponent");case"x":case"X":return z+=W(),void(T="hexadecimal")}return K("numeric",0*$)},decimalInteger:function(){switch(R){case".":return z+=W(),void(T="decimalPoint");case"e":case"E":return z+=W(),void(T="decimalExponent")}if(!U.isDigit(R))return K("numeric",$*Number(z));z+=W()},decimalPointLeading:function(){if(U.isDigit(R))return z+=W(),void(T="decimalFraction");throw ru(W())},decimalPoint:function(){switch(R){case"e":case"E":return z+=W(),void(T="decimalExponent")}return U.isDigit(R)?(z+=W(),void(T="decimalFraction")):K("numeric",$*Number(z))},decimalFraction:function(){switch(R){case"e":case"E":return z+=W(),void(T="decimalExponent")}if(!U.isDigit(R))return K("numeric",$*Number(z));z+=W()},decimalExponent:function(){switch(R){case"+":case"-":return z+=W(),void(T="decimalExponentSign")}if(U.isDigit(R))return z+=W(),void(T="decimalExponentInteger");throw ru(W())},decimalExponentSign:function(){if(U.isDigit(R))return z+=W(),void(T="decimalExponentInteger");throw ru(W())},decimalExponentInteger:function(){if(!U.isDigit(R))return K("numeric",$*Number(z));z+=W()},hexadecimal:function(){if(U.isHexDigit(R))return z+=W(),void(T="hexadecimalInteger");throw ru(W())},hexadecimalInteger:function(){if(!U.isHexDigit(R))return K("numeric",$*Number(z));z+=W()},string:function(){switch(R){case"\\":return W(),void(z+=function(){switch(q()){case"b":return W(),"\b";case"f":return W(),"\f";case"n":return W(),"\n";case"r":return W(),"\r";case"t":return W(),"\t";case"v":return W(),"\v";case"0":if(W(),U.isDigit(q()))throw ru(W());return"\0";case"x":return W(),function(){var u="",D=q();if(!U.isHexDigit(D))throw ru(W());if(u+=W(),D=q(),!U.isHexDigit(D))throw ru(W());return u+=W(),String.fromCodePoint(parseInt(u,16))}();case"u":return W(),Y();case"\n":case"\u2028":case"\u2029":return W(),"";case"\r":return W(),"\n"===q()&&W(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case void 0:throw ru(W())}return W()}());case'"':return H?(W(),K("string",z)):void(z+=W());case"'":return H?void(z+=W()):(W(),K("string",z));case"\n":case"\r":throw ru(W());case"\u2028":case"\u2029":!function(u){console.warn("JSON5: '"+Fu(u)+"' in strings is not valid ECMAScript; consider escaping")}(R);break;case void 0:throw ru(W())}z+=W()},start:function(){switch(R){case"{":case"[":return K("punctuator",W())}T="value"},beforePropertyName:function(){switch(R){case"$":case"_":return z=W(),void(T="identifierName");case"\\":return W(),void(T="identifierNameStartEscape");case"}":return K("punctuator",W());case'"':case"'":return H='"'===W(),void(T="string")}if(U.isIdStartChar(R))return z+=W(),void(T="identifierName");throw ru(W())},afterPropertyName:function(){if(":"===R)return K("punctuator",W());throw ru(W())},beforePropertyValue:function(){T="value"},afterPropertyValue:function(){switch(R){case",":case"}":return K("punctuator",W())}throw ru(W())},beforeArrayValue:function(){if("]"===R)return K("punctuator",W());T="value"},afterArrayValue:function(){switch(R){case",":case"]":return K("punctuator",W())}throw ru(W())},end:function(){throw ru(W())}};function K(u,D){return{type:u,value:D,line:V,column:J}}function Q(u){for(var D=0,e=u;D<e.length;D+=1){var r=e[D];if(q()!==r)throw ru(W());W()}}function Y(){for(var u="",D=4;D-- >0;){var e=q();if(!U.isHexDigit(e))throw ru(W());u+=W()}return String.fromCodePoint(parseInt(u,16))}var uu={start:function(){if("eof"===M.type)throw tu();Du()},beforePropertyName:function(){switch(M.type){case"identifier":case"string":return k=M.value,void(O="afterPropertyName");case"punctuator":return void eu();case"eof":throw tu()}},afterPropertyName:function(){if("eof"===M.type)throw tu();O="beforePropertyValue"},beforePropertyValue:function(){if("eof"===M.type)throw tu();Du()},beforeArrayValue:function(){if("eof"===M.type)throw tu();"punctuator"!==M.type||"]"!==M.value?Du():eu()},afterPropertyValue:function(){if("eof"===M.type)throw tu();switch(M.value){case",":return void(O="beforePropertyName");case"}":eu()}},afterArrayValue:function(){if("eof"===M.type)throw tu();switch(M.value){case",":return void(O="beforeArrayValue");case"]":eu()}},end:function(){}};function Du(){var u;switch(M.type){case"punctuator":switch(M.value){case"{":u={};break;case"[":u=[]}break;case"null":case"boolean":case"numeric":case"string":u=M.value}if(void 0===L)L=u;else{var D=j[j.length-1];Array.isArray(D)?D.push(u):Object.defineProperty(D,k,{value:u,writable:!0,enumerable:!0,configurable:!0})}if(null!==u&&"object"==typeof u)j.push(u),O=Array.isArray(u)?"beforeArrayValue":"beforePropertyName";else{var e=j[j.length-1];O=null==e?"end":Array.isArray(e)?"afterArrayValue":"afterPropertyValue"}}function eu(){j.pop();var u=j[j.length-1];O=null==u?"end":Array.isArray(u)?"afterArrayValue":"afterPropertyValue"}function ru(u){return Cu(void 0===u?"JSON5: invalid end of input at "+V+":"+J:"JSON5: invalid character '"+Fu(u)+"' at "+V+":"+J)}function tu(){return Cu("JSON5: invalid end of input at "+V+":"+J)}function nu(){return Cu("JSON5: invalid identifier character at "+V+":"+(J-=5))}function Fu(u){var D={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(D[u])return D[u];if(u<" "){var e=u.charCodeAt(0).toString(16);return"\\x"+("00"+e).substring(e.length)}return u}function Cu(u){var D=new SyntaxError(u);return D.lineNumber=V,D.columnNumber=J,D}return{parse:function(u,D){_=String(u),O="start",j=[],I=0,V=1,J=0,M=void 0,k=void 0,L=void 0;do{M=Z(),uu[O]()}while("eof"!==M.type);return"function"==typeof D?function u(D,e,r){var t=D[e];if(null!=t&&"object"==typeof t)if(Array.isArray(t))for(var n=0;n<t.length;n++){var F=String(n),C=u(t,F,r);void 0===C?delete t[F]:Object.defineProperty(t,F,{value:C,writable:!0,enumerable:!0,configurable:!0})}else for(var A in t){var i=u(t,A,r);void 0===i?delete t[A]:Object.defineProperty(t,A,{value:i,writable:!0,enumerable:!0,configurable:!0})}return r.call(D,e,t)}({"":L},"",D):L},stringify:function(u,D,e){var r,t,n,F=[],C="",A="";if(null==D||"object"!=typeof D||Array.isArray(D)||(e=D.space,n=D.quote,D=D.replacer),"function"==typeof D)t=D;else if(Array.isArray(D)){r=[];for(var i=0,E=D;i<E.length;i+=1){var o=E[i],a=void 0;"string"==typeof o?a=o:("number"==typeof o||o instanceof String||o instanceof Number)&&(a=String(o)),void 0!==a&&r.indexOf(a)<0&&r.push(a)}}return e instanceof Number?e=Number(e):e instanceof String&&(e=String(e)),"number"==typeof e?e>0&&(e=Math.min(10,Math.floor(e)),A="          ".substr(0,e)):"string"==typeof e&&(A=e.substr(0,10)),c("",{"":u});function c(u,D){var e=D[u];switch(null!=e&&("function"==typeof e.toJSON5?e=e.toJSON5(u):"function"==typeof e.toJSON&&(e=e.toJSON(u))),t&&(e=t.call(D,u,e)),e instanceof Number?e=Number(e):e instanceof String?e=String(e):e instanceof Boolean&&(e=e.valueOf()),e){case null:return"null";case!0:return"true";case!1:return"false"}return"string"==typeof e?B(e):"number"==typeof e?String(e):"object"==typeof e?Array.isArray(e)?function(u){if(F.indexOf(u)>=0)throw TypeError("Converting circular structure to JSON5");F.push(u);var D=C;C+=A;for(var e,r=[],t=0;t<u.length;t++){var n=c(String(t),u);r.push(void 0!==n?n:"null")}if(0===r.length)e="[]";else if(""===A){var i=r.join(",");e="["+i+"]"}else{var E=",\n"+C,o=r.join(E);e="[\n"+C+o+",\n"+D+"]"}return F.pop(),C=D,e}(e):function(u){if(F.indexOf(u)>=0)throw TypeError("Converting circular structure to JSON5");F.push(u);var D=C;C+=A;for(var e,t,n=r||Object.keys(u),i=[],E=0,o=n;E<o.length;E+=1){var a=o[E],B=c(a,u);if(void 0!==B){var f=s(a)+":";""!==A&&(f+=" "),f+=B,i.push(f)}}if(0===i.length)e="{}";else if(""===A)t=i.join(","),e="{"+t+"}";else{var l=",\n"+C;t=i.join(l),e="{\n"+C+t+",\n"+D+"}"}return F.pop(),C=D,e}(e):void 0}function B(u){for(var D={"'":.1,'"':.2},e={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"},r="",t=0;t<u.length;t++){var F=u[t];switch(F){case"'":case'"':D[F]++,r+=F;continue;case"\0":if(U.isDigit(u[t+1])){r+="\\x00";continue}}if(e[F])r+=e[F];else if(F<" "){var C=F.charCodeAt(0).toString(16);r+="\\x"+("00"+C).substring(C.length)}else r+=F}var A=n||Object.keys(D).reduce(function(u,e){return D[u]<D[e]?u:e});return A+(r=r.replace(new RegExp(A,"g"),e[A]))+A}function s(u){if(0===u.length)return B(u);var D=String.fromCodePoint(u.codePointAt(0));if(!U.isIdStartChar(D))return B(u);for(var e=D.length;e<u.length;e++)if(!U.isIdContinueChar(String.fromCodePoint(u.codePointAt(e))))return B(u);return u}}}});"use strict";if(typeof IS_DOCKER==="undefined"||typeof IS_PROCESS_SERVER==="undefined"){var SESSION_OBJ={};var DOCS_OBJ={}}var glb={};var func={};func.UI={};func.GLB={};func.mobile={};glb.IS_STUDIO=null;var PROJECT_OBJ={};var APP_OBJ={};var SESSION_ID=null;var EXP_BUSY=false;glb.PROTECTED_VARS=["_NULL","_THIS","_FOR_KEY","_FOR_VAL","_ROWNO","_ROWID","_ROWDOC","_KEY","_VAL"];func.common={};func.common.find_item_by_key=function(arr,key,val){return _.find(arr,function(e){return e.data[key]===val})};func.common.find_item_by_key_root=function(arr,key,val){return _.find(arr,function(e){return e[key]===val})};func.common.find_ROWID_idx=function(_ds,rowId){if(!_ds?.data_feed?.rows){throw new Error("data_feed not found")}const index=_ds.data_feed.rows.findIndex(item=>item._ROWID===rowId);if(index===-1){throw new Error(`ROWID "${rowId}" not found`)}return index};func.common.input_mask=async function(actionP,valP,typeP,maskP,elemP,grid_objP,grid_row_idP,grid_col_idP,dsSessionP){const module=await func.common.get_module(SESSION_ID,"xuda-input-musk-utils-module.mjs");module.input_mask(actionP,valP,typeP,maskP,elemP,grid_objP,grid_row_idP,grid_col_idP,dsSessionP)};glb.MAIN_WINDOW_TYPES_ARR=["screen","program"];glb.FUNCTION_NODES_ARR=["batch","get_data","set_data","Alert_error","Alert_warning","Alert_info","Alert_ok","javascript","SQL"];glb.emailRegex=/^[\w\.-]+@[a-zA-Z\d\.-]+\.[a-zA-Z]{2,}$/;const FIREBASE_AUTH_PROPERTIES_ARR=["provider","token","first_name","last_name","email","user_id","picture","verified_email","locale","error_code","error_msg"];const CLIENT_INFO_PROPERTIES_ARR=["fingerprint","device","user_agent","browser_version","browser_name","engine_version","engine_name","client_ip","os_name","os_version","device_model","device_vendor","device_type","screen_current_resolution_x","screen_current_resolution_y","screen_available_resolution_x","screen_available_resolution_y","language","time_zone","cpu_architecture","uuid","cursor_pos_x","cursor_pos_y"];const APP_PROPERTIES_ARR=["build","author","date","name"];const DATASOURCE_PROPERTIES_ARR=["rows","type","first_row_id","last_row_id","query_from_segments_json","query_to_segments_json","locate_query_from_segments_json","locate_query_to_segments_json","first_row_segments_json","last_row_segments_json","rowid_snapshot","rowid"];glb.MOBILE_ARR=["component","web_app","ios_app","android_app","electron_app","osx_app","windows_app"];glb.SYS_DATE_ARR=["SYS_DATE","SYS_DATE_TIME","SYS_DATE_VALUE","SYS_DATE_WEEK_YEAR","SYS_DATE_MONTH_YEAR","SYS_TIME_SHORT","SYS_TIME"];glb.API_OUTPUT_ARR=["json","html","xml","text","css","javascript"];const PROTECTED_NAMES_ARR=["THIS","ROWID"];func.common.db=async function(SESSION_ID,serviceP,dataP,opt={},dsSession){return new Promise(async function(resolve,reject){var _session=SESSION_OBJ[SESSION_ID];const app_id=_session.app_id;if(glb.DEBUG_MODE){console.log("request",dataP)}var data={app_id:app_id,fingerprint:_session?.SYS_GLOBAL_OBJ_CLIENT_INFO?.fingerprint,debug:glb.DEBUG_MODE,session_id:SESSION_ID,gtp_token:_session.gtp_token,app_token:_session.app_token,res_token:_session.res_token,engine_mode:_session.engine_mode,req_id:"rt_req_"+crypto.randomUUID(),app_replicate:APP_OBJ[app_id].app_replicate};try{if(typeof firebase!=="undefined"&&firebase?.auth()?.currentUser?.displayName){data.device_name=firebase.auth().currentUser.displayName}}catch(error){}for(const[key,val]of Object.entries(dataP)){data[key]=val}const success_callback=function(ret){if(dataP.table_id&&DOCS_OBJ[app_id][dataP.table_id]){func.utils.debug.watch(SESSION_ID,dataP.table_id,"table",DOCS_OBJ[app_id][dataP.table_id].properties.menuName,{req:data,res:ret})}if(glb.DEBUG_MODE){console.log("response",ret)}resolve(ret,true)};const error_callback=function(err){reject(err)};function cleanString(json){let str=JSON.stringify(json);return str.replace(/[^a-zA-Z0-9]/g,"")}const get_rep_id=function(){let _data={};const fields_to_skip=["fields","viewSourceDesc","skip","limit","count","reduce","prog_id","sortModel","filterModelMongo","filterModelSql","filterModelUserMongo","filterModelUserSql"];for(let[key,val]of Object.entries(dataP)){if(typeof val!=="undefined"&&val!==null&&!fields_to_skip.includes(key)){_data[key]=val}}return cleanString(_data)};const validate_existence_of_whole_table_request=async function(db){let table_req_id;try{table_req_id=cleanString({key:data.table_id,table_id:data.table_id});const doc=await db.get(table_req_id);let ret=await db.find({selector:{docType:"rep_request",table_id:data.table_id}});if(doc.stat<3){throw"not ready"}for(let doc of ret.docs){if(doc.entire_table)continue;func.db.pouch.remove_db_replication_from_server(SESSION_ID,doc._id)}return{code:1,data:table_req_id}}catch(err){return{code:-1,data:table_req_id}}};const read_dbs_pouch=async function(db){if(_session?.DS_GLB?.[dsSession]?.refreshed&&(dataP.filterModelMongo||dataP.filterModelSql)){return{code:1,data:await func.db.pouch[serviceP](SESSION_ID,data)}}const rep_id=get_rep_id();const{code:table_req_code,data:table_req_id}=await validate_existence_of_whole_table_request(db);if(table_req_code>0){return{code:1,data:await func.db.pouch[serviceP](SESSION_ID,data)}}try{const doc=await db.get(rep_id);if(doc.stat<3)throw"replication not ready";const json={code:1,data:await func.db.pouch[serviceP](SESSION_ID,data)};return json}catch(err){const json=await func.common.perform_rpi_request(SESSION_ID,serviceP,opt,data);if(json.data.opt){try{try{await db.get(rep_id)}catch(err){await db.put({_id:rep_id,selector:json.data.opt.selector,stat:1,ts:Date.now(),docType:"rep_request",table_id:dataP.table_id,prog_id:dataP.prog_id,entire_table:table_req_id===rep_id,source:"runtime",e:data})}func.db.pouch.set_db_replication_from_server(SESSION_ID)}catch(err){}}return json}};const update_dbs_pouch=async function(db){try{const{code:table_req_code,data:table_req_id}=await validate_existence_of_whole_table_request(db);if(table_req_code>0){data.full_table_downloaded=true}await db.get(dataP.row_id);return await func.db.pouch[serviceP](SESSION_ID,data)}catch(err){return await func.common.perform_rpi_request(SESSION_ID,serviceP,opt,data)}};const create_dbs_pouch=async function(db){try{const{code:table_req_code,data:table_req_id}=await validate_existence_of_whole_table_request(db);if(table_req_code>0){data.full_table_downloaded=true}return await func.db.pouch[serviceP](SESSION_ID,data)}catch(err){return await func.common.perform_rpi_request(SESSION_ID,serviceP,opt,data)}};const delete_dbs_pouch=async function(db){for await(let row_id of dataP.ids||[]){try{const{code:table_req_code,data:table_req_id}=await validate_existence_of_whole_table_request(db);if(table_req_code>0){data.full_table_downloaded=true}await db.get(row_id);let _data=_.cloneDeep(dataP);_data.ids=[row_id];return await func.db.pouch["dbs_delete"](SESSION_ID,_data)}catch(err){return await func.common.perform_rpi_request(SESSION_ID,serviceP,opt,data)}}};if(typeof IS_DOCKER==="undefined"&&typeof IS_PROCESS_SERVER==="undefined"){try{if(!SESSION_OBJ?.[SESSION_ID]?.rpi_http_methods?.includes(serviceP)){throw""}if(!await func?.db?.pouch?.get_replication_stat(SESSION_ID))throw"";const db=await func.utils.connect_pouchdb(SESSION_ID);switch(serviceP){case"dbs_read":{try{return success_callback(await read_dbs_pouch(db))}catch(err){if(err==="creating index in progress"){throw""}return error_callback(err)}break}case"dbs_update":{try{const ret={code:1,data:await update_dbs_pouch(db)};return success_callback(ret)}catch(err){return error_callback(err)}break}case"dbs_create":{try{const ret={code:1,data:await create_dbs_pouch(db)};return success_callback(ret)}catch(err){return error_callback(err)}break}case"dbs_delete":{try{const ret={code:1,data:await delete_dbs_pouch(db)};return success_callback(ret)}catch(err){return error_callback(err)}break}default:throw"";break}}catch(err){try{const json=await func.common.perform_rpi_request(SESSION_ID,serviceP,opt,data);return success_callback(json,true)}catch(err){return error_callback(err)}}}const response=function(res,ret){if(ret.code<0){return error_callback(ret)}success_callback(ret)};const get_white_spaced_data=function(data){var e={};_.forEach(data,function(val,key){if(!val){if(typeof val==="boolean"){e[key]="false"}else{e[key]=""}}else{if(typeof val==="boolean"){e[key]="true"}else{e[key]=val}}});if(data.fields&&!data.fields.length){e.fields=""}return e};if(dataP.table_id){await func.utils.FILES_OBJ.get(SESSION_ID,dataP.table_id);await func.utils.TREE_OBJ.get(SESSION_ID,dataP.table_id)}data.db_driver="xuda";__.rpi.http_calls(serviceP,{body:get_white_spaced_data(data)},null,response)})};func.common.getJsonFromUrl=function(){const queryString=window.location.search;const urlParams=new URLSearchParams(queryString);return urlParams};func.common.getParametersFromUrl=function(){const searchParams=new URLSearchParams(window.location.search);const parameters={};for(const[key,value]of searchParams.entries()){parameters[key]=value}return parameters};func.common.getObjectFromUrl=function(url,element_attributes_obj,embed_params_obj){var result={};if(element_attributes_obj){for(let[key,val]of Object.entries(element_attributes_obj)){result[key]=val}}if(embed_params_obj){for(let[key,val]of Object.entries(embed_params_obj)){result[key]=val}}if(!url&&typeof IS_DOCKER==="undefined"&&typeof IS_PROCESS_SERVER==="undefined"){url=location.href}var question=url.indexOf("?");var hash=url.indexOf("#");if(hash==-1&&question==-1)return result;if(hash==-1)hash=url.length;var query=question==-1||hash==question+1?url.substring(hash):url.substring(question+1,hash);query.split("&").forEach(function(part){if(!part)return;part=part.split("+").join(" ");var eq=part.indexOf("=");var key=eq>-1?part.substr(0,eq):part;var val=eq>-1?decodeURIComponent(part.substr(eq+1)):"";var from=key.indexOf("[");if(from==-1){result[decodeURIComponent(key)]=val}else{var to=key.indexOf("]",from);var index=decodeURIComponent(key.substring(from+1,to));key=decodeURIComponent(key.substring(0,from));if(!result[key])result[key]=[];if(!index)result[key].push(val);else result[key][index]=val}});return result};func.common.getContrast_color=function(hexcolor){function colourNameToHex(colour){var colours={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};if(typeof colours[colour.toLowerCase()]!="undefined")return colours[colour.toLowerCase()];return false}if(!hexcolor.includes("#")){hexcolor=colourNameToHex(hexcolor)}if(hexcolor.slice(0,1)==="#"){hexcolor=hexcolor.slice(1)}var r=Number(hexcolor.substr(0,2),16);var g=Number(hexcolor.substr(2,2),16);var b=Number(hexcolor.substr(4,2),16);var yiq=(r*299+g*587+b*114)/1e3;return yiq>=128?"black":"white"};func.common.get_url=function(SESSION_ID,method,path){return`https://${SESSION_OBJ[SESSION_ID].domain}/${method}${path?"/"+path:"/"}`};var UI_FRAMEWORK_INSTALLED=null;var UI_FRAMEWORK_PLUGIN={};func.common.get_cast_val=async function(SESSION_ID,source,attributeP,typeP,valP,errorP){const report_conversion_error=function(res){if(errorP){return func.utils.debug_report(SESSION_ID,_.capitalize(source),errorP,"W")}var msg=`error converting  ${attributeP} from ${valP} to ${typeP}`;func.utils.debug_report(SESSION_ID,_.capitalize(source),msg,"E")};const report_conversion_warn=function(msg){var msg=`type mismatch auto conversion made to ${attributeP} from value ${valP} to ${typeP}`;func.utils.debug_report(SESSION_ID,_.capitalize(source),msg,"W")};const module=await func.common.get_module(SESSION_ID,`xuda-get-cast-util-module.mjs`);return module.cast(typeP,valP,report_conversion_error,report_conversion_warn)};var WEB_WORKER={};var WEB_WORKER_CALLBACK_QUEUE={};glb.DEBUG_MODE=null;var DS_UI_EVENTS_GLB={};var RUNTIME_SERVER_WEBSOCKET=null;var RUNTIME_SERVER_WEBSOCKET_CONNECTED=null;var WEBSOCKET_PROCESS_PID=null;glb.worker_queue_num=0;glb.websocket_queue_num=0;func.common.get_module=async function(SESSION_ID,module,paramsP={}){let ret;const get_ret=async function(src){const module_ret=await import(src);var params=get_params();const ret=module_ret.XudaModule?new module_ret.XudaModule(params):await invoke_init_module(module_ret,params);return ret};const get_params=function(){let params={glb:glb,func:func,APP_OBJ:APP_OBJ,SESSION_ID:SESSION_ID,PROJECT_OBJ:PROJECT_OBJ,DOCS_OBJ:DOCS_OBJ,SESSION_OBJ:SESSION_OBJ,_:_,...paramsP};if(typeof IS_PROCESS_SERVER!=="undefined")params.IS_PROCESS_SERVER=IS_PROCESS_SERVER;if(typeof IS_API_SERVER!=="undefined")params.IS_API_SERVER=IS_API_SERVER;if(typeof IS_DOCKER!=="undefined")params.IS_DOCKER=IS_DOCKER;return params};const invoke_init_module=async function(module_ret,params){if(!module_ret.init_module)return module_ret;await module_ret.init_module(params);return module_ret};const _session=SESSION_OBJ[SESSION_ID];if(_session.worker_type==="Dev"){ret=await get_ret("./modules/"+module);return ret}if(_session.worker_type==="Debug"){if(typeof IS_DOCKER!=="undefined"||typeof IS_PROCESS_SERVER!=="undefined"){ret=await get_ret(func.utils.get_resource_filename(["live_preview","miniapp"].includes(_session.engine_mode)?"":_session?.opt?.app_build_id,`${_conf.xuda_home}root/dist/runtime/js/modules/`+module))}else{ret=await get_ret(func.common.get_url(SESSION_ID,"dist",func.utils.get_resource_filename(["live_preview","miniapp"].includes(_session.engine_mode)?"":_session?.opt?.app_build_id,"runtime/js/modules/"+module)))}return ret}const rep=function(){return _.endsWith(module,".js")?module.replace(".js",".min.js"):module.replace(".mjs",".min.mjs")};if(typeof IS_DOCKER!=="undefined"||typeof IS_PROCESS_SERVER!=="undefined"){ret=await get_ret(func.utils.get_resource_filename(["live_preview","miniapp"].includes(_session.engine_mode)?"":_session?.opt?.app_build_id,`${_conf.xuda_home}root/dist/runtime/js/modules/`+rep()))}else{ret=await get_ret(func.common.get_url(SESSION_ID,"dist",func.utils.get_resource_filename(["live_preview","miniapp"].includes(_session.engine_mode)?"":_session?.opt?.app_build_id,"runtime/js/modules/"+rep())))}return ret};func.api={};func.api.set_field_value=async function(field_id,value,avoid_refresh){const SESSION_ID=Object.keys(SESSION_OBJ)[0];const api_utils=await func.common.get_module(SESSION_ID,"xuda-api-library.mjs",{func:func,glb:glb,SESSION_OBJ:SESSION_OBJ,SESSION_ID:SESSION_ID,APP_OBJ:APP_OBJ,dsSession:func.utils.get_last_datasource_no(SESSION_ID)});return await api_utils.set_field_value(field_id,value,avoid_refresh)};func.api.get_field_value=async function(field_id){const SESSION_ID=Object.keys(SESSION_OBJ)[0];const api_utils=await func.common.get_module(SESSION_ID,"xuda-api-library.mjs",{func:func,glb:glb,SESSION_OBJ:SESSION_OBJ,SESSION_ID:SESSION_ID,APP_OBJ:APP_OBJ,dsSession:func.utils.get_last_datasource_no(SESSION_ID)});return await api_utils.get_field_value(field_id)};func.api.invoke_event=async function(event_id){const SESSION_ID=Object.keys(SESSION_OBJ)[0];const api_utils=await func.common.get_module(SESSION_ID,"xuda-api-library.mjs",{func:func,glb:glb,SESSION_OBJ:SESSION_OBJ,SESSION_ID:SESSION_ID,APP_OBJ:APP_OBJ,dsSession:func.utils.get_last_datasource_no(SESSION_ID)});return await api_utils.invoke_event(event_id)};func.api.call_project_api=async function(prog_id,params){const SESSION_ID=Object.keys(SESSION_OBJ)[0];const api_utils=await func.common.get_module(SESSION_ID,"xuda-api-library.mjs",{func:func,glb:glb,SESSION_OBJ:SESSION_OBJ,SESSION_ID:SESSION_ID,APP_OBJ:APP_OBJ,dsSession:func.utils.get_last_datasource_no(SESSION_ID)});return await api_utils.call_project_api(prog_id,params,null)};func.api.call_system_api=async function(api_method,payload){const SESSION_ID=Object.keys(SESSION_OBJ)[0];const api_utils=await func.common.get_module(SESSION_ID,"xuda-api-library.mjs",{func:func,glb:glb,SESSION_OBJ:SESSION_OBJ,SESSION_ID:SESSION_ID,APP_OBJ:APP_OBJ,dsSession:func.utils.get_last_datasource_no(SESSION_ID)});return await api_utils.call_system_api(api_method,payload,null)};func.api.dbs_create=async function(table_id,data,cb){const SESSION_ID=Object.keys(SESSION_OBJ)[0];const api_utils=await func.common.get_module(SESSION_ID,"xuda-api-library.mjs",{func:func,glb:glb,SESSION_OBJ:SESSION_OBJ,SESSION_ID:SESSION_ID,APP_OBJ:APP_OBJ,dsSession:func.utils.get_last_datasource_no(SESSION_ID)});return await api_utils.dbs_create(table_id,row_id,data,cb)};func.api.dbs_read=async function(table_id,selector,fields,sort,limit,skip,cb){const SESSION_ID=Object.keys(SESSION_OBJ)[0];const api_utils=await func.common.get_module(SESSION_ID,"xuda-api-library.mjs",{func:func,glb:glb,SESSION_OBJ:SESSION_OBJ,SESSION_ID:SESSION_ID,APP_OBJ:APP_OBJ,dsSession:func.utils.get_last_datasource_no(SESSION_ID)});return await api_utils.dbs_read(table_id,selector,fields,sort,limit,skip,cb)};func.api.dbs_update=async function(table_id,row_id,data,cb){const SESSION_ID=Object.keys(SESSION_OBJ)[0];const api_utils=await func.common.get_module(SESSION_ID,"xuda-api-library.mjs",{func:func,glb:glb,SESSION_OBJ:SESSION_OBJ,SESSION_ID:SESSION_ID,APP_OBJ:APP_OBJ,dsSession:func.utils.get_last_datasource_no(SESSION_ID)});return await api_utils.dbs_update(table_id,row_id,data,cb)};func.api.dbs_delete=async function(table_id,row_id,cb){const SESSION_ID=Object.keys(SESSION_OBJ)[0];const api_utils=await func.common.get_module(SESSION_ID,"xuda-api-library.mjs",{func:func,glb:glb,SESSION_OBJ:SESSION_OBJ,SESSION_ID:SESSION_ID,APP_OBJ:APP_OBJ,dsSession:func.utils.get_last_datasource_no(SESSION_ID)});return await api_utils.dbs_delete(table_id,row_id,cb)};func.api.call_javascript=async function(prog_id,params,evaluate){const SESSION_ID=Object.keys(SESSION_OBJ)[0];const api_utils=await func.common.get_module(SESSION_ID,"xuda-api-library.mjs",{func:func,glb:glb,SESSION_OBJ:SESSION_OBJ,SESSION_ID:SESSION_ID,APP_OBJ:APP_OBJ,dsSession:func.utils.get_last_datasource_no(SESSION_ID)});return await api_utils.call_javascript(prog_id,params,evaluate)};glb.rpi_request_queue_num=0;func.common.perform_rpi_request=async function(SESSION_ID,serviceP,opt={},data){var _session=SESSION_OBJ[SESSION_ID];var _data_system=_session?.DS_GLB?.[0]?.data_system;const set_ajax=async function(stat){var datasource_changes={[0]:{["data_system"]:{SYS_GLOBAL_BOL_AJAX_BUSY:stat}}};await func.datasource.update(SESSION_ID,datasource_changes)};if(_data_system){await set_ajax(1);if(!_data_system.SYS_GLOBAL_BOL_CONNECTED){func.utils.alerts.toast(SESSION_ID,"Server connection error","You are not connected to the server, so your request cannot be processed.","error");return{code:88,data:{}}}}const http=async function(){const fetchWithTimeout=(url,options={},timeout=6e5)=>{const controller=new AbortController;const{signal}=controller;const timeoutPromise=new Promise((_,reject)=>setTimeout(()=>{controller.abort();reject(new Error("Request timed out"))},timeout));const fetchPromise=fetch(url,{...options,signal:signal});return Promise.race([fetchPromise,timeoutPromise])};var url=func.common.get_url(SESSION_ID,"rpi","");var _session=SESSION_OBJ[SESSION_ID];const app_id=_session.app_id;if(APP_OBJ[app_id].is_deployment&&_session.rpi_http_methods?.includes(serviceP)){url="https://"+_session.host+"/rpi/"}url+=serviceP;try{const response=await fetchWithTimeout(url,{method:opt.type?opt.type:"POST",headers:{Accept:"application/json","Content-Type":"application/json","xu-gtp-token":_session.gtp_token,"xu-app-token":_session.app_token},body:JSON.stringify(data)});if(!response.ok){throw response.status}const json=await response.json();return json}catch(err){console.error(err);if(err===503){_this.func.UI.utils.progressScreen.show(SESSION_ID,`Error code ${err}, reloading in 5 sec`);setTimeout(async()=>{await func.index.delete_pouch(SESSION_ID);location.reload()},5e3)}return{}}};try{if(_session.engine_mode==="live_preview"){throw new Error("live_preview")}if(SESSION_OBJ?.[SESSION_ID]?.rpi_http_methods?.includes(serviceP)){const ret=await func.common.get_data_from_websocket(SESSION_ID,serviceP,data);if(_data_system){await set_ajax(0)}return ret}else{throw new Error("method not found in rpi_http_methods")}}catch(err){const ret=await http();if(_data_system){await set_ajax(0)}return ret}};func.common.get_data_from_websocket=async function(SESSION_ID,serviceP,data){var _session=SESSION_OBJ[SESSION_ID];return new Promise(function(resolve,reject){const dbs_calls=function(){glb.websocket_queue_num++;const obj={service:serviceP,data:data,websocket_queue_num:glb.websocket_queue_num};if(glb.IS_WORKER){func.utils.post_back_to_client(SESSION_ID,"get_dbs_data_from_websocket",_session.worker_id,obj);self.addEventListener("get_ws_data_worker_"+glb.websocket_queue_num,event=>{resolve(event.detail.data)})}else{if(RUNTIME_SERVER_WEBSOCKET&&RUNTIME_SERVER_WEBSOCKET_CONNECTED){RUNTIME_SERVER_WEBSOCKET.emit("message",obj);$("body").on("get_ws_data_response_"+glb.websocket_queue_num,(e,data)=>{resolve(data.data);$("body").off("get_ws_data_response_"+data.e.websocket_queue_num)})}else{throw new Error("fail to fetch from ws websocket inactive")}}};const heartbeat=function(){const obj={service:"heartbeat",data:data};if(RUNTIME_SERVER_WEBSOCKET&&RUNTIME_SERVER_WEBSOCKET_CONNECTED){RUNTIME_SERVER_WEBSOCKET.emit("message",obj);$("body").on("heartbeat_response",(e,data)=>{resolve(data.data);$("body").off("heartbeat_response")})}else{throw new Error("fail to fetch from ws websocket inactive")}};if(serviceP==="heartbeat"){return heartbeat()}dbs_calls()})};func.common.sha256=async function(inputString){const buffer=await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(inputString));const view=new DataView(buffer);const bigInt=view.getBigUint64(0,false);const base36Hash=bigInt.toString(36);const shortHash=base36Hash.slice(0,10);return shortHash.padStart(10,"0")};glb.new_xu_render=false;glb.DEBUG_INFO_OBJ={};glb.APP_INFO={};var SYSTEM_READY=null;var GLB_JS_SCRIPTS_LOADED=[];var STUDIO_WEBSOCKET=null;var STUDIO_WEBSOCKET_CONNECTION_ID=null;var STUDIO_PEER=null;var STUDIO_PEER_CONN_SEND_METHOD=null;var STUDIO_PEER_CONN_ID=null;var SUPPORT_PEER=null;var SUPPORT_PEER_CONN=null;var STUDIO_PEER_CONN_MSG_QUEUE=[];var CLIENT_ACTIVITY_TS;glb.REFERENCE_LESS_FUNCTIONS=["update","raise_event","call_library","invoke_action","loader_on","loader_off","emit_event","delay","execute_evaluate_javascript","execute_native_javascript"];var CACHE_PROG_UI={};var ALERT_IS_ACTIVE=false;glb.WORKER_ATTEMPTS_NOT_RESPONDING=2e5;glb.WORKER_TIMEOUT=6e5;glb.WORKER_PAUSE=false;var DATASOURCE_INTERVALS={};var APP_MODAL_OBJ={};var CURRENT_APP_POPOVER=null;var ELEMENT_CLICK_EVENT=null;var posX=0;var posY=0;var LOADER_ACTIVE=false;var LOADER_TEXT="";var REFRESHER_IN_PROGRESS=false;glb.screen_num=0;var RESPONSE_FROM_STUDIO_QUEUE={};var SCREEN_BLOCKER_OBJ={};var IS_PROGRESS_SCREEN_OPEN=null;var UI_WORKER_OBJ={jobs:[],num:9e3,cache:{},viewport_height_set_ids:[],xu_render_cache:{}};glb.html5_events_handler=["onabort","onafterprint","onautocomplete","onautocompleteerror","onbeforeprint","onbeforeunload","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncontextmenu","oncopy","oncuechange","oncut","ondblclick","ondrag","ondragend","ondragenter","ondragexit","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onhashchange","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onload","onloadeddata","onloadedmetadata","onloadstart","onmessage","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onmousewheel","onoffline","ononline","onpagehide","onpageshow","onpaste","onpause","onplay","onplaying","onpopstate","onprogress","onratechange","onreset","onresize","onscroll","onsearch","onseeked","onseeking","onselect","onshow","onsort","onstalled","onstorage","onsubmit","onsuspend","ontimeupdate","ontoggle","onunload","onvolumechange","onwaiting"];glb.lifecycle={plugins:{},fn_arr:["beforeInit","initialized","systemReady","beforeMounted","mounted"],execute:async function(SESSION_ID,event){const _session=SESSION_OBJ[SESSION_ID];const xu_api=await func.common.get_module(SESSION_ID,"xuda-api-library.mjs",{func:func,glb:glb,SESSION_OBJ:SESSION_OBJ,SESSION_ID:SESSION_ID,APP_OBJ:APP_OBJ,dsSession:func.utils.get_last_datasource_no(SESSION_ID)});var params={SESSION_ID:SESSION_ID,session_data:_session,app_obj:APP_OBJ[_session.app_id],xu_api:xu_api};for await(const[plugin_name,val]of Object.entries(glb.lifecycle.plugins)){if(val?.plugin_script?.[event]){params.setup_data=val.setup_data;await val.plugin_script[event](params)}}}};glb.run_xu_before=["xu-cdn","xu-style","xu-render","xu-for-key","xu-for-val"];glb.run_xu_after=["xu-bind","xu-class","xu-script","xu-ui-plugin"];glb.attr_abbreviations_arr=["xu-click","xu-dblclick","xu-contextmenu","xu-focus","xu-keyup","xu-change","xu-blur","xu-init"];glb.solid_attributes=["disabled"];func.utils={};func.utils.debug={};func.utils.debug.watch=async function(SESSION_ID,key,type,info,result,condition,not_executed){if(!glb.DEBUG_MODE)return;const debug_utils=await func.common.get_module(SESSION_ID,"xuda-debug-utils-module.mjs");debug_utils.watch(SESSION_ID,key,type,info,result,condition,not_executed)};func.utils.debug.log=async function(SESSION_ID,node_idP,jsonP){if(typeof IS_PROCESS_SERVER!=="undefined")return;if(!glb.DEBUG_MODE&&!glb.TRACE_ON)return;const debug_utils=await func.common.get_module(SESSION_ID,"xuda-debug-utils-module.mjs");debug_utils.log(SESSION_ID,node_idP,jsonP)};func.utils.debug.write=async function(SESSION_ID,logP,callbackP){if(!glb.DEBUG_MODE)return;const debug_utils=await func.common.get_module(SESSION_ID,"xuda-debug-utils-module.mjs");debug_utils.write(SESSION_ID,logP,callbackP)};func.utils.debug.read_command=async function(data){if(!glb.DEBUG_MODE)return;const debug_utils=await func.common.get_module(SESSION_ID,"xuda-debug-utils-module.mjs");debug_utils.read_command(data)};func.utils.DOCS_OBJ={};func.utils.DOCS_OBJ.get=async function(SESSION_ID,idP){if(!idP||idP==="0")return;var _session=SESSION_OBJ[SESSION_ID];const _app_id=_session.app_id;if(!DOCS_OBJ[_app_id]){DOCS_OBJ[_app_id]={}}if(DOCS_OBJ[_app_id][idP]){return DOCS_OBJ[_app_id][idP]}if(_session.project_data){if(idP==="system"){if(_session.project_data.globals){DOCS_OBJ[_app_id][idP]=_session.project_data.globals}else{DOCS_OBJ[_app_id][idP]={}}return DOCS_OBJ[_app_id][idP]}let val=_session.project_data?.programs?.[idP];if(val){return DOCS_OBJ[_app_id][idP]=val}}if(typeof _session.SLIM_BUNDLE==="undefined"||!_session.SLIM_BUNDLE){const module=await func.common.get_module(SESSION_ID,`xuda-progs-loader-module.mjs`);if(idP!=="system"){DOCS_OBJ[_app_id][idP]=await module.DOCS_OBJ_get(SESSION_ID,idP);if(DOCS_OBJ[_app_id][idP]&&_.isEmpty(DOCS_OBJ[_app_id][idP])){await func.utils.remove_cached_objects(SESSION_ID);delete DOCS_OBJ[_app_id][idP]}return DOCS_OBJ[_app_id][idP]}DOCS_OBJ[_app_id][idP]=await module.DOCS_OBJ_get(SESSION_ID,"global_"+(APP_OBJ[_app_id].app_replicate||_app_id));if(APP_OBJ[_app_id].app_imported_projects){for await(const imported_app_id of APP_OBJ[_app_id].app_imported_projects){var view_ret=await module.DOCS_OBJ_get(SESSION_ID,"global_"+imported_app_id);DOCS_OBJ[_app_id][idP]=_.merge(DOCS_OBJ[_app_id][idP],view_ret)}}return DOCS_OBJ[_app_id][idP]}console.error(`${idP} not found`)};func.utils.FILES_OBJ={};func.utils.FILES_OBJ.get=async function(SESSION_ID,idP){if(!idP)return;return await func.utils.DOCS_OBJ.get(SESSION_ID,idP)};func.utils.VIEWS_OBJ={};func.utils.VIEWS_OBJ.get=async function(SESSION_ID,idP){if(!idP)return;return await func.utils.DOCS_OBJ.get(SESSION_ID,idP)};func.utils.TREE_OBJ={};func.utils.TREE_OBJ.get=async function(SESSION_ID,idP){if(!idP)return;var ret=await func.utils.DOCS_OBJ.get(SESSION_ID,idP);if(ret?.properties){ret.properties.id=idP}return ret.properties};func.utils.get_dateTime=async function(SESSION_ID,typeP,dateP){const get_server_ts=async function(){var _session=SESSION_OBJ[SESSION_ID];const response=await fetch(`https://${_session.domain}/cpi/get_utc_ts`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({})});const json=await response.json();return json.data};function getWeekNumber(d){d=new Date(+d);d.setHours(0,0,0);d.setDate(d.getDate()+4-(d.getDay()||7));var yearStart=new Date(d.getFullYear(),0,1);var weekNo=Math.ceil(((d-yearStart)/864e5+1)/7);return weekNo}var sysDate=new Date(dateP);if(!dateP){let ts=await get_server_ts();sysDate=new Date(ts)}var day=_.padStart(sysDate.getDate(),2,"0");var month=_.padStart(sysDate.getMonth()+1,2,"0");var year=sysDate.getFullYear();var week=_.padStart(getWeekNumber(sysDate),2,"0");var hour=_.padStart(sysDate.getHours(),2,"0");var minute=_.padStart(sysDate.getMinutes(),2,"0");var second=_.padStart(sysDate.getSeconds(),2,"0");if(typeP==="SYS_DATE")return year+"-"+month+"-"+day;if(typeP==="SYS_DATE_TIME")return year+"-"+month+"-"+day+"T"+hour+":"+minute;if(typeP==="SYS_DATE_VALUE")return sysDate.valueOf();if(typeP==="SYS_DATE_WEEK_YEAR")return year+"W"+week;if(typeP==="SYS_DATE_MONTH_YEAR")return year+"-"+month;if(typeP==="SYS_TIME")return hour+":"+minute+":"+second;if(typeP==="SYS_TIME_SHORT")return hour+":"+minute};func.utils.is_onscreen_event=function(functionP){const arr=["invoke_action","cache_refresh","call_popover","call_modal","call_page","loader_on","loader_off","emit_event"];return arr.includes(functionP)};func.utils.get_screen_obj=async function(SESSION_ID,id){const prog_obj=await func.utils.VIEWS_OBJ.get(SESSION_ID,id);if(!prog_obj)return console.error("prog not found: "+id);if(prog_obj.properties.menuType==="screen"||prog_obj.properties.menuType==="api"||glb.FUNCTION_NODES_ARR.includes(prog_obj.properties.menuType)||glb.MOBILE_ARR.includes(prog_obj.properties.menuType)){return prog_obj}return};func.utils.clean_returned_datasource=function(SESSION_ID,DS){const clean_object_functions=function(obj){for(const[key,val]of Object.entries(obj)){if(typeof val==="function"){delete obj[key]}}};var _session=SESSION_OBJ[SESSION_ID];if(!_session.DS_GLB[DS])return;var obj=_.clone(_session.DS_GLB[DS]);delete obj.screen_params;try{clean_object_functions(obj);obj=JSON.parse(JSON.stringify(obj,func.utils.clean_stringify_null,"\t"))}catch(e){console.error(e)}delete obj.pre_init_fields;delete obj.oninit_triggers_to_run;delete obj.debug;const clean_empty_objects=function(){for(const[key,val]of Object.entries(obj)){if(typeof val==="object"&&!Array.isArray(val)&&_.isEmpty(val)){delete obj[key]}}for(const[key,val]of Object.entries(obj)){if(typeof val==="object"&&Array.isArray(val)&&!val.length){delete obj[key]}}};delete obj.screenInfo;delete obj.viewEventsProp;delete obj.viewSourceDesc;delete obj.viewSourceProp;delete obj.v;clean_empty_objects();return obj};func.utils.post_back_to_client=function(SESSION_ID,service,id,data){if(typeof IS_PROCESS_SERVER!=="undefined")return;worker_post_message({fx_to_execute:service,params:data,session_id:SESSION_ID,worker_id:id})};func.utils.job_worker={};func.utils.job_worker=function(session_id){var SESSION_ID=session_id;var _session=SESSION_OBJ[SESSION_ID];var is_progressScreen_on;var is_not_responding;var attempt=0;const lock=function(dsP){if(!_session.WORKER_OBJ.jobs[_session.WORKER_OBJ.stat]||_session.WORKER_OBJ.jobs[_session.WORKER_OBJ.stat].typeP==="system_interval"||_session.WORKER_OBJ.jobs[_session.WORKER_OBJ.stat].typeP==="system event"){return}if(glb.IS_WORKER){func.utils.post_back_to_client(SESSION_ID,"screen_blocker_on",_session.worker_id,null)}else{func.UI.utils.screen_blocker(true,"Worker",dsP)}};const unlock=function(){if(glb.IS_WORKER){}else{func.UI.utils.screen_blocker(false,"Worker")}};const not_responding=function(){is_not_responding=true;func.UI.utils.progressScreen.hide("Working, Please wait..");setTimeout(function(){if(!is_not_responding)return;reset()},500)};const idle=function(){if(is_progressScreen_on){setTimeout(function(){if(!attempt&&is_progressScreen_on){is_progressScreen_on=false;is_not_responding=false;func.UI.utils.progressScreen.hide("Working, Please wait..")}else if(attempt>300&&is_not_responding){is_not_responding=false;busy()}},310)}else{if(!glb.IS_WORKER){}}};const busy=function(){if(glb.IS_WORKER)return;func.utils.debug_report(SESSION_ID,"utils.worker.busy","worker processing more then 10 second","W","",_session.WORKER_OBJ.jobs);is_progressScreen_on=true};const reset=function(){func.utils.debug_report(SESSION_ID,"utils.worker.reset","worker not responding","E","",_session.WORKER_OBJ.jobs);_session.WORKER_OBJ.jobs=[];_session.WORKER_OBJ.stat=null;$(".screen_blocker").remove()};return{_interval:null,_was_busy:null,init:async function(){var _this=this;this._interval=setInterval(async function(){var _session=SESSION_OBJ[SESSION_ID];if(!_session?.WORKER_OBJ)return;if(typeof _session.WORKER_OBJ.stat==="undefined"||_session.WORKER_OBJ.stat==="undefined"||_session.WORKER_OBJ.stat===null){unlock();if(_session.WORKER_OBJ.jobs.length){for await(const[key,val]of Object.entries(_session.WORKER_OBJ.jobs)){if(val.stat){break}if(!_session.WORKER_OBJ.jobs[Number(key)]||val.job_num===9999999){continue}if(val.dsSessionP&&!_session.DS_GLB[val.dsSessionP]){func.events.delete_job(SESSION_ID,val.job_num);break}await func.events.execute(SESSION_ID,val.job_num,val.eventIdP,val.triggerP,val.functionP,val.refIdP,val.containerP,val.elementP,val.rowP,val.evt,val.descP,val.rootScreenIdP,val.dsSessionP,null,val.typeP,null,val.event_propertiesP,val.calling_triggerP,null,val.paramsP,val.target_frame_idP,val.calling_trigger_prop,val.calling_program,val.argumentsP,val.prog_id,val.nodeId,val.parentDataSourceNo,val.$container)}_this._was_busy=true}else{if(_this._was_busy){if(glb.IS_WORKER){func.utils.post_back_to_client(SESSION_ID,"worker_busy_off",_session.worker_id,null)}else{func.UI.utils.indicator.worker.normal()}}_this._was_busy=false}attempt=0;is_not_responding=false;idle()}else{_this._was_busy=true;if(glb.IS_WORKER){func.utils.post_back_to_client(SESSION_ID,"worker_busy_on",_session.worker_id,null)}else{func.UI.utils.indicator.worker.busy()}if(glb.WORKER_PAUSE)return;attempt++;if(!is_progressScreen_on&&attempt>glb.WORKER_TIMEOUT)busy();if(!is_not_responding&&attempt>=glb.WORKER_ATTEMPTS_NOT_RESPONDING){not_responding()}var ds=null;if(_session.WORKER_OBJ.jobs[0])ds=_session.WORKER_OBJ.jobs[0].dsSessionP;lock(ds)}},1)},stop:function(){clearInterval(this._interval)}}};func.utils.base64MimeType=function(encoded){var result=null;if(typeof encoded!=="string"){return result}var mime=encoded.match(/data:([a-zA-Z0-9]+\/[a-zA-Z0-9-.+]+).*,.*/);if(mime&&mime.length){result=mime[1]}return result};func.utils.makeid=function(length){var result="";var characters="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";var charactersLength=characters.length;for(var i=0;i<length;i++){result+=characters.charAt(Math.floor(Math.random()*charactersLength))}return result};func.utils.get_device=function(){var device;try{if(window.cordova){device=window.cordova.platformId}}catch(e){console.error("error using ui element in server side request")}return device};func.utils.ws_worker={};func.utils.ws_worker.functions={init:async function(data){var SESSION_ID=data.SESSION_ID;APP_OBJ[data.app_id]=data.APP_OBJ;PROJECT_OBJ[data.app_id]=data.PROJECT_OBJ;if(["live_preview","miniapp"].includes(data.SESSION_INFO.engine_mode)){DOCS_OBJ[data.app_id]=data.DOCS_OBJ}else if(typeof IS_DOCKER==="undefined"&&typeof IS_PROCESS_SERVER==="undefined"){if(!DOCS_OBJ[data.app_id]){DOCS_OBJ[data.app_id]={}}}glb.APP_INFO[data.app_id]=data.APP_INFO;glb.DEBUG_MODE=data.DEBUG_MODE;glb.DEBUG_INFO_OBJ=data.DEBUG_INFO_OBJ;glb.WINDOW_LOCATION_SEARCH=data.WINDOW_LOCATION_SEARCH;glb.ROOT_ELEMENT_ATTRIBUTES=data.ROOT_ELEMENT_ATTRIBUTES;DATASOURCE_INTERVALS[SESSION_ID]={};SESSION_OBJ[SESSION_ID]=data.SESSION_INFO;var _session=SESSION_OBJ[SESSION_ID];glb.SESSION_INFO=data.SESSION_INFO;_session.engine_mode=data.engine_mode;STUDIO_WEBSOCKET_CONNECTION_ID=data.STUDIO_WEBSOCKET_CONNECTION_ID;for(let[key,val]of Object.entries(_session.DS_GLB)){if(Number(key)>_session.dataSourceSessionGlobal){_session.dataSourceSessionGlobal=Number(key)}}if(typeof _session.SLIM_BUNDLE==="undefined"||!_session.SLIM_BUNDLE){const db_adapter=await func.common.get_module(SESSION_ID,"xuda-db-adapter-module.mjs");func.db=db_adapter._db}_session.WORKER_OBJ.fx=new func.utils.job_worker(SESSION_ID);_session.WORKER_OBJ.fx.init();if(_session.app_id==="unknown"){worker_post_message({fx_to_execute:"init_done",worker_id:ws_worker_id,session_id:SESSION_ID})}else{const module=await func.common.get_module(SESSION_ID,`xuda-progs-loader-module.mjs`);await module.load_objects_cache(SESSION_ID);worker_post_message({fx_to_execute:"init_done",worker_id:ws_worker_id,session_id:SESSION_ID})}WEB_WORKER_CALLBACK_QUEUE[SESSION_ID]={}},datasource_create:async function(params,promise_queue_id){var SESSION_ID=params.session_id;var _session=SESSION_OBJ[SESSION_ID];_session.ts=(new Date).getTime();var args=params;args.SESSION_ID=SESSION_ID;if(show_log){console.log("DATASOURCE EXECUTING SESSION_ID: "+SESSION_ID,APP_OBJ[_session.app_id].app_name)}if(Number(params.dataSourceSessionGlobal)>_session.dataSourceSessionGlobal){_session.dataSourceSessionGlobal=Number(params.dataSourceSessionGlobal)}const ret=await func.datasource.prepare(args.SESSION_ID,args.prog_id,args.dataSourceNoP,args.parentDataSourceNoP,args.containerIdP,args.rowIdP,args.jobNoP,args.calling_trigger_prop,args.parameters_raw_obj,null,args.callingSourceP,args.calling_jobP,args.screen_dsP,args.is_panelP,args.parameters_obj_inP,args.static_refreshP,args.run_atP,args.worker_id);try{let _ds=_session.DS_GLB[ret.dsSessionP];if(show_log)console.log("DATASOURCE EXECUTION DONE "+ret.dsSessionP+" "+_ds?.tree_obj?.menuName||""+" SESSION_ID: "+SESSION_ID,APP_OBJ[_session.app_id].app_name);var obj=func.utils.clean_returned_datasource(SESSION_ID,ret?.dsSessionP);obj.dataSourceSessionGlobal=_session.dataSourceSessionGlobal;worker_post_message({promise_queue_id:promise_queue_id,params:obj,worker_id:ws_worker_id,session_id:SESSION_ID,process_pid:params.process_pid,service:params.service});_ds.stat="idle"}catch(error){debugger}},datasource_delete:function(params,promise_queue_id){var SESSION_ID=params.session_id;var _session=SESSION_OBJ[SESSION_ID];if(DATASOURCE_INTERVALS[SESSION_ID]&&DATASOURCE_INTERVALS[SESSION_ID][params.dssession]){DATASOURCE_INTERVALS[SESSION_ID][params.dssession].clear()}delete _session.DS_GLB[params.dssession];if(show_log)console.log("DATASOURCE DELETE SESSION_ID: "+SESSION_ID,APP_OBJ[_session.app_id].app_name,params.dssession);worker_post_message({promise_queue_id:promise_queue_id,worker_id:ws_worker_id,session_id:SESSION_ID,process_pid:params.process_pid,service:params.service})},update_datasource_changes_from_client:async function(params,promise_queue_id){if(_.isEmpty(SESSION_OBJ))return;var SESSION_ID=params.session_id;var _session=SESSION_OBJ[SESSION_ID];if(!_session){_session={};_session.app_id=params.app_id;_session.dataSourceSessionGlobal=-1;_session.DS_GLB={}}if(show_log)console.log("DATASOURCE UPDATE SESSION_ID: "+SESSION_ID,APP_OBJ[_session.app_id].app_name,params.dssession);await func.datasource.update(SESSION_ID,params.datasource_changes,true);worker_post_message({promise_queue_id:promise_queue_id,params:params.dssession,worker_id:ws_worker_id,session_id:SESSION_ID,process_pid:params.process_pid,service:params.service})},return_to_data_source:function(params,promise_queue_id){var SESSION_ID=params.session_id;var _session=SESSION_OBJ[SESSION_ID];var ds=_session.DS_GLB[params.dssession];var type=params.return_to_data_source_type;var args=ds.args;if(show_log)console.log("DATASOURCE RETURN TO DATASOURCE "+params.dssession+" SESSION_ID: "+SESSION_ID,APP_OBJ[_session.app_id].app_name);_session.DS_GLB[params.dssession].v.onscreen_events_active=params.onscreen_events_active;if(params.viewEventExec_arr)_session.DS_GLB[params.dssession].viewEventExec_arr=JSON.parse(params.viewEventExec_arr);var done=function(SESSION_ID,DS){if(show_log)console.log("DATASOURCE RETURN TO DATASOURCE DONE "+DS+" SESSION_ID: "+SESSION_ID,APP_OBJ[_session.app_id].app_name);var obj=func.utils.clean_returned_datasource(SESSION_ID,DS);obj.dataSourceSessionGlobal=_session.dataSourceSessionGlobal;worker_post_message({fx_to_execute:"post_datasource",params:{ds_obj:obj,dsSessionP:params.dssession},worker_id:ws_worker_id,session_id:SESSION_ID,process_pid:params.process_pid,service:params.service})};done(SESSION_ID,params.dssession)},acknowledged_worker_with_eventChangesResults_done:function(params){var SESSION_ID=params.session_id;var _session=SESSION_OBJ[SESSION_ID];var ds=_session.DS_GLB[params.dssession];if(show_log)console.log("UPDATE CHANGE EVENT DONE TO DATASOURCE "+params.dssession+" SESSION_ID: "+SESSION_ID,APP_OBJ[_session.app_id].app_name);ds.eventChangesResults_done=true},return_from_db_query:function(params){var SESSION_ID=params.session_id;var _session=SESSION_OBJ[SESSION_ID];var id=params.id;if(show_log)console.log("RETURN FROM DB_QUERY "+params.dssession+" SESSION_ID: "+SESSION_ID,APP_OBJ[_session.app_id].app_name);debugger;var callback=func.utils.get_callback_queue(SESSION_ID,params.callback_id);if(callback)callback(params.data)},return_from_sava_data:function(params){var SESSION_ID=params.session_id;var _session=SESSION_OBJ[SESSION_ID];var id=params.id;if(show_log)console.log("RETURN FROM SAVE_DATA "+params.dssession+" SESSION_ID: "+SESSION_ID,APP_OBJ[_session.app_id].app_name);func.utils.get_callback_queue(SESSION_ID,params.callback_id)()},update_debug_info:function(params){glb.DEBUG_INFO_OBJ=params},get_dataSourceSessionGlobal:function(params){var SESSION_ID=params.session_id;SESSION_OBJ[SESSION_ID].dataSourceSessionGlobal++;let new_dataSourceSessionGlobal=SESSION_OBJ[SESSION_ID].dataSourceSessionGlobal;return{new_dataSourceSessionGlobal:new_dataSourceSessionGlobal}},create_webworker_globals:function(params){var SESSION_ID=params.session_id;SESSION_OBJ[SESSION_ID].DS_GLB[0]=params.ds_data},return_doc_from_studio:function(params){var SESSION_ID=params.session_id;function emitCustomEvent(eventName,detail){const event=new CustomEvent(eventName,{detail:detail});self.dispatchEvent(event)}emitCustomEvent("live_preview_get_obj_response_worker_"+params._id,{data:params})},return_doc_from_websocket:function(params){var SESSION_ID=params.session_id;function emitCustomEvent(eventName,detail){const event=new CustomEvent(eventName,{detail:detail});self.dispatchEvent(event)}emitCustomEvent("get_doc_obj_from_build_worker_"+params._id,{data:params})},return_dbs_data_from_websocket:function(params){var SESSION_ID=params.session_id;function emitCustomEvent(eventName,detail){const event=new CustomEvent(eventName,{detail:detail});self.dispatchEvent(event)}emitCustomEvent("get_ws_data_worker_"+params.websocket_queue_num,{data:params.data})},heartbeat:async function(params){var SESSION_ID=params.session_id;try{const do_heartbeat=async function(app_replicate,app_id,token_id,fingerprint,device_name,stat){try{module.exports.close_expired_device_log_sessions(app_id);return await update_device(app_replicate,app_id,token_id,fingerprint,device_name,stat)}catch(err){return{code:-400,data:err.message}}};let ret=await do_heartbeat(params.app_replicate,params.app_id,params.gtp_token||req.body.app_token,params.fingerprint,params.device_name,params.stat);if(params.token){try{const couch=await __.rpi.get_app_couch(req.body.app_id);const session_doc=await couch.get(req.body.app_token);ret.session_stat=session_doc.stat}catch(error){}}}catch(error){debugger}},return_rpi_request_from_studio:function(params){var SESSION_ID=params.session_id;function emitCustomEvent(eventName,detail){const event=new CustomEvent(eventName,{detail:detail});self.dispatchEvent(event)}emitCustomEvent("rpi_request_response_worker_"+params.table_id,{data:params.data})}};func.utils.set_callback_queue=function(SESSION_ID,func){var t=(new Date).valueOf().toString()+Math.random().toString();try{WEB_WORKER_CALLBACK_QUEUE[SESSION_ID][t]=func}catch(e){console.error(id);func.utils.remove_cached_objects(SESSION_ID)}return t};func.utils.get_callback_queue=function(SESSION_ID,t){var func=WEB_WORKER_CALLBACK_QUEUE[SESSION_ID][t];setTimeout(function(){if(WEB_WORKER_CALLBACK_QUEUE[SESSION_ID][t])delete WEB_WORKER_CALLBACK_QUEUE[SESSION_ID][t]},1e3);return func};func.utils.clean_stringify_null=function(key,value){if(value===null){return undefined}return value};func.utils.load_js_on_demand=async function(js_src,type){const get_script=function(callback){function getScript(scriptUrl,callback){const script=document.createElement("script");script.src=scriptUrl;if(type)script.type=type;script.onload=callback;document.head.appendChild(script)}if(glb.IS_WORKER){callback(script);return}function isScriptLoaded(src){return GLB_JS_SCRIPTS_LOADED.includes(src)}if(isScriptLoaded(js_src)){callback(false)}else{getScript(js_src,function(response,status){callback(true);GLB_JS_SCRIPTS_LOADED.push(js_src)})}};return new Promise(resolve=>{get_script(resolve)})};func.utils.load_css_on_demand=function(css_href){function isCssLoaded(src){try{return document.querySelector('link[href="'+src+'"]')?true:false}catch(err){console.warn(`load css ${css_href} failed`);return true}}if(isCssLoaded(css_href)){return}return $("<link/>",{rel:"stylesheet",type:"text/css",href:css_href}).prependTo("head")};func.utils.remove_js_css_file=function(filename,filetype){var targetelement=filetype=="js"?"script":filetype=="css"?"link":"none";var targetattr=filetype=="js"?"src":filetype=="css"?"href":"none";var allsuspects=document.getElementsByTagName(targetelement);for(var i=allsuspects.length;i>=0;i--){if(allsuspects[i]&&allsuspects[i].getAttribute(targetattr)!=null&&allsuspects[i].getAttribute(targetattr).indexOf(filename)!=-1)allsuspects[i].parentNode.removeChild(allsuspects[i])}};func.utils.replace_studio_drive_url=function(SESSION_ID,val){var _session=SESSION_OBJ[SESSION_ID];if(!_session.is_deployment)return val;try{return val.replaceAll(`https://xuda.io/studio-drive/${APP_OBJ[_session.app_id].app_replicate}`,`https://${_session.domain}/studio-drive/${APP_OBJ[_session.app_id].app_replicate}`)}catch(err){return val}};func.utils.get_drive_url=function(SESSION_ID,val,wrap){var _session=SESSION_OBJ[SESSION_ID];function replaceFiletoURL(fileString){const _app=APP_OBJ[_session.app_id];let url=`https://${_session.domain}/workspace-drive/${_app.is_deployment?_app.app_datacenter_id:_app.app_id_reference}/`;let FILE_REPLACE_URL=`${url}${val}`;if(!_app.is_deployment){FILE_REPLACE_URL+=`?app_token=${_session.app_token}&ts=${Date.now()}`}else{FILE_REPLACE_URL+=`?ts=${_session?.opt?.app_build_id||0}`}let match=`drv_${_app.app_replicate||_session.app_id}_[0-9a-f\\-]+\\.[a-zA-Z0-9]+`;let pat=new RegExp(match,"g");let URLString=fileString.replace(pat,function(match,idx){const hasURLbefore=fileString.substring(idx-url.length,idx)===url;if(hasURLbefore){return match}return FILE_REPLACE_URL.replace("{val}",match)});return URLString}if(typeof val==="string"||typeof val==="object"){if(typeof val==="string"){if(val.includes(".")&&val.includes("drv_")&&val.length>30){var ret=replaceFiletoURL(val);if(wrap){return{value:'"'+ret+'"',changed:true}}else{return{value:ret,changed:true}}}else{return{value:val,changed:false}}}if(typeof val==="object"){try{let str=JSON.stringify(val);if(str.includes(".")&&str.includes("drv_")&&str.length>30){let new_val=replaceFiletoURL(str);return{value:new_val,changed:true}}else{return{value:val,changed:false}}}catch(err){return{value:val,changed:false}}}}else{return{value:val,changed:false}}};func.utils.debug_report=async function(SESSION_ID,sourceP,msgP,typeP,errP,objP){var _session=SESSION_OBJ[SESSION_ID];var details=[sourceP];if(errP)details.push(errP);if(objP)details.push(objP);if(!typeP||typeP==="E"){setTimeout(()=>{},1e3);console.error("XUDA","ERROR",sourceP,msgP,details);if(typeof IS_API_SERVER!=="undefined"||typeof IS_DOCKER!=="undefined"||typeof IS_PROCESS_SERVER!=="undefined"){return __.rpi.write_log(SESSION_OBJ[SESSION_ID].app_id,"error","worker","runtime",msgP,null,objP,sourceP)}if(glb.IS_WORKER){let obj={service:"write_log",data:msgP,log_type:"error",id:STUDIO_WEBSOCKET_CONNECTION_ID,uid:_session.USR_OBJ._id,source:"runtime",app_id:_session.app_id,gtp_token:_session.gtp_token,app_token:_session.app_token};return func.utils.post_back_to_client(SESSION_ID,"write_log",_session.worker_id,obj)}}if(typeP==="W")console.warn("XUDA","WARNING",msgP,details);if(typeP==="I")console.log("XUDA","INFO",msgP,details)};func.utils.request_error=function(SESSION_ID,type,e){var _session=SESSION_OBJ[SESSION_ID];console.error(type,e);if(typeof IS_PROCESS_SERVER!=="undefined")return;if(!glb.IS_WORKER){func.utils.debug_report(SESSION_ID,type,e,"E");setTimeout(function(){if(!glb.debug_js){console.warn("** reload request")}},2e3)}else{func.utils.post_back_to_client(SESSION_ID,"ajax_error",_session.worker_id,null)}};func.utils.alerts={};func.utils.alerts.invoke=async function(SESSION_ID,typeP,paramsP,sourceP,dsSessionP,msgP){try{var _session=SESSION_OBJ[SESSION_ID];if(ALERT_IS_ACTIVE)return;ALERT_IS_ACTIVE=true;var title;var message="";var alert_type="console";var alertDisplay;var expRet={};var _ds=_session.DS_GLB[dsSessionP];var type="";var createLog;const get_alert_properties=async function(value,fx){var ret=value||"";if(fx){const exp_ret=await func.expression.get(SESSION_ID,fx,dsSessionP,"alert");ret=exp_ret.result}return ret};switch(typeP){case"alert":type="User defined alert";title=await get_alert_properties(paramsP.alertTitle,paramsP.alertTitleFx);alert_type=await get_alert_properties(paramsP.alertType,paramsP.alertTypeFx);message=await get_alert_properties(paramsP.alertBody,paramsP.alertBodyFx);alertDisplay=await get_alert_properties(paramsP.alertDisplay,paramsP.alertDisplayFx);createLog=paramsP.createLog;break;case"call_alert":type="User defined call alert";let prop=await func.utils.TREE_OBJ.get(SESSION_ID,paramsP.prog);if(!prop){console.log("events.execute","Missing details for alert message object: "+paramsP.prog,"W")}let ret=await func.utils.VIEWS_OBJ.get(SESSION_ID,paramsP.prog);if(ret?.alertData){title=await get_alert_properties(ret.alertData.alertTitle,ret.alertData.alertTitleFx);alert_type=await get_alert_properties(ret.alertData.alertType,ret.alertData.alertTypeFx);message=await get_alert_properties(ret.alertData.alertBody,ret.alertData.alertBodyFx);alertDisplay=await get_alert_properties(ret.alertData.alertDisplay,ret.alertData.alertDisplayFx);createLog=ret.alertData.createLog}if(!title){title=prop.menuTitle}if(!alert_type){alert_type="console"}if(!alertDisplay){alertDisplay="modal"}break;case"system_msg":{type="System alert";const sys_alerts_obj=func.utils.get_system_error_msg();if(sys_alerts_obj[paramsP]){title=sys_alerts_obj[paramsP].subject;alert_type=sys_alerts_obj[paramsP].alert_type;alertDisplay=sys_alerts_obj[paramsP].alertDisplay;expRet=await func.expression.get(SESSION_ID,sys_alerts_obj[paramsP].msg,dsSessionP,"alert");message=func.expression.remove_quotes(expRet.result);if(msgP)message=msgP;if(alert_type==="error"){if(_ds)_ds.error=title+" "+sourceP;func.utils.debug_report(SESSION_ID,sourceP,title+" "+sourceP,"E","",_ds)}}break}default:message=msgP;break}}catch(err){console.error(err);ALERT_IS_ACTIVE=false;return}if(glb.IS_WORKER){if(_session.IS_API){if(_ds){_ds.api_rendered_output=message}else{console.error(message)}return}ALERT_IS_ACTIVE=false;return func.utils.post_back_to_client(SESSION_ID,"alert",_session.worker_id,[SESSION_ID,alert_type,alertDisplay,message,title])}ALERT_IS_ACTIVE=false;func.utils.alerts.execute(SESSION_ID,alert_type,alertDisplay,message,title,type);if(createLog){func.utils.write_log(SESSION_ID,title,message,alert_type)}};func.utils.alerts.execute=function(SESSION_ID,alert_type,alertDisplay,message,title,type){if(!UI_FRAMEWORK_INSTALLED){ALERT_IS_ACTIVE=false;if(alertDisplay!=="console"){return alert(title+"\n \n"+message)}return console[alert_type==="error"?"error":"log"](alert_type,title,message)}switch(alertDisplay){case"console":console[alert_type==="success"?"log":alert_type==="warning"?"warn":alert_type](alert_type,title,message);ALERT_IS_ACTIVE=false;break;case"modal":func.utils.alerts.popup(title,message,alert_type);break;case"toast":func.utils.alerts.toast(SESSION_ID,title,message,alert_type);ALERT_IS_ACTIVE=false;break;case"browser":alert(title+"\n \n"+message);ALERT_IS_ACTIVE=false;default:console.log(alert_type,title,message);ALERT_IS_ACTIVE=false}};func.utils.alerts.toast=function(SESSION_ID,title,message,alert_type){if(!UI_FRAMEWORK_PLUGIN.toast)return;const toast=new UI_FRAMEWORK_PLUGIN.toast;toast.create(alert_type,message,title,func.common.get_url(SESSION_ID,"dist",`runtime/images/${alert_type}_alert_ico.svg`));ALERT_IS_ACTIVE=false};func.utils.alerts.popup=function(title,message,alert_type){const popup=new UI_FRAMEWORK_PLUGIN.popup;var buttons=[{text:"Ok",role:"cancel",handler:()=>{ALERT_IS_ACTIVE=false}}];popup.create(_.upperFirst(alert_type),title,message,buttons)};func.utils.get_system_error_msg=function(){var m={};m["SYS_MSG_0101"]={alert_type:"success",alertDisplay:"toast",subject:"Save Success",msg:"Settings successfully saved"};m["SYS_MSG_0102"]={alert_type:"error",alertDisplay:"toast",subject:"Save Failed CouchDB",msg:"Data fail save to database"};m["SYS_MSG_0103"]={alert_type:"error",alertDisplay:"toast",subject:"Save Failed Table Empty",msg:"Table empty, no fields declared"};m["SYS_MSG_0104"]={alert_type:"error",alertDisplay:"toast",subject:"Save Failed Missing Primary Index",msg:"Update failed, table missing Primary index"};m["SYS_MSG_0105"]={alert_type:"error",alertDisplay:"toast",subject:"Save Failed Table Missing",msg:"Table repository missing"};m["SYS_MSG_0106"]={alert_type:"error",alertDisplay:"toast",subject:"Save Failed Record Not Exist",msg:"Save update failed record not exist"};m["SYS_MSG_0107"]={alert_type:"error",alertDisplay:"modal",subject:"Save Failed Unique Key",msg:"Save Failed, record already exist"};m["SYS_MSG_0108"]={alert_type:"error",alertDisplay:"modal",subject:"Error reading document",msg:"Save Failed, record not found"};m["SYS_MSG_0110"]={alert_type:"warning",alertDisplay:"toast",subject:"Record Changed",msg:"Record changed by other user, reload to get the latest changes"};m["SYS_MSG_0120"]={alert_type:"error",alertDisplay:"modal",subject:"Create Mode Denied",msg:"Create mode not allowed for this program"};m["SYS_MSG_0122"]={alert_type:"error",alertDisplay:"modal",subject:"Modify Mode Denied",msg:"Modify mode not allowed for this program"};m["SYS_MSG_0124"]={alert_type:"error",alertDisplay:"modal",subject:"Delete Mode Denied",msg:"Delete mode not allowed for this program"};m["SYS_MSG_0126"]={alert_type:"error",alertDisplay:"modal",subject:"Program Read Only",msg:"Program set to Read Only"};m["SYS_MSG_0130"]={alert_type:"error",alertDisplay:"modal",subject:"Error Reduce",msg:"Select Index to Reduce"};m["SYS_MSG_0201"]={alert_type:"error",alertDisplay:"toast",subject:"Failed to change GUI Property",msg:"Failed to change GUI element property, GUI element missing"};m["SYS_MSG_0310"]={alert_type:"error",alertDisplay:"toast",subject:"Missing Reference Parameters Out",msg:"Parameter out not exist in dataset"};m["SYS_MSG_0400"]={alert_type:"error",alertDisplay:"modal",subject:"Delete Widget Folder Denied",msg:"The selected folder contains data, Please clean or move content to another folder"};m["SYS_MSG_0410"]={alert_type:"error",alertDisplay:"toast",subject:"Recipient Error",msg:"Check recipient data"};m["SYS_MSG_0412"]={alert_type:"error",alertDisplay:"modal",subject:"Recipient Empty",msg:"No recipients entered or selected"};m["SYS_MSG_0414"]={alert_type:"error",alertDisplay:"modal",subject:"Data Save Error",msg:"Widget has no content"};m["SYS_MSG_0416"]={alert_type:"error",alertDisplay:"modal",subject:"Required Field",msg:"Edit url field is empty"};m["SYS_MSG_0418"]={alert_type:"error",alertDisplay:"modal",subject:"Required Field",msg:"Publish url field is empty"};m["SYS_MSG_0420"]={alert_type:"error",alertDisplay:"modal",subject:"Connection Error",msg:"Cannot connect to mailbox"};m["SYS_MSG_0422"]={alert_type:"success",alertDisplay:"modal",subject:"Connection Ok",msg:"Connection Ok :)"};m["SYS_MSG_0424"]={alert_type:"error",alertDisplay:"modal",subject:"Connection Failed",msg:"Connection to POP3 failed"};m["SYS_MSG_0426"]={alert_type:"error",alertDisplay:"modal",subject:"Connection Failed",msg:"SMTP Connection error, Test Email was not sent"};m["SYS_MSG_0430"]={alert_type:"error",alertDisplay:"toast",subject:"Email Account Error",msg:"No email account found, Right Click Tree -> Settings->Manage Accounts -> Right click for menu options"};m["SYS_MSG_0440"]={alert_type:"error",alertDisplay:"modal",subject:"Widget Initiation Error",msg:"Missing information for Link Type or Link Name"};m["SYS_MSG_0442"]={alert_type:"error",alertDisplay:"modal",subject:"Error Init Widget",msg:"Missing record Id on Create Mode"};m["SYS_MSG_0450"]={alert_type:"error",alertDisplay:"modal",subject:"Validation Failed",msg:"Fix fields highlight in Red"};m["SYS_MSG_0501"]={alert_type:"error",alertDisplay:"modal",subject:"Mandatory Alert Save",msg:"Save action failed, Mandatory fields missing"};m["SYS_MSG_0550"]={alert_type:"error",alertDisplay:"toast",subject:"Illegal input number",msg:"@SYS_GLOBAL_OBJ_ACTIVE_FIELD_INFO.nameform +' only allow numbers!'"};m["SYS_MSG_0610"]={alert_type:"error",alertDisplay:"toast",subject:"Form Field Conflict",msg:"Field declared more than once for the form"};m["SYS_MSG_0612"]={alert_type:"error",alertDisplay:"toast",subject:"Mask Error - Missing Definition",msg:"Missing mask definition"};m["SYS_MSG_0614"]={alert_type:"error",alertDisplay:"toast",subject:"Mask Error - Wrong Definition",msg:"Wrong mask definition"};m["SYS_MSG_0616"]={alert_type:"error",alertDisplay:"toast",subject:"Mask Error - Size Parser",msg:"Size parser error"};m["SYS_MSG_0618"]={alert_type:"error",alertDisplay:"toast",subject:"Mask Error - Illegal Z switch",msg:"Illegal 'Z' in string mask"};m["SYS_MSG_0620"]={alert_type:"error",alertDisplay:"toast",subject:"Mask Error - Illegal N switch",msg:"Illegal 'N' in string mask"};m["SYS_MSG_0622"]={alert_type:"error",alertDisplay:"toast",subject:"Mask Error - Illegal + switch",msg:"Illegal '+' in string mask"};m["SYS_MSG_0624"]={alert_type:"error",alertDisplay:"toast",subject:"Mask Error - Illegal - switch",msg:"Illegal '-' in string mask"};m["SYS_MSG_0626"]={alert_type:"error",alertDisplay:"toast",subject:"Mask Error - Illegal C switch",msg:"Illegal 'C' in string mask"};m["SYS_MSG_0628"]={alert_type:"error",alertDisplay:"toast",subject:"Mask Error - Invalid switch",msg:"Invalid switch in string mask"};m["SYS_MSG_0630"]={alert_type:"error",alertDisplay:"toast",subject:"Mask Error - Missing DOM Element",msg:"Missing DOM element"};m["SYS_MSG_0632"]={alert_type:"error",alertDisplay:"toast",subject:"Mask Error - Too Big",msg:"Size to big, max: 15.5"};m["SYS_MSG_0700"]={alert_type:"warning",alertDisplay:"console",subject:"Table Warning - Empty",msg:"Table has no content"};m["SYS_MSG_0702"]={alert_type:"error",alertDisplay:"console",subject:"Table Error - No Fields",msg:"Table missing fields content"};m["SYS_MSG_0704"]={alert_type:"warning",alertDisplay:"console",subject:"Table Warning - Not In Use",msg:"Table not in use by any object"};m["SYS_MSG_0706"]={alert_type:"error",alertDisplay:"console",subject:"Table Error - No Primary Index",msg:"Table must have at least one index"};m["SYS_MSG_0708"]={alert_type:"error",alertDisplay:"console",subject:"Table Error - Bad Index Name",msg:"Index name is invalid or cannot contain any of non word characters"};m["SYS_MSG_0710"]={alert_type:"error",alertDisplay:"console",subject:"Table Error - Empty Index",msg:"Index has no keys"};m["SYS_MSG_0712"]={alert_type:"error",alertDisplay:"console",subject:"Table Error - Key Not Exist",msg:"Key not exist in the table fields repository"};m["SYS_MSG_0714"]={alert_type:"error",alertDisplay:"console",subject:"Table Error - Duplicate Fields",msg:"Duplicate fields in the table fields repository"};m["SYS_MSG_0716"]={alert_type:"error",alertDisplay:"console",subject:"Table Error - Bad Field Name",msg:"Field name is invalid or cannot contain any of non word characters"};m["SYS_MSG_0718"]={alert_type:"error",alertDisplay:"console",subject:"Table Error - Integrity Broken",msg:"Field broken from its properties, edit the field and save"};m["SYS_MSG_0720"]={alert_type:"error",alertDisplay:"console",subject:"Table Error - Model Not Exist",msg:"Model assigned to the field not exist"};m["SYS_MSG_0722"]={alert_type:"warning",alertDisplay:"console",subject:"Object Warning - Not In Use",msg:"Object not in use or not call by any object"};m["SYS_MSG_0724"]={alert_type:"error",alertDisplay:"console",subject:"Object Error - Table Not Exist",msg:"Table assigned in object datasource not exist"};m["SYS_MSG_0726"]={alert_type:"error",alertDisplay:"console",subject:"Object Error - Index Keys Mismatch",msg:"Table index has different structure"};m["SYS_MSG_0728"]={alert_type:"error",alertDisplay:"console",subject:"Object Error - Index Key From Empty",msg:"Index key From must have a value"};m["SYS_MSG_0730"]={alert_type:"error",alertDisplay:"console",subject:"Object Error - Index Key From Reference",msg:"Field reference not exist in any dataset or parameters"};m["SYS_MSG_0732"]={alert_type:"error",alertDisplay:"console",subject:"Object Error - Index Key To Empty",msg:"Index key To must have a value"};m["SYS_MSG_0734"]={alert_type:"error",alertDisplay:"console",subject:"Object Error - Index Key To Reference",msg:"Field reference not exist in any dataset or parameters"};m["SYS_MSG_0736"]={alert_type:"error",alertDisplay:"console",subject:"Object Error - Index Locate From Reference",msg:"Field reference not exist in any dataset or parameters"};m["SYS_MSG_0738"]={alert_type:"error",alertDisplay:"console",subject:"Object Error - Index Locate To Reference",msg:"Field reference not exist in any dataset or parameters"};m["SYS_MSG_0740"]={alert_type:"error",alertDisplay:"console",subject:"Object Error - Index Empty",msg:"Index empty - no keys defined"};m["SYS_MSG_0742"]={alert_type:"error",alertDisplay:"console",subject:"Object Error - Index Reference",msg:"Table index reference error"};m["SYS_MSG_0744"]={alert_type:"error",alertDisplay:"console",subject:"Object Error - Duplicate Fields",msg:"Duplicate fields in the dataset fields repository"};m["SYS_MSG_0746"]={alert_type:"error",alertDisplay:"console",subject:"Object Error - Field reference error",msg:"Field not exist in datasource table fields repository"};m["SYS_MSG_0748"]={alert_type:"error",alertDisplay:"console",subject:"Object Error - Mismatch Reference Type",msg:"Mismatch in calling reference type"};m["SYS_MSG_0750"]={alert_type:"error",alertDisplay:"console",subject:"Object Error - Reference Broken",msg:"Reference broken calling object not exist"};m["SYS_MSG_0752"]={alert_type:"error",alertDisplay:"console",subject:"Object Error - Empty Reference",msg:"Reference empty"};m["SYS_MSG_0754"]={alert_type:"error",alertDisplay:"console",subject:"Object Error - Action Not Exist",msg:"Action not exist"};m["SYS_MSG_0756"]={alert_type:"error",alertDisplay:"console",subject:"Object Error - Empty Event Reference",msg:"Empty event reference"};m["SYS_MSG_0758"]={alert_type:"error",alertDisplay:"console",subject:"Object Error - Bad Field Name",msg:"Field name is invalid or cannot contain any of non word characters"};m["SYS_MSG_0760"]={alert_type:"error",alertDisplay:"console",subject:"Object Error - Integrity Broken",msg:"Field broken from its properties, edit the object and save"};m["SYS_MSG_0762"]={alert_type:"error",alertDisplay:"console",subject:"Object Error - Model Not Exist",msg:"Model assigned to the field not exist"};m["SYS_MSG_0764"]={alert_type:"error",alertDisplay:"console",subject:"Object Error - Empty Dataset",msg:"Dataset empty from fields"};m["SYS_MSG_0766"]={alert_type:"error",alertDisplay:"console",subject:"Object Error - Field Type Mismatch",msg:"Field type not match to the underlined table field definition"};m["SYS_MSG_0768"]={alert_type:"error",alertDisplay:"console",subject:"Object Error - Field Mask Mismatch",msg:"Field masks not match to the underlined table field definition"};m["SYS_MSG_0770"]={alert_type:"error",alertDisplay:"console",subject:"Object Error - Bad Event Name",msg:"Event name is invalid or cannot contain any of non word characters"};m["SYS_MSG_0772"]={alert_type:"error",alertDisplay:"console",subject:"Object Error - UI Field Not Exist",msg:"UI Field not exist in the dataset repository"};m["SYS_MSG_0774"]={alert_type:"error",alertDisplay:"console",subject:"Object Error - UI Field Reference Broken",msg:"UI Field reference broken"};m["SYS_MSG_0780"]={alert_type:"error",alertDisplay:"toast",subject:"UI element error",msg:"UI element not exist"};m["SYS_MSG_1210"]={alert_type:"error",alertDisplay:"modal",subject:"Program error",msg:"Program not exist"};m["SYS_MSG_1220"]={alert_type:"error",alertDisplay:"modal",subject:"Program error",msg:"Non grid output defined"};m["SYS_MSG_1240"]={alert_type:"error",alertDisplay:"toast",subject:"Debug error",msg:""};m["SYS_MSG_1250"]={alert_type:"error",alertDisplay:"toast",subject:"Debug log error",msg:""};m["SYS_MSG_1260"]={alert_type:"error",alertDisplay:"toast",subject:"Session Expired",msg:"Renew token session in Studio"};return m};func.utils.find_key_in_ViewUITreeObj=function(arr,key,val){return arr.reduce((a,item)=>{if(a)return a;if(item[key]===val)return item;if(item.children)return findId(val,item.children)},null)};func.utils.get_plugin_setup=function(SESSION_ID,plugin_name){const report_error=function(descP,warn){func.utils.debug.log(SESSION_ID,plugin_name,{module:"plugin",action:"Init",source:"get_plugin_setup",prop:descP,details:descP,result:null,error:warn?false:true,fields:null,type:"plugin"})};return new Promise(async(resolve,reject)=>{try{const db=await func.utils.connect_pouchdb(SESSION_ID);try{let ret=await db.get(`cache_plugin_setup_${plugin_name}`);return resolve(ret.data)}catch(err){const json=await func.common.db(SESSION_ID,"get_plugin_setup",{plugin_name:plugin_name});if(json.code<0){report_error("Error: "+json.data,json.error_type==="W"?true:false)}resolve(json);var doc={_id:`cache_plugin_setup_${plugin_name}`,data:json,docType:"cache_plugin"};db.put(doc)}}catch(e){console.error(e);report_error("Error: "+e.msg,e.error_type==="W"?true:false);resolve(e.msg)}})};func.utils.connect_pouchdb=async function(SESSION_ID){const app_id=SESSION_OBJ[SESSION_ID].app_id;return new PouchDB("xuda_rt_"+app_id)};func.utils.call_plugin_api=function(SESSION_ID,plugin_nameP,dataP){var _session=SESSION_OBJ[SESSION_ID];const report_error=function(descP,warn){func.utils.debug.log(SESSION_ID,plugin_nameP,{module:"plugin",action:"Init",source:"call_plugin_api",prop:descP,details:descP,result:null,error:warn?false:true,fields:null,type:"plugin"})};return new Promise(async resolve=>{var data={app_id:APP_OBJ[_session.app_id]._id,debug:glb.DEBUG_MODE,uid:_session.USR_OBJ._id,gtp_token:_session.gtp_token,app_token:_session.app_token};data=_.assignIn(data,dataP);fetch(`https://xuda.io/ppi/${plugin_nameP}`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(data)}).then(response=>{if(!response.ok){return response.text().then(text=>{throw new Error(text)})}return response.json()}).then(json=>{if(json.code<0){report_error("Error: "+json.data,json.error_type==="W"?true:false)}resolve(json.data)}).catch(err=>{report_error("Error: "+err.message);resolve(err.message)})})};func.utils.get_plugin_resource=function(SESSION_ID,plugin_name,plugin_resource){var _session=SESSION_OBJ[SESSION_ID];const get_path=function(resource){if(_session.worker_type==="Dev"){return`../../plugins/${plugin_name}/${resource}`}if(typeof IS_PROCESS_SERVER!=="undefined"){return`${_conf.plugins_drive_path}/${_session.app_id}/node_modules/${plugin_name}/${resource}`}else{return`https://${_session.domain}/plugins/${plugin_name}/${resource}?app_id=${_session.app_id}&ts=${_session?.opt?.app_build_id||0}`}};return new Promise(async(resolve,reject)=>{try{const plugin_resource_res=await import(`${get_path(plugin_resource)}`);resolve(plugin_resource_res)}catch(err){console.error(err);reject()}})};func.utils.remove_cached_objects=async function(SESSION_ID){if(typeof IS_DOCKER!=="undefined"||typeof IS_PROCESS_SERVER!=="undefined")return;try{const db=await func.utils.connect_pouchdb(SESSION_ID);let opt={$or:[{docType:"cache_objects"},{docType:"cache_plugin"},{docType:"cache_app"}]};const res=await db.find({selector:opt});for await(let val of res.docs){await db.remove(val)}}catch(err){return}};func.utils.get_plugin_npm_cdn=async function(SESSION_ID,plugin_name,resource){const _session=SESSION_OBJ[SESSION_ID];const get_path=function(resource){if(_session.worker_type==="Dev"){return`../../plugins/${plugin_name}/${resource}`}return`https://${_session.domain}/plugins/${plugin_name}/${resource}?app_id=${_session.app_id}&ts=${_session?.opt?.app_build_id||0}`};return get_path(resource)};func.utils.write_log=async function(SESSION_ID,method="",msg="",log_type="error",source="runtime",details){const _session=SESSION_OBJ[SESSION_ID];if(typeof IS_API_SERVER!=="undefined"||typeof IS_DOCKER!=="undefined"||typeof IS_PROCESS_SERVER!=="undefined"){return __.rpi.write_log(_session.app_id,log_type,source,msg,details)}await func.common.db(SESSION_ID,"write_log",{msg:msg,log_type:log_type,source:source,details:details,method:method})};func.utils.get_resource_filename=function(build,filename){if(build){return filename.replace(/(\.\w+)$/,`.${build}$1`)}return filename};func.utils.set_SYS_GLOBAL_OBJ_WIDGET_INFO=async function(SESSION_ID,docP){var obj=_.clone(docP);obj.date=await func.utils.get_dateTime(SESSION_ID,"SYS_DATE",docP.date);obj.time=await func.utils.get_dateTime(SESSION_ID,"SYS_TIME",docP.date);var datasource_changes={[0]:{["data_system"]:{["SYS_GLOBAL_OBJ_WIDGET_INFO"]:obj}}};await func.datasource.update(SESSION_ID,datasource_changes)};func.utils.get_last_datasource_no=function(SESSION_ID){if(typeof IS_PROCESS_SERVER!=="undefined"){return Object.keys(SESSION_OBJ[SESSION_ID].DS_GLB).at?.(-1)}else{const filtered=Object.values(SESSION_OBJ[SESSION_ID].DS_GLB).filter(e=>e.tree_obj.menuType!=="api");return filtered?.at?.(-1)?.dsSession}};func.UI.utils={};func.UI.utils.indicator={};func.UI.utils.indicator.worker={};func.UI.utils.indicator.worker.busy=function(){$(".progressLoader").addClass("progress_busy")};func.UI.utils.indicator.worker.normal=function(){$(".progressLoader").removeClass("progress_busy")};func.UI.utils.indicator.server={};func.UI.utils.indicator.server.busy=function(){func.UI.utils.indicator.worker.busy()};func.UI.utils.indicator.server.normal=function(){func.UI.utils.indicator.worker.normal()};func.UI.utils.indicator.screen={};func.UI.utils.indicator.screen.busy=function(){$(".progressLoader").addClass("progress_busy2")};func.UI.utils.indicator.screen.normal=function(){$(".progressLoader").removeClass("progress_busy2")};func.UI.utils.save=function(SESSION_ID,stateP){if(stateP)func.UI.utils.indicator.worker.busy();else func.UI.utils.indicator.worker.normal()};func.UI.utils.screen_blocker=function(onP,idP,dsP){if(!idP){func.utils.debug_report("","Worker","Missing reference id","E");return}window.oncontextmenu=function(){if(onP)return false;else return true};if(!onP){delete SCREEN_BLOCKER_OBJ[idP];return}if(idP!=="Worker"){SCREEN_BLOCKER_OBJ[idP]=Date.now()}};func.UI.utils.get_node_elm=function(SESSION_ID,dsSessionP,ui_idP,$container,is_app_panel,ui_type,functionP){if(!$container){$container=$("body")}var $elm=func.UI.utils.find_in_element_data(is_app_panel?"xuPanelData":"xuData",$container,"ui_id",ui_idP);const _session=SESSION_OBJ[SESSION_ID];var _ds=_session.DS_GLB[dsSessionP];if(_ds.tree_obj.renderType==="form"){return $elm}var $grid_elm;$.each($elm,function(key,val){if($(val.data().xuData.recordid)===_ds.currentRecordId){$grid_elm=$(val);return false}});return $grid_elm;return $elm};func.UI.utils.get_nodeId=function(SESSION_ID,dsSessionP,ui_idP,$container,is_app_panel){var $elm=func.UI.utils.get_node_elm(SESSION_ID,dsSessionP,ui_idP,$container,is_app_panel,null,null);if(is_app_panel){return $elm.data().xuData.panel_info.prop.id}else{return $elm.attr("nodeId")}};func.UI.utils.get_ui_id_count=function(SESSION_ID,dsSessionP,ui_idP,$container){return func.UI.utils.get_node_elm(SESSION_ID,dsSessionP,ui_idP,$container,null,null).length};func.UI.utils.clean_node_busy=function(node){var run_node=function(node){node.busy=false;$.each(node.children,function(key,val){run_node(val)})};run_node(node);return node};func.UI.utils.live_preview_element_inspect_on=function(SESSION_ID,service){$.each($("[xu-ui-id]"),function(key,val){$(val).on("mouseenter.live_preview_element_inspector",function(){$("body").find(".preview_mark").removeClass("preview_mark").off("click.live_preview_element_inspector");$(this).addClass("preview_mark");$(this).on("click.live_preview_element_inspector",function(e){const _session=SESSION_OBJ[SESSION_ID];console.log($(this).data());const data=$(this).data();const obj={service:service+"_result",id:STUDIO_WEBSOCKET_CONNECTION_ID,uid:_session.USR_OBJ._id,source:"runtime",app_id:_session.app_id,gtp_token:_session.gtp_token,session_id:SESSION_ID,app_token:_session.app_token};switch(service){case"live_preview_element_reference":obj.data={prog_id:data.xuData.prog_id,node:data.xuData.node};break;case"live_preview_element_info":obj.data={element_info:data.debug_info,datasource:_session.DS_GLB[data.paramsP.dsSessionP]};break;case"live_preview_element_dnd":break;default:}STUDIO_PEER_CONN_SEND_METHOD(obj);func.UI.utils.live_preview_element_inspect_off();if(typeof LIVE_PREVIEW_APP_ACTIVE!=="undefined"){$(`#live_preview_element_reference_btn`).css("color","unset");$(`#live_preview_element_info_btn`).css("color","unset")}})});$(val).on("mouseleave.live_preview_element_inspector",function(){$(this).removeClass("preview_mark");$(this).off("click.live_preview_element_inspector")})})};func.UI.utils.live_preview_element_inspect_off=function(){$.each($("[xu-ui-id]"),function(key,val){$(val).off("mouseenter.live_preview_element_inspector mouseleave.live_preview_element_inspector")});$("body").find(".preview_mark").removeClass("preview_mark").off("click.live_preview_element_inspector")};func.UI.utils.live_preview_show_selected_element=function(nodeid){$("body").find(".preview_mark").removeClass("preview_mark");$(`[nodeid="${nodeid}"]`).addClass("preview_mark")};func.UI.utils.get_url_attribute=function(SESSION_ID,key){var ret=glb.URL_PARAMS.get(key);const _session=SESSION_OBJ[SESSION_ID];return glb.URL_PARAMS.get(key)||$(_session.root_element).attr(key)||_session.opt?.params?.[key]||_session.opt[key]||$.cookie(key)||window.localStorage.getItem(key)};func.UI.utils.get_root_element_attributes=function(SESSION_ID){var ret={};$(SESSION_OBJ[SESSION_ID].root_element).each(function(){$.each(this.attributes,function(){if(this.specified){ret[this.name]=this.value}})});return ret};func.UI.utils.prompt_confirm_window=async function(SESSION_ID,messageP,picP,confirmYesFuncP,confirmNoFuncP,confirmCancelFuncP,title,colorP){if(confirmNoFuncP){buttons.push({text:"Disagree",role:"no",cssClass:"secondary",handler:()=>{confirmNoFuncP()}})}if(confirmYesFuncP){buttons.push({text:"Agree",role:"yes",cssClass:"secondary",handler:()=>{confirmYesFuncP()}})}if(confirmCancelFuncP){buttons.push({text:"Dismiss",role:"cancel",cssClass:"secondary",handler:()=>{confirmCancelFuncP()}})}UI_FRAMEWORK_PLUGIN.modal(title,messageP,buttons)};func.UI.utils.alert=function(msg){console.error(msg)};func.UI.utils.progressScreen={};func.UI.utils.progressScreen.show=function(SESSION_ID,textP,show_bytesP,error,progress_off,logo_off){if(glb.IS_WORKER){return}const app_obj=APP_OBJ?.[SESSION_OBJ?.[SESSION_ID]?.app_id];var background_color="";var icon=app_obj?._conf?.logo_url||"https://xuda.io/dist/images/xuda_logo.png";if(app_obj?.app_pic){icon=app_obj.app_pic}if(app_obj&&app_obj.app_icon_prop){if(app_obj.app_icon_prop.app_icon_background_color){background_color=app_obj.app_icon_prop.app_icon_background_color}}IS_PROGRESS_SCREEN_OPEN=true;var $progressScreen=$("#progressScreen2").empty();$(".loader").hide();$progressScreen=$("#progressScreen2").css({});if(background_color){$progressScreen.css({color:func.common.getContrast_color(background_color),"background-color":background_color})}setTimeout(function(){if(IS_PROGRESS_SCREEN_OPEN){var error_msg=`<h4>${textP}</h4>`;$("#progressScreen2_text").show(500,function(){if(!logo_off){$(this).prepend(`<img class='progressScreen_logo' src='${icon}'>`)}$(this).append(error?error_msg:typeof textP==="object"?textP:`<p>${textP}</p>`)})}},500);$("#progressScreen2").show();$("<div>").attr("id","progressScreen2_text").hide().appendTo($progressScreen)};func.UI.utils.progressScreen.hide=function(){if(glb.IS_WORKER){return}IS_PROGRESS_SCREEN_OPEN=false;$("#progressScreen2").hide();$("#progressScreen2_text").empty()};func.UI.utils.find_in_element_data=function(folder,$elm,key,val){return $elm.find("*").filter(function(){if(typeof val==="undefined"){return $(this).data()?.[folder]?.[key]}return $(this).data()?.[folder]?.[key]==val})};func.UI.utils.init_ui_framework=async function(SESSION_ID,prog_id){if(typeof glb.SLIM_BUNDLE!=="undefined"||glb.SLIM_BUNDLE)return;var _session=SESSION_OBJ[SESSION_ID];var tree_obj=await func.utils.TREE_OBJ.get(SESSION_ID,prog_id);if(_.isEmpty(tree_obj)){return console.error("Error: prog "+prog_id+" not found.")}const report_error=function(descP,warn){func.utils.debug.log(SESSION_ID,prog_id,{module:"component",action:"Init",source:"install ui framework",prop:descP,details:descP,result:null,error:warn?false:true,fields:null,type:"component",prog_id:prog_id})};const plugin_name=tree_obj.uiFramework;if(!plugin_name){return report_error("no frameworks plugin defined",true)}if(plugin_name===UI_FRAMEWORK_INSTALLED)return;const _plugin=APP_OBJ[_session.app_id]?.app_plugins_purchased?.[plugin_name];if(!_plugin?.installed){return report_error(`plugin ${plugin_name} not installed`)}const get_path=function(plugin_name,resource){var path=`https://${_session.domain}/plugins/${plugin_name}${resource?"/"+resource:""}?app_id=${_session.app_id}`;return path};var _ui_framework_index;try{const runtime_mjs=`${_plugin.manifest["runtime.mjs"].dist?"dist/":""}runtime.mjs`;_ui_framework_index=await import(get_path(plugin_name,runtime_mjs))}catch(error){return report_error(`plugin ${plugin_name} not found`)}if(!_ui_framework_index){return report_error(`plugin ${plugin_name} is empty`)}if(!_ui_framework_index.core){return report_error(`plugin core not found in ${plugin_name} `)}var _ui_framework_dashboard_setup;var _ui_framework_dashboard_setup_data_ret;const ui_framework_core=new _ui_framework_index.core;if(ui_framework_core.init){try{const setup_mjs=`${_plugin.manifest["index.mjs"].dist?"dist/":""}index.mjs`;_ui_framework_dashboard_setup=await import(get_path(plugin_name,setup_mjs));if(_ui_framework_dashboard_setup){_ui_framework_dashboard_setup_data_ret=await func.utils.get_plugin_setup(SESSION_ID,plugin_name)}}catch(error){}}if(plugin_name!==UI_FRAMEWORK_INSTALLED){UI_FRAMEWORK_INSTALLED=plugin_name;const _plugin_INSTALLED=APP_OBJ[_session.app_id]?.app_plugins_purchased?.[UI_FRAMEWORK_INSTALLED];UI_FRAMEWORK_PLUGIN=_ui_framework_index;if(UI_FRAMEWORK_INSTALLED){var _current_ui_framework_runtime;try{const _runtime_mjs=`${_plugin_INSTALLED.manifest["runtime.mjs"].dist?"dist/":""}runtime.mjs`;_current_ui_framework_runtime=await import(get_path(UI_FRAMEWORK_INSTALLED,_runtime_mjs))}catch(error){return report_error(`plugin ${UI_FRAMEWORK_INSTALLED} not found`)}if(UI_FRAMEWORK_PLUGIN.core.discard&&UI_FRAMEWORK_PLUGIN.init_id){UI_FRAMEWORK_PLUGIN.core.discard(UI_FRAMEWORK_PLUGIN.init_id)}if(_ui_framework_index.resources){$.each(_current_ui_framework_runtime.resources,function(key,val){func.utils.remove_js_css_file(val.url,val.type)})}}var init_id;if(_ui_framework_index.resources){for await(var val of _ui_framework_index.resources){var ret=undefined;var url=val.url;switch(val.type){case"module":try{ret=await func.utils.load_js_on_demand(url,"module")}catch(error){debugger}break;case"css":ret=func.utils.load_css_on_demand(url);break;case"js":ret=await func.utils.load_js_on_demand(url);break;default:break}if(val.callback){val.callback(ret)}}}if(ui_framework_core.init){init_id=await ui_framework_core.init(_ui_framework_dashboard_setup_data_ret?.code>-1&&_ui_framework_dashboard_setup_data_ret.data);UI_FRAMEWORK_PLUGIN.init_id=init_id}}};func.UI.utils.get_panels_wrapper_from_dom=async function(SESSION_ID,$xu_embed_container,ignore_disableAutoRefresh){const $elm=func.UI.utils.find_in_element_data("xuPanelWrapper",$(SESSION_OBJ[SESSION_ID].root_element),"isWrapper");var panels_obj={};for(const[elem_key,elem_val]of Object.entries($elm)){if(elem_key==="length")break;var $panel_div=$(elem_val);const panelXuAttributes=$panel_div?.data().xuPanelWrapper?.panelXuAttributes;const panelDivData=$panel_div?.data().xuPanelWrapper?.panelDivData;if(!panelXuAttributes)continue;const xu_ui_id=$panel_div.attr("xu-ui-id");if(!panels_obj[xu_ui_id]){var _session=SESSION_OBJ[SESSION_ID];let _ds=_session?.DS_GLB[panelDivData.xuData.paramsP.dsSessionP];if(!_ds)continue;let prog_doc=await func.utils.DOCS_OBJ.get(SESSION_ID,_ds.prog_id);if(!ignore_disableAutoRefresh&&prog_doc.properties.disableAutoRefresh){continue}let ids=[];$.each($panel_div.children(),function(key,val){if($(val).data().xuPanelData){ids.push($(val).attr("xu-ui-id"))}});panels_obj[xu_ui_id]={panelXuAttributes:panelXuAttributes,progUi:prog_doc.progUi,prog_doc:prog_doc,$panel_div:$panel_div,_ds:_ds,ids:ids}}}return panels_obj};func.UI.worker={};func.UI.worker.ID=null;func.UI.worker.init=async function(SESSION_ID){$.fn.isInViewport=function(){var elementTop=$(this).offset().top;var elementBottom=elementTop+$(this).outerHeight();var viewportTop=$(window).scrollTop();var viewportBottom=viewportTop+$(window).height();return elementBottom>viewportTop&&elementTop<viewportBottom};let last_job_in_queue=0;const job_iterator2=async function(){let from_job_num_to_run=last_job_in_queue;last_job_in_queue=UI_WORKER_OBJ.num-from_job_num_to_run;if(typeof UI_WORKER_OBJ.stat==="undefined"||UI_WORKER_OBJ.stat==="undefined"||UI_WORKER_OBJ.stat===null){this.attempt=0;if(UI_WORKER_OBJ.jobs.length){for await(const[key,val]of Object.entries(UI_WORKER_OBJ.jobs)){try{if(val.stat){break}await func.UI.worker.execute(val.SESSION_ID,val)}catch(err){console.error(err)}}}}else{this.attempt++}};const job_iterator=async function(){let from_job_num_to_run=last_job_in_queue;last_job_in_queue=UI_WORKER_OBJ.num-from_job_num_to_run;this.attempt=0;if(UI_WORKER_OBJ.jobs.length){let running_job_children_elements=[];let active_job_children_elements=[];for await(const[key,val]of Object.entries(UI_WORKER_OBJ.jobs)){try{if(val.stat==="busy")continue;if(!val.elementP){await func.UI.worker.execute(val.SESSION_ID,val);continue}const active_xu_ui_id=val.elementP.attr("xu-ui-id");if(!active_xu_ui_id)continue;const running_job_obj=UI_WORKER_OBJ.jobs[0];if(running_job_obj.job_num!==val.job_num){const running_xu_ui_id=running_job_obj?.elementP?.attr("xu-ui-id");if(!running_xu_ui_id)continue;$.each(running_job_obj.elementP.find("*"),function(key,val){const xu_ui_id=$(val).attr("xu-ui-id");if(!xu_ui_id)return true;running_job_children_elements.push(xu_ui_id)});$.each(val.elementP.find("*"),function(key,val){const xu_ui_id=$(val).attr("xu-ui-id");if(!xu_ui_id)return true;active_job_children_elements.push(xu_ui_id)});if(running_job_children_elements.includes(active_xu_ui_id)){continue}if(active_job_children_elements.includes(running_xu_ui_id)){if(val.functionP==="execute_xu_render_attributes"){$.each(active_job_children_elements,function(key,val){const $elm=$(`[xu-ui-id=${val}]`);if(!$elm.length)return true;if(!$elm.data().xuData)return true;$elm.data().xuData.pending_to_delete=true});await func.UI.worker.delete_job(SESSION_ID,running_job_obj.job_num);break}}}await func.UI.worker.execute(val.SESSION_ID,val);continue}catch(err){console.error(err)}}}};this._interval=setInterval(job_iterator,1);setInterval(async function(){func.UI.ds_garbage_collector()},1e4);setInterval(async function(){func.UI.refs_garbage_collector();func.UI.teleport_garbage_collector()},1e3)};func.UI.worker.add_to_queue=async function(SESSION_ID,source,functionP,paramsP,calling_job,elementP,dsSession,calling_trigger_prop){var obj={SESSION_ID:SESSION_ID,source:source,functionP:functionP,paramsP:paramsP,calling_job:calling_job,elementP:elementP,dsSession:dsSession,calling_trigger_prop:calling_trigger_prop,job_num:UI_WORKER_OBJ.num};if(functionP==="execute_xu_all_attributes"){const queue_key=source+"_"+functionP+"_"+(elementP?.attr("xu-ui-id")||"")+"_"+(paramsP?.fields_arr?.toString()||"");obj.queue_key=queue_key;let exist_job=UI_WORKER_OBJ.jobs.find(e=>{if(e.queue_key===queue_key){return e}});if(exist_job){exist_job.paramsP=paramsP;exist_job.calling_trigger_prop=calling_trigger_prop;return}}UI_WORKER_OBJ.jobs.push(obj);UI_WORKER_OBJ.num++;return UI_WORKER_OBJ.num-1};func.UI.worker.delete_job=async function(SESSION_ID,jobNoP){var _session=SESSION_OBJ[SESSION_ID];var job_index=func.UI.worker.find_job_index(SESSION_ID,jobNoP);if(!UI_WORKER_OBJ.jobs[job_index]){return}var dsSession=UI_WORKER_OBJ.jobs[job_index].dsSession;let ds_obj=_session?.DS_GLB[dsSession];if(ds_obj){delete SCREEN_BLOCKER_OBJ[ds_obj.screenId+(ds_obj.callingScreenId?"_"+ds_obj.callingScreenId:"")]}if(dsSession&&ds_obj?.loops_limit&&ds_obj?.loops_count<ds_obj?.loops_limit-1){return}UI_WORKER_OBJ.jobs.splice(job_index,1)};func.UI.worker.execute=async function(SESSION_ID,queue_obj){var job_index=func.UI.worker.find_job_index(SESSION_ID,queue_obj.job_num);if(queue_obj.jobNoP)UI_WORKER_OBJ.stat=job_index;if(UI_WORKER_OBJ.jobs[job_index]){UI_WORKER_OBJ.jobs[job_index].stat="busy"}const fx={update_datasource:async function(){if(queue_obj?.paramsP){var _ds=SESSION_OBJ[SESSION_ID].DS_GLB[queue_obj.dsSession];_ds.currentRecordId=queue_obj.paramsP.currentRecordId;var datasource_changes={[_ds.dsSession]:{[_ds.currentRecordId]:"set"}};await func.datasource.update(SESSION_ID,datasource_changes);if(queue_obj.paramsP.field_id){datasource_changes={[_ds.dsSession]:{[_ds.currentRecordId]:{[queue_obj.paramsP.field_id]:queue_obj.paramsP.field_value}}};await func.datasource.update(SESSION_ID,datasource_changes)}}return func.UI.worker.delete_job(SESSION_ID,queue_obj.job_num)},execute_xu_render_attributes:async function(){const _data=queue_obj.paramsP.elem_val.$elm.data();if(_data?.xuData?.paramsP){await func.UI.screen.execute_xu_functions(SESSION_ID,null,_data.xuData.$root_container,_data.xuData.node,$(`[xu-ui-id="${_data.xuData.parent_element_ui_id}"`),_data.xuData.paramsP,{},queue_obj.jobNoP,_data.xuData.key,_data.xuData.parent_node,"xu-render",queue_obj.paramsP.elem_val.$elm,{key:"xu-render",value:queue_obj.paramsP.attr_value,fields_arr:queue_obj.paramsP.fields_arr,jobNoP:queue_obj.jobNoP})}return func.UI.worker.delete_job(SESSION_ID,queue_obj.job_num)},execute_xu_all_attributes:async function(){const done=function(){return func.UI.worker.delete_job(SESSION_ID,queue_obj.job_num)};var $elm=$(`[xu-ui-id="${queue_obj.paramsP.elem_key}"]`);if(!$elm.length){return done()}for await(const[key,attr]of Object.entries(queue_obj.paramsP.elem_val.attributes)){if(attr==="xu-exp:xu-render"||attr==="xu-exp:xu-for"||attr==="xu-for"||attr==="xu-exp:xu-bind"){continue}var res={result:queue_obj.paramsP.elem_val.$elm.data().xuAttributes[attr]};if(attr!=="xu-class"&&attr!=="xu-ui-plugin"){res=await func.expression.get(queue_obj.paramsP.SESSION_ID,queue_obj.paramsP.elem_val.$elm.data().xuAttributes[attr],queue_obj.paramsP.elem_val.$elm.data().xuData.paramsP.dsSessionP,"UI Property EXP",queue_obj.paramsP.elem_val.$elm.data().xuData.recordid,null,null,null,null,null,queue_obj.paramsP.elem_val.$elm.data().xuData.iterate_info)}const attr_new=attr.split("xu-exp:")[1];if(attr_new&&attr_new.substr(0,2)!=="xu"){queue_obj.paramsP.elem_val.$elm.attr(attr_new!=="viewBox"?attr_new.toLowerCase():attr_new,res.result)}else{try{let _data=queue_obj.paramsP.elem_val.$elm.data();if(!_data||_.isEmpty(_data)){continue}await func.UI.screen.execute_xu_functions(SESSION_ID,null,_data.xuData.$root_container,_data.xuData.node,_data.xuData.$container,_data.xuData.paramsP,{},queue_obj.jobNoP,null,null,attr_new||attr,queue_obj.paramsP.elem_val.$elm,{key:attr_new||attr,value:res.result})}catch(error){debugger}}}return done()},execute_xu_for:async function(){try{var $elm=queue_obj?.paramsP?.elem_val?.$elm;if(!$elm?.length){return func.UI.worker.delete_job(SESSION_ID,queue_obj.job_num)}$.each($elm.children(),(key,val)=>{if(!$(val)?.data()?.xuData)return true;if($(val).data().xuData.nodeid===queue_obj?.paramsP?.xu_for_item_id){$(val).remove()}});let _data=queue_obj.paramsP.elem_val.$elm.data();const node_to_render=_data.xuData.node_org.children?.find(e=>e.id===queue_obj?.paramsP?.xu_for_item_id);await func.UI.screen.render_ui_tree(queue_obj.paramsP.SESSION_ID,queue_obj.paramsP.elem_val.$elm,node_to_render,null,_data.xuData.paramsP,queue_obj.jobNoP,null,_data.xuData.key,null,_data.xuData.parent_node,null,_data.xuData.$root_container)}catch(error){}return func.UI.worker.delete_job(SESSION_ID,queue_obj.job_num)},render_viewport:async function(){const{nodeP,$div,parent_infoP,$root_container,jobNoP,is_skeleton,paramsP,$container}=queue_obj?.paramsP||{};if(nodeP?.children?.length&&!$div.children().length){$div.removeClass("skeleton");for await(const[key,val]of Object.entries(nodeP.children)){const ret=await func.UI.screen.render_ui_tree(SESSION_ID,$div,nodeP.children[key],parent_infoP,paramsP,jobNoP,is_skeleton,Number(key),null,nodeP,null,$root_container)}$div[0].style.removeProperty("height");$div.data().xuData.viewport_height=$div.height();const parent_id=$div.parent().attr("xu-ui-id");if(!UI_WORKER_OBJ.viewport_height_set_ids.includes(parent_id)){UI_WORKER_OBJ.viewport_height_set_ids.push(parent_id);func.UI.worker.add_to_queue(SESSION_ID,"gui event","set_viewport_height",{$div:$div,height:$div.height()},null,null,paramsP.dsSessionP)}}return func.UI.worker.delete_job(SESSION_ID,queue_obj.job_num)},set_viewport_height:async function(){const{$div,height}=queue_obj?.paramsP||{};$.each($div.parent().children(),function(key,elm){if(!$(elm)[0].style.height&&!$(elm).children().length){$(elm).css("height",height)}});return func.UI.worker.delete_job(SESSION_ID,queue_obj.job_num)},execute_xu_widget:async function(){try{var $elm=queue_obj?.paramsP?.elem_val?.$elm;if(!$elm?.length){return func.UI.worker.delete_job(SESSION_ID,queue_obj.job_num)}const _$elm=queue_obj.paramsP.elem_val.$elm.clone(true);const parent_id=$elm.parent().attr("xu-ui-id");let _data=_$elm.data();$elm.remove();const node_to_render=_data.xuData.node_org;await func.UI.screen.render_ui_tree(queue_obj.paramsP.SESSION_ID,$(`[xu-ui-id="${parent_id}"]`),node_to_render,null,_data.xuData.paramsP,queue_obj.jobNoP,null,_data.xuData.key,null,_data.xuData.parent_node,null,_data.xuData.$root_container)}catch(error){}return func.UI.worker.delete_job(SESSION_ID,queue_obj.job_num)}};return await fx[queue_obj.functionP]()};func.UI.worker.find_job_index=function(SESSION_ID,jobNoP){var ret=null;if(!UI_WORKER_OBJ)return ret;for(let[key,val]of Object.entries(UI_WORKER_OBJ.jobs)){if(val&&val.job_num==jobNoP){ret=Number(key);break}}return ret};func.UI.ds_garbage_collector=function(SESSION_ID=Object.keys(SESSION_OBJ)[0],re_check){let _session=SESSION_OBJ[SESSION_ID];const _data_system=_session?.DS_GLB?.[0]?.data_system;if(_data_system?.SYS_GLOBAL_BOL_AJAX_BUSY)return;if(!_data_system?.SYS_GLOBAL_BOL_IDLE)return;let abort;for(const[dsP,_ds]of Object.entries(_session.DS_GLB)){if(_ds.stat==="busy"){abort=true;break}}if(abort){return}let ds_pending_to_delete=[],ds_approve_to_delete=[];const $elm=$("body").find("*");for(const[dsP,_ds]of Object.entries(_session.DS_GLB)){if(!_ds.screen_params)continue;let found;$.each($elm,(key,val)=>{const _xuData=$(val).data().xuData;if(!_xuData||!_xuData.paramsP)return true;if(_xuData.paramsP.dsSessionP==dsP){found=true;return false}});if(!found){ds_pending_to_delete.push(dsP)}}const sortedKeys=Object.keys(_session.DS_GLB).sort((a,b)=>b.localeCompare(a));sortedKeys.forEach(key=>{const val=_session.DS_GLB[key];if(!ds_pending_to_delete.includes(key)&&typeof val.parentDataSourceNo!=="undefined"&&ds_pending_to_delete.includes(val.parentDataSourceNo.toString())){ds_pending_to_delete=ds_pending_to_delete.filter(item=>item!==val.parentDataSourceNo.toString())}});for(const val of ds_pending_to_delete){func.datasource.del(SESSION_ID,val)}};func.UI.refs_garbage_collector=function(SESSION_ID=Object.keys(SESSION_OBJ)[0]){if(!_.isEmpty(SCREEN_BLOCKER_OBJ)){return}let _session=SESSION_OBJ[SESSION_ID];const _data_system=_session?.DS_GLB?.[0]?.data_system;for(const[key,val]of Object.entries(_data_system?.SYS_GLOBAL_OBJ_REFS||{})){if(!$(`[xu-ui-id='${val.xu_ui_id}`)?.length&&!$(`[xu-panel-wrapper-id='${val.xu_ui_id}`)?.length){delete _data_system.SYS_GLOBAL_OBJ_REFS[key]}}};func.UI.teleport_garbage_collector=function(SESSION_ID=Object.keys(SESSION_OBJ)[0]){if(!_.isEmpty(SCREEN_BLOCKER_OBJ)){return}const $teleport_elements=$(`[xu-teleport-parent-id^='node-`);$.each($teleport_elements,(key,val)=>{const xu_teleport_parent_id=$(val).attr("xu-teleport-parent-id");if(!$(`[xu-ui-id='${xu_teleport_parent_id}`)?.length){$(val).remove()}})};func.UI.update_xu_ref=function(SESSION_ID,dsSessionP,ref_field_id,$elm){let ret;const _session=SESSION_OBJ[SESSION_ID];let _ds_0=_session.DS_GLB[0];const _ds=func.utils.clean_returned_datasource(SESSION_ID,dsSessionP);let obj={ds:_ds,data:{},props:_ds.in_parameters||{}};try{const row_idx=func.common.find_ROWID_idx(_ds,_ds.currentRecordId);obj.data=_ds?.data_feed?.rows?.[row_idx]}catch(error){}let SYS_GLOBAL_OBJ_REFS=_ds_0.data_system["SYS_GLOBAL_OBJ_REFS"];if($elm){const attributes=$elm?.data()?.xuData?.xuPanelProps||$elm?.data()?.xuData?.debug_info?.attribute_stat||{};obj.attributes=attributes;obj.xu_ui_id=$elm.attr("xu-ui-id")}if(!_.isEqual(SYS_GLOBAL_OBJ_REFS?.[ref_field_id]||{},obj)){if(!SYS_GLOBAL_OBJ_REFS[ref_field_id]){SYS_GLOBAL_OBJ_REFS[ref_field_id]={}}SYS_GLOBAL_OBJ_REFS[ref_field_id]=obj;ret=true}return ret};func.UI.find_field_in_progUi_attributes=function(progUi,field_id,prop,tag_name){let elm_nodes=[];const iterate_progUi=function(node){for(let item of node){if(!tag_name||item.tagName===tag_name){if(prop){if(!_.isEmpty(item.attributes)){for(const[attr,val]of Object.entries(item.attributes)){if(attr===`xu-exp:${prop}`||attr===prop){if(val.includes("@"+field_id)){elm_nodes.push(item);break}}}}}else{if(tag_name){elm_nodes.push(item)}}}if(item.children){iterate_progUi(item.children)}}};iterate_progUi(progUi);return elm_nodes};func.datasource={};func.datasource.create=async function(SESSION_ID,prog_id,dataSourceNoP=null,parentDataSourceNoP,containerIdP,rowIdP,jobNoP,calling_trigger_prop,parameters_raw_obj,NA_isInitP,NA_callingSourceP,calling_jobP,NA_screen_dsP,is_panelP,parameters_obj_inP,static_refreshP,worker_id,NA_eventChangesResults){return new Promise(async function(resolve,reject){if(!prog_id)return reject("Program is empty");var _session=SESSION_OBJ[SESSION_ID];if(!_session.DS_GLB)return reject("DS_GLB not exist");var _prog_obj=await func.utils.VIEWS_OBJ.get(SESSION_ID,prog_id);if(!_prog_obj)return reject("Program not found");var args={SESSION_ID:SESSION_ID,prog_id:prog_id,dataSourceNoP:dataSourceNoP,parentDataSourceNoP:parentDataSourceNoP,containerIdP:containerIdP,rowIdP:rowIdP,jobNoP:jobNoP,calling_trigger_prop:calling_trigger_prop,calling_jobP:calling_jobP,is_panelP:is_panelP,parameters_obj_inP:parameters_obj_inP,static_refreshP:static_refreshP,worker_id:worker_id,parameters_raw_obj:parameters_raw_obj};var IS_DATASOURCE_REFRESH=null;var _ds=_session.DS_GLB[dataSourceNoP];var old_dataSource_vars={};if(_ds)IS_DATASOURCE_REFRESH=true;if(IS_DATASOURCE_REFRESH){old_dataSource_vars.sortOrder=_ds.sortOrder;old_dataSource_vars.sortOrderTypeExp=_ds.sortOrderTypeExp;if(_ds.data_system){old_dataSource_vars.SYS_OBJ_WIN_MODE=_ds.data_system.SYS_OBJ_WIN_MODE;old_dataSource_vars.SYS_STR_WIN_ID=_ds.data_system.SYS_STR_WIN_ID;old_dataSource_vars.SYS_STR_WIN_NAME=_ds.data_system.SYS_STR_WIN_NAME}if(static_refreshP)old_dataSource_vars.in_parameters=_ds.in_parameters;await func.datasource.update(SESSION_ID,{[dataSourceNoP]:{["datasource_main"]:{stat:"busy",stat_ts:Date.now(),is_worker:glb.IS_WORKER}}})}const restore_old_dataSource_vars=function(dsSessionP){var _ds=SESSION_OBJ[SESSION_ID].DS_GLB[dsSessionP];if(_ds.data_system){_ds.data_system.SYS_OBJ_WIN_MODE=old_dataSource_vars.SYS_OBJ_WIN_MODE;_ds.data_system.SYS_STR_WIN_ID=old_dataSource_vars.SYS_STR_WIN_ID;_ds.data_system.SYS_STR_WIN_NAME=old_dataSource_vars.SYS_STR_WIN_NAME}if(static_refreshP)_ds.in_parameters=old_dataSource_vars.in_parameters};var run_at=_prog_obj?.properties?.runAt;if(!["live_preview","miniapp"].includes(_session.engine_mode)){if(_session.opt.app_computing_mode==="main"){run_at="client"}}if(_prog_obj?.properties.menuType==="globals"){run_at="client"}if(!run_at&&parentDataSourceNoP&&_session.DS_GLB[parentDataSourceNoP]){if(_session.DS_GLB[parentDataSourceNoP]._run_at)run_at=_session.DS_GLB[parentDataSourceNoP].v.run_at}const done=function(SESSION_ID,dsSessionP,response_returned_from_worker){var _ds=SESSION_OBJ[SESSION_ID].DS_GLB[dsSessionP];if(IS_DATASOURCE_REFRESH){restore_old_dataSource_vars(dsSessionP)}if(!IS_DATASOURCE_REFRESH){if(!glb.IS_WORKER){DATASOURCE_INTERVALS[SESSION_ID][dsSessionP]=new func.datasource.interval(SESSION_ID,dsSessionP,"client_interval");DATASOURCE_INTERVALS[SESSION_ID][dsSessionP].init()}}const set_stat_idle=async function(){let ds_connected=[];for(const[dsP,_ds]of Object.entries(_session.DS_GLB)){if(_ds.parentDataSourceNo==dsSessionP){ds_connected.push(dsP)}}const datasource_changes={[dsSessionP]:{["datasource_main"]:{stat:"idle",stat_ts:Date.now(),is_worker:glb.IS_WORKER}}};if(!ds_connected.length){return await func.datasource.update(SESSION_ID,datasource_changes)}let interval=setInterval(()=>{let idle_count=0;for(const dsSession of ds_connected){const _ds=_session.DS_GLB[dsSession];if(_ds.stat=="idle"){idle_count++}}if(ds_connected.length===idle_count){clearInterval(interval);func.datasource.update(SESSION_ID,datasource_changes)}},1e3)};set_stat_idle();resolve({SESSION_ID:SESSION_ID,dsSessionP:dsSessionP,rowIdP:_ds.args.rowIdP,jobNoP:_ds.args.jobNoP,callingLogId:_ds.callingLogId,calling_jobP:_ds.calling_jobP})};var db_driver;var is_system_client_vars=false;if(jobNoP){}if(glb.IS_WORKER||run_at==="client"||is_system_client_vars||db_driver==="pouchdb"){const ret=await func.datasource.prepare(args.SESSION_ID,args.prog_id,args.dataSourceNoP,args.parentDataSourceNoP,args.containerIdP,args.rowIdP,args.jobNoP,args.calling_trigger_prop,args.parameters_raw_obj,null,null,args.calling_jobP,null,args.is_panelP,args.parameters_obj_inP,args.static_refreshP,run_at,worker_id);return done(SESSION_ID,ret.dsSessionP)}if(_ds)IS_DATASOURCE_REFRESH=true;var data=_.assignIn({session_id:SESSION_ID,dataSourceSessionGlobal:SESSION_OBJ[SESSION_ID].dataSourceSessionGlobal,parentDataSourceNo:IS_DATASOURCE_REFRESH?_ds.parentDataSourceNo:null,IS_DATASOURCE_REFRESH:IS_DATASOURCE_REFRESH},args);delete data.SESSION_ID;const jsonP=await func.index.call_worker(SESSION_ID,{service:"datasource_create",data:data,id:SESSION_OBJ[SESSION_ID].worker_id});_session.DS_GLB[jsonP.dsSession]=jsonP;if(jsonP.dataSourceSessionGlobal>_session.dataSourceSessionGlobal){_session.dataSourceSessionGlobal=jsonP.dataSourceSessionGlobal}return done(SESSION_ID,jsonP.dsSession,true)})};func.datasource.prepare=async function(SESSION_ID,prog_id,dataSourceNoP,parentDataSourceNoP,containerIdP,rowIdP,jobNoP,calling_trigger_prop,parameters_raw_obj,NA_isInitP,callingSourceP,calling_jobP,NA_screen_dsP,is_panelP,parameters_obj_inP,static_refreshP,run_atP,worker_id){const set_parameters=async function(){var _session=SESSION_OBJ[SESSION_ID];const get_Out_parameters=async function(fieldIdP,located_field_param_idxP,param_row_idP){var ret=parameters_obj_inP?.[fieldIdP]||fieldIdP;PARAM_OUT_INFO[prog_id+"_"+param_row_idP]={module:_ds.viewModule,action:"parameters",prop:"out",details:ret,result:ret,source:_ds.viewSourceDesc,type:"parameters",prog_id:prog_id,dsSession:dataSourceSession,fieldId:fieldIdP,parentDataSourceNo:parentDataSourceNoP};return ret};const screenInfo=await func.utils.get_screen_obj(SESSION_ID,prog_id);if(screenInfo?.properties?.progParams){if(!_.isEmpty(screenInfo.properties.progParams)){_ds.in_parameters={};_ds.out_parameters={};for await(let[key,val]of Object.entries(screenInfo.properties?.progParams)){if(val.data.dir==="in"){_ds.in_parameters[val.data.parameter]={type:val.data.type};if(typeof parameters_obj_inP?.[val.data.parameter]!=="undefined"){_ds.in_parameters[val.data.parameter].value=parameters_obj_inP[val.data.parameter]}else if(["live_preview","miniapp"].includes(_session.engine_mode)){_ds.in_parameters[val.data.parameter].value=_session?.url_params?.[val.data.parameter]}continue}if(val.data.dir==="out"&&val.data.parameter){_ds.out_parameters[val.data.parameter]=await get_Out_parameters(val.data.parameter,key,val.id)}}_ds.PARAM_OUT_INFO=PARAM_OUT_INFO}}};const build_GLOBAL_SYS_fields=function(){if(!_ds.data_system)_ds.data_system={};_ds.data_system["SYS_GLOBAL_UTC"]=-(new Date).getTimezoneOffset()/60;_ds.data_system["SYS_GLOBAL_STR_APP_ID"]=APP_OBJ[_session.app_id]._id;_ds.data_system["SYS_GLOBAL_STR_SESSION_ID"]=SESSION_ID;_ds.data_system["SYS_GLOBAL_STR_LOGIN_USER_ID"]=_session.USR_OBJ._id;if(!["live_preview","miniapp"].includes(_session.engine_mode)&&PROJECT_OBJ[_session.app_id].info){_ds.data_system["SYS_GLOBAL_OBJ_APP_INFO"]={build:PROJECT_OBJ[_session.app_id].info.build_id,author:PROJECT_OBJ[_session.app_id].info.author,date:PROJECT_OBJ[_session.app_id].info.build_date,name:APP_OBJ[_session.app_id].app_name}}_ds.data_system["SYS_GLOBAL_OBJ_LOGIN_USER_INFO"]={id:_session.USR_OBJ._id,user_name:_session.USR_OBJ.usr_name,first_name:_session.USR_OBJ.usr_first_name,last_name:_session.USR_OBJ.usr_last_name,email:_session.USR_OBJ.usr_email,profile_picture:_session.USR_OBJ.usr_profile_picture};_ds.data_system["SYS_GLOBAL_STR_BROWSER_HASH_ID"]=_session.SYS_GLOBAL_STR_BROWSER_HASH_ID;_ds.data_system["SYS_GLOBAL_STR_BROWSER_TITLE"]=_session.SYS_GLOBAL_STR_BROWSER_TITLE;_ds.data_system["SYS_GLOBAL_STR_SITE_CSS"]={};_ds.data_system["SYS_GLOBAL_BOL_SHIFT_KEY_STATE"]=0;_ds.data_system["SYS_GLOBAL_BOL_COMMAND_KEY_STATE"]=0;_ds.data_system["SYS_GLOBAL_BOL_CONTROL_KEY_STATE"]=0;_ds.data_system["SYS_GLOBAL_BOL_ALT_KEY_STATE"]=0;_ds.data_system["SYS_GLOBAL_BOL_ONLINE"]=0;_ds.data_system["SYS_GLOBAL_BOL_REPLICATION_STAT"]=0;_ds.data_system["SYS_GLOBAL_BOL_AJAX_BUSY"]=0;_ds.data_system["SYS_GLOBAL_BOL_CONNECTED"]=1;_ds.data_system["SYS_GLOBAL_BOL_IDLE"]=0;_ds.data_system["SYS_GLOBAL_STR_FIREBASE_TOKEN_ID"]=0;_ds.data_system["SYS_GLOBAL_BOL_PUSH_NOTIFICATION_GRANTED"]=_session.PUSH_NOTIFICATION_GRANTED;_ds.data_system["SYS_GLOBAL_OBJ_FIREBASE_AUTH_INFO"]=_session.SYS_GLOBAL_OBJ_FIREBASE_AUTH_INFO;_ds.data_system["SYS_GLOBAL_OBJ_CLIENT_INFO"]=_session.SYS_GLOBAL_OBJ_CLIENT_INFO;_ds.data_system["SYS_GLOBAL_OBJ_REFS"]={}};if(!SESSION_OBJ[SESSION_ID].DS_GLB)return;if(dataSourceNoP&&!SESSION_OBJ[SESSION_ID].DS_GLB[dataSourceNoP]){return func.utils.debug_report(SESSION_ID,"Datasource","Datasource not exist: "+dataSourceNoP,"E")}if(!prog_id){return func.utils.debug_report(SESSION_ID,"Datasource","Program is null","E")}const args={SESSION_ID:SESSION_ID,prog_id:prog_id,dataSourceNoP:dataSourceNoP,parentDataSourceNoP:parentDataSourceNoP,containerIdP:containerIdP,rowIdP:rowIdP,jobNoP:jobNoP,calling_trigger_prop:calling_trigger_prop,calling_jobP:calling_jobP,is_panelP:is_panelP,parameters_obj_inP:parameters_obj_inP,static_refreshP:static_refreshP,run_atP:run_atP,worker_id:worker_id,parameters_raw_obj:parameters_raw_obj};var dataSourceSession=null;var IS_DATASOURCE_REFRESH=null;var PARAM_OUT_INFO={};const init_dataSource=async function(){const init_new_dataSource=async function(){if(!["main"].includes(SESSION_OBJ[SESSION_ID].opt.app_computing_mode)&&run_atP==="client"&&prog_id!=="system"){const ret=await func.index.call_worker(SESSION_ID,{service:"get_dataSourceSessionGlobal",data:{session_id:SESSION_ID},id:SESSION_OBJ[SESSION_ID].worker_id});SESSION_OBJ[SESSION_ID].dataSourceSessionGlobal=ret?.new_dataSourceSessionGlobal||1}else{SESSION_OBJ[SESSION_ID].dataSourceSessionGlobal++}dataSourceSession=SESSION_OBJ[SESSION_ID].dataSourceSessionGlobal;SESSION_OBJ[SESSION_ID].DS_GLB[dataSourceSession]={data_feed:{rows:[]}}};const init_existing_dataSource=function(){let _ds=SESSION_OBJ[SESSION_ID].DS_GLB[dataSourceNoP];console.log("DATASOURCE_REFRESH",dataSourceNoP);IS_DATASOURCE_REFRESH=true;_ds.refreshed=true;try{if(!_ds.v)_ds.v={};delete _ds.v.old_dataSource;delete _ds.rows_found;_ds.data_feed={};_ds.v.old_dataSource=_.cloneDeep(_ds)}catch(err){console.error("function: init_existing_dataSource - error");return}dataSourceSession=dataSourceNoP};if(typeof dataSourceNoP==="undefined"||dataSourceNoP===null){await init_new_dataSource()}else{init_existing_dataSource()}return SESSION_OBJ[SESSION_ID].DS_GLB[dataSourceSession]};var _ds=await init_dataSource();_ds.stat="busy";_ds._run_at=run_atP;if(_ds.refreshed){await func.datasource.update(SESSION_ID,{[_ds.dsSession]:{["datasource_main"]:{stat:"busy",stat_ts:Date.now(),is_worker:glb.IS_WORKER}}})}if(IS_DATASOURCE_REFRESH){if(!static_refreshP)await set_parameters();return func.datasource.execute(SESSION_ID,dataSourceSession,true)}_ds.tree_obj=await func.utils.TREE_OBJ.get(SESSION_ID,prog_id);if(!_ds.tree_obj){return func.utils.debug_report(SESSION_ID,"Datasource","Program not exist: "+prog_id,"E")}await func.datasource.set_VIEW_data(SESSION_ID,args,_ds);if(!_ds.v.viewSourceDesc){_ds.v.viewSourceDesc=callingSourceP}if(dataSourceSession===0)_ds.v.viewSourceDesc="system startup";var _session=SESSION_OBJ[SESSION_ID];const set_DS_GLB=async function(){_ds.dataSource_init_arr={};_ds.containerId=containerIdP;_ds.jobNoP=jobNoP;_ds.viewSourceDesc=_ds.v.viewSourceDesc;_ds.callingSource=callingSourceP;_ds.calling_jobP=calling_jobP;_ds.viewModule=_ds.v.viewModule;_ds.viewSourceProp=_ds.v.viewSourceProp;_ds.dsSession=dataSourceSession;_ds.args=args;_ds.worker_id=worker_id;_ds.prog_id=prog_id;_ds.parentDataSourceNo=parentDataSourceNoP};await set_DS_GLB();if(prog_id==="system"&&!parentDataSourceNoP){build_GLOBAL_SYS_fields()}await set_parameters();_ds.client_interval=func.datasource.get_event_interval_arr(SESSION_ID,dataSourceSession,"client_interval");if(prog_id==="system"){_ds.server_interval=func.datasource.get_event_interval_arr(SESSION_ID,dataSourceSession,"server_interval")}let ret_execute=await func.datasource.execute(SESSION_ID,dataSourceSession);return ret_execute};func.datasource.execute=async function(SESSION_ID,dataSourceSession,IS_DATASOURCE_REFRESH){var _session=SESSION_OBJ[SESSION_ID];var _ds=_session.DS_GLB[dataSourceSession];var args=_ds.args;let tree_obj=await func.utils.TREE_OBJ.get(SESSION_ID,_ds.prog_id);let prog_obj=await func.utils.VIEWS_OBJ.get(SESSION_ID,_ds.prog_id);const callback_datasource=async function(){if(typeof IS_WORKER==="undefined"&&typeof IS_DOCKER==="undefined"&&typeof IS_PROCESS_SERVER==="undefined"&&_ds.viewSourceProp==="globals"){if(!["main"].includes(_session.opt.app_computing_mode)){await func.index.call_worker(SESSION_ID,{service:"create_webworker_globals",data:{ds_data:_ds,session_id:SESSION_ID}})}}if(await func.datasource.get_view_events_count(SESSION_ID,dataSourceSession,"on_load")){await func.datasource.execute_view_events(SESSION_ID,dataSourceSession,"on_load")}return await func.datasource.callback(SESSION_ID,dataSourceSession,args.rowIdP,args.jobNoP,_ds.prog_id)};const get_limit=async function(){var ret=0;let tree_ret=await func.utils.TREE_OBJ.get(SESSION_ID,_ds.prog_id);if(tree_ret.menuType==="get_data"){return 1}ret=_ds.progDataSource?.dataSourceLimit;if(prog_obj.progDataSource?.dataSourceLoopExp){ret=(await func.expression.get(SESSION_ID,prog_obj.progDataSource.dataSourceLoopExp,dataSourceSession,"view_loop",args.rowIdP)).result}return ret};const get_skip=async function(){var ret=0;ret=_ds.progDataSource?.dataSourceSkip;if(prog_obj.progDataSource?.dataSourceSkipExp){ret=(await func.expression.get(SESSION_ID,prog_obj.progDataSource.dataSourceSkipExp,dataSourceSession,"view_loop",args.rowIdP)).result}return ret};const calc_batch_loops=async()=>{if(!prog_obj.progDataSource?.dataSourceType||_ds.progDataSource.dataSourceType==="none"){_ds.v.batch_loops=await get_limit();return false}_ds.v.batch_loops=await get_limit()<=_ds.v.raw_data?.rows?.length?await get_limit():_ds.v.raw_data?.rows?.length;return true};const render_api_output=async function(){if(prog_obj?.scriptData?.value){var exp=await func.expression.get(SESSION_ID,prog_obj.scriptData.value,dataSourceSession,"api_rendered_output",null,null,null,null,null,null,null,null,null,tree_obj.apiOutput);let output_result=exp.result;if(tree_obj.apiOutput==="json"){try{let output_result_obj=await func.expression.secure_eval(SESSION_ID,"api_rendered_output","("+output_result+")",null,dataSourceSession);output_result=JSON.stringify(output_result_obj)}catch(err){console.error(err)}}_ds.api_rendered_output+=output_result+(tree_obj.apiOutput==="json"?",":"")}else{_ds.api_rendered_output=""}};if(_ds.prog_id==="system"){_ds.currentRecordId="dataset";await func.datasource.render_fields_dataset(SESSION_ID,dataSourceSession,{id:"dataset",value:_session.url_params});return await callback_datasource()}let db_adapter_module;if(prog_obj.progDataSource?.dataSourceType){db_adapter_module=await func.common.get_module(SESSION_ID,"xuda-datasource-db-adapter-module.mjs")}const get_data_from_source=async function(){switch(prog_obj.progDataSource.dataSourceSrcType){case"input":{const{result,error}=await func.expression.get(SESSION_ID,prog_obj.progDataSource.progDataSourceInput,dataSourceSession,"datasource select");if(error){func.utils.debug_report(SESSION_ID,"Data source",`Datasource parse error using ${prog_obj.progDataSource?.dataSourceType} input`,"E");return null}return result;break}case"url":{let opt={method:prog_obj.progDataSource.dataSourceMethod||"POST",headers:{Accept:"application/json","Content-Type":"application/json"}};let data={};if(prog_obj.progDataSource.dataSourceMethod=="POST"&&prog_obj.progDataSource.dataSourceParameters){for(let val of prog_obj.progDataSource.dataSourceParameters){data[val.key]=val.val}opt.body=JSON.stringify(data)}try{const response=await fetch("https://"+prog_obj.progDataSource.dataSourceDataUrl,opt);const json=await response.json();return json.data}catch(err){func.utils.debug_report(SESSION_ID,"Data source",err.message+" https://"+prog_obj.progDataSource.dataSourceDataUrl,"E");return null}break}default:return null;break}};if(!_ds.v.raw_data){_ds.v.raw_data={rows:[]}}_ds.data_feed.rows=[];switch(prog_obj.progDataSource?.dataSourceType){case"table":{_ds._dataSourceTableId=prog_obj.progDataSource?.dataSourceTableId;if(prog_obj.progDataSource?.dataSourceTableIdExp){_ds.v.dataSourceTableIdExp=await func.expression.get(SESSION_ID,prog_obj.progDataSource?.dataSourceTableIdExp,dataSourceSession,"dataSourceTableIdExp",args.rowIdP);if(_ds.v.dataSourceTableIdExp.result){_ds._dataSourceTableId=_ds.v.dataSourceTableIdExp.result}else{func.utils.debug_report(SESSION_ID,"get_VIEW_data","Table Expression returned empty result","W")}}if(!_ds._dataSourceTableId){return func.utils.debug_report(SESSION_ID,"Data source","Table cannot be empty when Db Table selected","E")}let table_ret=await func.utils.TREE_OBJ.get(SESSION_ID,_ds._dataSourceTableId);if(!table_ret){return func.utils.debug_report(SESSION_ID,"Data source","Table not found: "+_ds._dataSourceTableId,"E")}await db_adapter_module.build_filter(SESSION_ID,dataSourceSession,_ds.v,_ds);let filterModelMongo=_ds.progDataSource.filterModelMongo;if(_ds.progDataSource.filterModelMongoFx){let ret=await func.expression.get(SESSION_ID,_ds.progDataSource.filterModelMongoFx,dataSourceSession,"query");filterModelMongo=ret.result}let filterModelSql=_ds.progDataSource.filterModelSql;if(_ds.progDataSource.filterModelSqlFx){let ret=await func.expression.get(SESSION_ID,_ds.progDataSource.filterModelSqlFx,dataSourceSession,"query");filterModelSql=ret.result}const filterModel={filterModelNative:_ds.progDataSource.filterModelNative,filterModelMongo:filterModelMongo,filterModelSql:filterModelSql,filterModelUserMongo:_ds.progDataSource.filterModelUserMongo,filterModelUserSql:_ds.progDataSource.filterModelUserSql};let _dataSourceFilterModelType=_ds?.progDataSource?.dataSourceFilterModelType;if(_ds?.progDataSource?.dataSourceFilterModelTypeFx){const fx_ret=await func.expression.get(SESSION_ID,_ds.progDataSource.dataSourceFilterModelTypeFx,dataSourceSession,"query");_dataSourceFilterModelType=fx_ret.result}if(_dataSourceFilterModelType&&!["query","index"].includes(_dataSourceFilterModelType)){return func.utils.debug_report(SESSION_ID,"Data source",`Valid values for dataSourceFilterModelType are: "query" or "index" (${_dataSourceFilterModelType})`,"E")}_ds.v.raw_data=await func.db.get_query(SESSION_ID,_ds._dataSourceTableId,_ds.v.couchView,dataSourceSession,_ds.viewSourceDesc,"datasource table",prog_obj.progDataSource.dataSourceReduce,await get_skip(),await get_limit()||99999999,null,null,_ds?.progDataSource?.sortModel,null,filterModel,_dataSourceFilterModelType);if(_ds?.progDataSource?.dataSourceLimit){const ret_rows_found=await func.db.get_query(SESSION_ID,_ds._dataSourceTableId,_ds.v.couchView,dataSourceSession,_ds.viewSourceDesc,"datasource table",prog_obj.progDataSource.dataSourceReduce,null,null,true,null,null,null,filterModel,_dataSourceFilterModelType);_ds.rows_found=ret_rows_found?.rows?.[0]?.value||0}else{_ds.rows_found=_ds?.v?.raw_data?.rows?.length||0}break}case"array":{let data=await get_data_from_source();if(data===null){data=[]}_ds.rows_found=data?.length||0;let _KEY=0;for(const _VAL of data){_ds.v.raw_data.rows.push({id:_KEY,value:{_KEY:_KEY,_VAL:_VAL}});_KEY++}break}case"json":{let data=await get_data_from_source();if(data===null){data={}}_ds.rows_found=Object.keys(data)?.length||0;for(let[_KEY,_VAL]of Object.keys(data)){_ds.v.raw_data.rows.push({id:_KEY,value:{_KEY:_KEY,_VAL:_VAL}})}break}case"csv":{let data=await get_data_from_source();if(data===null){data=""}let _KEY=0;let arr=data.split(",");for(const _VAL of arr){_ds.v.raw_data.rows.push({id:_KEY,value:{_KEY:_KEY,_VAL:_VAL}});_KEY++}_ds.rows_found=arr?.length||0;break}default:break}let ret;const get_before_record_count=async()=>{return await func.datasource.get_view_events_count(SESSION_ID,dataSourceSession,"before_record")};const get_after_record_count=async()=>{return await func.datasource.get_view_events_count(SESSION_ID,dataSourceSession,"after_record")};let _raw_data_rows=[];switch(tree_obj.menuType){case"api":{_ds.api_rendered_output="";let has_datasource=await calc_batch_loops();_raw_data_rows=_ds.v.raw_data.rows||[];if(!has_datasource){for(n=0;n<_ds.v.batch_loops;n++){_raw_data_rows.push({id:n,value:{}})}}_ds.currentRecordId="dataset";for await(let[key,raw_data_row]of Object.entries(_raw_data_rows)){if(has_datasource&&Number(key)>=_ds.v.batch_loops)break;if(!has_datasource){raw_data_row=_ds?.v.raw_data?.rows?.[key]||{id:key,value:{}}}if(await get_before_record_count()){await func.datasource.execute_view_events(SESSION_ID,dataSourceSession,"before_record")}await func.datasource.render_fields_dataset(SESSION_ID,dataSourceSession,raw_data_row);if(await get_after_record_count()){await func.datasource.execute_view_events(SESSION_ID,dataSourceSession,"after_record")}await render_api_output()}if(tree_obj.apiOutput==="json"){var str=_ds.api_rendered_output.substring(0,_ds.api_rendered_output.length-1);if(Number(_ds.progDataSource?.dataSourceLimit)===1){_ds.api_rendered_output=str}else{_ds.api_rendered_output="["+str+"]"}}break}case"batch":{let has_datasource=await calc_batch_loops();_raw_data_rows=_ds?.v.raw_data?.rows||[];if(!has_datasource){for(n=0;n<_ds.v.batch_loops;n++){_raw_data_rows.push({id:n,value:{}})}}_ds.currentRecordId="dataset";for await(let[key,raw_data_row]of Object.entries(_raw_data_rows)){if(has_datasource&&Number(key)>=_ds.v.batch_loops)break;if(!has_datasource){raw_data_row=_ds?.v.raw_data?.rows?.[key]||{id:key,value:{}}}if(await get_before_record_count()){await func.datasource.execute_view_events(SESSION_ID,dataSourceSession,"before_record")}await func.datasource.render_fields_dataset(SESSION_ID,dataSourceSession,raw_data_row);if(await get_after_record_count()){await func.datasource.execute_view_events(SESSION_ID,dataSourceSession,"after_record")}}await func.datasource.set_outputField(SESSION_ID,dataSourceSession,_ds?.v?.raw_data?.rows,_ds.args);break}case"get_data":{if(await get_before_record_count()){await func.datasource.execute_view_events(SESSION_ID,dataSourceSession,"before_record")}ret=await db_adapter_module.process_view_dataset(SESSION_ID,dataSourceSession,_ds);if(await get_after_record_count()){await func.datasource.execute_view_events(SESSION_ID,dataSourceSession,"after_record")}await func.datasource.set_outputField(SESSION_ID,dataSourceSession,_ds?.v?.raw_data?.rows,_ds.args);break}case"set_data":{if(!prog_obj.progDataSource?.dataSourceType||_ds.progDataSource.dataSourceType!=="table"||!_ds._dataSourceTableId){return func.utils.debug_report(SESSION_ID,"Data source","Datasource DB Table must be defined for Set Data operation","E")}const find_ROWID_idx_from_raw_data_arr=function(rowId){if(!_raw_data_rows){throw new Error("_raw_data_rows not found")}const index=_raw_data_rows.findIndex(item=>item.id===rowId);if(index===-1){throw new Error(`ROWID "${rowId}" not found`)}return index};if(tree_obj.crudMode==="U"){_ds.set_mode="U";_raw_data_rows=_ds?.v.raw_data?.rows||[]}if(tree_obj.crudMode==="D"){_ds.set_mode="D";_raw_data_rows=_ds?.v.raw_data?.rows||[]}if(tree_obj.crudMode==="U"&&tree_obj.allowCreate&&!_raw_data_rows?.length){_ds.set_mode="C";try{const row_idx=find_ROWID_idx_from_raw_data_arr("newRecord");_raw_data_rows[row_idx]=[{id:"newRecord",value:{}}]}catch(error){_raw_data_rows.push({_ROWID:"newRecord"})}}if(tree_obj.crudMode==="C"){_ds.set_mode="C";try{const row_idx=find_ROWID_idx_from_raw_data_arr("newRecord");_raw_data_rows[row_idx]=[{id:"newRecord",value:{}}]}catch(error){_raw_data_rows.push({id:"newRecord",value:{}})}}for await(let raw_data_row of _raw_data_rows){_ds.currentRecordId=raw_data_row.id;if(await get_before_record_count()){await func.datasource.execute_view_events(SESSION_ID,dataSourceSession,"before_record")}await func.datasource.render_fields_dataset(SESSION_ID,dataSourceSession,raw_data_row);let data_feed_str=JSON.stringify(_ds.data_feed);if(await get_after_record_count()){await func.datasource.execute_view_events(SESSION_ID,dataSourceSession,"after_record")}if(_ds.set_mode==="C"||JSON.stringify(_ds.data_feed)!==data_feed_str){const dbMsgP=await func.db.save_data(SESSION_ID,dataSourceSession);if(dbMsgP)_ds.currentRecordId=dbMsgP.id;_ds.set_mode="U"}if(_ds.set_mode==="D"){const dbMsgP=await func.db.save_data(SESSION_ID,dataSourceSession);if(dbMsgP)_ds.currentRecordId=dbMsgP.id}}await func.datasource.set_outputField(SESSION_ID,dataSourceSession,_ds?.v?.raw_data?.rows,_ds.args);break}case"component":{_raw_data_rows=_ds?.v.raw_data?.rows||[];_ds.rows_processed=0;_ds.viewRangeExp_rows_deleted=0;let rows=_ds?.v.raw_data?.rows?.length;_ds.data_feed.rows_changed=[];_ds.data_feed.rows_deleted=[];_ds.data_feed.rows_added=[];if(tree_obj.rwMode==="U"){_ds.set_mode="U"}else{_ds.set_mode="R"}const row_not_found=async function(){if(!prog_obj.progDataSource?.dataSourceType||prog_obj.properties.renderType==="form"||tree_obj.rwMode==="U"&&tree_obj.allowCreate){_ds.currentRecordId="newRecord";if(tree_obj.rwMode==="U"&&tree_obj.allowCreate){_ds.set_mode="C"}if(prog_obj.progDataSource?.dataSourceType){_ds.record_not_found=true}try{const row_idx=func.common.find_ROWID_idx(_ds,_ds.currentRecordId)}catch(error){await func.datasource.render_fields_form(SESSION_ID,dataSourceSession,{id:"newRecord",value:{}})}var count=await func.datasource.get_field_init_count(SESSION_ID,dataSourceSession,"newRecord",false);if(count>0){await func.datasource.execute_field_init_events(SESSION_ID,dataSourceSession,"form","newRecord")}}await func.datasource.callback(SESSION_ID,dataSourceSession,args.rowIdP,args.jobNoP,_ds.prog_id)};if(!rows){await row_not_found();break}_ds.firstRecordId=_raw_data_rows[0].id;const finish_form=async function(){if(_ds.locatedRecordId){try{const row_idx=func.common.find_ROWID_idx(_ds,_ds.locatedRecordId)}catch(error){delete _ds.locatedRecordId}}_ds.finalRecordId=func.datasource.get_currentRecordId(SESSION_ID,dataSourceSession,true);_ds.currentRecordId=_ds.finalRecordId};for await(const[key,raw_data_row]of Object.entries(_raw_data_rows)){const idx=Number(key);if(await get_before_record_count()){await func.datasource.execute_view_events(SESSION_ID,dataSourceSession,"before_record")}_ds.currentRecordId=raw_data_row.id;await func.datasource.render_fields_form(SESSION_ID,dataSourceSession,raw_data_row);try{const init_count=await func.datasource.get_field_init_count(SESSION_ID,dataSourceSession,raw_data_row.id,false,_ds.oninit_triggers_to_run);if(init_count>0){await func.datasource.execute_field_init_events(SESSION_ID,dataSourceSession,"form",raw_data_row.id)}}catch(err){console.error(err)}if(await get_after_record_count()){await func.datasource.execute_view_events(SESSION_ID,dataSourceSession,"after_record")}}await finish_form();break}default:return func.utils.debug_report(SESSION_ID,"Data source","Program type not defined","E")}ret=await callback_datasource();return ret};func.datasource.render_fields_dataset=async function(SESSION_ID,dataSourceSession,raw_data_row){var _ds=SESSION_OBJ[SESSION_ID].DS_GLB[dataSourceSession];var args=_ds.args;const _progFields=await func.datasource.get_progFields(SESSION_ID,dataSourceSession);if(!_progFields){return}const get_value=async(field_id,value)=>{let view_field_obj=func.common.find_item_by_key(_progFields,"field_id",field_id);var fieldType=view_field_obj?.props?.fieldType;let table_field_obj;if(view_field_obj.data.type==="table"&&field_id!=="REDUCE_VALUE"){if(!_ds.progDataSource?.dataSourceTableId){return func.utils.debug_report(SESSION_ID,"Datasource",`Table type defined without dataSourceTableId deceleration`,"E")}let table_obj=await func.utils.FILES_OBJ.get(SESSION_ID,_ds._dataSourceTableId);if(!table_obj){return func.utils.debug_report(SESSION_ID,"Datasource",`dataSourceTableId reference error: `+_ds._dataSourceTableId,"E")}table_field_obj=func.common.find_item_by_key(table_obj.tableFields,"field_id",field_id);fieldType=table_field_obj.props?.fieldType}return await func.common.get_cast_val(SESSION_ID,`render fields dataset ${_ds.viewSourceDesc}`,field_id,fieldType,value,null)};if(!_ds.data_feed){_ds.data_feed={rows:[{_ROWID:_ds.currentRecordId}]}}let row_idx;try{row_idx=func.common.find_ROWID_idx(_ds,_ds.currentRecordId)}catch(err){_ds.data_feed.rows.push({_ROWID:_ds.currentRecordId});row_idx=func.common.find_ROWID_idx(_ds,_ds.currentRecordId)}_ds.dataset_alias={};for await(const val of _progFields){try{var fieldId=val.data.field_id;if(val.data.type==="virtual"||_ds.set_mode==="C"){if(typeof raw_data_row?.value?.[fieldId]!=="undefined"){_ds.data_feed.rows[row_idx][fieldId]=await get_value(fieldId,raw_data_row.value[fieldId]);continue}if(val.props?.propExpressions?.fieldValue){let ret=await func.expression.get(SESSION_ID,val.props?.propExpressions?.fieldValue,dataSourceSession,"update",args.rowIdP);_ds.data_feed.rows[row_idx][fieldId]=await get_value(fieldId,ret.result);continue}_ds.data_feed.rows[row_idx][fieldId]=await get_value(fieldId,val.props?.fieldValue);continue}if(val.data.type==="table"||val.data.type==="datasource"){if(typeof raw_data_row.value[fieldId]==="undefined"){throw"field do not exist in data: "+fieldId}_ds.data_feed.rows[row_idx][fieldId]=await get_value(fieldId,raw_data_row.value[fieldId])}}catch(err){func.utils.debug_report(SESSION_ID,"Datasource",err,"E",null,_ds)}}};func.datasource.run_events_functions=async function(SESSION_ID,dataSourceSession,event_id,calling_job,async_event,event_parameters){if(typeof dataSourceSession==="undefined"||dataSourceSession===null){console.warn(`Event ${event_id} not exist or not found`);return}var _ds=SESSION_OBJ[SESSION_ID].DS_GLB[dataSourceSession];var args=_ds.args;const _view_obj=await func.utils.VIEWS_OBJ.get(SESSION_ID,_ds.prog_id);let job_promises=[];if(_view_obj.progEvents){for await(const[key,val]of Object.entries(_view_obj.progEvents)){if(val.data.type==="user_defined"&&val.data.event_name&&val.data.event_name===event_id){const jobs=await func.events.validate(SESSION_ID,"user_defined",dataSourceSession,val.data.event_name,args.callingSourceP,event_parameters);if(calling_job||async_event)continue;for(let job_num of jobs){job_promises.push(new Promise((resolve,reject)=>{let i=0;const interval=setInterval(()=>{i++;var job_index=func.events.find_job_index(SESSION_ID,job_num);if(job_index==null){clearInterval(interval);resolve(job_num)}if(i>200){console.error("deadlock detected");clearInterval(interval);resolve(job_num)}},100)}))}}}}if(job_promises.length){await Promise.all(job_promises)}};func.datasource.render_fields_form=async function(SESSION_ID,dataSourceSession,raw_data_row){var _ds=SESSION_OBJ[SESSION_ID].DS_GLB[dataSourceSession];const _progFields=await func.datasource.get_progFields(SESSION_ID,dataSourceSession);if(!_progFields){return}const get_value=async(field_id,value)=>{let view_field_obj=func.common.find_item_by_key(_progFields,"field_id",field_id);var fieldType=view_field_obj.props?.fieldType;let table_field_obj;if(view_field_obj.data.type==="table"&&field_id!=="REDUCE_VALUE"){if(!_ds._dataSourceTableId){return func.utils.debug_report(SESSION_ID,"Datasource",`Table type defined without dataSourceTableId deceleration`,"E")}let table_obj=await func.utils.FILES_OBJ.get(SESSION_ID,_ds._dataSourceTableId);if(!table_obj){return func.utils.debug_report(SESSION_ID,"Datasource",`dataSourceTableId reference error: `+_ds._dataSourceTableId,"E")}table_field_obj=func.common.find_item_by_key(table_obj.tableFields,"field_id",field_id);if(!table_field_obj){return func.utils.debug_report(SESSION_ID,"Datasource",`Field Id: ${field_id} not exist in table ${table_obj.properties.menuName}`,"E")}fieldType=table_field_obj.props?.fieldType}return await func.common.get_cast_val(SESSION_ID,`render fields datasource ${_ds.viewSourceDesc}`,field_id,fieldType,value,null)};let row_idx;try{row_idx=func.common.find_ROWID_idx(_ds,raw_data_row.id)}catch(error){_ds.data_feed.rows.push({_ROWID:raw_data_row.id});row_idx=func.common.find_ROWID_idx(_ds,raw_data_row.id)}_ds.dataset_alias={};for await(const val of _progFields){try{var fieldId=val.data.field_id;if(val.data.type==="virtual"||raw_data_row.id==="newRecord"){if(glb.PROTECTED_VARS.includes(fieldId)){switch(fieldId){case"_ROWNO":{_ds.data_feed.rows[row_idx][fieldId]=await get_value(fieldId,row_idx);continue}case"_ROWID":{_ds.data_feed.rows[row_idx][fieldId]=await get_value(fieldId,raw_data_row.id);continue}case"_ROWDOC":{_ds.data_feed.rows[row_idx][fieldId]=await get_value(fieldId,raw_data_row.value);continue}}}if(val.props?.propExpressions?.fieldValue){let ret=await func.expression.get(SESSION_ID,val.props?.propExpressions?.fieldValue,dataSourceSession,"update",raw_data_row.id);_ds.data_feed.rows[row_idx][fieldId]=await get_value(fieldId,ret.result);continue}_ds.data_feed.rows[row_idx][fieldId]=await get_value(fieldId,val.props?.fieldValue);continue}if(val.data.type==="table"||val.data.type==="datasource"){if(typeof raw_data_row.value[fieldId]==="undefined"){throw"field do not exist in data: "+fieldId}_ds.data_feed.rows[row_idx][fieldId]=await get_value(fieldId,raw_data_row.value[fieldId])}}catch(err){func.utils.debug_report(SESSION_ID,"Datasource",err,"E",null,_ds)}}};func.datasource.execute_field_init_events=async function(SESSION_ID,dataSourceSession,sourceP,rowIdP){var _ds=SESSION_OBJ[SESSION_ID].DS_GLB[dataSourceSession];var args=_ds.args;var arr=_ds.dataSource_init_arr[rowIdP];for await(const val of arr){if(!func.utils.is_onscreen_event(val.eventInfo.data.action)){var cond=val?.eventInfo?.data?.enabled;var expression=undefined;if(val.eventInfo.props.condition)expression=val.eventInfo.props.condition;var expCond={};if(expression&&!_.isEmpty(expression)){expCond=await func.expression.get(SESSION_ID,expression,dataSourceSession,"condition",rowIdP,null,null,val.fieldId);cond=expCond.result;expCond.conditional=true;val.DEBUG_INFO_OBJ.result=expCond.result;val.DEBUG_INFO_OBJ.error=expCond.error;val.DEBUG_INFO_OBJ.fields=expCond.fields;val.DEBUG_INFO_OBJ.conditional=expCond.conditional;val.DEBUG_INFO_OBJ.details=expression}func.utils.debug.log(SESSION_ID,val.node_id,val.DEBUG_INFO_OBJ);if(cond){if(!_ds)continue;var ds=_ds.prog_id;await func.events.execute(SESSION_ID,null,val.triggerId,val.eventInfo.data.name,val.eventInfo.data.action,val.eventInfo.data.name,null,val.fieldId,val.rowId,val.colId,null,null,dataSourceSession,val.eventInfo.id,sourceP,true,null,null,args.jobNoP,null,null,val.eventInfo,null,null,null,null,ds.parentDataSourceNo,null)}}}};func.datasource.get_field_init_count=async function(SESSION_ID,dataSourceSession,rowIdP,pre_initP,oninit_triggers_to_runP){var _ds=SESSION_OBJ[SESSION_ID].DS_GLB[dataSourceSession];var args=_ds.args;const _view_obj=await func.utils.VIEWS_OBJ.get(SESSION_ID,_ds.prog_id);var ret=0;for await(const field_obj of _view_obj.progFields){var fieldId=field_obj.data.field_id;if(!field_obj?.workflow?.length){continue}for await(const trigger_obj of field_obj.workflow){if(oninit_triggers_to_runP&&!oninit_triggers_to_runP?.includes(trigger_obj.id)){continue}if(["get_data","set_data","batch","update","raise_event"].includes(trigger_obj.data.action)){if(!trigger_obj.data.action){func.utils.debug_report(SESSION_ID,"_ds.get_field_init_count",`Error initiating event for field: ${fieldId} prog: ${_ds.v.viewSourceDesc} row: ${rowIdP} reason: missing action`,"E");break}if(trigger_obj.data.enabled){if(!_ds.dataSource_init_arr[rowIdP]){_ds.dataSource_init_arr[rowIdP]=[]}_ds.dataSource_init_arr[rowIdP].push({eventInfo:trigger_obj,triggerId:trigger_obj.id,fieldId:fieldId,rowId:rowIdP,colId:field_obj.id,node_id:args.prog_id+"_"+trigger_obj.id+"_"+field_obj.id,fieldProp:field_obj,DEBUG_INFO_OBJ:{module:_ds.viewModule,action:"init field event",prop:fieldId,source:_ds.viewSourceDesc,type:"event",prog_id:args.prog_id,dsSession:dataSourceSession}});ret++}}}}return ret};func.datasource.get_view_events_count=async function(SESSION_ID,dataSourceSession,typeP,eventIdP){var _ds=SESSION_OBJ[SESSION_ID].DS_GLB[dataSourceSession];const _prog=await func.utils.VIEWS_OBJ.get(SESSION_ID,_ds.prog_id);if(!_ds)return 0;var args=_ds.args;var index=typeP;if(eventIdP)index=typeP+"_"+eventIdP;if(!_ds.viewEventExec_arr)_ds.viewEventExec_arr={};_ds.viewEventExec_arr[index]=[];if(!_prog.progEvents||_.isEmpty(_prog.progEvents))return 0;for(const event_obj of _prog.progEvents){if(event_obj.data.type!==typeP)continue;if(eventIdP&&event_obj.id!==eventIdP)continue;if(event_obj.data.condition){let res=await func.expression.get(SESSION_ID,event_obj.data.condition,dataSourceSession,"condition",args.rowIdP,null,null,null,null,event_obj);if(!res.result){continue}}if(_.isEmpty(event_obj.workflow))continue;for(const trigger_obj of event_obj.workflow){if(trigger_obj.data.enabled){var expression;if(trigger_obj.props.condition)expression=trigger_obj.props.condition;var expCond={};if(expression){expCond.conditional=true}func.utils.debug.log(SESSION_ID,args.prog_id+"_"+trigger_obj.id,{module:_ds.viewModule,action:trigger_obj.data.action,prop:event_obj.data.type,details:expression,result:expCond.result,error:expCond.error,source:_ds.viewSourceDesc,fields:expCond.fields,type:"event",prog_id:args.prog_id,dsSession:dataSourceSession,conditional:expCond.conditional})}if(!trigger_obj.data.action){func.utils.debug_report(SESSION_ID,"get_view_events_count",`Error initiating ${typeP} prog:${_ds.v.viewSourceDesc} reason: missing action`,"E");break}if(!glb.REFERENCE_LESS_FUNCTIONS.includes(trigger_obj.data.action)&&!trigger_obj.data.action){func.utils.debug_report(SESSION_ID,"get_view_events_count",`Error initiating ${typeP} prog: ${_ds.v.viewSourceDesc} reason: missing reference`,"E");break}if(trigger_obj.data.enabled){_ds.viewEventExec_arr[index].push({eventInfo:trigger_obj,eventId:event_obj.id,triggerId:trigger_obj.id,expression:expression})}}}return _ds.viewEventExec_arr[index].length};func.datasource.execute_view_events=async function(SESSION_ID,dataSourceSession,typeP,eventIdP){var _ds=SESSION_OBJ[SESSION_ID].DS_GLB[dataSourceSession];var args=_ds.args;var i=-1;var index=typeP;if(eventIdP)index=typeP+"_"+eventIdP;var arr=_ds.viewEventExec_arr[index];if(_.isEmpty(arr))return;for await(const val of arr){if(!glb.IS_WORKER||!func.utils.is_onscreen_event(val.eventInfo.data.action)||glb.IS_WORKER&&_ds.v.run_at==="server"&&!func.utils.is_onscreen_event(val.eventInfo.data.action)){var cond=true;if(val.expression){var expCond=await func.expression.get(SESSION_ID,val.expression,dataSourceSession,"condition",args.rowIdP,null,null,null,null,val.eventInfo);cond=expCond.result}if(cond){var elem_params=undefined;if(!glb.IS_WORKER){elem_params=$("#"+_ds.containerId).data("params")}const ret=await func.events.execute(SESSION_ID,null,val.triggerId,val.eventInfo.data.trigger,val.eventInfo.data.action,val.eventInfo.data.name,null,null,null,null,val.eventInfo.data.action,null,dataSourceSession,val.eventId,_ds.tree_obj.menuType+" event",true,null,null,args.jobNoP,elem_params,null,val.eventInfo)}continue}if(typeP=="before_record"||typeP=="after_record"||typeP=="on_load"||typeP=="on_exit"){_ds.v.onscreen_events_active={i:i,type:typeP};var parent_ds_chain=func.datasource.get_parent_ds_chain(SESSION_ID,dataSourceSession);var obj={ds_obj:func.utils.clean_returned_datasource(SESSION_ID,dataSourceSession),dsSessionP:dataSourceSession};obj.ds_obj.parent_ds_chain=parent_ds_chain}}};func.datasource.get_parent_ds_chain=function(SESSION_ID,dataSourceSession){var arr=[];var drill=function(ds){if(SESSION_OBJ[SESSION_ID].DS_GLB[ds]){if(typeof SESSION_OBJ[SESSION_ID].DS_GLB[ds].parentDataSourceNo!=="undefined"){arr.push(SESSION_OBJ[SESSION_ID].DS_GLB[ds].parentDataSourceNo);drill(SESSION_OBJ[SESSION_ID].DS_GLB[ds].parentDataSourceNo)}}};drill(dataSourceSession);return arr};func.datasource.execute_onscreen_view_events=async function(SESSION_ID,dataSourceSession,sourceP){var _ds=SESSION_OBJ[SESSION_ID].DS_GLB[dataSourceSession];var args=_ds.args;var i=_ds.v.onscreen_events_active.i;var type=_ds.v.onscreen_events_active.type;var evnt;if(_ds.viewEventExec_arr?.[type]?.[i]){evnt=_ds.viewEventExec_arr[type][i];evnt.done=true;var cond=true;if(evnt.expression){var expCond=await func.expression.get(SESSION_ID,evnt.expression,dataSourceSession,"condition",args.rowIdP);cond=expCond.result}if(cond){let ret=await func.events.execute(SESSION_ID,null,evnt.triggerId,evnt.eventInfo.data.trigger,evnt.eventInfo.data.action,evnt.eventInfo.data.name,null,null,null,null,evnt.eventInfo.data.name,null,dataSourceSession,null,sourceP+" event",true,null,null,args.jobNoP)}}else console.error("*execute_onscreen_view_events error")};func.datasource.get_event_interval_arr=function(SESSION_ID,dataSourceSession,typeP){var _ds=SESSION_OBJ[SESSION_ID].DS_GLB[dataSourceSession];var arr=[];var ret=0;if(!_ds.v.progEvents)return 0;for(let val of _ds.v.progEvents){if(val.data.type!==typeP)continue;arr.push([val.id,val.data.properties,val.data.condition])}return arr};func.datasource.clean_all=function(SESSION_ID,dsP){var arr=[dsP];var get_child_ds=function(ds){var arr=[];_.forEach(SESSION_OBJ[SESSION_ID].DS_GLB,function(val,key){if(val.parentDataSourceNo==ds){arr.push(key);arr=arr.concat(get_child_ds(key))}});return arr};arr=arr.concat(get_child_ds(dsP));for(let val of arr){func.datasource.del(SESSION_ID,val)}};func.datasource.clean=function(SESSION_ID,screenIdP){var arr=[];for(const[key,val]of Object.entries(SESSION_OBJ[SESSION_ID].DS_GLB)){try{if(Number(key)>0&&(val.screenId===screenIdP||val.rootScreenId===screenIdP||$("#"+val.screenId).parent().attr("id")===screenIdP||val&&val.parentDataSourceNo&&arr.includes(val.parentDataSourceNo.toString()))){arr.push(key);if(val.screenId)func.UI.utils.screen_blocker(false,val.screenId)}}catch(err){console.warn("func.datasource.clean failed");func.datasource.reset_jobs(SESSION_ID,key,"datasource.clean",err)}}for(let val of arr){func.datasource.del(SESSION_ID,val)}};func.datasource.del=function(SESSION_ID,dsP){if(SESSION_OBJ[SESSION_ID].DS_GLB[dsP]&&SESSION_OBJ[SESSION_ID].DS_GLB[dsP].keep_alive||dsP==0)return;if(DATASOURCE_INTERVALS[SESSION_ID]&&DATASOURCE_INTERVALS[SESSION_ID][dsP]){DATASOURCE_INTERVALS[SESSION_ID][dsP].clear()}const perform_delete=async function(){var response={success:function(jsonP,ajaxP){},error:function(status){console.error("error datasource:"+status)},fail:function(status){console.error("error datasource:"+status)}};var data={session_id:SESSION_ID,dssession:dsP};if(!SESSION_OBJ[SESSION_ID].DS_GLB[dsP])return;if(!glb.IS_WORKER){let _ds=SESSION_OBJ[SESSION_ID].DS_GLB[dsP];if(_ds.worker_id){if(RUNTIME_SERVER_WEBSOCKET&&RUNTIME_SERVER_WEBSOCKET_CONNECTED&&(!_session.opt.app_computing_mode||_session.opt.app_computing_mode==="server")){WEB_WORKER[SESSION_ID][_ds.worker_id].emit("message",{service:"close_websocket"})}else{WEB_WORKER[SESSION_ID][_ds.worker_id].worker.terminate()}delete WEB_WORKER[SESSION_ID][_ds.worker_id]}else{const json=await func.index.call_worker(SESSION_ID,{service:"datasource_delete",data:data,id:_ds.worker_id});response.success(json,true)}if(DS_UI_EVENTS_GLB)delete DS_UI_EVENTS_GLB[dsP]}delete SESSION_OBJ[SESSION_ID].DS_GLB[dsP]};var delete_pending_jobs=function(){var arr=[];_.forEach(SESSION_OBJ[SESSION_ID].WORKER_OBJ.jobs,function(val,key){if(val&&val.dsSessionP==dsP){arr.push(key);for(const[key,val]of Object.entries($(".screen_blocker"))){$(val).remove()}}});for(let val of arr.reverse()){SESSION_OBJ[SESSION_ID].WORKER_OBJ.jobs.splice(val,1)}if(!SESSION_OBJ[SESSION_ID].WORKER_OBJ.jobs.length)SESSION_OBJ[SESSION_ID].WORKER_OBJ.stat=null};if(!glb.IS_WORKER){if(SESSION_OBJ[SESSION_ID].DS_GLB[dsP]){delete SCREEN_BLOCKER_OBJ[SESSION_OBJ[SESSION_ID].DS_GLB[dsP].screenId+"_"+SESSION_OBJ[SESSION_ID].DS_GLB[dsP].callingScreenId];delete_pending_jobs();if(glb.new_xu_render){for(const[ui_cache_key,ui_cache_val]of Object.entries(UI_WORKER_OBJ.xu_render_cache)){if(ui_cache_val.paramsP.dsSessionP===dsP){delete UI_WORKER_OBJ.xu_render_cache[ui_cache_key]}}}}if($(SESSION_OBJ[SESSION_ID].root_element).find("xu-nav").length){var ds_obj=$(SESSION_OBJ[SESSION_ID].root_element).find("xu-nav")?.data()?.xuData.nav_params;if(ds_obj){delete ds_obj[dsP]}}}perform_delete()};func.datasource.update=async function(SESSION_ID,datasource_changes,update_local_scope_only,avoid_xu_for_refresh,trigger){return new Promise(async(resolve,reject)=>{var _session=SESSION_OBJ[SESSION_ID];if(_session.IS_API||typeof IS_MASTER_WEBSOCKET!=="undefined"||typeof IS_PROCESS_SERVER!=="undefined"){update_local_scope_only=true}if(typeof glb.GLOBAL_VARS==="undefined"){glb.GLOBAL_VARS=(await func.common.get_module(SESSION_ID,"xuda-system-globals-module.mjs")).system_globals}const set_fieldComputed_dependencies=async function(dsNo,field_id,parent_ds){for(const[dsSession,_ds]of Object.entries(_session.DS_GLB)){if(parent_ds!==null){if(_ds.parentDataSourceNo!=parent_ds)continue}else{if(dsSession!=dsNo)continue}let tree_ret=await func.utils.TREE_OBJ.get(SESSION_ID,_ds.prog_id);if(tree_ret.menuType==="component"||tree_ret.menuType==="globals"){const _progFields=await func.datasource.get_progFields(SESSION_ID,dsSession);let fieldComputed_propExpressions,fieldComputed_id;for await(const val of _progFields){const fieldId=val.data.field_id;if(val.data.type!=="virtual"||!val.props.fieldComputed)continue;const _propExpressions=val.props?.propExpressions?.fieldValue;if(_propExpressions&&JSON.stringify(_propExpressions).includes(field_id)){fieldComputed_propExpressions=_propExpressions;fieldComputed_id=fieldId}}if(!fieldComputed_id)return;for(const row of _ds.data_feed?.rows||[]){for(const[key,val]of Object.entries(row)){if(key!==fieldComputed_id)continue;try{let ret=await func.expression.get(SESSION_ID,fieldComputed_propExpressions,dsNo,"update",row._ROWID);const row_idx=func.common.find_ROWID_idx(_ds,row._ROWID);if(_ds.data_feed.rows[row_idx][fieldComputed_id]!==ret.result){_ds.data_feed.rows[row_idx][fieldComputed_id]=ret.result;if(!fields_changed.includes(fieldComputed_id)){fields_changed.push(fieldComputed_id)}if(!datasource_changed.includes(dsSession)){datasource_changed.push(dsSession)}}}catch(err){console.error(err)}}}}await set_fieldComputed_dependencies(dsNo,field_id,dsSession)}};var fields_changed=[];var datasource_changed=[];let client_datasource_changes={};let server_datasource_changes={};const update_xu_ref=function(dataSource){let ret;let _ds_0=_session.DS_GLB[0];for([ref_name,val]of Object.entries(_ds_0.data_system["SYS_GLOBAL_OBJ_REFS"])){if(val.ds.dsSession==dataSource){ret=func.UI.update_xu_ref(SESSION_ID,dataSource,ref_name)}}return ret};for await(const[dataSource,row_data]of Object.entries(datasource_changes)){var _ds=_session.DS_GLB[dataSource];if(!_ds){continue}for(const[record_id,fields_data]of Object.entries(row_data)){for(const[field_id,value]of Object.entries(fields_data)){if(record_id==="datasource_main"){_.set(_ds,field_id,value);const ret=update_xu_ref(dataSource);if(ret){fields_changed.push(field_id);datasource_changed.push(dataSource)}continue}if(typeof fields_data==="object"){if(glb.GLOBAL_VARS[field_id]){_ds.data_system[field_id]=value;continue}try{const row_idx=func.common.find_ROWID_idx(_ds,record_id);if(!_.isEqual(_ds.data_feed.rows[row_idx][field_id],value)){_ds.data_feed.rows[row_idx][field_id]=value;await set_fieldComputed_dependencies(dataSource,field_id,null);update_xu_ref(dataSource);if(!update_local_scope_only){let tree_ret=await func.utils.TREE_OBJ.get(SESSION_ID,_ds.prog_id);if(glb.IS_WORKER){if(tree_ret.menuType==="globals"||tree_ret.menuType==="component"){const _progFields=await func.datasource.get_progFields(SESSION_ID,dataSource);let view_field_obj=func.common.find_item_by_key(_progFields,"field_id",field_id);if(!view_field_obj?.data?.serverField&&record_id!=="data_system"){if(!client_datasource_changes[dataSource]){client_datasource_changes[dataSource]={}}if(!client_datasource_changes[dataSource][record_id]){client_datasource_changes[dataSource][record_id]={}}client_datasource_changes[dataSource][record_id][field_id]=value}}}else{if(tree_ret.menuType==="component"&&_ds._run_at!=="client"||tree_ret.menuType==="globals"){if(!server_datasource_changes[dataSource]){server_datasource_changes[dataSource]={}}if(!server_datasource_changes[dataSource][record_id]){server_datasource_changes[dataSource][record_id]={}}server_datasource_changes[dataSource][record_id][field_id]=value}}}if(!fields_changed.includes(field_id)){fields_changed.push(field_id);for(const[_dsSession,_ds]of Object.entries(_session.DS_GLB)){if(_ds.args.parameters_raw_obj){for(const[key,exp]of Object.entries(_ds.args.parameters_raw_obj)){if(exp.includes(field_id)){let ret=await func.expression.get(SESSION_ID,exp,_dsSession,"parameters");_ds.in_parameters[key].value=ret.result}}}}}if(!datasource_changed.includes(dataSource)){datasource_changed.push(dataSource)}if(!_ds.data_feed.rows_changed){_ds.data_feed.rows_changed=[]}if(!_ds.data_feed.rows_changed.includes(record_id))_ds.data_feed.rows_changed.push(record_id)}}catch(error){}}else if(fields_data==="set"){_ds.currentRecordId=record_id}}}}if(glb.IS_WORKER){if(!update_local_scope_only&&!_.isEmpty(client_datasource_changes)){func.utils.post_back_to_client(SESSION_ID,"update_client_eventChangesResults_from_worker",_session.worker_id,client_datasource_changes)}}else{if(!update_local_scope_only&&!_.isEmpty(server_datasource_changes)){const ret=await func.index.call_worker(SESSION_ID,{service:"update_datasource_changes_from_client",data:{session_id:SESSION_ID,datasource_changes:server_datasource_changes},id:_ds.worker_id})}if(fields_changed.length){function findMin(arr){return Math.min(...arr.map(Number))}await func.UI.screen.refresh_xu_attributes(SESSION_ID,_.cloneDeep(fields_changed),null,null,findMin(datasource_changed),avoid_xu_for_refresh,trigger);await func.UI.screen.refresh_screen(SESSION_ID,_.cloneDeep(fields_changed),null,datasource_changed[0])}}resolve()})};func.datasource.callback=async function(SESSION_ID,dsSessionP,rowIdP,jobNoP,nodeIdP){var _session=SESSION_OBJ[SESSION_ID];var _ds=_session.DS_GLB[dsSessionP];try{const row_idx=func.common.find_ROWID_idx(_ds,"dataset");if(_ds.PARAM_OUT_INFO){for(const[key,val]of Object.entries(_ds.PARAM_OUT_INFO)){if(typeof _ds?.data_feed?.rows?.[row_idx]?.[val.fieldId]==="undefined"){func.utils.alerts.invoke(SESSION_ID,"system_msg","SYS_MSG_0310",val.fieldId,dsSessionP);break}val.result=_ds.data_feed.rows[row_idx][val.fieldId]}}}catch(err){}const datasetOutputField=_ds?.progDataSource?.datasetOutputField;if(datasetOutputField){let ret_get_value=await func.datasource.get_value(SESSION_ID,datasetOutputField,_ds.dsSession);if(ret_get_value.found){let datasource_changes={};if(!datasource_changes[ret_get_value.dsSessionP]){datasource_changes[ret_get_value.dsSessionP]={}}if(!datasource_changes[ret_get_value.dsSessionP][ret_get_value.currentRecordId]){datasource_changes[ret_get_value.dsSessionP][ret_get_value.currentRecordId]={};datasource_changes[ret_get_value.dsSessionP][ret_get_value.currentRecordId][_ds?.progDataSource?.datasetOutputField]=_ds?.data_feed?.rows||[];await func.datasource.update(SESSION_ID,datasource_changes)}}}func.utils.debug.log(SESSION_ID,nodeIdP,{module:_ds.viewModule,action:"close",source:_ds.viewSourceDesc,type:"adapter",prog_id:_ds.prog_id,dsSession:dsSessionP,prop:_ds.log_prop+" "+"adapter"});if(!glb.IS_WORKER)$(_session.root_element).css("cursor","default");if(_ds.prog_id){let _ds=_session.DS_GLB[dsSessionP];func.utils.debug.watch(SESSION_ID,_ds.prog_id,"program",{in_parameters:_ds.in_parameters,out_parameters:_ds.out_parameters,data_feed:_ds.data_feed},_ds.tree_obj.menuType)}delete _ds.old_dataSource;return{SESSION_ID:SESSION_ID,dsSessionP:dsSessionP,rowIdP:rowIdP,jobNoP:jobNoP,callingLogId:_ds.callingLogId,calling_jobP:_ds.calling_jobP}};func.datasource.validate_viewRange=async function(SESSION_ID,viewRangeExpP,dsSessionP,rowIdP,sourceP){var _ds=SESSION_OBJ[SESSION_ID].DS_GLB[dsSessionP];if(viewRangeExpP&&_ds){var ret=func.expression.remove_quotes(await func.expression.get(SESSION_ID,viewRangeExpP,dsSessionP,"range",rowIdP));ret.result=func.expression.remove_quotes(ret.result);func.utils.debug.log(SESSION_ID,_ds.prog_id,{module:_ds.viewModule,action:"range Exp",prop:sourceP,details:viewRangeExpP,result:ret.result,error:ret.error,source:_ds.viewSourceDesc,json:ret.explain,fields:ret.fields,dsSession:dsSessionP});_ds.viewRangeExpResults=ret.fields;if(glb.DEBUG_MODE){if(!_ds.debug){_ds.debug={}}if(!_ds.debug.viewRangeExp){_ds.debug.viewRangeExp=[]}_ds.debug.viewRangeExp.push(ret)}return ret.result}else return false};func.datasource.validate_viewLocate=async function(SESSION_ID,viewLocateExpP,dsSessionP,rowIdP,sourceP){if(viewLocateExpP&&_ds){var ret=func.expression.remove_quotes(await func.expression.get(SESSION_ID,viewLocateExpP,dsSessionP,"locate",rowIdP));ret.result=func.expression.remove_quotes(ret.result);func.utils.debug.log(SESSION_ID,_ds.prog_id,{module:_ds.viewModule,action:"locate Exp",prop:sourceP,details:viewLocateExpP,result:ret.result,error:ret.error,source:_ds.viewSourceDesc,json:ret.explain,fields:ret.fields,dsSession:dsSessionP});_ds.viewLocateExpResults=ret.fields;return ret.result}else return false};func.datasource.get_viewFields_for_update_function=function(SESSION_ID,calling_trigger_prop,na,dsSessionP){var viewFields=[];var exp=calling_trigger_prop?.data?.name?.value;if(!exp){return viewFields}try{var json=JSON5.parse(exp.replace(/\n/gi,""));for(const[key,val]of Object.entries(json)){let id=key.substr(1,key.length-1);if(!id)continue;viewFields.push({val:val,id:id})}return viewFields}catch(e){if(!exp){return}if(exp.substr(exp.length-1,1)===";")exp=exp.substr(0,exp.length-1);var exp_arr=exp.split(/;\s*(?=(?:[^"]|"[^"]*")*$)/g);if(exp_arr?.length){for(let val of exp_arr){var pos=val.indexOf(":");var seg=[val.substring(0,pos),val.substring(pos+1)];if(seg&&seg.length===2){let id=seg[0].substr(1,seg[0].length);if(!id)continue;viewFields.push({id:id,val:seg[1]})}else{func.utils.debug.log(SESSION_ID,_ds.prog_id,{module:_ds.viewModule,action:"set",prop:"parse update exp",details:exp,result:"",error:"Invalid json; too many segments",source:_ds.viewSourceDesc,json:"",fields:"",dsSession:dsSessionP})}}}return viewFields}};func.datasource.get_value=async function(SESSION_ID,fieldIdP,dsSessionP,rowIdP,org_dsSessionP){const return_value=async(field_id,value)=>{const _progFields=await func.datasource.get_progFields(SESSION_ID,dsSessionP);let view_field_obj=func.common.find_item_by_key(_progFields,"field_id",field_id);var fieldType=view_field_obj?.props?.fieldType||"string";var fieldProp=view_field_obj?.props;let table_field_obj;if(view_field_obj?.data?.type==="table"){if(!_ds._dataSourceTableId){return func.utils.debug_report(SESSION_ID,"Datasource",`Table type defined without dataSourceTableId deceleration`,"E")}let table_obj=await func.utils.FILES_OBJ.get(SESSION_ID,_ds._dataSourceTableId);if(!table_obj){return func.utils.debug_report(SESSION_ID,"Datasource",`dataSourceTableId reference error: `+_ds._dataSourceTableId,"E")}table_field_obj=func.common.find_item_by_key(table_obj.tableFields,"field_id",field_id);fieldType=table_field_obj.props?.fieldType;fieldProp=table_field_obj.props}let ret={value:await func.common.get_cast_val(SESSION_ID,`datasource get value ${_ds.tree_obj.menuName}`,fieldIdP,fieldType,value,null),type:fieldType,prop:fieldProp};if(ret.value&&typeof ret.value==="string"&&ret.type!=="exp"){if(/"/.test(ret.value)&&ret.value.indexOf("\\")===-1)ret.value=ret.value.replace(/"/g,'"')}return{ret:ret,dsSessionP:dsSessionP,fieldIdP:field_id,currentRecordId:_ds.currentRecordId,found:typeof value!=="undefined"}};const return_dynamic_value=async(field_id,value)=>{let view_field_obj=_ds.dynamic_fields[field_id];var fieldType=view_field_obj?.props?.fieldType||"string";var fieldProp=view_field_obj?.props;let ret={value:view_field_obj.value,type:fieldType,prop:fieldProp};if(ret.value&&typeof ret.value==="string"&&ret.type!=="exp"){if(/"/.test(ret.value)&&ret.value.indexOf("\\")===-1)ret.value=ret.value.replace(/"/g,'"')}return{ret:ret,dsSessionP:dsSessionP,fieldIdP:field_id,currentRecordId:_ds.currentRecordId,found:typeof value!=="undefined"}};const return_value_parameters=async(field_id,value)=>{let ret={value:await func.common.get_cast_val(SESSION_ID,"datasource get value",fieldIdP,value.type,value.value,null),type:value.type,prop:null};if(ret.value&&typeof ret.value==="string"&&ret.type!=="exp"){if(!ret.value.includes("<svg xmlns=")&&/"/.test(ret.value)&&ret.value.indexOf("\\")===-1)ret.value=ret.value.replace(/"/g,'"')}return{ret:ret,dsSessionP:dsSessionP,fieldIdP:field_id,currentRecordId:_ds.currentRecordId,found:typeof value!=="undefined"}};const return_value_system=async(field_id,value)=>{let fieldType=glb.GLOBAL_VARS[field_id].type;let fieldProp=null;let ret={value:await func.common.get_cast_val(SESSION_ID,`datasource get value ${_ds.tree_obj.menuName}`,field_id,fieldType,value,null),type:fieldType,prop:fieldProp};return{ret:ret,dsSessionP:dsSessionP,fieldIdP:field_id,currentRecordId:_ds.currentRecordId,found:typeof value!=="undefined"}};const search_in_parameters=async field_id=>{if(typeof _ds?.in_parameters?.[field_id]?.value!=="undefined"){let ret=await return_value_parameters(field_id,_ds.in_parameters[field_id]);return ret}if(typeof _ds.parentDataSourceNo!=="undefined"){var org_dsSession=org_dsSessionP;if(!org_dsSessionP)org_dsSession=dsSessionP;if(recordId&&recordId!=="newRecord")org_dsSession=null;return await func.datasource.get_value(SESSION_ID,fieldIdP,_ds.parentDataSourceNo,recordId,org_dsSession)}return await return_value(field_id)};if(typeof glb.GLOBAL_VARS==="undefined"){glb.GLOBAL_VARS=(await func.common.get_module(SESSION_ID,"xuda-system-globals-module.mjs")).system_globals}var _ds=SESSION_OBJ[SESSION_ID].DS_GLB[dsSessionP];if(!_ds){if(dsSessionP>0){return await func.datasource.get_value(SESSION_ID,fieldIdP,dsSessionP-1,rowIdP,org_dsSessionP)}return await return_value(fieldIdP)}let recordId=rowIdP;if(!recordId){recordId=_ds.currentRecordId}if(glb.GLOBAL_VARS[fieldIdP]){if(!_ds.data_system){_ds.data_system={}}if(dsSessionP>0){_ds.data_system["SYS_STR_ACTIVE_ROW_ID"]=_ds.currentRecordId;_ds.data_system["SYS_STR_PROG_DS_SESSION"]=dsSessionP}if(glb.SYS_DATE_ARR.includes(fieldIdP)){var _ds_0=SESSION_OBJ[SESSION_ID].DS_GLB[0];if(_ds_0){if(!_ds_0.data_system){_ds_0.data_system={}}const ts=await func.utils.get_dateTime(SESSION_ID,"SYS_DATE_VALUE");for(const val of glb.SYS_DATE_ARR){_ds_0.data_system[val]=await func.utils.get_dateTime(SESSION_ID,val,ts)}}}if(typeof _ds?.data_system?.[fieldIdP]!=="undefined"){return await return_value_system(fieldIdP,_ds?.data_system?.[fieldIdP])}return await search_in_parameters(fieldIdP)}if(!_ds.data_feed){return await search_in_parameters(fieldIdP)}var _field_id=fieldIdP;if(fieldIdP.substr(0,1)==="_"){if(_ds.alias)_field_id=_ds.alias[fieldIdP]}if(!org_dsSessionP&&recordId){try{const row_idx=func.common.find_ROWID_idx(_ds,recordId);if(typeof _ds.data_feed?.rows?.[row_idx]?.[_field_id]!=="undefined"){if(Object.keys(_ds.data_feed?.rows?.[row_idx]||{})?.includes(_field_id)){return await return_value(_field_id,_ds.data_feed.rows[row_idx][_field_id])}if(Object.keys(_ds?.dynamic_fields||{})?.includes(_field_id)){return await return_dynamic_value(_field_id,_ds.dynamic_fields[_field_id])}}}catch(err){}}try{const row_idx=func.common.find_ROWID_idx(_ds,_ds.currentRecordId);if(typeof _ds.data_feed?.rows?.[row_idx]?.[_field_id]!=="undefined"){return await return_value(_field_id,_ds.data_feed.rows[row_idx][_field_id])}}catch(error){}if(typeof _ds?.dynamic_fields?.[_field_id]!=="undefined"){return await return_dynamic_value(_field_id,_ds.dynamic_fields[_field_id])}return await search_in_parameters(fieldIdP)};func.datasource.find_event_dataSource=async function(SESSION_ID,eventIdP,dsSessionP){const _ds=SESSION_OBJ[SESSION_ID].DS_GLB[dsSessionP];var ret;if(_ds?.prog_id){let view_ret=await func.utils.VIEWS_OBJ.get(SESSION_ID,_ds.prog_id);if(view_ret?.progEvents&&func.common.find_item_by_key(view_ret.progEvents,"event_name",eventIdP)){ret=dsSessionP;if(_ds.callingSource==="system")ret=0;if(_ds.callingSource==="program"||!_ds.callingSource)ret=dsSessionP;return ret}}if(!ret&&dsSessionP!==0){if(_ds&&_ds.parentDataSourceNo&&Number(_ds.parentDataSourceNo)>0&&Number(_ds.parentDataSourceNo)<dsSessionP){return await func.datasource.find_event_dataSource(SESSION_ID,eventIdP,_ds.parentDataSourceNo)}else{if(!ret)return await func.datasource.find_event_dataSource(SESSION_ID,eventIdP,0)}}};func.datasource.reset_jobs=function(SESSION_ID,dsSessionP,sourceP,errP){for(const[key,val]of Object.entries(SESSION_OBJ[SESSION_ID].WORKER_OBJ.jobs)){if(val.dsSessionP===dsSessionP){func.events.delete_job(SESSION_ID,val.job_num);break}}func.utils.debug_report(SESSION_ID,sourceP+"Missing datasource: "+dsSessionP,errP,"W",null)};func.datasource.get_currentRecordId=function(SESSION_ID,dsSessionP,from_datasourceP){var _ds=SESSION_OBJ[SESSION_ID].DS_GLB[dsSessionP];if(_ds._dataSourceTableId!==""){var firstRecordId=_ds.firstRecordId;var currentRecordId=_ds.currentRecordId;var locatedRecordId=_ds.locatedRecordId;if(!currentRecordId||from_datasourceP){if(!locatedRecordId)currentRecordId=firstRecordId;else currentRecordId=locatedRecordId}}else currentRecordId="newRecord";return currentRecordId};func.datasource.interval=function(session_id,dsSessionP,typeP){var SESSION_ID=session_id;var interval=[];var _ds=SESSION_OBJ[SESSION_ID].DS_GLB[dsSessionP];var arr=_ds[typeP];var fx={init:async function(){if(arr?.length){for(let val of arr){var event_id=val[0];var interval_rate=val[1];var condition=val[2];interval.push(setInterval(async function(){if(!SESSION_OBJ[SESSION_ID])return;var event_count=await func.datasource.get_view_events_count(SESSION_ID,dsSessionP,typeP,event_id);if(!event_count){fx.clear();return}var event_condition=await func.expression.get(SESSION_ID,condition,dsSessionP,"condition");if(condition&&!event_condition.result)return;const e=await func.datasource.execute_view_events(SESSION_ID,dsSessionP,typeP,event_id)},Number(interval_rate)*1e3))}}else{await fx.clear();return}},clear:function(){if(DATASOURCE_INTERVALS[session_id])delete DATASOURCE_INTERVALS[session_id][dsSessionP];for(const[key,val]of Object.entries(interval)){clearInterval(val)}}};return fx};func.datasource.server_cron=function(session_id){var SESSION_ID=session_id;var jobs=[];var arr=func.datasource.get_event_interval_arr(SESSION_ID,0,"server_cron");const schedule=require("node-schedule");if(!arr.length){return jobs}for(let val of arr){var event_id=val[0];var cron_prop=val[1];var condition=val[2];jobs.push(schedule.scheduleJob(cron_prop,async function(){if(!SESSION_OBJ[SESSION_ID])return;var event_count=await func.datasource.get_view_events_count(SESSION_ID,0,"server_cron",event_id);if(!event_count){fx.clear();return}var event_condition=await func.expression.get(SESSION_ID,condition,0,"condition");if(condition&&!event_condition.result)return;if(event_count){const e=await func.datasource.execute_view_events(SESSION_ID,0,"server_cron",event_id)}}))}return jobs};func.datasource.get_viewLoops=async function(SESSION_ID,dataSourceSession,data,batch_source,default_limit){var _ds=SESSION_OBJ[SESSION_ID].DS_GLB[dataSourceSession];var args=_ds.args;var ret=default_limit;if(batch_source==="db_data")ret=_.size(data.rows);if(batch_source==="array"||batch_source==="csv")ret=data.length;if(batch_source==="json")ret=Object.keys(data).length;if(_ds.progDataSource?.dataSourceLimit){if(batch_source!=="no_data"&&Number(_ds.progDataSource?.dataSourceLimit)<ret){ret=Number(_ds.progDataSource.dataSourceLimit)}if(!batch_source)ret=Number(_ds.progDataSource.dataSourceLimit)}if(prog_obj.progDataSource?.dataSourceLoopExp){var n=(await func.expression.get(SESSION_ID,_ds.v.viewLoopsExp,dataSourceSession,"view_loop",args.rowIdP)).result;if(batch_source!=="no_data"&&n<ret)ret=n;if(!batch_source)ret=n}return ret};func.datasource.set_VIEW_data=async function(SESSION_ID,args,_ds){_ds.v={viewFieldsProp:{},segFrom:[],segTo:[],segLocateFrom:[],segLocateTo:[],viewModule:"adapter"};_ds.viewEventExec_arr={};var view=_.cloneDeep(await func.utils.VIEWS_OBJ.get(SESSION_ID,args.prog_id));_ds.v.dataSourceSrcType=view.dataSourceSrcType;if(view.progDataSource)_ds.progDataSource=view.progDataSource;_ds.v.viewIndex=view?.progDataSource?.dataSourceIndexesObj;let tree_ret=await func.utils.TREE_OBJ.get(SESSION_ID,args.prog_id);_ds.v.viewSourceDesc=tree_ret.menuName;if(!_ds.v.viewSourceDesc&&tree_ret){_ds.v.viewSourceDesc=tree_ret.menuName}if(glb.FUNCTION_NODES_ARR.includes(tree_ret.menuType)){_ds.v.viewModule="function"}_ds.v.viewSourceProp=tree_ret.menuType;if(view.progEvents)_ds.v.progEvents=view.progEvents;_ds._progDataSource_fields=[];if(_ds.progDataSource){let ret=func.expression.parse(JSON.stringify(_ds.progDataSource));_ds._progDataSource_fields=ret.map(e=>{if(e.fieldId)return e.fieldId})}};func.datasource.get_cast_val=async function(SESSION_ID,source,dsSession,valP,typeP,req,error){var prog_id,prog_name;var _session=SESSION_OBJ[SESSION_ID];var _ds=_session.DS_GLB[dsSession];prog_id=_ds.prog_id;prog_name=await func.utils.TREE_OBJ.get(SESSION_ID,_ds.prog_id).menuName;const prog_info=prog_id?` (prog: ${prog_id} ${prog_name})`:"";const report_conversion_error=function(res){var msg=`error converting from ${valP} to ${typeP}`;if(error){return func.utils.debug_report(SESSION_ID,msg,"","W")}func.utils.debug_report(SESSION_ID,msg+" "+_.capitalize(source)+prog_info,"","E")};const report_conversion_warn=function(res){var msg=`type mismatch auto conversion from value ${valP} to ${typeP}`;func.utils.debug_report(SESSION_ID,msg+" "+_.capitalize(source)+prog_info,"","W")};if(error){return report_conversion_error()}const module=await func.common.get_module(SESSION_ID,"xuda-get-cast-util-module.mjs");return module.cast(typeP,valP,report_conversion_error,report_conversion_warn)};func.datasource.get_field_init_triggers_to_run=function(SESSION_ID,dataSourceSession,pre_init_fieldsP){var _ds=SESSION_OBJ[SESSION_ID].DS_GLB[dataSourceSession];if(!_ds)return;return[]};func.datasource.get_pre_init_fields=function(SESSION_ID,dsSessionP,viewRangeExpP,viewSortExpP,viewGroupByExpP,viewLocateExpP){var ret=[];return};func.datasource.add_dynamic_field_to_ds=function(SESSION_ID,dsSessionP,key,val){var _ds=SESSION_OBJ[SESSION_ID].DS_GLB[dsSessionP];if(!_ds.dynamic_fields){_ds.dynamic_fields={}}const toType=function(obj){return{}.toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase()};_ds.dynamic_fields[key]={id:crypto.randomUUID(),data:{type:"virtual",field_id:key},props:{fieldType:typeof val!=="undefined"?toType(val):"string"},value:val}};func.datasource.get_progFields=async function(SESSION_ID,dsSessionP){var _ds=SESSION_OBJ[SESSION_ID].DS_GLB[dsSessionP];const _view_obj=await func.utils.VIEWS_OBJ.get(SESSION_ID,_ds.prog_id);return _view_obj.progFields};func.datasource.update_changes_for_out_parameter=async function(SESSION_ID,dsSessionP,calling_dsP){let _session=SESSION_OBJ[SESSION_ID];let _ds=_session.DS_GLB[dsSessionP];const _calling_ds=_session.DS_GLB[calling_dsP];if(_ds.PARAM_OUT_INFO){let data={};for await(const[key,val]of Object.entries(_ds.PARAM_OUT_INFO)){if(val.prop==="out"){try{const row_idx=func.common.find_ROWID_idx(_ds,_ds.currentRecordId);data[val.details]=_ds.data_feed.rows[row_idx][val.fieldId]}catch(err){console.error(err)}}}if(!_.isEmpty(data)){let datasource_changes={[calling_dsP]:{[_calling_ds.currentRecordId]:data}};await func.datasource.update(SESSION_ID,datasource_changes)}}};func.datasource.set_outputField=async function(SESSION_ID,dsSessionP,result,args){var _session=SESSION_OBJ[SESSION_ID];const output_field=await func.datasource.get_args_property_value(SESSION_ID,dsSessionP,args,"outputField");if(output_field){let datasource_changes={};let ret_get_value=await func.datasource.get_value(SESSION_ID,output_field,dsSessionP);if(ret_get_value.found){let _ds=_session.DS_GLB[ret_get_value.dsSessionP];if(!datasource_changes[_ds.dsSession]){datasource_changes[_ds.dsSession]={}}if(!datasource_changes[_ds.dsSession][ret_get_value.currentRecordId]){datasource_changes[_ds.dsSession][ret_get_value.currentRecordId]={}}datasource_changes[_ds.dsSession][ret_get_value.currentRecordId][output_field]=result;await func.datasource.update(SESSION_ID,datasource_changes)}}};func.datasource.get_args_property_value=async function(SESSION_ID,dsSession,args,prop_name){let _prop=args?.calling_trigger_prop?.data?.name;let _value=_prop[prop_name];if(_prop?.[`xu-exp:${prop_name}`]){_value=(await func.expression.get(SESSION_ID,_prop[`xu-exp:${prop_name}`],dsSession,`${prop_name} expression`)).result}return _value};func.UI.screen={};func.UI.screen.init=async function(SESSION_ID,prog_id,sourceScreenP,callingDataSource_objP,$callingContainerP,triggerIdP,rowIdP,jobNoP,is_panelP,parameters_obj_inP,source_functionP,call_screen_propertiesP,refreshed_ds,parameters_raw_obj){if(!prog_id)return console.error("program is empty");let screen_ret=await func.utils.get_screen_obj(SESSION_ID,prog_id);if(!screen_ret)return console.error("program is not a screen object");await func.UI.utils.init_ui_framework(SESSION_ID,prog_id);let _session=SESSION_OBJ[SESSION_ID];const screenInfo=_.cloneDeep(screen_ret);var screen_type=source_functionP?.split("_")?.[1];var screenId=(glb.screen_num++).toString();if(SCREEN_BLOCKER_OBJ[prog_id+(sourceScreenP?"_"+sourceScreenP:"")]){const wait_for_SCREEN_BLOCKER_release=()=>{return new Promise(resolve=>{var interval=setInterval(function(){if(!SCREEN_BLOCKER_OBJ[prog_id+(sourceScreenP?"_"+sourceScreenP:"")]){window.clearInterval(interval);resolve()}},5)})};await wait_for_SCREEN_BLOCKER_release()}func.UI.utils.screen_blocker(true,prog_id+(sourceScreenP?"_"+sourceScreenP:""));if($callingContainerP&&!_.isEmpty($callingContainerP))$callingContainerP.data().xuData.screenInfo=screenInfo;var $dialogDiv;var $rootFrame;var containerId;var params={prog_id:prog_id,sourceScreenP:sourceScreenP,$callingContainerP:$callingContainerP,triggerIdP:triggerIdP,callingDataSource_objP:callingDataSource_objP,rowIdP:rowIdP,renderType:screenInfo.properties?.renderType,parameters_obj_inP:parameters_obj_inP,source_functionP:source_functionP,is_panelP:is_panelP,screen_type:screen_type,screenInfo:screenInfo,call_screen_propertiesP:call_screen_propertiesP,parentDataSourceNoP:_session.DS_GLB?.[callingDataSource_objP?.dsSession]?.dsSession||callingDataSource_objP?.parentDataSourceNo||0,parameters_raw_obj:parameters_raw_obj};switch(screen_type){case"embed":$dialogDiv=$("<div>").attr({id:screenId,ui_engine:UI_FRAMEWORK_INSTALLED}).addClass("xu_embed_container").css({display:"contents"}).data({xuData:{paramsP:params,screenInfo:params.screenInfo}});let rootTagName="div";if(typeof glb.SLIM_BUNDLE==="undefined"&&!glb.SLIM_BUNDLE){const ui_plugin_core=new UI_FRAMEWORK_PLUGIN.core;rootTagName=ui_plugin_core?.rootTagName()}$rootFrame=$(`<${rootTagName}>`).data("xuData",{}).data("xuAttributes",{}).appendTo($dialogDiv);$dialogDiv.appendTo($callingContainerP);break;case"panel":$dialogDiv=$callingContainerP;$dialogDiv.data({xuData:{paramsP:params,screenInfo:params.screenInfo}});$rootFrame=$dialogDiv;break;case"page":case"modal":case"popover":$dialogDiv=$("<div>");$rootFrame=$("<div>").appendTo($dialogDiv);$dialogDiv.appendTo("body");break;default:}params.containerIdP=$rootFrame.attr("id");params.$container=$rootFrame;containerId="container_"+params.screenInfo.properties?.id+"_"+screenId;var data={note:" ROOT container",root:true,screenId:screenId,is_panelP:is_panelP,prog_id:prog_id,screen_type:screen_type,container:"#"+containerId};if(is_panelP){$rootFrame.data().xuData.rootFrame=data}else{if(!$rootFrame.data().xuData){$rootFrame.data().xuData={}}$rootFrame.attr("id",containerId).data().xuData.rootFrame=data;$rootFrame.css("display","contents")}var node=JSON.parse(JSON.stringify(screen_ret.progUi));func.UI.utils.indicator.screen.busy();const ret=await func.datasource.create(SESSION_ID,prog_id,refreshed_ds,params.parentDataSourceNoP,$rootFrame.attr("id"),rowIdP,jobNoP,null,parameters_raw_obj,null,null,null,null,null,parameters_obj_inP);var _ds=SESSION_OBJ[SESSION_ID].DS_GLB[ret.dsSessionP];_ds.screen_params=params;params.dsSessionP=ret.dsSessionP;func.UI.screen.update_SYS_OBJ_WIN_INFO(SESSION_ID,params.dsSessionP);if(ret.dsSessionP>=0){var viewDoc;let view_ret=await func.utils.VIEWS_OBJ.get(SESSION_ID,SESSION_OBJ[SESSION_ID].DS_GLB[ret.dsSessionP].prog_id);if(view_ret){viewDoc=view_ret}if(!viewDoc?.progUi){return func.utils.alerts.invoke(SESSION_ID,"system_msg","SYS_MSG_0780",params.renderType,ret.dsSessionP)}var node;node=_.cloneDeep(viewDoc.progUi);if(!node.length)return console.warn("ui node empty");const ret_render_$container=await func.UI.screen.render_ui_tree(SESSION_ID,$rootFrame,node[0],null,params,jobNoP,null,null,null,null,null,$rootFrame);func.UI.utils.indicator.screen.normal();let ret_screen_loading=await func.UI.screen.screen_loading_done(SESSION_ID,params,ret_render_$container,jobNoP);return ret_screen_loading}};func.UI.screen.update_SYS_OBJ_WIN_INFO=function(SESSION_ID,dsNoP){var _ds=SESSION_OBJ[SESSION_ID].DS_GLB[dsNoP];if(!_ds)return;if(!_ds.data_system){_ds.data_system={}}_ds.data_system["SYS_STR_WIN_ID"]=_ds.tree_obj?.id;_ds.data_system["SYS_STR_WIN_NAME"]=_ds.tree_obj?.menuName;if(SESSION_OBJ[SESSION_ID].DS_GLB[dsNoP].mode){_ds.data_system["SYS_STR_WIN_MODE"]=SESSION_OBJ[SESSION_ID].DS_GLB[dsNoP].mode}};func.UI.screen.validate_exit_events=async function(SESSION_ID,div_data_paramsP,forceP){return new Promise(async resolve=>{await func.events.validate(SESSION_ID,"on_exit",div_data_paramsP.dsSessionP,null,"screen");var interval=setInterval(function(){if(!SESSION_OBJ[SESSION_ID].WORKER_OBJ.jobs.length||forceP){clearInterval(interval);resolve()}},5)})};func.UI.screen.call_embed=function(SESSION_ID,prog){$("#embed_"+SESSION_ID).empty().data().xuData.screenInfo=null;_.forEach(SESSION_OBJ[SESSION_ID].DS_GLB,function(val,key){if(key)func.datasource.del(SESSION_ID,key)});func.UI.main.embed_prog_execute(SESSION_ID,prog)};func.UI.screen.refresh_xu_attributes=async function(SESSION_ID,fields_arr,jobNoP,$elm_to_search,dsSession_changed,avoid_xu_for_refresh,trigger){if(trigger!=="click"){if(!_.isEmpty(SCREEN_BLOCKER_OBJ)){setTimeout(()=>{func.UI.screen.refresh_xu_attributes(SESSION_ID,fields_arr,jobNoP,$elm_to_search,dsSession_changed)},100);return}}UI_WORKER_OBJ.cache={};const _session=SESSION_OBJ[SESSION_ID];if(glb.DEBUG_MODE){console.info("========= xu-attributes refresh info ==============");console.info("fields_arr:",fields_arr)}var selectors={};var search_from="body";var new_job=jobNoP;if($elm_to_search){search_from="#"+$elm_to_search.attr("id")}const get_selectors=function(){$.each(fields_arr,function(key_field,val_field){$(search_from).find("*").filter(function(){const elm_data=$(this).data();if(!elm_data.xuData)return true;if(typeof dsSession_changed!=="undefined"&&elm_data.xuData.paramsP&&elm_data.xuData.paramsP.dsSessionP<dsSession_changed)return true;let attr=[];const validate_param_in=function(exp,without_var){let exp_val_for_parameter_in_validation;if(typeof exp==="string")exp_val_for_parameter_in_validation=exp;if(typeof exp==="object")exp_val_for_parameter_in_validation=JSON.stringify(exp);if(!exp_val_for_parameter_in_validation)return;if(!exp.includes("@"))return;if(_.isEmpty(elm_data?.xuData?.paramsP?.parameters_raw_obj))return;for(const[param_key,param_val]of Object.entries(elm_data?.xuData?.paramsP?.parameters_raw_obj)){if(!param_val.includes("@"))continue;exp_val_for_parameter_in_validation=exp_val_for_parameter_in_validation.replaceAll((without_var?"":"@")+param_key,param_val)}return exp_val_for_parameter_in_validation?.includes?.((without_var?"":"@")+val_field)};$.each(elm_data?.xuAttributes,function(key,val){if(typeof val!=="string"&&typeof val!=="object")return true;if(typeof val==="string"&&!val?.includes("@")&&key!=="xu-bind"&&key!=="xu-for")return true;if(key.substr(0,3)!=="xu-")return true;if(key==="xu-bind"||key==="xu-for"){if(val?.includes?.(val_field)||validate_param_in(val,true)){attr.push(key)}return true}if(key.substr(0,6)==="xu-exp"&&key.substr(6,1)===":"){if(val?.includes?.("@"+val_field)||validate_param_in(val)){attr.push(key)}return true}if(key.substr(0,8)==="xu-class"){try{const classes_string=val;const classes_obj=_.isString(classes_string)?JSON.parse(classes_string):_.defaults(classes_string,{});$.each(classes_obj,function(cla,cond){if(cond.includes("@"+val_field)||validate_param_in(cond)){attr.push("xu-class");return false}});if(attr.length){return false}}catch(e){console.warn("parse error:"+val)}}if(key==="xu-ui-plugin"){const plugin_str=JSON.stringify(val);if(plugin_str.includes("@"+val_field)||validate_param_in(plugin_str)){attr.push(key);return false}}});const selector_id=$(this).attr("xu-ui-id");if(attr.length){selectors[selector_id]=selectors[selector_id];if(!selectors[selector_id]){selectors[selector_id]={attributes:[],$elm:$(this)}}attr.forEach(function(value){if(!selectors[selector_id].attributes.includes(value))selectors[selector_id].attributes.push(value)})}})})};get_selectors();for await(let[elem_key,elem_val]of Object.entries(selectors)){if(elem_key==="length")break;if(!elem_val.$elm.data().xuData)continue;if(elem_val.$elm.data().xuData.pending_to_delete)continue;const add_execute_queue=async function(type){if(!elem_val.$elm?.data?.()?.xuData)return;try{const obj={ui_type:elem_val.$elm.data().xuData.ui_type,SESSION_ID:SESSION_ID,fields_arr:fields_arr,elem_key:elem_key,elem_val:elem_val};new_job=await func.UI.worker.add_to_queue(SESSION_ID,"gui event",type,obj,new_job,elem_val.$elm);if(glb.DEBUG_MODE){console.log(type+">>>",new_job,obj)}}catch(error){debugger}};var performed_render=undefined;if(!elem_val?.$elm?.data()?.xuAttributes)continue;if(elem_val.attributes.includes("xu-exp:xu-render")){var res=await func.expression.get(SESSION_ID,elem_val.$elm.data().xuAttributes["xu-exp:xu-render"],elem_val.$elm.data().xuData.paramsP.dsSessionP,"UI Property EXP",elem_val.$elm.data().xuData.recordid);var attr_value=await func.common.get_cast_val(SESSION_ID,"refresh xu-attributes","xu-render","bool",res.result);if(!attr_value&&elem_val.$elm[0].tagName==="XURENDER")continue;if(attr_value&&elem_val.$elm[0].tagName!=="XURENDER"){await add_execute_queue("execute_xu_all_attributes");continue}if(!elem_val?.$elm?.data()?.xuData?.ui_type)continue;const obj={ui_type:elem_val.$elm.data().xuData.ui_type,SESSION_ID:SESSION_ID,elem_key:elem_key,elem_val:elem_val,fields_arr:fields_arr,attr_value:attr_value};new_job=jobNoP;new_job=await func.UI.worker.add_to_queue(SESSION_ID,"gui event","execute_xu_render_attributes",obj,new_job,elem_val.$elm,elem_val.$elm.data().xuData.paramsP.dsSessionP);performed_render=true;$.each(elem_val.$elm.find("*"),function(key,val){if($(val).data().xuData){$(val).data().xuData.pending_to_delete=true}});if(glb.DEBUG_MODE){console.info("execute_xu_render_attributes",obj)}}if(performed_render||elem_val.$elm[0].tagName==="XURENDER")continue;if(elem_val.attributes.includes("xu-exp:xu-for")||elem_val.attributes.includes("xu-for"))continue;if(elem_val.$elm.data().xuData.ui_type==="xu-widget"){add_execute_queue("execute_xu_widget")}else{add_execute_queue("execute_xu_all_attributes")}}selectors={};get_selectors();let refreshed_ids=[];let parent_element_ui_id;for await(let[elem_key,elem_val]of Object.entries(selectors)){if(elem_key==="length")break;if(!elem_val.$elm.data().xuData)continue;if(elem_val.$elm.data().xuData.pending_to_delete)continue;if(!elem_val.attributes.includes("xu-exp:xu-for")&&!elem_val.attributes.includes("xu-for"))continue;let _parent_element_ui_id;if(elem_val?.$elm?.data()?.xuPanelData){_parent_element_ui_id=elem_val?.$elm?.data()?.xuPanelData?.parent_element_ui_id}else{_parent_element_ui_id=elem_val?.$elm?.data()?.xuData?.parent_element_ui_id}if(!parent_element_ui_id||_parent_element_ui_id!=parent_element_ui_id){parent_element_ui_id=_parent_element_ui_id;const _$elem=$(`[xu-ui-id=${parent_element_ui_id}]`);const _elem_key=parent_element_ui_id;const _elem_val={attributes:[],$elm:_$elem};$.each(_$elem.data()?.xuAttributes,function(key,val){_elem_val.attributes.push(key)});const obj={ui_type:_elem_val.$elm.data().xuData.ui_type,SESSION_ID:SESSION_ID,elem_key:_elem_key,elem_val:_elem_val,fields_arr:fields_arr,xu_for_item_id:elem_val?.$elm?.data()?.xuPanelData?elem_val?.$elm?.data()?.xuPanelData.node.id:elem_val?.$elm?.data().xuData.nodeid};if(avoid_xu_for_refresh)return;await func.UI.worker.add_to_queue(SESSION_ID,"gui event","execute_xu_for",obj,new_job,_elem_val.$elm,_elem_val.$elm.data().xuData.paramsP.dsSessionP);refreshed_ids.push(parent_element_ui_id);if(glb.DEBUG_MODE){console.info("execute_xu_for",obj)}}}const iterate_field_in_progUi=async function(progUi,field_id,panel_val){let found;const iterate_progUi=async function(node,node_id){for(let item of node){if(!_.isEmpty(item.attributes)){const parent_element_ui_id=node_id;for await(const[attr,val]of Object.entries(item.attributes)){if(attr==="xu-exp:xu-for"||attr==="xu-for"){if(val?.includes(field_id)){const _$elem=func.UI.utils.find_in_element_data("xuData",$(SESSION_OBJ[SESSION_ID].root_element),"nodeid",parent_element_ui_id);const _elem_key=_$elem.attr("xu-ui-id");const _elem_val={attributes:[],$elm:_$elem};if(!_$elem?.length)continue;if(refreshed_ids.includes(_$elem.attr("xu-ui-id")))break;$.each(_$elem.data()?.xuAttributes,function(key,val){_elem_val.attributes.push(key)});const obj={ui_type:_elem_val.$elm.data().xuData.ui_type,SESSION_ID:SESSION_ID,elem_key:_elem_key,elem_val:_elem_val,fields_arr:fields_arr,xu_for_item_id:item.id};if(avoid_xu_for_refresh)return;await func.UI.worker.add_to_queue(SESSION_ID,"gui event","execute_xu_for",obj,new_job,_elem_val.$elm,_elem_val.$elm.data().xuData.paramsP.dsSessionP);if(glb.DEBUG_MODE){console.info("node execute_xu_for",obj,panel_val)}break}}}}if(found)break;if(item.children){await iterate_progUi(item.children,item.id)}}};await iterate_progUi(progUi);return found};const $xu_embed_container=$(".xu_embed_container");const panels_obj=await func.UI.utils.get_panels_wrapper_from_dom(SESSION_ID,$xu_embed_container,true);for await(const field_id of fields_arr){if($xu_embed_container.length){const progUi=$xu_embed_container?.data()?.xuData?.screenInfo?.progUi;if(progUi){await iterate_field_in_progUi(progUi,field_id)}}for await(const[panel_wrapper_element_ui_id,panel_val]of Object.entries(panels_obj)){await iterate_field_in_progUi(panel_val.progUi,field_id,panel_val)}}func.events.delete_job(SESSION_ID,jobNoP);if(glb.DEBUG_MODE){console.info("===================================================")}};func.UI.screen.refresh_screen=async function(SESSION_ID,fields_changed_arr,datasource_changed,fields_changed_datasource){var found,refresh_reason,refresh_details;const validate_change=function(prog_doc,panelXuAttributes,skip_ui_check){found=null;refresh_reason=null;refresh_details=null;const progDataSource_str=JSON.stringify(prog_doc.progDataSource);for(const field_id of fields_changed_arr){const _attributes=panelXuAttributes||{};found=_attributes["xu-exp:program"]?.includes("@"+field_id);if(found){refresh_reason=`program ${_attributes["xu-exp:program"]} ${field_id} changed `;refresh_details=_attributes;break}for(const[attr,value]of Object.entries(_attributes)){const pattern=/xu-exp:(\w+)/;const match=attr.match(pattern);if(!match){continue}const parameter_in_field_id=match?.[1];if(value.includes(field_id)){found=progDataSource_str?.includes("@"+parameter_in_field_id);if(found){refresh_reason=`field ${field_id} in progDataSource parameter_in changed`;refresh_details=prog_doc?.progDataSource;break}if(!skip_ui_check){found=func.UI.find_field_in_progUi_attributes(prog_doc.progUi,parameter_in_field_id,"xu-for").length;if(found){refresh_reason=`field ${field_id} in progUi xu-for parameter_in changed`;refresh_details=found;break}}}}if(found)break;found=progDataSource_str?.includes("@"+field_id);if(found){refresh_reason=`field ${field_id} in progDataSource changed`;refresh_details=prog_doc?.progDataSource;break}if(!skip_ui_check){found=func.UI.find_field_in_progUi_attributes(prog_doc.progUi,field_id,"xu-for").length;if(found){refresh_reason=`field ${field_id} in progUi xu-for changed`;refresh_details=found;break}}if(found){break}}};if(fields_changed_datasource){const _session=SESSION_OBJ[SESSION_ID];const _ds=_session.DS_GLB[fields_changed_datasource];const prog_doc=await func.utils.DOCS_OBJ.get(SESSION_ID,_ds.prog_id);if(prog_doc.progUi){validate_change(prog_doc,null,true);if(found){const $elm=$(`#container_${_ds.prog_id}_0`);if($elm?.length){const elm_data=$elm.data();const $wrapper=$elm.parent();const refreshed_ds=_ds.dsSession;$elm.empty();if($elm.data()){const new_$div=await func.UI.screen.render_ui_tree(SESSION_ID,$elm,_.cloneDeep($elm.data().xuData.node),{},elm_data.xuData.paramsP,null,null,elm_data.xuData.key,refreshed_ds,elm_data.xuData.parent_node,null,elm_data.xuData.$root_container);if(glb.DEBUG_MODE){console.info("========= refresh main info ==============");console.info("reason:",refresh_reason);console.info("element:",$elm);console.info("==========================================")}return}}}}}const panels_obj=await func.UI.utils.get_panels_wrapper_from_dom(SESSION_ID,$(SESSION_OBJ[SESSION_ID].root_element),false);for await(const[parent_element_ui_id,panel_val]of Object.entries(panels_obj)){if(!panel_val.$panel_div?.data()?.xuData)continue;if(panel_val.$panel_div.data().xuData.pending_to_delete)continue;if(fields_changed_arr){if(fields_changed_datasource&&panel_val._ds.dsSession<=Number(fields_changed_datasource)){continue}validate_change(panel_val.prog_doc,panel_val?.panelXuAttributes)}if(datasource_changed){if(panel_val._ds.dsSession==datasource_changed){refresh_reason=`panel datasource ${datasource_changed} changed`;refresh_details="";found=true}}if(found){UI_WORKER_OBJ.cache={};const _session=SESSION_OBJ[SESSION_ID];if(glb.DEBUG_MODE){console.info("========= refresh info ==============");console.info("reason:",refresh_reason);console.info("details:",refresh_details);console.info("panel:",panel_val);console.info("=====================================")}const $div_elm=panel_val.$panel_div;const wrapper_data=$div_elm.data();if(_.isEmpty(wrapper_data))continue;try{const ts=Date.now();$.each(panel_val.ids,async function(key,val){$("[xu-ui-id='"+val+"']").attr("xu-ui-id",val+ts).removeData()});let refreshed_ds;if(_session.DS_GLB[panel_val._ds.dsSession]){refreshed_ds=panel_val._ds.dsSession}for await(const item of wrapper_data.xuData.node_org.children){if(item.tagName!=="xu-panel")continue;const new_$div=await func.UI.screen.render_ui_tree(SESSION_ID,$div_elm,_.cloneDeep(item),{},wrapper_data.xuData.paramsP,null,null,wrapper_data.xuData.key,refreshed_ds,wrapper_data.xuData.parent_node,null,wrapper_data.xuData.$root_container)}$.each(panel_val.ids,async function(key,val){$("[xu-ui-id='"+val+ts+"']").remove()})}catch(error){debugger}}}};const get_params_obj_new=async function(SESSION_ID,prog_id,nodeP,dsSession){const _prog=await func.utils.VIEWS_OBJ.get(SESSION_ID,prog_id);if(!_prog)return;let params_res={},params_raw={};if(_prog?.properties?.progParams){for await(const[key,val]of Object.entries(_prog.properties.progParams)){if(!["in","out"].includes(val.data.dir))continue;if(nodeP.attributes){if(nodeP.attributes[val.data.parameter]){params_res[val.data.parameter]=nodeP.attributes[val.data.parameter]}else if(nodeP.attributes[`xu-exp:${val.data.parameter}`]){if(val.data.dir=="out"){params_res[val.data.parameter]=nodeP.attributes[`xu-exp:${val.data.parameter}`].replaceAll("@","")}else{let ret=await func.expression.get(SESSION_ID,nodeP.attributes[`xu-exp:${val.data.parameter}`],dsSession,"parameters");params_res[val.data.parameter]=ret.result;params_raw[val.data.parameter]=nodeP.attributes[`xu-exp:${val.data.parameter}`]}}continue}console.warn(`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`)}}return{params_res:params_res,params_raw:params_raw}};func.UI.screen.execute_xu_functions=async function(SESSION_ID,is_skeleton,$root_container,nodeP,$container,paramsP,parent_infoP,jobNoP,keyP,parent_nodeP,xu_func,$elm,val,is_init,refreshed_ds){if(is_skeleton)return;var _ds=SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP];const tag_fx={[`xu-panel`]:{program:async function($elm,val){var ret={};var _session=SESSION_OBJ[SESSION_ID];var _ds=_session.DS_GLB[paramsP.dsSessionP];const init_program=async function(){async function render_panel(){const prog_id=val.value?.prog||val.value;const params_obj=await get_params_obj_new(SESSION_ID,prog_id,nodeP,paramsP.dsSessionP);let ret_panel=await func.UI.screen.init(SESSION_ID,prog_id,paramsP.screenId,_ds,$elm,null,_ds.currentRecordId,null,true,params_obj.params_res,"initXu_panel",undefined,prog_id!==_ds.prog_id?null:refreshed_ds,params_obj.params_raw);ret={$new_div:ret_panel};if($container.data().xuData){$container.data().xuData.xuPanelProps=$elm.data().xuAttributes;$container.data().xuData.xuPanelData=ret_panel.data()}return ret}if(!val.value){val.value="_empty_panel_program"}ret=await render_panel();return ret};const alter_program=async function(){var _session=SESSION_OBJ[SESSION_ID];var _ds=_session.DS_GLB[paramsP.dsSessionP];async function render_panel(){const program=val.value?.prog||val.value;var $wrapper=$("<div>");var $div=await func.UI.screen.create_container(SESSION_ID,$root_container,nodeP,$container,paramsP,parent_infoP,jobNoP,keyP,parent_nodeP,nodeP.attributes,null,null,null,$wrapper,"");const params_obj=await get_params_obj_new(SESSION_ID,program,nodeP,paramsP.dsSessionP);let ret_init=await func.UI.screen.init(SESSION_ID,program,paramsP.screenId,_ds,$div,null,_ds.currentRecordId,jobNoP,true,params_obj.params_res,"alterXu_panel",undefined,undefined,params_obj.params_raw);ret={$new_div:ret_init,abort:true};await func.UI.screen.panel_post_render_handler(SESSION_ID,$elm,$new_div,nodeP,$div.clone(true),jobNoP);return ret}if(!val.value){return{abort:true}}await render_panel();return ret};if(is_init){let ret=await init_program();return ret}return alter_program()},"xu-render":async function($elm,val){let ret=await common_fx["xu-render"]($elm,val,true);return ret},"xu-ref":async function($elm,val){let ret=await common_fx["xu-ref"]($container,val,$container.data().xuData.xuPanelData.xuData.paramsP.dsSessionP);return ret}},[`xu-teleport`]:{to:async function($elm,val){if(!glb.new_xu_render){if(val.value){if($elm?.parent()?.data()?.xuData?.length){$elm.parent().data("xuTeleportData",[]);for(const[key,node]of Object.entries(nodeP.children)){const $teleport_elm=await func.UI.screen.render_ui_tree(SESSION_ID,$(val.value),node,parent_infoP,paramsP,jobNoP,is_skeleton,Number(key),null,node,null,$root_container);$elm.parent().data().xuTeleportData.push($teleport_elm.attr("xu-ui-id"));$teleport_elm.attr("xu-teleport-parent-id",$elm.parent().attr("xu-ui-id"))}$elm.remove()}else{$elm.data("xuTeleportData",[]).attr("hidden",true);for(const[key,node]of Object.entries(nodeP.children)){const $to_container=$(val.value);if(!$to_container?.length){return console.error(`container ${val.value} for xuTeleportData not found`)}const $teleport_elm=await func.UI.screen.render_ui_tree(SESSION_ID,$to_container,node,parent_infoP,paramsP,jobNoP,is_skeleton,Number(key),null,node,null,$root_container);$elm.data().xuTeleportData.push($teleport_elm.attr("xu-ui-id"));$teleport_elm.attr("xu-teleport-parent-id",$elm.attr("xu-ui-id"))}}}return{abort:true}}if(val.value){}return{}},"xu-render":async function($elm,val){let ret=await common_fx["xu-render"]($elm,val,true);return ret},"xu-show":async function($elm,val){let ret=await common_fx["xu-show"]($elm,val,true);return ret}}};const load_cdn=async function(resource){if(!_.isObject(resource)&&_.isString(resource)){resource={src:resource,type:"js"}}if(!_.isObject(resource)){throw new Error("cdn resource in wrong format")}return new Promise(async resolve=>{try{switch(resource.type){case"js":await func.utils.load_js_on_demand(resource.src);break;case"css":await func.utils.load_js_on_demand(resource.src);break;case"module":func.utils.load_js_on_demand(resource.src,"module");break;default:await func.utils.load_js_on_demand(resource.src);break}resolve()}catch(error){func.utils.debug_report(SESSION_ID,"xu-cdn","Fail to load: "+resource,"W");resolve()}})};const common_fx={"xu-attrs":async function($elm,val){if(!val.value)return{};if(!_.isObject(val.value))throw"xu-attrs value us not an object";for(const[attr_key,attr_val]of Object.entries(val.value)){nodeP.attributes[attr_key]=attr_val}return{}},"xu-ref":async function($elm,val,dsSession){if(!val.value)return{};func.UI.update_xu_ref(SESSION_ID,dsSession||paramsP.dsSessionP,val.value,$elm);const targetNode=$elm[0];if(!targetNode)return;const config={attributes:true,childList:true,subtree:true};const callback=(mutationList,observer)=>{func.UI.screen.refresh_xu_attributes(SESSION_ID,[val.value])};const observer=new MutationObserver(callback);observer.observe(targetNode,config);return{}},"xu-bind":async function($elm,val){if(is_skeleton)return;let val_is_reference_field=false;let _prog_id=$elm.data().xuData.paramsP.prog_id;let _dsP=$elm.data().xuData.paramsP.dsSessionP;const view_ret=await func.utils.VIEWS_OBJ.get(SESSION_ID,_prog_id);if(!view_ret)return{};let is_dynamic_field=false;let field_prop;let bind_field_id;const input_field_type=$elm.attr("type");const get_bind_field=async function(field_id){if(["_FOR_VAL","_FOR_KEY"].includes(field_id)){is_dynamic_field=true;field_prop=_ds.dynamic_fields[field_id]}else{field_prop=func.common.find_item_by_key(view_ret.progFields,"field_id",field_id);if(!field_prop){const ret_get_value=await func.datasource.get_value(SESSION_ID,field_id,_dsP);if(ret_get_value.found){_dsP=ret_get_value.dsSessionP;let _ds=SESSION_OBJ[SESSION_ID].DS_GLB[_dsP];_prog_id=_ds.prog_id;const view_ret=await func.utils.VIEWS_OBJ.get(SESSION_ID,_prog_id);if(!view_ret)return{};field_prop=func.common.find_item_by_key(view_ret.progFields,"field_id",field_id)}if(!field_prop){throw`field ${field_id} not found in the program scope`}}}return field_id};try{bind_field_id=await get_bind_field(val.value.split(".")[0]);val_is_reference_field=true}catch(err){console.error(err?.message||err);return{}}const field_changed=async function(e){var _ds=SESSION_OBJ[SESSION_ID].DS_GLB[_dsP];if(field_prop.props.fieldType==="array"&&input_field_type==="checkbox"&&val_is_reference_field){let arr_value_before_cast=_.clone((await func.datasource.get_value(SESSION_ID,bind_field_id,_dsP,_ds.currentRecordId)).ret.value);let value_from_getter=bind.getter($elm[0]);let value;if(arr_value_before_cast.includes(value_from_getter)){value=arr_value_before_cast.filter(item=>!_.isEqual(item,value_from_getter))}else{arr_value_before_cast.push(value_from_getter);value=arr_value_before_cast}let datasource_changes={[_dsP]:{[_ds.currentRecordId]:{[bind_field_id]:value}}};return await func.datasource.update(SESSION_ID,datasource_changes)}if(field_prop.props.fieldType==="array"&&input_field_type==="radio"&&val_is_reference_field){let value_from_getter=bind.getter($elm[0]);let datasource_changes={[_dsP]:{[_ds.currentRecordId]:{[bind_field_id]:[value_from_getter]}}};return await func.datasource.update(SESSION_ID,datasource_changes)}var value=await func.common.get_cast_val(SESSION_ID,"xu-bind","value",field_prop.props.fieldType,bind.getter($elm[0]));if(field_prop.props.fieldType==="object"){value=await func.common.get_cast_val(SESSION_ID,"xu-bind","value",input_field_type,bind.getter($elm[0]))}if(!_ds.currentRecordId)return;let datasource_changes={[_dsP]:{[_ds.currentRecordId]:{[bind_field_id]:value}}};await func.datasource.update(SESSION_ID,datasource_changes);const iterate_info=$elm?.data()?.xuData?.iterate_info;const reference_source_obj=iterate_info?.reference_source_obj;if(reference_source_obj){if(reference_source_obj.ret.type==="array"){if(iterate_info.iterator_val===bind_field_id){const arr_idx=Number($elm?.data()?.xuData?.iterate_info._key);const dataset_arr=await func.datasource.get_value(SESSION_ID,reference_source_obj.fieldIdP,_dsP,reference_source_obj.currentRecordId);let new_arr=_.cloneDeep(dataset_arr.ret.value);if(field_prop.props.fieldType==="object"&&val_is_reference_field){let obj_item=new_arr[arr_idx];let e_exp=val.value.replace(bind_field_id,"obj_item");let new_val=eval(e_exp+(input_field_type==="string"?`="${value}"`:`=${value}`));new_arr[arr_idx]=obj_item}else{new_arr[arr_idx]=value}let datasource_changes={[_dsP]:{[_ds.currentRecordId]:{[reference_source_obj.fieldIdP]:new_arr}}};await func.datasource.update(SESSION_ID,datasource_changes,null,true)}}}await func.datasource.update_changes_for_out_parameter(SESSION_ID,_dsP,_ds.parentDataSourceNo)};const bind=new UI_FRAMEWORK_PLUGIN.bind;bind.listener($elm[0],field_changed);const set_value=function(){let _ds=SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP];if(!_ds.currentRecordId)return;let value;try{if(val_is_reference_field){if(is_dynamic_field){value=_ds.dynamic_fields[bind_field_id].value}else{const row_idx=func.common.find_ROWID_idx(_ds,_ds.currentRecordId);value=_ds.data_feed.rows?.[row_idx]?.[bind_field_id]}if(field_prop.props.fieldType==="array"&&$elm.attr("type")==="checkbox"&&$elm.attr("value")){if(value.includes($elm.attr("value"))){value=true}else{value=false}}else if(field_prop.props.fieldType==="array"&&$elm.attr("type")==="radio"&&$elm.attr("value")){if(value.includes($elm.attr("value"))){value=$elm.attr("value")}else{value=false}}else if(field_prop.props.fieldType==="object"&&val.value.split(".").length>1){let str=val.value.replace(bind_field_id,"("+JSON.stringify(value)+")");value=eval(str)}}else{value=val.value}if(typeof value==="undefined")return;bind.setter($elm[0],value)}catch(err){console.error(err)}};$("body").on("xu-bind-refresh."+_ds.dsSession.toString(),()=>{set_value()});set_value();return{}},"xu-render":async function($elm,val,from_panel){const old_render=async function(){var value=await func.common.get_cast_val(SESSION_ID,"common fx","xu-render","bool",val.value);const init_render=function(){if(!value){var cloned_$div=$elm.clone(true);let $xurender=$("<xurender>").attr("xu-ui-id",$elm.attr("xu-ui-id")).attr("hidden",true).appendTo($container);let original_data_obj={$container:cloned_$div,nodeP:_.cloneDeep(nodeP),parent_infoP:parent_infoP,paramsP:paramsP,keyP:keyP,parent_nodeP:parent_nodeP,$root_container:$root_container};$xurender.data("xuData",cloned_$div.data().xuData);$xurender.data().xuData.original_data_obj=original_data_obj;$xurender.data().xuData.xurender_node=cloned_$div;$xurender.data().xuAttributes=nodeP.attributes||{};$elm.remove();return{abort:true}}return{}};const post_render=async function(){if(value){try{if($elm[0].tagName!=="XURENDER"&&$elm?.length){return func.events.delete_job(SESSION_ID,jobNoP)}let original_data_obj=$elm.data().xuData.original_data_obj;if(!original_data_obj){func.events.delete_job(SESSION_ID,jobNoP);return{delete_job:jobNoP}}const new_$div=await func.UI.screen.render_ui_tree(SESSION_ID,$elm,_.cloneDeep(original_data_obj.nodeP),original_data_obj.parent_infoP,original_data_obj.paramsP,jobNoP,null,original_data_obj.keyP,null,original_data_obj.parent_nodeP,null,original_data_obj.$root_container);new_$div.data().xuData.original_data_obj=original_data_obj;new_$div.data().xuData.xurender_node=$elm.clone(true);new_$div.data().xuAttributes=$elm.data().xuAttributes||{};const replace=async function(){$elm.replaceWith(new_$div);if(from_panel){const xuPanelWrapper=_.clone(new_$div.data().xuPanelWrapper);$elm.parent().data().xuPanelWrapper=xuPanelWrapper;$elm.replaceWith(new_$div.children())}if(val.fields_arr){return await func.UI.screen.refresh_xu_attributes(SESSION_ID,val.fields_arr,val.jobNoP,new_$div)}func.events.delete_job(SESSION_ID,jobNoP)};if($elm&&$(`[xu-ui-id="${$elm.attr("xu-ui-id")}"]`).length){if(new_$div.data().xuData.paramsP){return await replace()}func.events.delete_job(SESSION_ID,jobNoP)}}catch(error){func.events.delete_job(SESSION_ID,jobNoP)}return}if($elm.prop("tagName")==="XURENDER"){func.events.delete_job(SESSION_ID,jobNoP);return}let tmp_$div=$("<div>");let $xurender=$("<xurender>").attr("xu-ui-id",$elm.attr("xu-ui-id")).appendTo(tmp_$div);if($elm.data().xuData.xurender_node){$xurender.data({xuAttributes:$elm.data().xuData.xurender_node.data().xuAttributes||{},xuData:$elm.data().xuData.xurender_node.data().xuData||{}})}else{$xurender.data({xuAttributes:$elm.data().xuAttributes||{},xuData:$elm.data().xuData||{}});const original_data_obj={nodeP:_.cloneDeep($elm.data().xuData.node_org),paramsP:$elm.data().xuData.paramsP,$container:$elm.clone(true),parent_infoP:parent_infoP};$xurender.data().xuData.original_data_obj=original_data_obj}$.each($elm.find("xu-teleport"),(key,val)=>{const xuTeleportData=$(val).data().xuTeleportData||[];for(const teleported_elm_id of xuTeleportData){$(`[xu-ui-id="${teleported_elm_id}"]`).remove()}});$elm.replaceWith(tmp_$div.children());func.events.delete_job(SESSION_ID,jobNoP)};if(is_init){return init_render()}return await post_render()};const new_render=async function(){var value=await func.common.get_cast_val(SESSION_ID,"common fx","xu-render","bool",val.value);const has_xu_render_attribute=true;const has_xu_exp_render_attribute=$elm.data()?.xuData?.attr_exp_info?.["xu-render"]?true:false;const init_render=async function(){nodeP.xu_render_made=value;if(!value){if(has_xu_exp_render_attribute){return{has_xu_exp_render_attribute:has_xu_exp_render_attribute,has_xu_render_attribute:has_xu_render_attribute,xu_render_background_processing:true}}return{has_xu_render_attribute:has_xu_render_attribute,abort:true}}return{has_xu_exp_render_attribute:has_xu_exp_render_attribute,has_xu_render_attribute:has_xu_render_attribute}};const post_render=async function(){let nodeP=$container.data().xuData.node.children[keyP];nodeP.xu_render_made=value;if(value){try{const xu_render_cache_id=await get_xu_render_cache_str(SESSION_ID,paramsP.dsSessionP,Object.keys($elm.data()?.xuData?.attr_exp_info?.["xu-render"]?.fields||{}));const xu_ui_id=$elm.attr("xu-ui-id");let new_$div=UI_WORKER_OBJ?.xu_render_cache?.[xu_ui_id+xu_render_cache_id]?.$div.clone(true);let found_parent_vars=false;if(new_$div){const parent_data=get_parent_ds_fields(SESSION_ID,paramsP.dsSessionP);const parent_fields=Object.keys(parent_data);$.each(new_$div.find("*"),(key,val)=>{const _xuAttributes=$(val)?.data()?.xuAttributes;if(found_parent_vars||!_xuAttributes)return;for(const[attr_key,attr_val]of Object.entries(_xuAttributes)){if(found_parent_vars)break;for(const[key,val]of Object.entries(parent_fields)){if(attr_val.includes("@"+key)){found_parent_vars=true;break}}}})}if(!new_$div||found_parent_vars){UI_WORKER_OBJ.xu_render_cache[xu_ui_id+xu_render_cache_id]={paramsP:paramsP};nodeP.xu_render_xu_ui_id=xu_ui_id;nodeP.xu_render_cache_id=xu_render_cache_id;new_$div=await func.UI.screen.render_ui_tree(SESSION_ID,$container,nodeP,parent_infoP,paramsP,jobNoP,null,keyP,null,parent_nodeP,null,$root_container);const _$div=new_$div.clone(true);UI_WORKER_OBJ.xu_render_cache[xu_ui_id+xu_render_cache_id].$div=_$div;UI_WORKER_OBJ.xu_render_cache[xu_ui_id+xu_render_cache_id].data=_$div.data()}if(!$container.children().length){new_$div.appendTo($container)}else{let $last_elm_found=[];$.each($container.data().xuData.node.children,(item_key,item_val)=>{const $elm=func.UI.utils.find_in_element_data("xuData",$(SESSION_OBJ[SESSION_ID].root_element),"nodeid",item_val.id);if($elm.length){$last_elm_found=$elm}if(keyP==item_key){if($last_elm_found.length){new_$div.after($last_elm_found)}else{$container.prepend(new_$div)}}})}}catch(error){func.events.delete_job(SESSION_ID,jobNoP)}return}const xu_ui_id=$elm.attr("xu-ui-id");const cache_str=await get_xu_render_cache_str(SESSION_ID,paramsP.dsSessionP,Object.keys($elm.data()?.xuData?.attr_exp_info?.["xu-render"]?.fields||{}));const _$div=$elm.clone(true);UI_WORKER_OBJ.xu_render_cache[xu_ui_id+cache_str]={$div:_$div,data:_$div.data(),paramsP:paramsP};$elm.remove();func.events.delete_job(SESSION_ID,jobNoP)};if(is_init){return await init_render()}return await post_render()};if(glb.new_xu_render){return new_render()}return old_render()},"xu-show":async function($elm,val){var value=await func.common.get_cast_val(SESSION_ID,"common fx","xu-show","bool",val.value);if(value){$elm.show()}if(!value){$elm.hide()}return{}},"xu-content":async function($elm,val){try{$elm.html(val.value)}catch(error){console.warn(e)}return},"xu-text":async function($elm,val){try{$elm.text(val.value)}catch(error){console.warn(e)}return},"xu-html":async function($elm,val){try{$elm.html(val.value)}catch(error){console.warn(e)}return},"xu-for":async function($elm,data){if(parent_infoP?.iterate_info)return{};if(!data.value)return{};try{let arr=data.value;let reference_source_obj;const _progFields=await func.datasource.get_progFields(SESSION_ID,paramsP.dsSessionP);let view_field_obj=func.common.find_item_by_key(_progFields,"field_id",data.value);if(view_field_obj){reference_source_obj=await func.datasource.get_value(SESSION_ID,data.value,paramsP.dsSessionP);arr=reference_source_obj?.ret?.value}else{if(typeof data.value==="string"){arr=eval(data.value.replaceAll("\\",""))}if(typeof arr==="number"){arr=Array.from(Array(arr).keys())}}const custom_iterator_key=$elm.data().xuData.iterator_key;const custom_iterator_val=$elm.data().xuData.iterator_val;let iterator_key=custom_iterator_key;let iterator_val=custom_iterator_val;let is_key_dynamic_field,is_val_dynamic_field;if(!custom_iterator_key){is_key_dynamic_field=true;iterator_key="_FOR_KEY"}if(!custom_iterator_val){is_val_dynamic_field=true;iterator_val="_FOR_VAL"}var i=0;for await(let[_key,_val]of Object.entries(arr)){if(_.isArray(arr)){_key=Number(_key)}const set_value=async function(is_dynamic_field,currentRecordId,field_id,value){if(is_dynamic_field){func.datasource.add_dynamic_field_to_ds(SESSION_ID,paramsP.dsSessionP,field_id,value)}else{const _progFields=await func.datasource.get_progFields(SESSION_ID,paramsP.dsSessionP);let view_field_obj=func.common.find_item_by_key(_progFields,"field_id",field_id);if(view_field_obj){let _ds=SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP];try{const row_idx=func.common.find_ROWID_idx(_ds,currentRecordId);_ds.data_feed.rows[row_idx][field_id]=value}catch(err){console.error(err)}}else{console.error("field not exist in dataset for xu-for method")}}};var currentRecordId=SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP].currentRecordId.toString();await set_value(is_key_dynamic_field,currentRecordId,iterator_key,_key);await set_value(is_val_dynamic_field,currentRecordId,iterator_val,_val);var iterate_info={_val:_val,_key:_key,iterator_key:iterator_key,iterator_val:iterator_val,is_key_dynamic_field:is_key_dynamic_field,is_val_dynamic_field:is_val_dynamic_field,reference_source_obj:reference_source_obj};let _parent_info=_.cloneDeep(parent_infoP)||{};_parent_info.iterate_info=iterate_info;const $divP=await func.UI.screen.render_ui_tree(SESSION_ID,$container,nodeP,_parent_info,paramsP,jobNoP,null,i,null,nodeP,null,$root_container);$.each($divP.children(),function(key,val){if($(val)?.data()?.xuData){$(val).data().xuData.iterate_info=iterate_info}});i++}$elm.remove();return{abort:true}}catch(e){console.error(" Iterator Arr parse error");return{abort:true}}},"xu-for-key":async function($elm,val){$elm.data().xuData.iterator_key=val.value;return{}},"xu-for-val":async function($elm,val){$elm.data().xuData.iterator_val=val.value;return{}},"xu-class":async function($elm,val){try{const classes_string=val.value;const classes_obj=_.isString(classes_string)?JSON.parse(classes_string):_.defaults(classes_string,{});for await(const[cla,cond]of Object.entries(classes_obj)){let res=await func.expression.get(SESSION_ID,cond,paramsP.dsSessionP,"UI Attr EXP",$elm.data().xuData.currentRecordId,null,null,null,null,null,$elm.data().xuData.iterate_info);if(res.result){$elm.addClass(cla)}else{$elm.removeClass(cla)}$elm.data().xuData.debug_info.attribute_stat["xu-class"]=$elm.attr("class")}return{}}catch(e){console.warn("parse error:"+val.value);return{abort:true}}},"xu-exp":async function($elm,val){let exp=val.value===null?true:val.value;let exp_ret=await func.expression.get(SESSION_ID,exp,paramsP.dsSessionP,"UI Attr EXP",SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP].currentRecordId,null,null,null,null,null,$elm.data().xuData.iterate_info);let value=func.UI.screen.fix_val_defaults(val.key,exp_ret.result);var new_val={key:val.key,value:value};if(nodeP.tagName.substr(0,3)==="xu-"){if(tag_fx[nodeP.tagName][new_val.key]){return await tag_fx[nodeP.tagName][new_val.key]($elm,new_val)}console.warn(`attribute ${new_val.key} not found for ${nodeP.tagName}`);return{}}if(!$elm.data().xuData)return;$elm.data().xuData.debug_info.attribute_stat[new_val.key]=new_val.value;if(typeof new_val.value==="undefined"||new_val.value===null){return{}}if(glb.solid_attributes.includes(new_val.key)&&!new_val.value){return{}}if(new_val.key.substr(0,2)==="xu"){return await common_fx[new_val.key]($elm,new_val)}$elm.attr(new_val.key,($elm.attr(new_val.key)||"")+new_val.value);return{}},"xu-on":async function($elm,val){CLIENT_ACTIVITY_TS=Date.now();const trigger=val.key.split("xu-on:")[1].toLowerCase();$elm.on(trigger,async function(evt){const _$elm=$(evt.currentTarget);if(_.isEmpty(_$elm.data().xuAttributes))return;for await(const[key,val]of Object.entries(_$elm.data().xuAttributes["xu-on:"+evt.type])){if(!_.isEmpty(val.props.condition)){const expCond=await func.expression.get(SESSION_ID,val.props.condition,paramsP.dsSessionP,"condition",paramsP.recordid);if(!expCond.result)continue}if(val.event_modifiers&&evt[val.event_modifiers]){evt[val.event_modifiers]()}if(val.workflow){for await(const[key2,val2]of Object.entries(val.workflow)){if(!val2.data.enabled)continue;func.events.add_to_queue(SESSION_ID,"element event",val2.id,evt.type,val2.data.action,val2.data.name,null,_$elm.attr("xu-ui-id"),null,evt,null,null,null,paramsP.dsSessionP,null,null,null,evt.type,val2.data.name,null,null,val2,null,null,null,null,null,null)}}}});return{}},"xu-script":async function($elm,val){var checkExist=setInterval(async function(){if($elm.is(":visible")){try{const fn=`async (el)=>{${val.value} };`;var res=eval(fn);await res($elm[0])}catch(e){eval(val.value)}clearInterval(checkExist)}},100);return{}},"xu-style-global":async function($elm,val){$("head").append(`<style>${val.value}</style>`);return{}},"xu-style":async function($elm,val){var cssString=val.value;var parser=new cssjs;var parsed=parser.parseCSS(cssString);var xuUiId=`[xu-ui-id="${$elm.attr("xu-ui-id")}"]`;$.each(parsed,function(key,val){var selectors_arr=val.selector.split(",");$.each(selectors_arr,function(key2,val2){selectors_arr[key2]=`${xuUiId} ${val2}, ${xuUiId}${val2}`});val.selector=selectors_arr.join(",")});var newCSSString=parser.getCSSForEditor(parsed);$("head").append(`<style>${newCSSString}</style>`);return{}},"xu-cdn":async function($elm,val){for await(const[key,resource]of Object.entries(val.value)){await load_cdn(resource)}return{}},"xu-ui-plugin":async function($elm,val){var _session=SESSION_OBJ[SESSION_ID];for await(const[plugin_name,value]of Object.entries(val.value)){const _plugin=APP_OBJ[_session.app_id]?.app_plugins_purchased?.[plugin_name];if(_plugin?.installed&&_plugin?.manifest?.["runtime.mjs"]?.exist&&_plugin?.manifest?.["index.mjs"]?.exist&&value.enabled){if(_plugin?.manifest?.["runtime.mjs"].dist&&_plugin?.manifest?.["runtime.mjs"]?.css){const plugin_runtime_css_url=await func.utils.get_plugin_npm_cdn(SESSION_ID,plugin_name,"dist/runtime.css");func.utils.load_css_on_demand(plugin_runtime_css_url)}const plugin_index_src=await func.utils.get_plugin_npm_cdn(SESSION_ID,plugin_name,`${_plugin.manifest["index.mjs"].dist?"dist/":""}index.mjs`);const plugin_index_resources=await import(plugin_index_src);let properties=_.cloneDeep(plugin_index_resources.properties);for await(let[prop_name,prop_val]of Object.entries(properties)){prop_val.value=value?.attributes?.[prop_name];if(value?.attributes?.[`xu-exp:${prop_name}`]){const res=await func.expression.get(SESSION_ID,value?.attributes?.[`xu-exp:${prop_name}`],paramsP.dsSessionP,"UI Attr EXP");prop_val.value=res.result}}const plugin_runtime_src=await func.utils.get_plugin_npm_cdn(SESSION_ID,plugin_name,`${_plugin.manifest["runtime.mjs"].dist?"dist/":""}runtime.mjs`);const plugin_runtime_resources=await import(plugin_runtime_src);if(plugin_runtime_resources.cdn&&typeof _.isArray(plugin_runtime_resources.cdn)){for await(const resource of plugin_runtime_resources.cdn){await load_cdn(resource)}}if(plugin_runtime_resources.fn){await plugin_runtime_resources.fn(plugin_name,$elm?.[0],properties)}}}return{}},"xu-store":async function($elm,val){try{const fields_obj=JSON5.parse(val.value);for(const[field_id,value]of Object.entries(fields_obj)){func.datasource.add_dynamic_field_to_ds(SESSION_ID,paramsP.dsSessionP,field_id,value)}}catch(err){console.error(err)}return{}},"xu-viewport":async function($elm,val){return{}}};if(nodeP.tagName.substr(0,3)==="xu-"){if(xu_func==="xu-exp"){return common_fx[xu_func]($elm,val)}if(tag_fx?.[nodeP.tagName]?.[xu_func]){let ret=await tag_fx[nodeP.tagName][xu_func]($elm,val);return ret}console.warn(`attribute ${xu_func} not found for ${nodeP.tagName}`);return{}}if(_.isEmpty($elm.data())){return{}}if(!$elm.data().xuData.debug_info.attribute_stat){$elm.data().xuData.debug_info.attribute_stat={}}if(xu_func!=="xu-exp"){$elm.data().xuData.debug_info.attribute_stat[xu_func]=val.value}try{if(!common_fx[xu_func]){console.warn("invalid xu-tag",xu_func,error);return{}}return await common_fx[xu_func]($elm,val)}catch(error){debugger}};func.UI.screen.fix_val_defaults=function(key,val){var ret=val;if(key==="xu-render"&&(typeof val==="undefined"||val===null||val==="")){ret=true}if(key==="xu-show"&&(typeof val==="undefined"||val===null||val==="")){ret=true}return ret};func.UI.screen.set_attributes_new=async function(SESSION_ID,is_skeleton,$root_container,nodeP,$container,paramsP,parent_infoP,jobNoP,keyP,parent_nodeP,$elm,is_init,execute_attributes=[],refreshed_ds){var done_exp=[];const _ds=SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP];if(!_ds)return{abort:true};const get_attr_value=async function(key){let ret=func.UI.screen.fix_val_defaults(key,nodeP.attributes[key]);if(nodeP?.attributes?.hasOwnProperty(`xu-exp:${key}`)){ret=await get_xuExp(key)}return ret};const get_xuExp=async function(attrib){if(is_skeleton)return;if(glb.new_xu_render){let _xuData=$elm.data().xuData;if(!_xuData.attr_exp_info){_xuData.attr_exp_info={}}}const attr=`xu-exp:${attrib}`;if(!nodeP?.attributes?.hasOwnProperty(attr))return;var exp=nodeP.attributes[attr];var res=await func.expression.get(SESSION_ID,exp,paramsP.dsSessionP,"UI Attr EXP",_ds.currentRecordId);if(glb.new_xu_render){_xuData.attr_exp_info[attrib]=res}done_exp.push(attr);return res.result};var _ret={};if(nodeP.type!=="element"||!nodeP.attributes)return _ret;for(let[key,val]of Object.entries(nodeP.attributes)){if(key.substring(0,6)==="xu-exp"){if(_.isEmpty(val)){delete nodeP.attributes[key];continue}const clean_key=key.split(":")[1];if(typeof nodeP.attributes[clean_key]!=="undefined"){delete nodeP.attributes[clean_key]}}if(glb.attr_abbreviations_arr.includes(key)){nodeP.attributes[`xu-on:${key.substring(3)}`]=[{handler:"custom",props:{},event:[{id:Date.now(),data:{action:"update",name:{value:val},enabled:true},props:{}}]}];delete nodeP.attributes[key]}}for(let[key,val]of Object.entries(nodeP.attributes)){val=func.UI.screen.fix_val_defaults(key,val);if(typeof val==="undefined"||val===null){delete nodeP.attributes[key]}if(glb.solid_attributes.includes(key)&&!val){delete nodeP.attributes[key]}}if(nodeP?.attributes?.["xu-attrs"]||nodeP?.attributes?.["xu-exp:xu-attrs"]){const attr="xu-attrs";let ret=await func.UI.screen.execute_xu_functions(SESSION_ID,is_skeleton,$root_container,nodeP,$container,paramsP,parent_infoP,jobNoP,keyP,parent_nodeP,attr,$elm,{key:attr,value:await get_attr_value(attr)},is_init)}if(!_.isEmpty(nodeP.attributes)){for await(const[key,attr]of Object.entries(glb.run_xu_before)){if(_ret.abort||$container?.data()?.xuData?.pending_to_delete)break;if(glb.html5_events_handler.includes(attr)||execute_attributes.includes(attr)){continue}if(!nodeP?.attributes?.hasOwnProperty(attr)&&!nodeP?.attributes?.hasOwnProperty(`xu-exp:${attr}`)){continue}if(!nodeP.attributes[`xu-exp:${attr}`]&&nodeP?.attributes?.hasOwnProperty(attr)&&typeof func.UI.screen.fix_val_defaults(attr,nodeP.attributes[attr])==="undefined"){continue}let ret=await func.UI.screen.execute_xu_functions(SESSION_ID,is_skeleton,$root_container,nodeP,$container,paramsP,parent_infoP,jobNoP,keyP,parent_nodeP,attr,$elm,{key:attr,value:await get_attr_value(attr)},is_init);_ret=_.assignIn(_ret,ret)}}for await(const[key,val]of Object.entries(nodeP.attributes)){if(_ret.abort||$container?.data()?.xuData?.pending_to_delete)break;if(glb.html5_events_handler.includes(key)||execute_attributes.includes(key)){continue}const new_key=key.split(":")[0];if(nodeP.tagName!=="xu-panel"&&nodeP.tagName!=="xu-teleport"&&(new_key.substr(0,2)!=="xu"||new_key.substr(2,1)!=="-")){try{$elm.get(0).setAttribute(key,val)}catch(err){console.error(err.message)}continue}try{if($elm?.data()?.xuAttributes){$elm.data().xuAttributes[key]=val}}catch(error){debugger;console.error(error)}if(new_key==="xu-exp"||nodeP.attributes["xu-exp:"+new_key]||glb.run_xu_before.includes(new_key)||glb.run_xu_after.includes(new_key)){continue}if(new_key==="xu-on"){let ret=await func.UI.screen.execute_xu_functions(SESSION_ID,is_skeleton,$root_container,nodeP,$container,paramsP,parent_infoP,jobNoP,keyP,parent_nodeP,"xu-on",$elm,{key:key,value:await get_attr_value(key)},is_init,refreshed_ds);_ret=_.assignIn(_ret,ret);continue}let ret=await func.UI.screen.execute_xu_functions(SESSION_ID,is_skeleton,$root_container,nodeP,$container,paramsP,parent_infoP,jobNoP,keyP,parent_nodeP,new_key,$elm,{key:key,value:await get_attr_value(key)},is_init,refreshed_ds);_ret=_.assignIn(_ret,ret)}for await(const[key,val]of Object.entries(nodeP.attributes)){if(_ret.abort||$container?.data()?.xuData?.pending_to_delete)break;const attr=key.split("xu-exp:")[1];if(!attr){continue}if(glb.html5_events_handler.includes(attr)||execute_attributes.includes(attr))continue;if(done_exp.includes(key)){continue}let ret=await func.UI.screen.execute_xu_functions(SESSION_ID,is_skeleton,$root_container,nodeP,$container,paramsP,parent_infoP,jobNoP,keyP,parent_nodeP,"xu-exp",$elm,{key:attr,value:val},true,refreshed_ds);_ret=_.assignIn(_ret,ret)}for await(const[key,attr]of Object.entries(glb.run_xu_after)){if($container?.data()?.xuData?.pending_to_delete)break;if(glb.html5_events_handler.includes(attr)||execute_attributes.includes(attr))continue;if(!nodeP.attributes||!nodeP.attributes[attr]&!nodeP.attributes[`xu-exp:${attr}`])continue;let ret=await func.UI.screen.execute_xu_functions(SESSION_ID,is_skeleton,$root_container,nodeP,$container,paramsP,parent_infoP,jobNoP,keyP,parent_nodeP,attr,$elm,{key:attr,value:await get_attr_value(attr)},is_init,refreshed_ds);_ret=_.assignIn(_ret,ret)}for await(const[key,val]of Object.entries(nodeP.attributes)){if($container?.data()?.xuData?.pending_to_delete)break;if(!glb.html5_events_handler.includes(key))break;$elm.attr(key,await get_xuExp(key))||val}return _ret};func.UI.screen.panel_post_render_handler=async function(SESSION_ID,$container,$wrapper,nodeP,$panel_div,jobNoP){const _container_ds=SESSION_OBJ[SESSION_ID].DS_GLB[$container.data().xuData.paramsP.dsSessionP];const _ds=SESSION_OBJ[SESSION_ID].DS_GLB[$wrapper.data().xuData.paramsP.dsSessionP];const find_old_panels_elements=function(){return func.UI.utils.find_in_element_data("xuPanelData",$container.parent(),"xu-ui-id",$container.data()?.xuPanelData?.xu_panel_xu_ui_id)};var $old_panel_div=find_old_panels_elements();const set_xuPanelData_to_the_new_rendered_items=()=>{$container.data().xuPanelWrapper={isWrapper:true,panelXuAttributes:_.clone($wrapper.data().xuAttributes),panelDivData:_.clone($wrapper.data())};$container.attr("xu-panel-wrapper-id",$wrapper.attr("xu-ui-id"));$.each($wrapper.children(),function(key,val){if(!$(val).data().xuPanelData){$(val).data().xuPanelData={}}$(val).data().xuPanelData.parent_element_ui_id=$old_panel_div?.length?$container.parent().data().xuData.ui_id:$container.data().xuData.ui_id;$(val).data().xuPanelData.xu_panel_xu_ui_id=(nodeP.xu_tree_id||nodeP.id)+"-"+_container_ds?.currentRecordId;$(val).data().xuPanelData.node=nodeP;$(val).data().xuPanelData.$panel_div=$panel_div.clone(true)})};set_xuPanelData_to_the_new_rendered_items();if($old_panel_div?.length){$($old_panel_div[0]).after($wrapper.children())}else{$.each($wrapper.children(),function(key,child){$.each($container.children(),function(key,elm){if($(elm)?.data()?.xuData&&$(elm)?.data()?.xuData?.elem_key===$(child)?.data()?.xuData?.elem_key){$(elm).remove()}});$container.append($(child))})}if(!$wrapper.data()?.xuData?.dsSession)return;if($old_panel_div?.length){$container.parent().data().xuData.paramsP.dsSessionP=_ds.parentDataSourceNo}else{$container.data().xuData.paramsP.dsSessionP=_ds.parentDataSourceNo}if($old_panel_div?.length){$old_panel_div.remove()}return jobNoP};const generate_xu_ui_id=async function(SESSION_ID,nodeP,$container,paramsP,keyP){const _paramsP=_.cloneDeep(paramsP);var _ds=SESSION_OBJ[SESSION_ID].DS_GLB[_paramsP.dsSessionP];const currentRecordId=$container?.data?.()?.xuData?.recordid||(_ds?_ds.currentRecordId:"");const key_path=`${$container?.data()?.xuData?.key_path||"0"}-${keyP||"0"}`;const elem_key=`${nodeP.xu_tree_id||nodeP.id}-${key_path}-${currentRecordId}`;let ui_id=`${nodeP.id}-${elem_key}-${_paramsP?.dsSessionP?.toString()||""}`;const new_ui_id=await func.common.sha256(ui_id);return new_ui_id};func.UI.screen.create_container=async function(SESSION_ID,$root_container,nodeP,$container,paramsP,parent_infoP,jobNoP,keyP,parent_nodeP,prop,classP,elem_propP,div_typeP,$appendToP,attr_str,is_placeholder){const _paramsP=_.cloneDeep(paramsP);var _ds=SESSION_OBJ[SESSION_ID].DS_GLB[_paramsP.dsSessionP];var $appendTo=$container;if($appendToP)$appendTo=$appendToP;if(!$appendTo||!$appendTo.length)return null;var div="div";if(div_typeP)div=div_typeP;var items=[];if(nodeP.children)items=nodeP.children.map(function(val){return val.xu_tree_id||val.id});var currentRecordId=$container?.data?.()?.xuData?.recordid||(_ds?_ds.currentRecordId:"");try{const key_path=`${$container?.data()?.xuData?.key_path||"0"}-${keyP||"0"}`;const elem_key=`${nodeP.xu_tree_id||nodeP.id}-${key_path}-${currentRecordId}`;var $div;if(div==="svg"){const draw_svg=function(element){const get_tag_str=function(element,prop,val){let class_str="";let attr_str="";for(const[key,val]of Object.entries(prop)){if(key.substr(0,2)!=="xu"){attr_str+=` ${key}="${val}" `}}if(element==="svg"){return`<${element}  ${attr_str} > `}let ret="";if(val?.children?.length){ret=iterate_svg(val)}return`<${element} ${class_str} ${attr_str} > ${ret} </${element}>`};let svg_str=get_tag_str(element,prop);let inner_str="";const iterate_svg=function(node){let ret="";if(node.children){for(let val of node.children){let prop=val.attributes;ret+=get_tag_str(val.tagName,prop,val)}}return ret};inner_str=iterate_svg(nodeP);$div=$(svg_str+inner_str+"</svg>").appendTo($appendTo)};draw_svg(div_typeP)}else{$div=$(`<${div} ${attr_str?attr_str:""}>`)}const new_ui_id=await generate_xu_ui_id(SESSION_ID,nodeP,$container,paramsP,keyP);$div.attr("xu-ui-id",new_ui_id).data({xuData:{prog_id:_paramsP.prog_id,nodeid:nodeP.id,ui_type:nodeP.tagName,recordid:currentRecordId,paramsP:_paramsP,key:keyP,key_path:key_path,screenId:_paramsP.screenId,parent_container:$container?.attr("id"),elem_key:elem_key,properties:prop,node:nodeP,node_org:_.cloneDeep(nodeP),is_panelP:_paramsP.is_panelP,ui_id:new_ui_id,elem_prop:elem_propP,debug_info:{id:nodeP.id,parent_id:$container?.data()?.xuData?.ui_id,items:items},parent_node:parent_nodeP,currentRecordId:currentRecordId,$root_container:$root_container,parent_element_ui_id:$container?.data()?.xuData?.ui_id},xuAttributes:{}});if(is_placeholder){$div.addClass("display_none")}if(div_typeP!=="svg"){$div.appendTo($appendTo)}}catch(e){console.error(e)}if(parent_infoP?.iterate_info){$div.data().xuData.iterate_info=parent_infoP.iterate_info}if(classP)$div.addClass(classP);return $div};func.UI.screen.execute_screen_ready_events=async function(SESSION_ID,paramsP,sourceP,$div,jobNoP,$div_objP){var _ds=SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP];if(!_ds)return;var viewEventExec_arr=[];const execute_view_events=async function(sourceP){for await(const val of viewEventExec_arr){cond=val.eventInfo.data.enabled;if(val.expression){expCond=await func.expression.get(SESSION_ID,val.expression,paramsP.dsSessionP,"condition",paramsP.rowIdP);cond=expCond.result}if(cond){await func.events.execute(SESSION_ID,null,val.eventId,val.triggerId,val.eventInfo.data.action,val.eventInfo.data.name,null,null,null,null,val.eventInfo.data.action,null,paramsP.dsSessionP,val.eventId,sourceP+" event",true,null,null,paramsP.dsSessionP,null,null,val.eventInfo,null,null,_ds.prog_id,_ds.nodeId,_ds.parentDataSourceNo,$div);var fields_to_refresh=[];try{var current_record_id=_ds.currentRecordId}catch(e){console.error(e)}if(_ds?.data_feed?.form_fields_changed?.[current_record_id]){$.each(_ds.data_feed.form_fields_changed[current_record_id],function(key,val){fields_to_refresh.push(key)});var containerId=_ds.containerId;var $container=$("#"+containerId);if($container?.data()?.xuData?.is_mobile_modal||$container?.data()?.xuData?.params?.is_mobile_page){await func.UI.screen.refresh_container(SESSION_ID,"init",fields_to_refresh,$container,paramsP.dsSessionP,null)}else{$container.trigger(containerId+".refresh",["init",fields_to_refresh])}if($div_objP){await func.UI.screen.refresh_container(SESSION_ID,"init",fields_to_refresh,$div_objP,paramsP.dsSessionP,null)}}}continue}};const get_view_events_count=async function(typeP){const _prog=await func.utils.VIEWS_OBJ.get(SESSION_ID,_ds.prog_id);viewEventExec_arr=[];if(!_prog.progEvents||_.isEmpty(_prog.progEvents)){return 0}for await(const event_obj of _prog.progEvents){if(event_obj.data.type!==typeP)continue;if(_.isEmpty(event_obj.workflow))continue;if(event_obj.data.condition){let res=await func.expression.get(SESSION_ID,event_obj.data.condition,paramsP.dsSessionP,"condition",paramsP.rowIdP,null,null,null,null,event_obj);if(!res.result){continue}}for await(const trigger_obj of event_obj.workflow){var expression=undefined;var cond=undefined;if(!trigger_obj.data.enabled){continue}cond=true;if(trigger_obj.props.condition)expression=trigger_obj.props.condition;var expCond={};if(expression){expCond=await func.expression.get(SESSION_ID,expression,paramsP.dsSessionP,"condition",paramsP.rowIdP,trigger_obj.data.type);cond=expCond.result;expCond.conditional=true}if(!trigger_obj.data.action){func.utils.debug_report(SESSION_ID,"get_view_events_count",`Error initiating ${typeP} prog: ${_ds.viewSourceDesc} reason: missing action`,"E");break}if(!glb.REFERENCE_LESS_FUNCTIONS.includes(trigger_obj.data.action)&&!trigger_obj.data.name?.prog){func.utils.debug_report(SESSION_ID,"get_view_events_count",`Error initiating ${typeP} prog: ${_ds.viewSourceDesc} reason: missing reference`,"E");break}viewEventExec_arr.push({eventInfo:trigger_obj,eventId:event_obj.id,triggerId:trigger_obj.id,expression:expression})}}return viewEventExec_arr.length};try{let count=await get_view_events_count("screen_ready");if(!count)return;return await execute_view_events(sourceP)}catch(error){debugger}};func.UI.screen.screen_loading_done=async function(SESSION_ID,paramsP,$div,jobNoP){let retries=0;let interval=setInterval(()=>{if(!$(SESSION_OBJ[SESSION_ID].root_element).find(`[xu-ui-id=${$div.attr("xu-ui-id")}]`).length&&!$(SESSION_OBJ[SESSION_ID].root_element).find(`[xu-panel-wrapper-id=${$div.attr("xu-ui-id")}]`).length&&!$div.attr("xu-ui-id")&&$div.attr("xu-ui-id")){retries++;if(retries>100){console.warn("deadlock detected for screen ready")}else{return $div}}clearInterval(interval);func.UI.screen.execute_screen_ready_events(SESSION_ID,paramsP,paramsP.screenInfo.properties?.renderType,$div,jobNoP);var _session=SESSION_OBJ[SESSION_ID];func.events.delete_job(SESSION_ID,jobNoP);func.UI.utils.screen_blocker(false,paramsP.prog_id+(paramsP.sourceScreenP?"_"+paramsP.sourceScreenP:""));if(_session.prog_id===paramsP.prog_id){_session.system_ready=true;if(_session.engine_mode==="live_preview"&&STUDIO_PEER_CONN_SEND_METHOD){STUDIO_PEER_CONN_SEND_METHOD({service:"system_ready",data:{},id:STUDIO_PEER.id,source:"runtime",session_id:SESSION_ID,app_id:_session.app_id,gtp_token:_session.gtp_token,app_token:_session.app_token})}}},100);return $div};func.UI.screen.render_ui_tree=async function(SESSION_ID,$container,nodeP,parent_infoP,paramsP,jobNoP,is_skeleton,keyP,refreshed_ds,parent_nodeP,check_existP,$root_container){if(!is_skeleton){var _session=SESSION_OBJ[SESSION_ID];var _ds=_session.DS_GLB[paramsP.dsSessionP]}var prop;try{prop=nodeP.attributes}catch(error){}var is_mobile=glb.MOBILE_ARR.includes(paramsP.screenInfo.properties?.menuType)?true:false;const get_element_info=function(){var ret={};let currentRecordId=_ds?.currentRecordId||"";let $div=func.UI.utils.find_in_element_data("xuData",$container.parent(),"nodeid",nodeP.id);$.each($div,function(key,val){if($(val)?.data().xuData?.recordid===currentRecordId&&$(val)?.data().xuData?.key===keyP&&$(val)?.prop("tagName")!=="XURENDER"){ret={div:$div}}});return ret};const init=async function(){var ret=true;if(!nodeP)ret=false;return ret};const debug=function(is_errorP,error_descP){func.utils.debug.log(SESSION_ID,paramsP.prog_id+"_"+nodeP.id_org+"_ui_prop",{module:"gui",action:"init",prop:nodeP.id,details:error_descP,result:null,error:is_errorP,source:_ds?.tree_obj?.menuName||"",fields:null,type:null,prog_id:paramsP.prog_id,dsSession:null})};const open_modal=async function($div){const modal_id="app_modal-"+paramsP.dsSessionP.toString();var xu_modal_controller=document.querySelector("xu-modal-controller");if(!xu_modal_controller){func.UI.component.create_app_modal_component(SESSION_ID,modal_id);xu_modal_controller=document.querySelector("xu-modal-controller")}var controller_params=$(xu_modal_controller).data("xuControllerParams");if(!controller_params){controller_params={}}var params={menuTitle:paramsP.screenInfo.properties?.menuTitle,screenId:paramsP.screenId,$dialogDiv:$div.children(),$container:$container,dsSession:paramsP.dsSessionP};controller_params[modal_id]=params;$(xu_modal_controller).data("xuControllerParams",controller_params);const modalController=await new UI_FRAMEWORK_PLUGIN.modal;if(!APP_MODAL_OBJ[modal_id]){const modal=await modalController.create(SESSION_ID,modal_id,paramsP.screenInfo,close_modal);APP_MODAL_OBJ[modal_id]=modal}else{$(modal_id).empty()}await modalController.init(SESSION_ID,modal_id);return $div};const close_modal=async function(modal_id){delete APP_MODAL_OBJ[modal_id];const xu_modal_controller=document.querySelector("xu-modal-controller");var params=$(xu_modal_controller).data().xuControllerParams[modal_id];if(params&&params.$container){await func.UI.screen.validate_exit_events(SESSION_ID,params.$container.data().xuData.paramsP,null);func.datasource.clean_all(SESSION_ID,params.dsSession)}};const close_all_modals=function(){$.each(APP_MODAL_OBJ,function(key,val){if(val){UI_FRAMEWORK_PLUGIN.modal.close(key)}})};const open_popover=async function($div){const xu_popover_controller=func.UI.component.create_app_popover_component(SESSION_ID);$(xu_popover_controller).data("xuControllerParams",{menuTitle:paramsP.screenInfo.properties?.menuTitle,screenId:paramsP.screenId,$dialogDiv:$div.children(),$container:$container});const popover=new UI_FRAMEWORK_PLUGIN.popover(SESSION_ID);await popover.open(SESSION_ID);CURRENT_APP_POPOVER=popover;return;popoverController.create({component:"xu-popover-content-"+SESSION_ID,event:ELEMENT_CLICK_EVENT,translucent:true}).then(modal=>{modal.present().then(()=>{CURRENT_APP_POPOVER=modal;if(callbackP)callbackP($div)})})};const iterate_child=async function($divP,nodeP,parent_infoP,$root_container,before_record_function){if(!is_mobile&&nodeP.busy)return;nodeP.busy=true;const done=async function($divP){setTimeout(function(){nodeP.busy=false},1e3);return $divP};if(!nodeP||!nodeP.children){return await done($divP)}if(before_record_function){await before_record_function()}if(nodeP?.children?.length){let node_promises=[];for(const[key,val]of Object.entries(nodeP.children)){node_promises.push(new Promise(async(resolve,reject)=>{const ret=await func.UI.screen.render_ui_tree(SESSION_ID,$divP,nodeP.children[key],parent_infoP,paramsP,jobNoP,is_skeleton,Number(key),null,nodeP,null,$root_container);resolve()}))}await Promise.all(node_promises)}return await done($divP)};const _$=function($elm){try{const id=$elm.attr("xu-ui-id");if(!id||!glb.DEBUG_MODE)return $elm;const $el=$(`[xu-ui-id="${id}"]`);if($el.length>1){console.warn("Multiple elements for xu-ui-id: "+id,$el)}return $($el[0])}catch(e){console.error(e)}};const hover_in=function($div,e){if(is_skeleton||e&&(EXP_BUSY||UI_WORKER_OBJ.jobs.length))return;CLIENT_ACTIVITY_TS=Date.now();if(_$($container)?.data()?.xuData?.debug_info)_$($container).data().xuData.debug_info.hover_item=$div.attr("xu-ui-id");if(!_ds)return;let attributes={};$.each($div[0].attributes,function(index,attr){attributes[attr.name]=attr.value});_session.DS_GLB[0].data_system.SYS_OBJ_WIN_ELEMENT_HOVERED_ATTRIBUTES=attributes;if(!$div.data()?.xuData)return;const _iterate_info=$div.data().xuData.iterate_info;if(_iterate_info){if(_iterate_info.is_key_dynamic_field){_ds.dynamic_fields[_iterate_info.iterator_key].value=_iterate_info._key}else{try{const row_idx=func.common.find_ROWID_idx(_ds,_ds.currentRecordId);_ds.data_feed.rows[row_idx][_iterate_info.iterator_key]=_iterate_info._key}catch(err){console.error(err)}}if(_iterate_info.is_val_dynamic_field){_ds.dynamic_fields[_iterate_info.iterator_val].value=_iterate_info._val}else{try{const row_idx=func.common.find_ROWID_idx(_ds,_ds.currentRecordId);_ds.data_feed.rows[row_idx][_iterate_info.iterator_val]=_iterate_info._val}catch(err){console.error(err)}}}if($div&&_$($div)&&_ds&&paramsP.renderType==="grid"){func.UI.worker.add_to_queue(SESSION_ID,"gui event","update_datasource",{currentRecordId:_$($div).data().xuData.currentRecordId},null,null,paramsP.dsSessionP)}const set_value=function(field_id,value){var currentRecordId=_$($div).data().xuData.currentRecordId;func.UI.worker.add_to_queue(SESSION_ID,"gui event","update_datasource",{currentRecordId:currentRecordId,field_id:field_id,field_value:value},null,null,paramsP.dsSessionP)};if($div?.data()?.iterate_info){var data=$div.data().xuData.iterate_info;if(data.iterator_key){set_value(data.iterator_key,data._key)}if(data.iterator_val){set_value(data.iterator_val,data._val)}}};const hover_out=function(){if(is_skeleton)return;CLIENT_ACTIVITY_TS=Date.now();if(_$($container)?.data()?.xuData?.debug_info){_$($container).data().xuData.debug_info.hover_item=null}if(_ds?.data_system){SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system.SYS_OBJ_WIN_ELEMENT_HOVERED_ATTRIBUTES={}}};const render_screen_type=async function($div){const set_call_screen_properties_values=async function(ui_framework){params.properties={};const get_values=async function(property){var property_value=paramsP?.screenInfo?.properties?.[property]||paramsP?.screenInfo?.properties?.frameworkProperties?.[property];if(paramsP?.call_screen_propertiesP){if(paramsP.call_screen_propertiesP?.[property]){property_value=paramsP.call_screen_propertiesP[property]}if(paramsP.call_screen_propertiesP[`xu-exp:${property}`]){property_value=(await func.expression.get(SESSION_ID,paramsP.call_screen_propertiesP[`xu-exp:${property}`],paramsP.dsSessionP,property)).result}}return property_value};params.properties["name"]=await get_values("menuTitle");if(await ui_framework?.properties()){for await(const[key,val]of Object.entries(await ui_framework.properties())){params.properties[key]=await get_values(key)}}};var $div_content=$div.children();$.each($div_content,function(key,val){if(!$(val)?.data()?.xuData?.parent_container){return true}$(val).data().xuData.parent_container=$div.data().xuData.parent_container});let $ret=$div;var $nav=$(SESSION_OBJ[SESSION_ID].root_element).find("xu-nav");var params;switch(paramsP.screen_type){case"modal":const modal_id="app_modal-"+paramsP.dsSessionP.toString();var xu_modal_controller=document.querySelector("xu-modal-controller");if(!xu_modal_controller){func.UI.component.create_app_modal_component(SESSION_ID,modal_id);xu_modal_controller=document.querySelector("xu-modal-controller")}var controller_params=$(xu_modal_controller).data("xuControllerParams");if(!controller_params){controller_params={}}params={screenId:paramsP.screenId,$dialogDiv:$div.children(),$container:$container,dsSession:paramsP.dsSessionP,modal_id:modal_id,screenInfo:paramsP.screenInfo,close_callback:close_modal,paramsP:paramsP};controller_params[modal_id]=params;$(xu_modal_controller).data("xuControllerParams",controller_params);const modalController=await new UI_FRAMEWORK_PLUGIN.modal;await set_call_screen_properties_values(modalController);if(!APP_MODAL_OBJ[modal_id]){const modal=await modalController.create(params);APP_MODAL_OBJ[modal_id]=modal}else{$(modal_id).empty()}await modalController.init(params);break;case"popover":const xu_popover_controller=func.UI.component.create_app_popover_component(SESSION_ID);params={menuTitle:paramsP.screenInfo.properties?.menuTitle,screenId:paramsP.screenId,$dialogDiv:$div.children(),$container:$container};$(xu_popover_controller).data("xuControllerParams",params);const popover=new UI_FRAMEWORK_PLUGIN.popover(SESSION_ID);await set_call_screen_properties_values(popover);await popover.open(params);CURRENT_APP_POPOVER=popover;func.UI.utils.screen_blocker(false,paramsP.prog_id+"_"+paramsP.sourceScreenP);break;case"page":const nav=$nav[0];params={div:$div_content,name:paramsP.screenInfo.properties?.menuTitle,screenId:paramsP.screenId,$container:$container,dsSession:paramsP.dsSessionP,SESSION_ID:SESSION_ID,nav:nav,paramsP:paramsP};var component_name="xu-page-component-"+paramsP.dsSessionP;if(!$(nav).data().xuData.nav_params){$(nav).data().xuData.nav_params={}}if($(nav)?.data()?.xuData?.params?.[paramsP.dsSessionP]){params.$container.data().xuData.validate_screen_ready=$(nav).data().xuData.params[paramsP.dsSessionP].$container.data().xuData.validate_screen_ready}if(!$(nav)?.data()?.xuData)return;$(nav).data().xuData.nav_params[paramsP.dsSessionP]=params;if(!$(component_name).length){await func.UI.component.create_app_page_component(SESSION_ID,paramsP.dsSessionP);const page=new UI_FRAMEWORK_PLUGIN.page;await set_call_screen_properties_values(page);await page.create(params);await page.init(params);nav.push(component_name,{params:params})}else{debugger;$(component_name).empty();await UI_FRAMEWORK_PLUGIN.page(SESSION_ID,paramsP.dsSessionP)}$div.data().xuData.paramsP=$container.data().xuData.paramsP;break;case"panel":$container.append($div_content);$ret=$container;break;default:if($nav&&$nav.length){}else{$nav=$("<xu-nav>");$container.append($nav);func.UI.component.init_xu_nav($container,$nav)}$nav.data().xuData.$div=$div_content;await $nav[0].setRoot("xu-root-component-"+SESSION_ID);$ret=$container;break}return $ret};if(!await init())return;debug();const fx={widget:async function(){var _session=SESSION_OBJ[SESSION_ID];var exist_elm_obj=get_element_info();var $div=exist_elm_obj.div;if(!exist_elm_obj.div){$div=await func.UI.screen.create_container(SESSION_ID,$root_container,nodeP,$container,paramsP,parent_infoP,jobNoP,keyP,parent_nodeP,prop,"widget_wrapper",null,null,null,null);let plugin_name=prop["xu-widget"],method=prop["xu-method"],dsP=paramsP.dsSessionP,propsP=prop,sourceP="widgets";const call_plugin_api=async function(plugin_nameP,dataP){return await func.utils.call_plugin_api(SESSION_ID,plugin_nameP,dataP)};const report_error=function(descP,warn){func.utils.debug.log(SESSION_ID,_session.DS_GLB[dsP].prog_id+"_"+_session.DS_GLB[dsP].callingMenuId,{module:"widgets",action:"Init",source:sourceP,prop:descP,details:descP,result:null,error:warn?false:true,fields:null,type:"widgets",prog_id:_session.DS_GLB[dsP].prog_id})};const get_fields_data=async function(fields,props){const report_error=function(descP,warn){func.utils.debug.log(SESSION_ID,_session.DS_GLB[dsP].prog_id+"_"+_session.DS_GLB[dsP].callingMenuId,{module:"widgets",action:"Init",source:sourceP,prop:descP,details:descP,result:null,error:warn?false:true,fields:null,type:"widgets",prog_id:_session.DS_GLB[dsP].prog_id})};const get_property_value=async function(fieldIdP,val){if(!val)return;var value=fieldIdP in props?props[fieldIdP]:typeof val.defaultValue==="function"?val?.defaultValue?.():val?.defaultValue;if(val.render==="eventId"){value=props?.[fieldIdP]?.event}if(props[`xu-exp:${fieldIdP}`]){value=(await func.expression.get(SESSION_ID,props[`xu-exp:${fieldIdP}`],dsP,"widget property")).result}return func.common.get_cast_val(SESSION_ID,"widgets",fieldIdP,val.type,value,null)};var data_obj={};var return_code=1;for await(const[key,val]of Object.entries(fields)){data_obj[key]=await get_property_value(key,val);if(!data_obj[key]&&val.mandatory){return_code=-1;report_error(`${key} is a mandatory field.`);break}}for await(const key of["xu-bind"]){data_obj[key]=await get_property_value(key,props[key])}return{code:return_code,data:data_obj}};const load_css_style=function(){const get_css_path=function(resource){if(_session.worker_type==="Dev"){return`../../plugins/${plugin_name}/${resource}`}return`https://${_session.domain}/plugins/${plugin_name}/${APP_OBJ[_session.app_id].app_plugins_purchased[plugin_name].manifest[resource].dist?"dist/":""}${resource}?gtp_token=${_session.gtp_token}&app_id=${_session.app_id}`};let path=get_css_path("style.css");func.utils.load_css_on_demand(path)};const _plugin=APP_OBJ[_session.app_id]?.app_plugins_purchased?.[plugin_name];const index=await func.utils.get_plugin_resource(SESSION_ID,plugin_name,`${_plugin.manifest["index.mjs"].dist?"dist/":""}index.mjs`);const methods=index.methods;if(methods&&!methods[method]){return report_error("method not found")}const fields_ret=await get_fields_data(methods[method].fields,propsP);if(fields_ret.code<0){return report_error(fields_ret.data)}const fields=fields_ret.data;let exclude_attributes=[];for await(const[key,val]of Object.entries(propsP)){if(typeof fields[key]!=="undefined"||typeof fields[`xu-exp:${key}`]!=="undefined"){exclude_attributes.push(key)}}let ret=await func.UI.screen.set_attributes_new(SESSION_ID,is_skeleton,$root_container,nodeP,$container,paramsP,parent_infoP,jobNoP,keyP,parent_nodeP,$div,true,exclude_attributes);$div.addClass("widget_wrapper");if(!APP_OBJ[_session.app_id].app_plugins_purchased[plugin_name]){return report_error(`plugin ${plugin_name} not found`)}if(APP_OBJ[_session.app_id].app_plugins_purchased[plugin_name].manifest["style.css"].exist){load_css_style()}const plugin_setup_ret=await func.utils.get_plugin_setup(SESSION_ID,plugin_name);if(plugin_setup_ret.code<0){return report_error(plugin_setup_ret)}const api_utils=await func.common.get_module(SESSION_ID,"xuda-api-library.mjs",{func:func,glb:glb,SESSION_OBJ:SESSION_OBJ,SESSION_ID:SESSION_ID,APP_OBJ:APP_OBJ,dsSession:paramsP.dsSessionP,job_id:jobNoP});const params={SESSION_ID:SESSION_ID,method:method,_session:_session,dsP:dsP,sourceP:sourceP,propsP:propsP,plugin_name:plugin_name,$containerP:$div,plugin_setup:plugin_setup_ret.data,report_error:report_error,call_plugin_api:call_plugin_api,api_utils:api_utils};const fx=await func.utils.get_plugin_resource(SESSION_ID,plugin_name,`${_plugin.manifest["runtime.mjs"].dist?"dist/":""}runtime.mjs`);if(_plugin?.manifest?.["runtime.mjs"].dist&&_plugin?.manifest?.["runtime.mjs"]?.css){const plugin_runtime_css_url=await func.utils.get_plugin_npm_cdn(SESSION_ID,plugin_name,"dist/runtime.css");func.utils.load_css_on_demand(plugin_runtime_css_url)}if(!fx[method]){throw`Method: ${method} does not exist`}try{await fx[method](fields,params)}catch(err){func.utils.debug_report(SESSION_ID,`${plugin_name} widget`,err.message,"E")}}return $div},[`xu-single-view`]:async function(){var exist_elm_obj=get_element_info();var $div=exist_elm_obj.div;if(!exist_elm_obj.div){var $wrapper=$("<div>");$div=await func.UI.screen.create_container(SESSION_ID,$root_container,nodeP,$container,paramsP,parent_infoP,jobNoP,keyP,parent_nodeP,prop,null,null,"div",$wrapper,"");if(!$div)return;if(!REFRESHER_IN_PROGRESS&&(paramsP.is_mobile_popover||paramsP.is_mobile_page)){close_all_modals()}$div.hover(function(e){hover_in()},function(e){hover_out()})}const ret=await iterate_child($div,nodeP,null,$div);if(_.isEmpty($container.data().xuAttributes)){await func.UI.screen.set_attributes_new(SESSION_ID,is_skeleton,$root_container,nodeP,$container,paramsP,parent_infoP,jobNoP,keyP,parent_nodeP,$container,true)}$.each($div.data().xuData,function(key,val){$container.data().xuData[key]=_.cloneDeep(val)});$.each($div.data().xuAttributes,function(key,val){$container.data().xuAttributes[key]=_.cloneDeep(val)});return await render_screen_type($div)},[`xu-multi-view`]:async function(){var $div=$container;if(!$div.data().xuData.node||!$div.data().xuData.node.children){$div.data().xuData.node=nodeP}if(!$div.data().xuData.debug_info){$div.data().xuData.debug_info={id:nodeP.id,parent_id:$container.data().xuData.ui_id}}const done=async function(continuous_idx){await func.UI.screen.set_attributes_new(SESSION_ID,is_skeleton,$root_container,nodeP,$container,paramsP,parent_infoP,jobNoP,keyP,parent_nodeP,$container,true);return await render_screen_type($div)};if(!REFRESHER_IN_PROGRESS&&(paramsP.is_mobile_popover||paramsP.is_mobile_page)){close_all_modals()}const empty_result=async function(){await func.events.validate(SESSION_ID,"record_not_found",paramsP.dsSessionP);return await done(null)};var _ds=SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP];var continuous_idx=null;if(!_ds.data_feed||_.isEmpty(_ds.data_feed.rows)){return await empty_result()}var i=0;for await(const[key,val]of Object.entries(_ds.data_feed.rows)){var node=JSON.parse(JSON.stringify(nodeP));_ds.currentRecordId=val._ROWID;const ret=await iterate_child($div,node,{continuous_idx:continuous_idx},$root_container);if(_.isEmpty($container.data().xuAttributes)){await func.UI.screen.set_attributes_new(SESSION_ID,is_skeleton,$root_container,nodeP,$container,paramsP,parent_infoP,jobNoP,keyP,parent_nodeP,$container,true)}}return await done(continuous_idx)},[`xu-panel`]:async function(){const done=async function($new_div){if(!$container.data()?.xuData?.paramsP){return $container}var $div_items=$div.data().xuData.node.children;await func.UI.screen.panel_post_render_handler(SESSION_ID,$container,$new_div,nodeP,$div,jobNoP);$container.data().xuData.node.children=$div_items;return $container};var $wrapper=$("<div>");$div=await func.UI.screen.create_container(SESSION_ID,$root_container,nodeP,$container,paramsP,parent_infoP,jobNoP,keyP,parent_nodeP,prop,null,null,null,$wrapper,"");let ret=await func.UI.screen.set_attributes_new(SESSION_ID,is_skeleton,$root_container,nodeP,$container,paramsP,parent_infoP,jobNoP,keyP,parent_nodeP,$div.clone(true),true,undefined,refreshed_ds);if(ret.abort){return ret.$new_div=$("<template>").append($div)}let $ret_panel_div=ret.$new_div;if(!$ret_panel_div?.children()?.length){if(nodeP.children.length){$ret_panel_div=await func.UI.screen.render_ui_tree(SESSION_ID,$container,nodeP.children[0],parent_infoP,paramsP,jobNoP,null,0,null,nodeP,null,$root_container)}}let ret_done=await done($ret_panel_div);return ret_done}};const draw_html_element_org=async function(element){const done=async function(ret={}){return $div};if(!element||element==="script")return await done();let str="";var $div=await func.UI.screen.create_container(SESSION_ID,$root_container,nodeP,$container,paramsP,parent_infoP,jobNoP,keyP,parent_nodeP,prop,null,null,element,null,str);$div.hover(function(e){hover_in($div,e)},function(e){hover_out()});if(paramsP.paramsP==="grid"||parent_infoP?.iterate_info){$div.on("click contextmenu",function(e){hover_in($div,e)})}let ret=await func.UI.screen.set_attributes_new(SESSION_ID,is_skeleton,$root_container,nodeP,$container,paramsP,parent_infoP,jobNoP,keyP,parent_nodeP,$div,true);if(ret.abort||nodeP.tagName==="svg"||!_.isEmpty(nodeP?.attributes?.["xu-text"])||!_.isEmpty(nodeP?.attributes?.["xu-html"])||!_.isEmpty(nodeP?.attributes?.["xu-exp:xu-text"])||!_.isEmpty(nodeP?.attributes?.["xu-exp:xu-html"])){return await done(ret)}if(nodeP?.attributes?.["xu-viewport"]=="true"){const xu_viewport=function(){const observer_inViewport=new IntersectionObserver(function(entries){entries.forEach(entry=>{if(entry.isIntersecting){$(entry.target).trigger("inViewport");observer_inViewport.unobserve(entry.target)}})},{threshold:.1});const observer_outViewport=new IntersectionObserver(function(entries){entries.forEach(entry=>{if(!entry.isIntersecting){$(entry.target).trigger("outViewport")}})},{threshold:0});let ui_job_id;$div.on("inViewport",function(){if($div.children().length){$div.removeClass("skeleton");return}hover_in($div);ui_job_id=func.UI.worker.add_to_queue(SESSION_ID,"gui event","render_viewport",{$div:$div,nodeP:nodeP,parent_infoP:parent_infoP,$root_container:$root_container,paramsP:paramsP,jobNoP:jobNoP,is_skeleton:is_skeleton,keyP:keyP,refreshed_ds:refreshed_ds,parent_nodeP:parent_nodeP,check_existP:check_existP,$container:$container},null,null,paramsP.dsSessionP);observer_outViewport.observe($div[0])});$div.on("outViewport",function(){func.UI.worker.delete_job(SESSION_ID,ui_job_id);if($div.children().length){$div.empty();const height=$div?.data()?.xuData?.viewport_height||10;if(typeof height!=="undefined"){$div.css("height",height)}}observer_inViewport.observe($div[0])});$div.addClass("skeleton");observer_inViewport.observe($div[0])};xu_viewport()}else{await iterate_child($div,nodeP,parent_infoP,$root_container)}return await done(ret)};const draw_html_element=async function(element){const done=async function(ret={}){const xu_ui_id=$div.attr("xu-ui-id");$div.removeClass("display_none");if(ret.has_xu_exp_render_attribute){const xu_render_cache_id=await get_xu_render_cache_str(SESSION_ID,paramsP.dsSessionP,Object.keys($div.data()?.xuData?.attr_exp_info?.["xu-render"]?.fields||{}));const _$div=$div.clone(true);UI_WORKER_OBJ.xu_render_cache[xu_ui_id+xu_render_cache_id]={$div:_$div,paramsP:paramsP,data:_$div.data()};nodeP.xu_render_xu_ui_id=xu_ui_id;nodeP.xu_render_cache_id=xu_render_cache_id;if(ret.xu_render_background_processing){temp_$div.remove();return $div}else{temp_$div.replaceWith($div);return $div}}else{if(ret.has_xu_render_attribute){temp_$div.remove();return $div}temp_$div.replaceWith($div);return $div}};if(!element||element==="script")return await done();let str="";var temp_$div=await func.UI.screen.create_container(SESSION_ID,$root_container,nodeP,$container,paramsP,parent_infoP,jobNoP,keyP,parent_nodeP,prop,null,null,element,null,str,true);let temp_$container=$("<tmp>").data("xuData",$container.data().xuData);let $div=temp_$div.clone(true);$div.hover(function(e){hover_in($div,e)},function(e){hover_out()});if(paramsP.paramsP==="grid"||parent_infoP?.iterate_info){$div.on("click contextmenu",function(e){hover_in($div,e)})}let ret=await func.UI.screen.set_attributes_new(SESSION_ID,is_skeleton,$root_container,nodeP,temp_$container,paramsP,parent_infoP,jobNoP,keyP,parent_nodeP,$div,true);if(ret.abort||nodeP.tagName==="svg"||!_.isEmpty(nodeP?.attributes?.["xu-text"])||!_.isEmpty(nodeP?.attributes?.["xu-html"])||!_.isEmpty(nodeP?.attributes?.["xu-exp:xu-text"])||!_.isEmpty(nodeP?.attributes?.["xu-exp:xu-html"])){return await done(ret)}if(nodeP?.attributes?.["xu-viewport"]=="true"){const xu_viewport=function(){const observer_inViewport=new IntersectionObserver(function(entries){entries.forEach(entry=>{if(entry.isIntersecting){$(entry.target).trigger("inViewport");observer_inViewport.unobserve(entry.target)}})},{threshold:.1});const observer_outViewport=new IntersectionObserver(function(entries){entries.forEach(entry=>{if(!entry.isIntersecting){$(entry.target).trigger("outViewport")}})},{threshold:0});let ui_job_id;$div.on("inViewport",function(){if($div.children().length){$div.removeClass("skeleton");return}hover_in($div);ui_job_id=func.UI.worker.add_to_queue(SESSION_ID,"gui event","render_viewport",{$div:$div,nodeP:nodeP,parent_infoP:parent_infoP,$root_container:$root_container,paramsP:paramsP,jobNoP:jobNoP,is_skeleton:is_skeleton,keyP:keyP,refreshed_ds:refreshed_ds,parent_nodeP:parent_nodeP,check_existP:check_existP,temp_$container:temp_$container},null,null,paramsP.dsSessionP);observer_outViewport.observe($div[0])});$div.on("outViewport",function(){func.UI.worker.delete_job(SESSION_ID,ui_job_id);if($div.children().length){$div.empty();const height=$div?.data()?.xuData?.viewport_height||10;if(typeof height!=="undefined"){$div.css("height",height)}}observer_inViewport.observe($div[0])});$div.addClass("skeleton");observer_inViewport.observe($div[0])};xu_viewport()}else{if(!ret.xu_render_background_processing){iterate_child($div,nodeP,parent_infoP,$root_container)}}return await done(ret)};if(nodeP.content&&nodeP.attributes){nodeP.attributes["xu-content"]=nodeP.content}if(nodeP.tagName==="xu-widget"){if(is_skeleton)return;return await fx["widget"]()}if(fx[nodeP.tagName]){return await fx[nodeP.tagName]()}if(!glb.new_xu_render){return await draw_html_element_org(nodeP.tagName)}return await draw_html_element(nodeP.tagName)};func.UI.screen.refresh_document_changes_for_realtime_update=async function(SESSION_ID,doc_change){let _session=SESSION_OBJ[SESSION_ID];for(const[key,_ds]of Object.entries(_session.DS_GLB)){let prog_obj=await func.utils.VIEWS_OBJ.get(SESSION_ID,_ds.prog_id);if(prog_obj?.progDataSource?.dataSourceRealtime&&prog_obj?.progDataSource?.dataSourceTableId===doc_change.table_id){try{if(!_ds.screen_params)continue;if(_ds.screen_params.is_panelP){func.UI.screen.refresh_screen(SESSION_ID,null,key)}else{func.action.execute(SESSION_ID,"act_refresh",_ds,null,null)}}catch(err){}}}if(glb.new_xu_render){for(const[ui_cache_key,ui_cache_val]of Object.entries(UI_WORKER_OBJ.xu_render_cache)){let prog_obj=await func.utils.VIEWS_OBJ.get(SESSION_ID,ui_cache_val.paramsP.prog_id);if(prog_obj?.progDataSource?.dataSourceTableId===doc_change.table_id){ui_cache_val.$div=null}}}};const get_parent_ds_fields=function(SESSION_ID,dsSessionP){var _session=SESSION_OBJ[SESSION_ID];var _ds=_session.DS_GLB[dsSessionP];const idx=func.common.find_ROWID_idx(_ds,_ds.currentRecordId);const data=_ds.data_feed.rows[idx];let obj={};if(typeof _ds.parentDataSourceNo!=="undefined"){obj=get_parent_ds_fields(SESSION_ID,_ds.parentDataSourceNo)}return{...data,...obj}};const get_xu_render_cache_str=async function(SESSION_ID,dsSessionP,exclude_vars=[]){const fields_obj=get_parent_ds_fields(SESSION_ID,dsSessionP);let str="";for(const[key,val]of Object.entries(fields_obj)){if(exclude_vars.includes(key))continue;str+=typeof val!=="undefined"?JSON.stringify(val):""}return"C-"+await func.common.sha256(str)};func.UI.component={};func.UI.component.create_app_modal_component=function(SESSION_ID,modal_content_name){const root_element=$(SESSION_OBJ[SESSION_ID].root_element);const xu_modal_controller_id="xu-modal-controller";var $xu_modal_controller=root_element.find(xu_modal_controller_id);if(!$xu_modal_controller.length){$xu_modal_controller=$("<"+xu_modal_controller_id+">");$(root_element).prepend($xu_modal_controller)}customElements.define(modal_content_name,class extends HTMLElement{constructor(){super()}connectedCallback(){}});return xu_modal_controller_id};func.UI.component.create_app_page_component=async function(SESSION_ID,id){const component_id="xu-page-component-"+id;customElements.define(component_id,class extends HTMLElement{constructor(){super();var params=$(SESSION_OBJ[SESSION_ID].root_element).find("xu-nav").data();$.each(params.xuData.nav_params[id].$container.data(),function(key,val){$(this).data(key,val)})}connectedCallback(){const page_back_callback=async()=>{await func.UI.screen.validate_exit_events(SESSION_ID,params.$container.data().xuData.paramsP,null);nav.back();func.datasource.clean_all(SESSION_ID,params.dsSession)};const $nav=$(SESSION_OBJ[SESSION_ID].root_element).find("xu-nav");const nav=$nav[0];const params=$nav.data().xuData.nav_params[id];params.callback(this,page_back_callback)}});return component_id};func.UI.component.create_app_root_component=function(SESSION_ID){customElements.define("xu-root-component-"+SESSION_ID,class ModalContent extends HTMLElement{connectedCallback(){$(this).append($(SESSION_OBJ[SESSION_ID].root_element).find("xu-nav").data().xuData.$div);const root_component_callback=$(SESSION_OBJ[SESSION_ID].root_element).find("xu-nav").data().xuData.root_component_callback;if(root_component_callback){root_component_callback()}}})};func.UI.component.create_app_popover_component=function(SESSION_ID){const root_element=$(SESSION_OBJ[SESSION_ID].root_element);const xu_popover_controller_id="xu-popover-controller-"+SESSION_ID;var $xu_popover_controller=root_element.find(xu_popover_controller_id);if(!$xu_popover_controller.length){$xu_popover_controller=$("<"+xu_popover_controller_id+">");$(root_element).prepend($xu_popover_controller)}customElements.define("xu-popover-content-"+SESSION_ID,class ModalContent extends HTMLElement{connectedCallback(){const xu_popover_controller=document.querySelector("xu-popover-controller-"+SESSION_ID);var params=$(xu_popover_controller).data("xuControllerParams");var $popover=$("xu-popover-content-"+SESSION_ID).attr("id",params.$container.attr("id"));$.each(params.$container.data(),function(key,val){$popover.data(key,val)});$popover.html(params.$dialogDiv)}});return xu_popover_controller_id};func.UI.component.create_camera_select_popover_component=function(SESSION_ID){customElements.define("popover-camera-select-page"+SESSION_ID,class ModalContent extends HTMLElement{connectedCallback(){const xu_popover_controller=document.querySelector("ion-popover-controller");var params=$(xu_popover_controller).data("xuControllerParams");$(this).append(params.$dialogDiv)}})};func.UI.component.init_xu_nav=function($container,$nav){$nav.data("xuData",{nav_stack:[]});Object.defineProperty($nav[0],"setRoot",{value:async function(component_id){return new Promise(async function(resolve,reject){$nav.data().xuData.nav_stack.unshift(component_id);$container.append("<"+component_id+">");await customElements.whenDefined(component_id);resolve()})},configurable:true});Object.defineProperty($nav[0],"push",{value:async function(component_id){return new Promise(async function(resolve,reject){let last_component=_.last($nav.data().xuData.nav_stack);$(last_component).hide();$nav.data().xuData.nav_stack.push(component_id);$container.append("<"+component_id+">");await customElements.whenDefined(component_id);resolve()})},configurable:true});Object.defineProperty($nav[0],"popToRoot",{value:async function(){return new Promise(async function(resolve,reject){let last_component=_.last($nav.data().xuData.nav_stack);$(last_component).remove();let root_component=$nav.data().xuData.nav_stack[0];$nav.data().xuData.nav_stack[root_component];$(root_component).show();await customElements.whenDefined(root_component);resolve()})},configurable:true});Object.defineProperty($nav[0],"popTo",{value:async function(index){return new Promise(async function(resolve,reject){let last_component=_.last($nav.data().xuData.nav_stack);let last_component_index=$nav.data().xuData.nav_stack.length-1;$(last_component).remove();try{var selected_component=$nav.data().xuData.nav_stack[index||last_component_index-1]}catch(error){console.error(error);return reject(error)}$(selected_component).show();$nav.data().xuData.nav_stack.splice(last_component_index,1);await customElements.whenDefined(selected_component);resolve()})},configurable:true});Object.defineProperty($nav[0],"back",{value:async function(index){return new Promise(async function(resolve,reject){let last_component=_.last($nav.data().xuData.nav_stack);let last_component_index=$nav.data().xuData.nav_stack.length-1;if(last_component_index===0)return;$(last_component).remove();try{var selected_component=$nav.data().xuData.nav_stack[last_component_index-1]}catch(error){console.error(error);return reject(error)}$(selected_component).show();$nav.data().xuData.nav_stack.splice(last_component_index,1);await customElements.whenDefined(selected_component);resolve()})},configurable:true})};func.expression={};func.expression.get=async function(SESSION_ID,valP,dsSessionP,sourceP,rowIdP,sourceActionP,secondPassP,calling_fieldIdP,fieldsP,debug_infoP,iterate_info,js_script_callback,jobNo,api_output_type){class xu_class{async get(){if(typeof EXP_BUSY!=="undefined"){EXP_BUSY=true}var ret;var fields={};var error;var warning;function evalJson(text){return eval("("+text+")")}if(valP===null){ret=""}else{switch(typeof valP){case"string":ret=valP;break;case"undefined":ret="";break;case"boolean":ret=valP?"Y":"N";break;default:ret=valP.toString();break}}ret=ret.replace(/\&amp;/g,"&");ret=func.utils.replace_studio_drive_url(SESSION_ID,ret);const end_results=function(){const replace_quotes=function(ret){for(const[key,val]of Object.entries(fields)){if(typeof val==="string")ret=ret.replace('"'+val+'"',val.replace(/"/gi,""))}return ret};if(["update","javascript"].includes(sourceP)){if(typeof ret==="string")ret=replace_quotes(ret)}const log_error=function(){if(SESSION_OBJ[SESSION_ID].DS_GLB[dsSessionP]){func.utils.debug.log(SESSION_ID,SESSION_OBJ[SESSION_ID].DS_GLB[dsSessionP].nodeId,{module:"expression",action:sourceP,source:calling_fieldIdP,prop:ret,details:ret,result:ret,error:error,warning:warning,fields:null,type:"exp",prog_id:SESSION_OBJ[SESSION_ID].DS_GLB[dsSessionP].prog_id,debug_info:debug_infoP})}};if(error)log_error();if(typeof EXP_BUSY!=="undefined"){EXP_BUSY=false}const results={result:ret,fields:fields,res:res,explain:result,error:error,warning:warning,req:valP,var_error_found:var_error_found};return results};const variable_not_exist=async function(){try{if(sourceP!=="arguments"){if(ret&&ret.substr(0,6)==="_DATE_"){ret=ret.substr(6)}else if(ret&&ret.length===10&&ret.substr(4,1)==="-"&&ret.substr(7,1)==="-"||ret==="self"){ret=ret}else{ret=await func.expression.secure_eval(SESSION_ID,sourceP,ret,jobNo,dsSessionP,js_script_callback)}return end_results()}else{ret=ret.replace(/_NULL/gi,"");return end_results()}}catch(err){return end_results()}};if(!func.expression.validate_variables(valP)){return await variable_not_exist()}const validate_email=async function(){const ret=await func.expression.secure_eval(SESSION_ID,sourceP,valP,jobNo,dsSessionP,js_script_callback,null,true);return glb.emailRegex.test(ret)};if(await validate_email()){return await variable_not_exist()}var var_Arr=[];const split=func.expression.parse(ret)||[];for await(const[arr_key,val]of Object.entries(split)){const key=Number(arr_key);var_Arr[key]={};var_Arr[key].value=val.value;const replace_value_in_string=async function(retP,fieldIdP){if(iterate_info?.iterator_key===fieldIdP||iterate_info?.iterator_val===fieldIdP){if(iterate_info.iterator_key===fieldIdP){retP.value=iterate_info._key}if(iterate_info.iterator_val===fieldIdP){retP.value=iterate_info._val}}const set_value=function(valP){if(typeof valP!=="undefined"){var_Arr[key].value=valP;if(typeof valP==="string")var_Arr[key].type="string"}else{if(retP.type==="object"){var_Arr[key].value="";var_Arr[key].type="string"}}};if(sourceP==="exp"&&retP.type!=="exp"){var_Arr[key].type=retP.type;return}if(typeof retP.value!=="undefined"){var_Arr[key].type=retP.type;var_Arr[key].value=typeof retP.value==="string"&&!retP.value.includes("<svg xmlns=")&&retP.value.indexOf("\\")===-1&&!["UI Attr EXP","update"].includes(sourceP)?retP.value.replaceAll('"','\\"'):retP.value;if(val.value.indexOf("[")>-1|val.value.indexOf(".")>-1){var data=retP.prop;if(retP.type==="object")data=retP.value;var property1,property2;if(val.value.indexOf("[")===-1&&val.value.indexOf("]")>-1&&val.value.substr(0,1)==="@"){var prevData=var_Arr[key-1].value;var_Arr[key].value=prevData[data];if(val.value.indexOf(".")>-1){property2=await func.expression.get_property(val.value).property2;if(prevData[data])set_value(prevData[data][property2])}delete var_Arr[key-1]}else{property1=await func.expression.get_property(val.value).property1;property2=await func.expression.get_property(val.value).property2;if(property1){var_Arr[key].value=data[property1];if(property2){if(data[property1])set_value(data[property1][property2])}}if(property2&&!property1){if(data){set_value(data[property2])}}}fields[fieldIdP]=var_Arr[key].value;var_Arr[key].fieldId=fieldIdP}else{fields[fieldIdP]=var_Arr[key].value;var_Arr[key].fieldId=fieldIdP}}};if(val.fieldId){if(val.fieldId&&val.fieldId.substr(0,5)==="_THIS"&&calling_fieldIdP&&(val.fieldId.length===5||val.fieldId.length>5&&val.fieldId.substr(5,1)===".")){if(val.fieldId.length===5)val.fieldId=calling_fieldIdP;else val.fieldId=calling_fieldIdP+val.fieldId(5,val.fieldId.length-1)}if(!sourceP==="exp"){var_Arr[key].value='""'}fields[val.fieldId]=var_Arr[key].value;const ret=await func.datasource.get_value(SESSION_ID,val.fieldId,dsSessionP,rowIdP);await replace_value_in_string(ret.ret,ret.fieldIdP)}}try{var res=[];var exp_exist;var var_error_found;_.forEach(var_Arr,function(val,key){if(sourceP==="UI Property EXP"){let ret=func.utils.get_drive_url(SESSION_ID,val.value,true);if(ret.changed){res[key]=ret.value;return true}}if(sourceP==="UI Attr EXP"){let ret=func.utils.get_drive_url(SESSION_ID,val.value,var_Arr.length==1?false:true);if(ret.changed){res[key]=ret.value;return true}}if(val.type==="exp"){exp_exist=true}res[key]=val.value;if(var_Arr.length>1){if(!["DbQuery","alert","exp","api_rendered_output"].includes(sourceP)&&["string","date"].includes(val.type)){res[key]="`"+val.value+"`"}if(["api_rendered_output"].includes(sourceP)&&["json"].includes(api_output_type)&&["string","date"].includes(val.type)){res[key]=`"`+val.value+`"`}}if(val.fieldId&&val.value&&typeof val.value==="string"){if(["query","condition","range","sort","locate"].includes(sourceP)){if(val.value.indexOf("↵")>-1){res[key]=val.value.split("↵").join("")}res[key]=res[key].replace(/(\r\n|\n|\r)/gm,"")}if(["init","update","virtual"].includes(sourceP)){if(val.value.indexOf("↵")>-1)res[key]=val.value.split("↵").join("\n");res[key]=res[key].replace(/(\r\n|\n|\r)/gm,"\\n")}if(typeof IS_PROCESS_SERVER!=="undefined"){res[key]=res[key].replace(/(\r\n|\n|\r)/gm,"<br>")}fields[val.fieldId]=res[key]}if(typeof val.value==="object"&&var_Arr.length>1){if(!Array.isArray(val.value)&&!var_Arr[key+1].value?.includes(".")){res[key]="("+JSON.stringify(val.value)+")"}else{res[key]=JSON.stringify(val.value)}}if(!exp_exist&&sourceP!=="exp"&&val.value&&typeof val.value==="string"&&val.value.substr(0,1)==="@"){warning="Error encoding "+val.value;var_error_found=true;res[key]=0}});const join=function(arrP){return arrP.join("")};var exp=undefined;if(exp_exist&&sourceP!=="exp"){exp=await func.expression.get(SESSION_ID,join(res),dsSessionP,sourceP,rowIdP,sourceActionP,true,calling_fieldIdP,fields,debug_infoP);if(exp.res)res=exp.res;else res=[exp.result];fields=_.assignIn(exp.fields,fieldsP)}var result=join(res);if(res.length===1){result=res[0]}if(secondPassP){ret=result}else if(sourceP!=="exp"){if(res.length===1&&typeof res[0]==="string"&&typeof res[0]!=="object"){ret=join(res);if(ret&&ret.substr(0,1)==="@"){error="Error encoding @ var";var_error_found=true}}else{if(!["arguments","api_rendered_output","DbQuery"].includes(sourceP)){ret=await func.expression.secure_eval(SESSION_ID,sourceP,result,jobNo,dsSessionP,js_script_callback)}else{if(sourceP==="DbQuery"){ret=JSON.stringify(evalJson(result))}else{ret=result}}}}return end_results()}catch(err){ret=result;error=err.message;return end_results()}}}const new_class=new xu_class;return new_class.get()};func.expression.parse=function(input){if(typeof input!=="string")return[];const segments=[];let pos=0;const parts=input.split(/(@\w+)/).filter(Boolean);for(const part of parts){if(part.startsWith("@")){const fieldId=part.slice(1);segments.push({value:part,fieldId:fieldId,pos:pos})}else{segments.push({value:part,pos:pos})}pos+=part.length}return segments};func.expression.get_property=async function(valP){async function secure_eval(val){if(typeof IS_PROCESS_SERVER==="undefined"){try{return eval(val)}catch(err){console.error(err);return}}try{let vm=new VM.VM({sandbox:{func:func,SESSION_ID:SESSION_ID,SESSION_OBJ:{[`${SESSION_ID}`]:SESSION_OBJ[SESSION_ID]}},timeout:1e3,allowAsync:false});return await vm.run(val)}catch(err){throw""}}var property1,property2;if(valP.indexOf("[")>-1&&valP.indexOf("]")>-1){property1=valP.substr(valP.indexOf("[")+1,valP.indexOf("]")-valP.indexOf("[")-1);property1=await secure_eval(property1)}if(valP.indexOf(".")>-1)property2=valP.substr(valP.indexOf(".")+1,valP.length);return{property1:property1,property2:property2}};func.expression.validate_constant=function(valP){var patt=/["']/;if(typeof valP==="string"&&patt.test(valP.substr(0,1))&&patt.test(valP.substr(0,valP.length-1)))return true;else return false};func.expression.validate_variables=function(valP){if(typeof valP==="string"&&valP.indexOf("@")>-1)return true;else return false};func.expression.remove_quotes=function(valP){if(func.expression.validate_constant(valP))return valP.substr(1,valP.length-2);else return valP};func.expression.secure_eval=async function(SESSION_ID,sourceP,val,job_id,dsSessionP,js_script_callback,evt,ignore_errors){if(typeof val!=="string")return val;const xu=await func.common.get_module(SESSION_ID,"xuda-api-library.mjs",{func:func,glb:glb,SESSION_OBJ:SESSION_OBJ,SESSION_ID:SESSION_ID,APP_OBJ:APP_OBJ,dsSession:dsSessionP,job_id:job_id});const isServer=typeof IS_PROCESS_SERVER!=="undefined"||typeof IS_DOCKER!=="undefined";if(!isServer){try{return eval(val)}catch(err){try{if(sourceP==="javascript"&&!ignore_errors)console.error(err);return JSON5.parse(val)}catch(err){if(sourceP==="javascript"&&!ignore_errors)console.error(err);return val}}}const sandbox={func:func,xu:xu,SESSION_ID:SESSION_ID,SESSION_OBJ:{[SESSION_ID]:SESSION_OBJ[SESSION_ID]},callback:js_script_callback,job_id:job_id,...sourceP==="javascript"?{axios:axios,got:got,FormData:FormData}:{}};const handleError=err=>{console.error("Execution error:",err);func.events.delete_job(SESSION_ID,job_id);if(isServer&&!SESSION_OBJ[SESSION_ID].crawler){if(sourceP==="javascript"){__.rpi.write_log(SESSION_OBJ[SESSION_ID].app_id,"error","worker","vm error",err,null,val,"func.expression.get.secure_eval")}else{__.db.add_error_log(SESSION_OBJ[SESSION_ID].app_id,"api",err)}}return val};if(sourceP==="javascript"){process.on("uncaughtException",handleError);try{const dir=path.join(_conf.studio_drive_path,SESSION_OBJ[SESSION_ID].app_id,"node_modules");const script=new VM.VMScript(`try { ${val} } catch (e) { func.api.error(SESSION_ID, "nodejs error", e); console.error(e); func.events.delete_job(SESSION_ID, "${job_id}"); }`,{filename:dir,dirname:dir});const vm=new VM.NodeVM({require:{external:true},sandbox:sandbox,timeout:6e4});return await vm.run(script,{filename:dir,dirname:dir})}catch(err){return handleError(err)}}try{const vm=new VM.VM({sandbox:sandbox,timeout:1e3,allowAsync:false});return await vm.run(val)}catch{try{return JSON5.parse(val)}catch{return val}}};func.events={};func.events.validate=async function(SESSION_ID,triggerP,dsSessionP,eventIdP,sourceP,argumentsP,return_validation_onlyP){var _session=SESSION_OBJ[SESSION_ID];var _ds=_session.DS_GLB[dsSessionP];var args={triggerP:triggerP,dsSessionP:dsSessionP,eventIdP:eventIdP,sourceP:sourceP,argumentsP:argumentsP,return_validation_onlyP:return_validation_onlyP};const search_event_in_parent_ds=async function(){if(_ds&&typeof _ds.parentDataSourceNo!=="undefined"){await func.events.validate(SESSION_ID,triggerP,_ds.parentDataSourceNo,eventIdP,sourceP,argumentsP,return_validation_onlyP)}};var ret=false;var jobs=[];if(_ds?.prog_id){const _view_obj=await func.utils.VIEWS_OBJ.get(SESSION_ID,_ds.prog_id);if(!glb.IS_WORKER)_ds.event_stat_obj={};if(_view_obj.progEvents){if(_session.api_callback&&eventIdP){_session.api_callback(eventIdP,SESSION_ID,SESSION_OBJ)}for await(let val of _view_obj.progEvents){var eventProp=undefined;if(val.data.type===triggerP){if(triggerP!=="user_defined"|(triggerP==="user_defined"&&eventIdP===val.data.event_name)){var expCond;if(val.data.condition)expCond=await func.expression.get(SESSION_ID,val.data.condition,dsSessionP,"condition");if(!val.data.condition||expCond.result){func.utils.debug.watch(SESSION_ID,_ds.prog_id+"%"+val.id,"view_event",val,triggerP+" "+eventIdP,expCond);ret=true;if(return_validation_onlyP)break;const set_arguments=async function(){var args=argumentsP||{};for await(let[key,fieldId]of Object.entries(val.data.parameters)){const field_info=func.common.find_item_by_key(_view_obj.progFields,"field_id",fieldId);if(field_info?.data?.type!=="virtual"){console.warn("parameter field must be virtual, update ignored");continue}if(!args[fieldId])continue;let value=await func.common.get_cast_val(SESSION_ID,"events",fieldId,field_info.props.fieldType,args[fieldId].value);if(!_.isEmpty(args[fieldId].fx)){const fx_ret=await func.expression.get(SESSION_ID,args[fieldId].fx,dsSessionP,"update");value=fx_ret.result}const ret=await func.datasource.get_value(SESSION_ID,fieldId,dsSessionP,_ds.currentRecordId);const datasource_changes={[ret.dsSessionP]:{[ret.currentRecordId]:{[fieldId]:value}}};await func.datasource.update(SESSION_ID,datasource_changes)}await add_event()};const add_event=async function(){const _event=func.common.find_item_by_key_root(_view_obj.progEvents,"id",val.id);if(_event.workflow){if(!_event.workflow||_.isEmpty(_event.workflow))return;for(const trigger_obj of _event.workflow){if(!trigger_obj.data.action)continue;if(!trigger_obj.data.enabled)continue;var callingEventId=val.data.event_name;if(!callingEventId)callingEventId=val.id;const ref_id=trigger_obj.data.name;var container=undefined;var screen_prop=undefined;if(!glb.IS_WORKER){if(_ds.panel_div_id){try{container="#"+_ds.panel_div_id;if($(container).data().xuData.panel_info){screen_prop=$(container).data().xuData.panel_info.paramsP}else{container="#"+_session.DS_GLB[dsSessionP].screenId;if($(container)&&$(container).data()){screen_prop=$(container).data().xuData.paramsP}if(!$(container)||!$(container).length){container="#"+_session.DS_GLB[dsSessionP].containerId}}}catch(e){console.error(e)}}else{container="#"+_ds.screenId;if($(container)&&$(container).data()){screen_prop=$(container).data().xuData.paramsP}if(!$(container)||!$(container).length){container="#"+_ds.containerId}}}else{screen_prop={callingContainerP:_ds.containerId}}jobs.push(await func.events.add_to_queue(SESSION_ID,sourceP+" event",trigger_obj.id,null,trigger_obj.data.action,ref_id,container,null,_ds.currentRecordId,null,trigger_obj.data.name,null,null,dsSessionP,null,null,trigger_obj,triggerP,screen_prop,null,null,trigger_obj,trigger_obj.data.parameter_source_data,val.id,null,args,null,null))}}};if(val.data.parameters){await set_arguments()}else{await add_event()}}else{if(val.data.condition&&!expCond.result){func.utils.debug.watch(SESSION_ID,_ds.prog_id+"%"+val.id,"view_event",val,triggerP+" "+eventIdP,expCond,true)}}}}}}}if(return_validation_onlyP)return ret;if(!ret)await search_event_in_parent_ds();return jobs};func.events.add_to_queue=async function(SESSION_ID,typeP,eventIdP,triggerP,functionP,refIdP,containerP,elementP,rowP,evt,descP,NA_rootScreenIdP,NA_callingEventIdP,dsSessionP,NA_isInitP,NA_calling_program,event_propertiesP,calling_triggerP,paramsP,NA_target_frame_idP,_NA2,calling_trigger_prop,argumentsP,source_event_idP,calling_job,args,$div,$container){var _session=SESSION_OBJ[SESSION_ID];var obj={SESSION_ID:SESSION_ID,typeP:typeP,eventIdP:eventIdP,triggerP:triggerP,functionP:functionP,refIdP:refIdP,containerP:containerP,elementP:elementP,rowP:rowP,descP:descP,dsSessionP:dsSessionP,event_propertiesP:event_propertiesP,calling_triggerP:calling_triggerP,paramsP:paramsP,calling_trigger_prop:calling_trigger_prop,argumentsP:argumentsP,source_event_idP:source_event_idP,calling_job:calling_job,args:args,$div:$div,$container:$container,evt:evt,job_num:_session.WORKER_OBJ.num};var _ds=_session.DS_GLB[dsSessionP];if(!_ds)return;if(typeof dsSessionP!=="undefined"&&dsSessionP!==null){obj.prog_id=_ds.prog_id;obj.parentDataSourceNo=_ds.parentDataSourceNo;obj.nodeId=_ds.nodeId}if(glb.IS_WORKER&&func.utils.is_onscreen_event(functionP)){obj.client=true;if(functionP==="call_library"){obj.client=false}if(typeof dsSessionP!=="undefined"&&dsSessionP!==null){obj.ds_obj=func.utils.clean_returned_datasource(SESSION_ID,dsSessionP)}if(obj.client){_session.WORKER_OBJ.num++;func.utils.post_back_to_client(SESSION_ID,"job",_session.worker_id,obj);return}}if(calling_job){var job_index=func.events.find_job_index(SESSION_ID,calling_job);try{if(!_session.WORKER_OBJ.jobs[job_index].splice_count){_session.WORKER_OBJ.jobs[job_index].splice_count=0}_session.WORKER_OBJ.jobs[job_index].splice_count++;_session.WORKER_OBJ.jobs.splice(job_index+_session.WORKER_OBJ.jobs[job_index].splice_count,0,obj)}catch(e){console.error("bug")}}else{_session.WORKER_OBJ.jobs.push(obj)}_session.WORKER_OBJ.num++;return _session.WORKER_OBJ.num-1};func.events.find_job_index=function(SESSION_ID,jobNoP){var _session=SESSION_OBJ[SESSION_ID];var ret=null;if(!_session.WORKER_OBJ)return ret;_.forEach(_session.WORKER_OBJ.jobs,function(val,key){if(val&&val.job_num==jobNoP){ret=key;return false}});return ret};func.events.execute=async function(SESSION_ID,jobNoP,eventIdP,triggerP,functionP,refIdP,containerP,elementP,rowP,evt,descP,rootScreenIdP,dsSessionP,NA_callingEventIdP,callingSourceP,NA_isInitP,event_propertiesP,calling_triggerP,calling_jobP,paramsP,NA_target_frame_idP,calling_trigger_prop,NA_calling_program,argumentsP,NA_viewIdP,NA_nodeIdP,NA_parentDataSourceNoP,$div){var _session=SESSION_OBJ[SESSION_ID];var _ds=_session.DS_GLB[dsSessionP];if(functionP==="update")refIdP=null;var job_index=func.events.find_job_index(SESSION_ID,jobNoP);if(_session.WORKER_OBJ.jobs?.[job_index]?.stat==="busy"){if(jobNoP)_session.WORKER_OBJ.stat=job_index;return}if(jobNoP&&!_session.WORKER_OBJ.jobs[job_index]){_session.WORKER_OBJ.stat=null;return}if(jobNoP)_session.WORKER_OBJ.stat=job_index;if(jobNoP&&calling_trigger_prop?.props?.async){func.events.delete_job(SESSION_ID,jobNoP);_session.WORKER_OBJ.stat=null}if(_session.WORKER_OBJ.jobs[job_index]){_session.WORKER_OBJ.jobs[job_index].stat="busy"}var dsSession=dsSessionP;var field_elm=elementP;var calling_field_id=field_elm;if(field_elm&&typeof field_elm==="object")calling_field_id=field_elm.attr("xu-ui-id");var log_nodeId;var log_prog_id;var log_source;if(_session.DS_GLB[dsSession]?.prog_id)log_prog_id=_session.DS_GLB[dsSession].prog_id;log_nodeId=log_prog_id+"_"+eventIdP;var log_prop=callingSourceP;if(callingSourceP==="system event"){log_prop="global event"}if(calling_field_id){const _view_obj=await func.utils.VIEWS_OBJ.get(SESSION_ID,_ds.prog_id);let _field_obj=func.common.find_item_by_key(_view_obj.progFields,"field_id",calling_field_id);log_nodeId=log_prog_id+"_"+eventIdP+"_"+_field_obj?.id;log_source=calling_field_id}if(elementP){log_prop=triggerP;log_nodeId=log_nodeId+"_ui_prop"}var expCond;if(event_propertiesP){if(event_propertiesP?.props?.condition){expCond=await func.expression.get(SESSION_ID,event_propertiesP.props.condition,dsSession,"condition",null,null,null,calling_field_id?calling_field_id:calling_triggerP,null,descP);func.utils.debug.log(SESSION_ID,log_nodeId,{module:"event",action:log_prop,source:log_source,prop:descP,details:event_propertiesP.props.condition,result:expCond.result,error:expCond.error,fields:expCond.fields,type:"event",prog_id:log_prog_id,conditional:true});var cond=expCond.result;if(!cond||expCond.error){func.events.delete_job(SESSION_ID,jobNoP);func.utils.debug.watch(SESSION_ID,calling_trigger_prop?.id,functionP,"","",expCond,true);return}}else{func.utils.debug.log(SESSION_ID,log_nodeId,{module:"event",action:log_prop,source:log_source,prop:descP,details:null,result:null,error:null,fields:null,type:"event",prog_id:log_prog_id})}}const get_params_obj=async function(){const _prog=await func.utils.VIEWS_OBJ.get(SESSION_ID,await get_prog_id());if(!_prog){func.events.delete_job(SESSION_ID,jobNoP);return func.utils.debug_report(SESSION_ID,"func.events.execute","Program not found: "+refIdP.prog,"E")}var params_obj={};if(_prog?.properties?.progParams){for await(const[key,val]of Object.entries(_prog.properties.progParams)){if(typeof args.parameters_obj_inP?.[val.data.parameter]!=="undefined"){if(args.parameters_obj_inP?.[val.data.parameter].fx){let ret=await func.expression.get(SESSION_ID,args.parameters_obj_inP?.[val.data.parameter].fx,dsSession,"parameters");params_obj[val.data.parameter]=ret.result}else{params_obj[val.data.parameter]=args.parameters_obj_inP?.[val.data.parameter].value}continue}console.warn(`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`)}}return params_obj};const get_prog_id=async function(){let _prop=args?.calling_trigger_prop?.data?.name?.properties;let _prog_id=args.prog_id;if(_prop?.["xu-exp:prog"]){_prog_id=(await func.expression.get(SESSION_ID,_prop["xu-exp:prog"],dsSession,"prog_id expression")).result}return _prog_id};var args={prog_id:refIdP?.prog,screenIdP:refIdP?.prog,callingFieldIdP:field_elm,dataSourceNoP:null,parentDataSourceNoP:dsSession,triggerIdP:eventIdP,containerIdP:null,rowIdP:rowP,jobNoP:jobNoP,callingSourceP:callingSourceP,calling_jobP:calling_jobP,screen_dsP:null,is_panelP:null,argument_listP:null,calling_trigger_prop:calling_trigger_prop,parameters_obj_inP:refIdP?.parameters,call_screen_propertiesP:refIdP?.properties};const fx={Call_window:async function(){var is_panel;var $calling_container;if(_session.WORKER_OBJ.jobs[job_index]){if(_session.WORKER_OBJ.jobs[job_index].paramsP){$calling_container=$("#"+_session.WORKER_OBJ.jobs[job_index].paramsP.callingContainerP)}else{$calling_container="";_session.WORKER_OBJ.jobs[job_index].paramsP={}}}if(!refIdP.prog){func.events.delete_job(SESSION_ID,jobNoP);return func.utils.debug_report(SESSION_ID,"func.events.execute","Program is empty","E")}const params_obj=await get_params_obj();return await func.UI.screen.init(SESSION_ID,await get_prog_id(),$(containerP)?.data()?.xuData.screenId,_session.DS_GLB[dsSession],$calling_container,eventIdP,rowP,jobNoP,is_panel,params_obj,functionP,args.call_screen_propertiesP)},call_modal:async function(){return await fx.Call_window()},call_popover:async function(){return await fx.Call_window()},call_page:async function(){return await fx.Call_window()},call_library:async function(){let plugin_name=refIdP.plugin_name,method=refIdP.library_method,$containerP=$div,dsP=dsSession,propsP=refIdP.library_props,sourceP=descP;var _session=SESSION_OBJ[SESSION_ID];const set_SYS_GLOBAL_OBJ_WIDGET_INFO=async function(docP){var obj=_.clone(docP);obj.date=await func.utils.get_dateTime(SESSION_ID,"SYS_DATE",docP.date);obj.time=await func.utils.get_dateTime(SESSION_ID,"SYS_TIME",docP.date);var datasource_changes={[0]:{["data_system"]:{["SYS_GLOBAL_OBJ_WIDGET_INFO"]:obj}}};await func.datasource.update(SESSION_ID,datasource_changes)};const call_plugin_api=async function(plugin_nameP,dataP){return await func.utils.call_plugin_api(SESSION_ID,plugin_nameP,dataP)};const report_error=function(descP,warn){func.utils.debug.log(SESSION_ID,_session.DS_GLB[dsP].prog_id+"_"+_session.DS_GLB[dsP].callingMenuId,{module:"widgets",action:"Init",source:sourceP,prop:descP,details:descP,result:null,error:warn?false:true,fields:null,type:"widgets",prog_id:_session.DS_GLB[dsP].prog_id})};const get_fields_data=async function(fields,props){const report_error=function(descP,warn){func.utils.debug.log(SESSION_ID,_session.DS_GLB[dsP].prog_id+"_"+_session.DS_GLB[dsP].callingMenuId,{module:"widgets",action:"Init",source:sourceP,prop:descP,details:descP,result:null,error:warn?false:true,fields:null,type:"widgets",prog_id:_session.DS_GLB[dsP].prog_id})};const get_property_value=async function(fieldIdP,val){var value=props[fieldIdP]||(typeof val.defaultValue==="function"?val?.defaultValue?.():val?.defaultValue);if(props[`xu-exp:${fieldIdP}`]){value=(await func.expression.get(SESSION_ID,props[`xu-exp:${fieldIdP}`],dsP,"widget property")).result}return func.common.get_cast_val(SESSION_ID,"widgets",fieldIdP,val.type,value,null)};var data_obj={};var return_code=1;for await(const[key,val]of Object.entries(fields)){try{data_obj[key]=await get_property_value(key,val);if(!data_obj[key]&&val.mandatory){return_code=-1;report_error(`${key} is a mandatory field.`);break}}catch(error){debugger}}return{code:return_code,data:data_obj}};try{const _plugin=APP_OBJ[_session.app_id]?.app_plugins_purchased?.[plugin_name];const index=await func.utils.get_plugin_resource(SESSION_ID,plugin_name,`${_plugin.manifest["index.mjs"].dist?"dist/":""}index.mjs`);const methods=index.methods;if(methods&&!methods[method]){return report_error("method not found")}const fields_ret=await get_fields_data(methods[method].fields,propsP);if(fields_ret.code<0){return report_error(fields_ret.data)}const fields=fields_ret.data;const plugin_setup_ret=await func.utils.get_plugin_setup(SESSION_ID,plugin_name);if(plugin_setup_ret.code<0){return report_error(plugin_setup_ret)}const api_utils=await func.common.get_module(SESSION_ID,"xuda-api-library.mjs",{func:func,glb:glb,SESSION_OBJ:SESSION_OBJ,SESSION_ID:SESSION_ID,APP_OBJ:APP_OBJ,dsSession:dsP,job_id:jobNoP});const params={SESSION_ID:SESSION_ID,method:method,_session:_session,dsP:dsP,sourceP:sourceP,propsP:propsP,plugin_name:plugin_name,$containerP:$containerP,plugin_setup:plugin_setup_ret.data,report_error:report_error,call_plugin_api:call_plugin_api,set_SYS_GLOBAL_OBJ_WIDGET_INFO:set_SYS_GLOBAL_OBJ_WIDGET_INFO,api_utils:api_utils};const fx=await func.utils.get_plugin_resource(SESSION_ID,plugin_name,`${_plugin.manifest["runtime.mjs"].dist?"dist/":""}runtime.mjs`);if(!fx[method]){throw`Method: ${method} does not exist`}await fx[method](fields,params)}catch(err){report_error(err)}func.events.delete_job(SESSION_ID,jobNoP)},call_native_javascript:async function(){const module=await func.common.get_module(SESSION_ID,"xuda-event-javascript-module.mjs");const result=await module.call_javascript(SESSION_ID,jobNoP,refIdP,dsSession,false,$div);await func.datasource.set_outputField(SESSION_ID,dsSessionP,result,args);return result},call_evaluate_javascript:async function(){const module=await func.common.get_module(SESSION_ID,"xuda-event-javascript-module.mjs");const result=await module.call_javascript(SESSION_ID,jobNoP,refIdP,dsSession,true,$div);await func.datasource.set_outputField(SESSION_ID,dsSessionP,result,args);return result},execute_native_javascript:async function(){const module=await func.common.get_module(SESSION_ID,"xuda-event-javascript-module.mjs");const result=await module.run_javascript(SESSION_ID,jobNoP,dsSession,`(async function(el,evt) {
          ${refIdP.value}
          })(document.querySelector(\`[xu-ui-id="${elementP}"]\`),evt)`,null,null,null,evt,$div);await func.datasource.set_outputField(SESSION_ID,dsSessionP,result,args);return result},execute_evaluate_javascript:async function(){const module=await func.common.get_module(SESSION_ID,"xuda-event-javascript-module.mjs");const result=await module.run_javascript(SESSION_ID,jobNoP,dsSession,`(async function(el,evt) {
          ${refIdP.value}
          })(document.querySelector(\`[xu-ui-id="${elementP}"]\`),evt)`,true,null,null,evt,$div);await func.datasource.set_outputField(SESSION_ID,dsSessionP,result,args);return result},loader_on:async function(){glb.CURRENT_APP_LOADING=null;LOADER_ACTIVE=true;LOADER_TEXT=descP;func.events.delete_job(SESSION_ID,jobNoP)},loader_off:async function(){LOADER_ACTIVE=false;func.events.delete_job(SESSION_ID,jobNoP)},emit_event:async function(){if(refIdP.value){$(document).trigger(refIdP.value,[_session.DS_GLB[dsSession]])}else{func.utils.debug_report(SESSION_ID,"func.events.execute","Event name missing","E")}func.events.delete_job(SESSION_ID,jobNoP)},invoke_action:async function(){func.utils.debug.watch(SESSION_ID,calling_trigger_prop?.id,functionP,null,null,expCond);await func.action.execute(SESSION_ID,refIdP.value,_ds,null,null,jobNoP,containerP)},raise_event:async function(){var _ds=_session.DS_GLB[dsSession];const _view_obj=await func.utils.VIEWS_OBJ.get(SESSION_ID,_ds.prog_id);if(callingSourceP==="grid"||callingSourceP==="form"){let _field_obj=func.common.find_item_by_key(_view_obj.progFields,"field_id",field_elm);var event_name=_field_obj?.workflow?.[eventIdP].name.event;if(_field_obj?.workflow?.[eventIdP].name?.properties["xu-exp:event"]){event_name=(await func.expression.get(SESSION_ID,props[`xu-exp:event`],dsSession,"event_name expression")).result}if(field_elm&&event_name){const dsP=await func.datasource.find_event_dataSource(SESSION_ID,event_name,dsSession);return await func.datasource.run_events_functions(SESSION_ID,dsP,event_name,jobNoP,null,calling_trigger_prop?.data?.name?.parameters||{})}}if(callingSourceP.includes("event")){let event_name=refIdP.event;if(refIdP?.properties?.["xu-exp:event"]){event_name=(await func.expression.get(SESSION_ID,refIdP.properties["xu-exp:event"],dsSession,"event_name expression")).result}const dsP=await func.datasource.find_event_dataSource(SESSION_ID,event_name,dsSession);await func.datasource.run_events_functions(SESSION_ID,dsP,event_name,jobNoP,calling_trigger_prop?.props?.async,calling_trigger_prop?.data?.name?.parameters||{})}func.events.delete_job(SESSION_ID,jobNoP);func.utils.debug.watch(SESSION_ID,calling_trigger_prop?.id,functionP,"","",expCond)},get_data:async function(){const params_obj=await get_params_obj();if(!await get_prog_id()){func.utils.debug_report(SESSION_ID,"func.events.execute",`${elementP} > ${triggerP} > ${functionP} > program ${prog} is missing`,"E");func.events.delete_job(SESSION_ID,jobNoP);return}var _ds=_session.DS_GLB[dsSession];if(!_ds){func.events.delete_job(SESSION_ID,jobNoP);return}if(_ds){func.utils.debug.watch(SESSION_ID,calling_trigger_prop?.id,functionP,null,calling_trigger_prop,expCond);const ret=await func.datasource.create(SESSION_ID,await get_prog_id(),args.dataSourceNoP,args.parentDataSourceNoP,args.containerIdP,args.rowIdP,args.jobNoP,args.calling_trigger_prop,null,null,args.callingSourceP,args.calling_jobP,args.screen_dsP,args.is_panelP,params_obj);let _ds_new=_session.DS_GLB[ret.dsSessionP];let parameters=args?.calling_trigger_prop?.data?.name?.parameters;if(parameters&&!_.isEmpty(parameters)){await func.datasource.update_changes_for_out_parameter(SESSION_ID,_ds_new.dsSession,_ds.dsSession)}func.events.delete_job(SESSION_ID,jobNoP);return _ds_new}},set_data:async function(){return this.get_data()},batch:async function(){const result=await this.get_data();return result},update:async function(){const obj_values_to_update=func.datasource.get_viewFields_for_update_function(SESSION_ID,calling_trigger_prop,null,dsSessionP);if(!obj_values_to_update||_.isEmpty(obj_values_to_update)){func.utils.debug_report(SESSION_ID,"Update values object is empty","","W");if(jobNoP)func.events.delete_job(SESSION_ID,jobNoP);return}var updates=[];for await(const[key,val]of Object.entries(obj_values_to_update)){var $element;if(elementP){$element=$(`[xu-ui-id="${elementP}"]`).clone(true)}let ret_field_id=await func.expression.get(SESSION_ID,val.id.trim(),dsSessionP,"update",null,null,null,null,null,null,$element?.length?$element?.data()?.xuData?.iterate_info:null);let ret_value=await func.expression.get(SESSION_ID,val.val.trim(),dsSessionP,"update",null,null,null,null,null,null,$element?.length?$element?.data()?.xuData?.iterate_info:null);let _field_id=ret_field_id.result;let _value=ret_value.result;updates.push({_field_id:_field_id,_value:_value})}let datasource_changes={};for await(const change of updates){let ret_get_value=await func.datasource.get_value(SESSION_ID,change._field_id,dsSessionP);if(ret_get_value.found){let _ds=_session.DS_GLB[ret_get_value.dsSessionP];if(!datasource_changes[_ds.dsSession]){datasource_changes[_ds.dsSession]={}}if(!datasource_changes[_ds.dsSession][ret_get_value.currentRecordId]){datasource_changes[_ds.dsSession][ret_get_value.currentRecordId]={}}datasource_changes[_ds.dsSession][ret_get_value.currentRecordId][change._field_id]=change._value}}await func.datasource.update(SESSION_ID,datasource_changes,null,null,triggerP);if(_ds.PARAM_OUT_INFO){for await(const[key,val]of Object.entries(_ds.PARAM_OUT_INFO)){await func.datasource.update_changes_for_out_parameter(SESSION_ID,_ds.dsSession,val.parentDataSourceNo)}}if(jobNoP)func.events.delete_job(SESSION_ID,jobNoP)},call_alert:async function(){await func.utils.alerts.invoke(SESSION_ID,"call_alert",refIdP,log_source,dsSession);func.events.delete_job(SESSION_ID,jobNoP)},alert:async function(){await func.utils.alerts.invoke(SESSION_ID,"alert",refIdP,log_source,dsSession);func.events.delete_job(SESSION_ID,jobNoP)},delay:async function(){return new Promise(resolve=>{setTimeout(function(){if(jobNoP)func.events.delete_job(SESSION_ID,jobNoP);resolve()},refIdP.value)})},comment:async function(){if(jobNoP)func.events.delete_job(SESSION_ID,jobNoP)},call_project_api:async function(){const params_obj=await get_params_obj();const _prog_id=await get_prog_id();if(!_prog_id){func.utils.debug_report(SESSION_ID,"func.events.execute",`${elementP} > ${triggerP} > ${functionP} > program not defined`,"E");func.events.delete_job(SESSION_ID,jobNoP);return}const api_ret=await func.api.call_project_api(_prog_id,params_obj);await func.datasource.set_outputField(SESSION_ID,dsSessionP,api_ret,args);func.events.delete_job(SESSION_ID,jobNoP)},call_system_api:async function(){const api_method=await func.datasource.get_args_property_value(SESSION_ID,dsSession,args,"api_method");if(!api_method){func.utils.debug_report(SESSION_ID,"func.events.execute",`${elementP} >${triggerP} >${functionP} > api_method not defined`,"E");func.events.delete_job(SESSION_ID,jobNoP);return}let payload={};const _payload=await func.datasource.get_args_property_value(SESSION_ID,dsSession,args,"payload");if(_payload){const get_payload_property_value=async function(prop_name){let _prop=_payload;let _value=_prop[prop_name];if(_prop?.[`xu-exp:${prop_name}`]){_value=(await func.expression.get(SESSION_ID,_prop[`xu-exp:${prop_name}`],dsSession,`${prop_name} expression`)).result}return _value};for await(let[key,val]of Object.entries(_payload)){const new_key=key.replaceAll("xu-exp:","");payload[new_key]=await get_payload_property_value(new_key)}}const output_field=await func.datasource.get_args_property_value(SESSION_ID,dsSession,args,"outputField");const api_ret=await func.api.call_system_api(api_method,payload);if(output_field){let datasource_changes={};let ret_get_value=await func.datasource.get_value(SESSION_ID,output_field,dsSessionP);if(ret_get_value.found){let _ds=_session.DS_GLB[ret_get_value.dsSessionP];if(!datasource_changes[_ds.dsSession]){datasource_changes[_ds.dsSession]={}}if(!datasource_changes[_ds.dsSession][ret_get_value.currentRecordId]){datasource_changes[_ds.dsSession][ret_get_value.currentRecordId]={}}datasource_changes[_ds.dsSession][ret_get_value.currentRecordId][output_field]=api_ret;await func.datasource.update(SESSION_ID,datasource_changes)}}func.events.delete_job(SESSION_ID,jobNoP)},call_external_api:async function(){const method=await func.datasource.get_args_property_value(SESSION_ID,dsSession,args,"method");if(!method){func.utils.debug_report(SESSION_ID,"func.events.execute",`${elementP} >${triggerP} >${functionP} > method not defined`,"E");func.events.delete_job(SESSION_ID,jobNoP);return}const url=await func.datasource.get_args_property_value(SESSION_ID,dsSession,args,"url");if(!url){func.utils.debug_report(SESSION_ID,"func.events.execute",`${elementP} >${triggerP} >${functionP} > url not defined`,"E");func.events.delete_job(SESSION_ID,jobNoP);return}const payload_arr=await func.datasource.get_args_property_value(SESSION_ID,dsSession,args,"payload");const report_conversion_error=function(res,typeP,valP){var msg=`${elementP} >${triggerP} >${functionP} > error converting from ${valP} to ${typeP}`;if(error){return func.utils.debug_report(SESSION_ID,msg,"","W")}func.utils.debug_report(SESSION_ID,msg+" "+_.capitalize(source)+prog_info,"","E")};const report_conversion_warn=function(res){var msg=`${elementP} >${triggerP} >${functionP} > type mismatch auto conversion from value ${valP} to ${typeP}`;func.utils.debug_report(SESSION_ID,msg+" "+_.capitalize(source)+prog_info,"","W")};if(error){return report_conversion_error()}const module=await func.common.get_module(SESSION_ID,"xuda-get-cast-util-module.mjs");var payload=_.reduce(payload_arr,(ret,val,key)=>{ret[val.key]=module.cast(val.type,val.val,report_conversion_error,report_conversion_warn);return ret},{});const output_field=await func.datasource.get_args_property_value(SESSION_ID,dsSession,args,"outputField");const api_ret=await func.api.call_external_api(method,url,payload);if(output_field){let datasource_changes={};let ret_get_value=await func.datasource.get_value(SESSION_ID,output_field,dsSessionP);if(ret_get_value.found){let _ds=_session.DS_GLB[ret_get_value.dsSessionP];if(!datasource_changes[_ds.dsSession]){datasource_changes[_ds.dsSession]={}}if(!datasource_changes[_ds.dsSession][ret_get_value.currentRecordId]){datasource_changes[_ds.dsSession][ret_get_value.currentRecordId]={}}datasource_changes[_ds.dsSession][ret_get_value.currentRecordId][output_field]=api_ret;await func.datasource.update(SESSION_ID,datasource_changes)}}func.events.delete_job(SESSION_ID,jobNoP)}};return await fx[functionP]()};func.events.delete_job=function(SESSION_ID,jobNoP){var _session=SESSION_OBJ[SESSION_ID];var job_index=func.events.find_job_index(SESSION_ID,jobNoP);if(!_session.WORKER_OBJ.jobs[job_index]){_session.WORKER_OBJ.stat=null;return}var dsSession=_session.WORKER_OBJ.jobs[job_index].dsSessionP;let ds_obj=_session?.DS_GLB[dsSession];if(ds_obj){delete SCREEN_BLOCKER_OBJ[ds_obj.screenId+(ds_obj.callingScreenId?"_"+ds_obj.callingScreenId:"")]}if(dsSession&&ds_obj?.loops_limit&&ds_obj?.loops_count<ds_obj?.loops_limit-1){return}_session.WORKER_OBJ.stat=null;_session.WORKER_OBJ.jobs.splice(job_index,1)};func.events.delete_job_0=function(SESSION_ID){var job_index=0;var _session=SESSION_OBJ[SESSION_ID];if(!_session.WORKER_OBJ.jobs[job_index]){_session.WORKER_OBJ.stat=null;return}var dsSession=_session.WORKER_OBJ.jobs[job_index].dsSession;let ds_obj=_session?.DS_GLB[dsSession];if(ds_obj){delete SCREEN_BLOCKER_OBJ[ds_obj.screenId+(ds_obj.callingScreenId?"_"+ds_obj.callingScreenId:"")]}if(dsSession&&ds_obj&&ds_obj.loops_limit&&ds_obj.loops_count<ds_obj.loops_limit-1){return}_session.WORKER_OBJ.stat=null;_session.WORKER_OBJ.jobs.splice(job_index,1)};func.events.check_jobs_idle=async function(SESSION_ID,jobsP){return new Promise((resolve,reject)=>{var _session=SESSION_OBJ[SESSION_ID];if(!jobsP||jobsP&&jobsP.length===0){resolve();return}var listener=setInterval(function(){var found;for(const[key,val]of Object.entries(jobsP)){_.forEach(_session.WORKER_OBJ.jobs,function(val2,key2){if(key2===val){found=true;return false}})}if(!found){do_callback();return}},100);var do_callback=function(){window.clearInterval(listener);resolve()}})};var loop_detected_obj={};setInterval(function(){loop_detected_obj={}},1e3);func.events.set_browser_changes=function(dsP,fieldsChangedP){if(fieldsChangedP.includes("SYS_GLOBAL_STR_BROWSER_TITLE"))document.title=dsP.dataset_new["SYS_GLOBAL_STR_BROWSER_TITLE"]};func.events.execute_PENDING_OPEN_URL_EVENTS=async function(){for(let[key,url]of Object.entries(PENDING_OPEN_URL_EVENTS)){if(url){glb.WINDOW_LOCATION_SEARCH=url;glb.ROOT_ELEMENT_ATTRIBUTES=func.UI.utils.get_root_element_attributes();const params_obj=func.common.getObjectFromUrl(url,glb.ROOT_ELEMENT_ATTRIBUTES);if(!params_obj.prog){return console.warn("prog empty")}await func.utils.TREE_OBJ.get(SESSION_ID,params_obj.prog);let screen_ret=await func.utils.get_screen_obj(SESSION_ID,params_obj.prog);if(screen_ret){await func.UI.screen.init(SESSION_ID,params_obj.prog,null,null,$("#embed_"+SESSION_ID),null,null,null,null,null,"pendingUrlEvent_embed")}else{console.error("Program not exist",params_obj.prog_id);func.UI.utils.progressScreen.show(SESSION_ID,"Program not exist",null,true)}}else{console.warn("url empty")}}};func.events.invoke=async function(event_id){var _session=SESSION_OBJ[SESSION_ID];if(!event_id){console.warn("event_id Cannot be empty");return false}var ds;for await(const[ds_key,val]of Object.entries(_session.DS_GLB)){const _view_obj=await func.utils.VIEWS_OBJ.get(SESSION_ID,val.prog_id);if(_.isEmpty(_view_obj.progEvents))continue;if(ds)break;for await(const[key,val]of Object.entries(_view_obj.progEvents)){if(val?.data?.type==="user_defined"&&val.data.event_name===event_id){ds=ds_key;break}}}if(!ds){console.warn("event_id not found");return false}func.events.validate(SESSION_ID,"user_defined",ds,event_id)};func.action={};func.action.execute=async function(SESSION_ID,actionP,paramsP,isScreenActionP,event_sourceP,jobNoP,containerP){const module=await func.common.get_module(SESSION_ID,"xuda-actions-module.esm.js");await module.action_execute(SESSION_ID,actionP,paramsP,isScreenActionP,event_sourceP,jobNoP,containerP)};func.fcm={};func.UI.main={};func.UI.main.clear_SYNC_INTERVAL=function(){$("body").unbind("mousemove keypress mousedown")};func.UI.main.embed_prog_execute=async function(SESSION_ID,prog){var _session=SESSION_OBJ[SESSION_ID];const _prog=await func.utils.VIEWS_OBJ.get(SESSION_ID,prog);const get_params_obj=function(){var params_obj={};if(_prog?.properties?.progParams){for(const[key,val]of Object.entries(_prog.properties.progParams)){if(typeof _session.url_params?.[val.data.parameter]!=="undefined"){params_obj[val.data.parameter]=_session.url_params?.[val.data.parameter];continue}console.warn(`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`)}}return params_obj};let screen_ret=await func.utils.get_screen_obj(SESSION_ID,prog);if(screen_ret){let ret_init=await func.UI.screen.init(SESSION_ID,prog,null,null,$("#embed_"+SESSION_ID),null,null,null,null,get_params_obj(),"call_embed");document.title=screen_ret.properties.menuTitle;return}console.error("Program not exist",prog);func.UI.utils.progressScreen.show(SESSION_ID,"Program not exist",null,true)};func.UI.main.embed_loader=async function(SESSION_ID){var _session=SESSION_OBJ[SESSION_ID];var hash="";if(window.location.hash)hash=window.location.hash.substr(1);_session.SYS_GLOBAL_STR_BROWSER_HASH_ID=hash;_session.SYS_GLOBAL_STR_BROWSER_TITLE=document.title;const init_system_ds=async function(){if(!["main"].includes(_session.opt.app_computing_mode)){await func.index.new_webworker(SESSION_ID,{menuName:"Main"})}const ret=await func.datasource.create(SESSION_ID,"system");return ret};const set_SYS_GLOBAL_KEYS_STATE=async function(SESSION_ID,e,state){if(!_session?.DS_GLB?.[0])return;if(e.keyCode!==16&&e.keyCode!==17&&e.keyCode!==18&&e.keyCode!==91){return}var data={};if(e.keyCode===17){data.SYS_GLOBAL_BOL_CONTROL_KEY_STATE=state}if(e.keyCode===16){data.SYS_GLOBAL_BOL_SHIFT_KEY_STATE=state}if(e.keyCode===18){data.SYS_GLOBAL_BOL_ALT_KEY_STATE=state}if(e.keyCode===91){data.SYS_GLOBAL_BOL_COMMAND_KEY_STATE=state}var datasource_changes={[0]:{["data_system"]:data}};await func.datasource.update(SESSION_ID,datasource_changes)};const start_workers=async function(){_session.WORKER_OBJ.fx=new func.utils.job_worker(SESSION_ID);_session.WORKER_OBJ.fx.init()};const create_embed_container=async function(){$("<div>").attr("id","embed_"+SESSION_ID).addClass("xu_embed_div").data({xuData:{}}).appendTo($(_session.root_element))};const execute_PENDING_OPEN_URL_EVENTS=async function(){if(typeof func.events.execute_PENDING_OPEN_URL_EVENTS!=="undefined"&&glb.is_cordova){func.events.execute_PENDING_OPEN_URL_EVENTS()}};const remove_loader=async function(){$(".loader").remove();$(_session.root_element).removeClass("loader_background_color")};const perform_callback=async function(){if(_session.api_callback){_session.api_callback("xuda_ready",SESSION_ID,SESSION_OBJ)}};const call_program=async function(){if(_session.route_id){const route_obj=await func.utils.DOCS_OBJ.get(SESSION_ID,_session.route_id);function flattenMenuItems(menu){let flatMenu={};function recurse(items){for(let item of items){flatMenu[item.id]=item;if(item.children&&item.children.length>0){recurse(item.children)}}}recurse(menu);return flatMenu}const flatMenu=flattenMenuItems(route_obj.routeMenu.menu);const menu_obj=flatMenu[_session.menu_id];if(_session.menu_id){if(menu_obj){_session.prog_id=menu_obj.prog_id;if(menu_obj.prog_params){_session.url_params={..._session.url_params,...menu_obj.prog_params}}if(menu_obj.global_params){_session.url_params={..._session.url_params,...menu_obj.global_params}}}}}if(!_session.prog_id)return;await func.utils.TREE_OBJ.get(SESSION_ID,_session.prog_id);let screen_ret=await func.utils.get_screen_obj(SESSION_ID,_session.prog_id);if(screen_ret){func.UI.main.embed_prog_execute(SESSION_ID,_session.prog_id)}else{console.error("Program not exist",_session.prog_id);func.UI.utils.progressScreen.show(SESSION_ID,"Program not exist",null,true)}};const register_run_background_plugins=async function(){if(typeof glb.SLIM_BUNDLE!=="undefined"||glb.SLIM_BUNDLE)return;for await(const[plugin_name,val]of Object.entries(APP_OBJ[_session.app_id].app_plugins_purchased)){if(val.installed&&val.run_in_background&&val.manifest?.["runtime.mjs"]?.exist){try{const plugin_runtime_src=await func.utils.get_plugin_npm_cdn(SESSION_ID,plugin_name,`${val.manifest["runtime.mjs"].dist?"dist/":""}runtime.mjs`);if(val.manifest["runtime.mjs"].dist&&val.manifest?.["runtime.mjs"]?.css){const plugin_runtime_css_url=await func.utils.get_plugin_npm_cdn(SESSION_ID,plugin_name,"dist/runtime.css");func.utils.load_css_on_demand(plugin_runtime_css_url)}const plugin_script=await import(plugin_runtime_src);eval(plugin_script);let plugin_setup_script_ret=null;if(val.manifest?.["index.mjs"]?.exist){const plugin_setup_src=await func.utils.get_plugin_npm_cdn(SESSION_ID,plugin_name,`${val.manifest["index.mjs"].dist?"dist/":""}index.mjs`);let plugin_setup_script=await import(plugin_setup_src);if(plugin_setup_script){plugin_setup_script_ret=await func.utils.get_plugin_setup(SESSION_ID,plugin_name);if(plugin_setup_script_ret.code<0){throw plugin_setup_script_ret}}}glb.lifecycle.plugins[plugin_name]={plugin_script:plugin_script,setup_data:plugin_setup_script_ret?.data}}catch(err){console.error(err)}}}};async function updateOnlineStatus(){if(!_session?.DS_GLB?.[0])return;var data={};if(navigator.onLine){data.SYS_GLOBAL_BOL_ONLINE=1}else{data.SYS_GLOBAL_BOL_ONLINE=0}var datasource_changes={[0]:{["data_system"]:data}};await func.datasource.update(SESSION_ID,datasource_changes)}await register_run_background_plugins();$(_session.root_element).show();func.UI.component.create_app_root_component(SESSION_ID);await glb.lifecycle.execute(SESSION_ID,"beforeInit");await start_workers();await init_system_ds();await glb.lifecycle.execute(SESSION_ID,"initialized");await create_embed_container();await execute_PENDING_OPEN_URL_EVENTS();await remove_loader();await func.UI.worker.init(SESSION_ID);await glb.lifecycle.execute(SESSION_ID,"beforeMounted");await call_program();await glb.lifecycle.execute(SESSION_ID,"mounted");await perform_callback();func.utils.debug.write(SESSION_ID,"Xuda.io started.");await glb.lifecycle.execute(SESSION_ID,"systemReady");$(document).keydown(function(e){set_SYS_GLOBAL_KEYS_STATE(SESSION_ID,e,1)});$(document).keyup(function(e){set_SYS_GLOBAL_KEYS_STATE(SESSION_ID,e,0)});await updateOnlineStatus();window.addEventListener("online",updateOnlineStatus);window.addEventListener("offline",updateOnlineStatus);console.log("xuda.io system ready.");$("body")[0].dispatchEvent(glb.system_ready_event)};func.UI.main.set_custom_css=function(SESSION_ID,callbackP){if(SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system?.["SYS_GLOBAL_STR_SITE_CSS"])$("<style type='text/css'> "+SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system["SYS_GLOBAL_STR_SITE_CSS"]+" </style>").appendTo("head");callbackP()};func.index={};$(document).ready(function(){func.index.init_document_listeners();func.UI.utils.indicator.worker.normal();func.index.init_service_workers()});function xuda(...args){let element=null;let opt={};let callback=null;for(const arg of args){if(arg instanceof HTMLElement){element=arg}else if(typeof arg==="object"&&arg!==null&&!Array.isArray(arg)){opt=arg}else if(typeof arg==="function"){callback=arg}}if(!element){if(typeof glb.SLIM_BUNDLE==="undefined"||!glb.SLIM_BUNDLE){return console.error("Xuda Error - element argument is empty")}element="body";console.warn("root element set to body")}if(!$(element).length){return console.error("Xuda Error - element not found")}if(typeof opt==="undefined"){return console.error("Xuda Error - opt argument is undefined")}if(typeof opt!=="object"){return console.error("Xuda Error - opt argument is not an object")}glb.URL_PARAMS=func.common.getJsonFromUrl(window.location.href);glb.worker_type="Worker";if(opt.debug_js){glb.debug_js=true;if((location.host.includes("localhost")||location.host.includes("127.0.0.1"))&&typeof glb.SLIM_BUNDLE==="undefined"&&typeof glb.CODE_BUNDLE==="undefined"){glb.worker_type="Dev"}else{glb.worker_type="Debug"}}const call_xuda=async function(){const _instance_id=Date.now().toString()+Math.round(Math.random()*1e4).toString();const _api_callback=callback;const create_index_html=function(){const{root_element,domain}=_session;$(root_element).css("position","relative");$(root_element).append(`
      
          <style>
          .loader {
            position: absolute;
            background: rgb(0 0 0 / 30%);
            z-index: 10;
            overflow-y: auto;
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
          }

          .loader .loader_logo {

            width: 43px;
            height: 43px;
            border-radius: 50%;
            background-size: cover;
          }

          .loader .loader_msg {
            padding-top: 10px;
            text-align: center;
            min-height: 20px;
            font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
          }
    
          .loader .loader_rotate {
            padding: 20px;
            border: 2px solid #fff;
            border-right-color: #898989;
            border-radius: 22px;
            -webkit-animation: rotate 0.8s infinite linear;
            position: absolute;
          }
    
          @-webkit-keyframes rotate {
            100% {
              -webkit-transform: rotate(360deg);
            }
          }
      </style>
      
      <div class="loader">
      <div class="loader_logo">
        <div class="loader_rotate"></div> 
      </div>
      <div class="loader_msg"> </div>
    </div>
  
      
      <div class="progressLoader"></div>
      
      `);$(root_element).append(`<div aria-live="assertive"
          class="fixed inset-0 flex items-end px-4 py-6 pointer-events-none sm:p-6 sm:items-start z-[999]">
          <div id="tailwind_toast_controller" class="w-full flex flex-col items-center space-y-4 sm:items-end">
  
          </div>
       </div>`);$(root_element).append(`
        <div id="progressScreen2" style="display: none">
          <div id="progressScreen2_text"></div>
        </div>`);const get_url=function(domain,method,path){return`https://${domain}/${method}${path?"/"+path:"/"}`};func.utils.load_css_on_demand(get_url(domain,"dist","runtime/css/mobile.css"))};const device_ready=async function(){return new Promise(function(resolve,reject){if(!func.utils.get_device()){return resolve()}document.addEventListener("deviceready",function(){glb.is_cordova=true;resolve()},false)})};const get_fingerprint_component=async function(){return new Promise(function(resolve,reject){Fingerprint2.get(function(components){resolve(components)})})};const get_session_id=function(){function defineTabID(){var iPageTabID=sessionStorage.getItem("tabID");if(iPageTabID==null){var iLocalTabID=localStorage.getItem("tabID");var iPageTabID=iLocalTabID==null?1:Number(iLocalTabID)+1;localStorage.setItem("tabID",iPageTabID);sessionStorage.setItem("tabID",iPageTabID)}return iPageTabID}if(func.utils.get_device()){return _instance_id+window.device.uuid}var fingerprint_id=Fingerprint2.x64hash128(components.map(function(pair){return pair.value}).join(),31);return _instance_id+fingerprint_id+defineTabID()};const get_fingerprint=function(){if(func.utils.get_device()){return window.device.uuid}return Fingerprint2.x64hash128(components.map(function(pair){return pair.value}).join(),31)};const init_SESSION=function(){SESSION_OBJ[SESSION_ID]={JOB_NO:1e3,opt:opt,root_element:$(element)[0],worker_type:glb.worker_type,api_callback:_api_callback,CODE_BUNDLE:glb.CODE_BUNDLE,SLIM_BUNDLE:glb.SLIM_BUNDLE,WORKER_OBJ:{jobs:[],num:1e3,stat:null},DS_GLB:{},SYS_GLOBAL_OBJ_FIREBASE_AUTH_INFO:{token:"",first_name:"",last_name:"",email:"",user_id:"",picture:"",verified_email:"",locale:"",error_code:"",error_msg:""},SYS_GLOBAL_OBJ_CLIENT_INFO:{fingerprint:"",device:"",user_agent:"",browser_version:"",browser_name:"",engine_version:"",client_ip:"",engine_name:"",os_name:"",os_version:"",device_model:"",device_vendor:"",device_type:"",screen_current_resolution_x:"",screen_current_resolution_y:"",screen_available_resolution_x:"",screen_available_resolution_y:"",language:"",time_zone:"",cpu_architecture:"",uuid:""},PUSH_NOTIFICATION_GRANTED:null,FIREBASE_TOKEN_ID:null,USR_OBJ:{},debug_js:null,DS_UI_EVENTS_GLB:{},host:location.host,req_id:0,build_info:{},CACHE_REQ:{},url_params:{...func.common.getParametersFromUrl(),...opt.url_params}};WEB_WORKER[SESSION_ID]={};return SESSION_OBJ[SESSION_ID]};const set_SESSION=async function(){for await(const key of["gtp_token","app_token","prog_id","domain","engine_mode","crawler","app_id","route_id","menu_id","local_live_preview","project_data"]){_session[key]=func.UI.utils.get_url_attribute(SESSION_ID,key);if(!_session[key]){var val=_session[key];switch(key){case"domain":val=window.location.host;break;case"engine_mode":val="miniapp";break;case"app_id":val="unknown";break;default:break}_session[key]=val}switch(key){case"domain":if(_session[key].includes("localhost")||_session[key].includes("127.0.0.1")){const getSubdomain=url=>{let domain=url;if(url.includes("://")){domain=url.split("://")[1]}let subdomain="";if(!_session[key].includes("127.0.0.1")){subdomain=domain.split(".")[0]}return subdomain};_session[key]=getSubdomain(_session[key])?getSubdomain(_session[key])+".xuda.io":"xuda.io"}break;case"project_data":{if(typeof glb.SLIM_BUNDLE!=="undefined"||glb.SLIM_BUNDLE){const{root_element}=_session;if(!_session[key]){_session[key]={}}if(!_session[key].programs){_session[key].programs={}}if(!_session[key].globals){_session[key].globals={_id:"globals",progDataSource:{},properties:{menuType:"globals"},studio_meta:{},progEvents:[],progFields:[]}}if($("template").length){const module=await func.common.get_module(SESSION_ID,"xuda-cli-plugin-html-parser-module.esm.js");$.each($("template"),function(idx,el){const _id=$(el).attr("id")||"template_"+idx.toString();if(!_session[key].programs[_id]){_session[key].programs[_id]={_id:_id,progDataSource:{},properties:{menuType:"component",renderType:"form"},studio_meta:{},progEvents:[],progFields:[]}}if($(el).html()){window.xudaStringify=module.xudaStringify;const progUi=module.xudaPrase($(el).html());_session[key].programs[_id].progUi=progUi?.[0]?.children||[]}});if(!_session.prog_id){_session.prog_id=$($("template")?.[0])?.attr("id")||"template_0"}$(root_element).empty()}}break}default:break}}_session.crawler=opt.crawler};const set_SYS_GLOBAL_OBJ_CLIENT_INFO=function(){const{engine_mode}=_session;var _client_info=_session.SYS_GLOBAL_OBJ_CLIENT_INFO;_client_info.fingerprint=get_fingerprint();if(engine_mode==="live_preview"){_client_info.screen_current_resolution_x=window.innerWidth;_client_info.screen_current_resolution_y=window.innerHeight;_client_info.screen_available_resolution_x=window.innerWidth;_client_info.screen_available_resolution_y=window.innerHeight}else{_client_info.screen_current_resolution_x=components[6].value[0];_client_info.screen_current_resolution_y=components[6].value[1];_client_info.screen_available_resolution_x=components[7].value[0];_client_info.screen_available_resolution_y=components[7].value[1]}const client=new ClientJS;_client_info.device=func.utils.get_device();const browser_data=client.getBrowserData();_client_info.user_agent=browser_data.ua;_client_info.browser_version=browser_data.browser.name;_client_info.browser_name=browser_data.browser.version;_client_info.engine_version=browser_data.engine.name;_client_info.engine_name=browser_data.engine.version;_client_info.os_name=browser_data.os.name;_client_info.os_version=browser_data.os.version;_client_info.device_model=browser_data.device.name;_client_info.device_vendor=browser_data.device.name;_client_info.device_type=browser_data.device.name;_client_info.language=client.getLanguage();_client_info.time_zone=client.getTimeZone();_client_info.cpu_architecture=browser_data.cpu.architecture;if(["android","ios","windows","macos","linux","live_preview"].includes(engine_mode)&&func.utils.get_device()){_client_info.uuid=window.device.uuid;if(window.device){_client_info.device_name=window.device.name}}};const init_globals=function(){const{app_id,worker_type}=_session;if(worker_type!=="Worker"){glb.DEBUG_MODE=true}SESSION_OBJ[SESSION_ID].dataSourceSessionGlobal=-1;PROJECT_OBJ[app_id]={};DOCS_OBJ[app_id]={};glb.APP_INFO[app_id]={};glb.ROOT_ELEMENT_ATTRIBUTES=func.UI.utils.get_root_element_attributes(SESSION_ID);DATASOURCE_INTERVALS[SESSION_ID]={}};const print_version_info=function(){const version_name=`Xuda.io  ${opt.engine_mode}  ${opt?.app_version||""}  Session Id: ${SESSION_ID}`;const divider=_.repeat("#",version_name.length);console.info(divider);console.info(version_name);console.info(divider)};const print_xuda_banner=function(){var banner="";["__  ___   _ ____    _    ","\\ \\/ / | | |  _ \\  / \\   "," \\  /| | | | | | |/ _ \\  "," /  \\| |_| | |_| / ___ \\ ","/_/\\_\\\\___/|____/_/   \\_\\"].forEach(e=>{banner+=e+"\r\n"});console.info(banner)};print_xuda_banner();var SESSION_ID=Date.now();var components;if(typeof glb.SLIM_BUNDLE==="undefined"||!glb.SLIM_BUNDLE){await device_ready();components=await get_fingerprint_component();SESSION_ID=get_session_id();print_version_info()}var _session=init_SESSION();await set_SESSION();create_index_html();APP_OBJ[_session.app_id]={};init_globals();if(typeof glb.SLIM_BUNDLE!=="undefined"&&glb.SLIM_BUNDLE){await func.UI.main.embed_loader(SESSION_ID);return}set_SYS_GLOBAL_OBJ_CLIENT_INFO(SESSION_ID);if(!_session.app_id){func.UI.utils.progressScreen.show(SESSION_ID,"Error reading app_id",false,true);console.error("no app_id found");return}const module=await func.common.get_module(SESSION_ID,"xuda-project-loader-module.esm.js");const db_adapter=await func.common.get_module(SESSION_ID,"xuda-db-adapter-module.mjs");func.db=db_adapter._db;await module.project_loader(SESSION_ID,_session.app_id);func.db.pouch.init_db_replication(SESSION_ID)};glb.system_ready_event=new Event("on_mounted");call_xuda();return{on_mounted:function(fn){$("body")[0].addEventListener("on_mounted",e=>{fn()},false)}}}func.index.call_worker=async function(SESSION_ID,obj,params,promiseP){var _session=SESSION_OBJ[SESSION_ID];if(_session.opt.app_computing_mode==="main"){return}return new Promise(async function(resolve,reject){var worker_id;const set_promise_queue=function(worker_id){var t=glb.worker_queue_num++;try{WEB_WORKER[SESSION_ID][worker_id].promise_queue[t]={resolve:promiseP?promiseP.resolve:resolve,reject:promiseP?promiseP.reject:reject,worker_id:worker_id}}catch(e){console.log(worker_id)}return t};const get_worker_id=function(ds){if(!_session.DS_GLB[ds]){if(ds==0){console.error("Error - onscreen (window,modal etc..) event cannot be invoked by on_load");return}else{return}}if(ds==0){return 1}if(_session.DS_GLB[ds].worker_id){return _session.DS_GLB[ds].worker_id}else{if(typeof _session.DS_GLB[ds].parentDataSourceNo!=="undefined"){return get_worker_id(_session.DS_GLB[ds].parentDataSourceNo)}}};if(obj.service==="datasource_create"){if(!params||params&&!params.done){var prog_obj=await func.utils.TREE_OBJ.get(SESSION_ID,obj.data.prog_id);if(!prog_obj||!prog_obj.dedicatedWorker){if(!Object.keys(WEB_WORKER[SESSION_ID]).length){worker_id=await func.index.new_webworker(SESSION_ID,{menuName:"Main"},obj)}else{if(obj.data.IS_DATASOURCE_REFRESH){worker_id=get_worker_id(obj.data.parentDataSourceNo)}else{worker_id=get_worker_id(obj.data.parentDataSourceNoP)}if(!worker_id){debugger}}}else{if(obj.data.IS_DATASOURCE_REFRESH){worker_id=get_worker_id(obj.data.parentDataSourceNo)}else{worker_id=await func.index.new_webworker(SESSION,prog_obj,obj);return _resolve()}}}else{worker_id=params.worker_id}}else{if(params&&params.worker_id){worker_id=params.worker_id}else{worker_id=get_worker_id(obj.data.dssession)}if(!worker_id)worker_id=1}try{var msg=obj;msg.worker_id=worker_id;if(!worker_id){console.warn("missing worker_id")}msg.promise_queue_id=set_promise_queue(worker_id);if(!WEB_WORKER[SESSION_ID][worker_id]){return resolve()}if(RUNTIME_SERVER_WEBSOCKET&&RUNTIME_SERVER_WEBSOCKET_CONNECTED&&(!_session.opt.app_computing_mode||_session.opt.app_computing_mode==="server")){msg.process_pid=WEBSOCKET_PROCESS_PID;msg=JSON.stringify(obj,func.utils.clean_stringify_null,"\t");let msg_obj=JSON.parse(msg);WEB_WORKER[SESSION_ID][worker_id].worker.emit("message",msg_obj)}else{msg=JSON.stringify(obj,func.utils.clean_stringify_null,"\t");let msg_obj=JSON.parse(msg);msg_obj.data=JSON.stringify(msg_obj.data);WEB_WORKER[SESSION_ID][worker_id].worker.postMessage(msg_obj)}}catch(e){console.error(e);return reject(e)}})};func.index.init_SCREEN_BLOCKER=async function(SESSION_ID){setInterval(async function(){if(glb.CURRENT_APP_LOADING||!LOADER_ACTIVE&&_.isEmpty(SCREEN_BLOCKER_OBJ)){return}glb.CURRENT_APP_LOADING=1;const loader=await UI_FRAMEWORK_PLUGIN.loader(LOADER_TEXT);glb.CURRENT_APP_LOADING=loader;var interval=setInterval(function(){if(_.isEmpty(SCREEN_BLOCKER_OBJ)&&!LOADER_ACTIVE){if(glb.CURRENT_APP_LOADING){glb.CURRENT_APP_LOADING.dismiss()}clearInterval(interval);glb.CURRENT_APP_LOADING=null}},100)},1e3)};func.index.init_document_listeners=function(){$(document).on("keydown",function(event){CLIENT_ACTIVITY_TS=Date.now();var keys={72:{key:"h",name:"Help",fx:function(){let SESSION_ID=Object.keys(SESSION_OBJ)[0];let _session=SESSION_OBJ[SESSION_ID];let app_id=_session.app_id;if(!_session.opt.enable_utility_screen)return;func.UI.utils.progressScreen.show(SESSION_ID,`
            <center>Utility Screen</center>
            <div class="help_screen">
                  <button name="hard_reload">
                  <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-refresh" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" style="enable-background:new 0 0 473.677 473.677; xml:space="preserve" >
                  <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
                  <path d="M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4"></path>
                  <path d="M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"></path>
                  </svg><h3 style="text-align: center;display: flex;align-items: center;gap: 10px;">Clean cache &amp; Reload <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 8l4 4m0 0l-4 4m4-4H3"></path></svg></h3>
                  
                  </button>


                  <button  name="reset_worker">
                  <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-activity" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" style="enable-background:new 0 0 473.677 473.677; xml:space="preserve">
           <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
           <path d="M3 12h4l3 8l4 -16l3 8h4"></path>
        </svg>
        <h3 style="text-align: center;display: flex;align-items: center;gap: 10px;">Reset worker<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 8l4 4m0 0l-4 4m4-4H3"></path></svg></h3>
        
                  
                  </button>


                  <button  name="get_support">
              <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-lifebuoy" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"    xml:space="preserve">
              <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
              <path d="M12 12m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0"></path>
              <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path>
              <path d="M15 15l3.35 3.35"></path>
              <path d="M9 15l-3.35 3.35"></path>
              <path d="M5.65 5.65l3.35 3.35"></path>
              <path d="M18.35 5.65l-3.35 3.35"></path>
           </svg>
           <h3 style="text-align: center;display: flex;align-items: center;gap: 10px;">Get support ${SUPPORT_PEER?"(in session, click to cancel)":""}<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 8l4 4m0 0l-4 4m4-4H3"></path></svg></h3>
              
                        
                        </button>

                  </div>
                 
            `);setTimeout(()=>{$(`[name="hard_reload"]`).off("click").on("click",async function(){await func.index.delete_pouch(SESSION_ID);location.reload()});$(`[name="reset_worker"]`).off("click").on("click",function(){_session.WORKER_OBJ.jobs[0].stat=null;_session.WORKER_OBJ.stat=null;func.UI.utils.progressScreen.hide(SESSION_ID)});$(`[name="get_support"]`).off("click").on("click",async function(){const get_support=await func.common.get_module(SESSION_ID,"xuda-get-support-module.esm.js");var name,subject;const prompt_name=()=>{name=window.prompt(`Get support from your ${APP_OBJ[app_id].app_general_prop?.app_name} team,  \n\nYour Name (required):`);if(name==="")prompt_name()};const prompt_subject=()=>{subject=window.prompt(`When you click on "Ok," you are granting permission to ${APP_OBJ[app_id]?.app_name} team to access your browser. \n\nSubject (required):`);if(subject==="")prompt_subject()};if(!SUPPORT_PEER){try{name=firebase.auth().currentUser.displayName}catch(error){if(_session?.USR_OBJ?.usr_name){name=_session.USR_OBJ.usr_name}else{prompt_name()}}if(name===null)return;prompt_subject();if(subject===null)return;func.common.db(SESSION_ID,"get_support",{name:name,subject:subject});setTimeout(()=>{$("body").addClass("get_support_request");$("body").remove(".get_support_request_title").append("<div class='get_support_request_title'>Support pending</div>")},2e3)}else{get_support.terminate_peer(SESSION_ID)}func.UI.utils.progressScreen.hide(SESSION_ID)})},1e3)}}};if(event.which===27){let SESSION_ID=Object.keys(SESSION_OBJ)[0];func.UI.utils.progressScreen.hide(SESSION_ID)}if(event.ctrlKey&&event.shiftKey){if(keys[event.which]){keys[event.which].fx()}}});$(document).mousemove(function(e){CLIENT_ACTIVITY_TS=Date.now();posX=e.pageX;posY=e.pageY;if(SESSION_OBJ[SESSION_ID]?.DS_GLB?.[0]){SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system["SYS_GLOBAL_OBJ_CLIENT_INFO"].cursor_pos_x=posX;SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system["SYS_GLOBAL_OBJ_CLIENT_INFO"].cursor_pos_y=posY}});$.fn.draggable=function(){CLIENT_ACTIVITY_TS=Date.now();var $this=this,ns="draggable_"+(Math.random()+"").replace(".",""),mm="mousemove."+ns,mu="mouseup."+ns,$w=$(window),isFixed=$this.css("position")==="fixed",adjX=0,adjY=0;$this.mousedown(function(ev){var pos=$this.offset();if(isFixed){adjX=$w.scrollLeft();adjY=$w.scrollTop()}var ox=ev.pageX-pos.left,oy=ev.pageY-pos.top;$this.data(ns,{x:ox,y:oy});$w.on(mm,function(ev){ev.preventDefault();ev.stopPropagation();if(isFixed){adjX=$w.scrollLeft();adjY=$w.scrollTop()}var offset=$this.data(ns);$this.css({left:ev.pageX-adjX-offset.x,top:ev.pageY-adjY-offset.y})});$w.on(mu,function(){$w.off(mm+" "+mu).removeData(ns)})});return this};var heartbeat_attempts=0;var heartbeat_internal=setInterval(async function(){const SESSION_ID=Object.keys(SESSION_OBJ)[0];if(!SESSION_ID)return;let _session=SESSION_OBJ[SESSION_ID];if(!_session)return;if(_session.crawler)return;const set_idle=async function(stat){var datasource_changes={[0]:{["data_system"]:{SYS_GLOBAL_BOL_IDLE:stat}}};await func.datasource.update(SESSION_ID,datasource_changes)};if(Date.now()-CLIENT_ACTIVITY_TS>3e4){set_idle(1)}else{set_idle(0)}if(_session.engine_mode==="live_preview"||!_session.opt.enable_user_assist){return}const ret=await func.common.db(SESSION_ID,"heartbeat",{stat:Date.now()-CLIENT_ACTIVITY_TS>3e4?1:2}).catch(err=>{heartbeat_attempts++;console.warn(err.message);if(heartbeat_attempts<10)return;clearInterval(heartbeat_internal)});heartbeat_attempts=0;if(ret?.session_stat===3){await func.index.delete_pouch();window.top.location.reload()}$("body").removeClass("get_support_request");$("body").find(".get_support_request_title").remove();$("body").removeClass("get_support_online");$("body").find(".get_support_online_title").remove();if(ret?.data?.peer?.peer_status===1){if(ret.data.peer.peer_regional_server){get_support.init_peer(SESSION_ID,ret.data.peer.peer_regional_server)}$("body").addClass("get_support_request");$("body").remove(".get_support_request_title").append("<div class='get_support_request_title'>Support pending</div>")}if(ret?.data?.peer?.peer_status===2){$("body").addClass("get_support_online");$("body").remove(".get_support_online_title").append("<div class='get_support_online_title'>Support online</div>")}_session.res_token=ret.res_token},3e4);glb.WINDOW_LOCATION_SEARCH=window.location.search};func.index.init_service_workers=function(){if("serviceWorker"in navigator){navigator.serviceWorker.addEventListener("message",function(event){console.log("serviceWorker message:",event)});navigator.serviceWorker.register("xuda-sw.js").then(function(registration){console.log("ServiceWorker registration successful with scope: ",registration.scope);glb.sw_registration=registration},function(err){console.log("ServiceWorker registration failed: ",err)})}};func.index.delete_pouch=async function(SESSION_ID=Object.keys(SESSION_OBJ)[0]){const db=await func.utils.connect_pouchdb(SESSION_ID);try{return await db.destroy()}catch(err){console.log(err)}};func.index.new_webworker=async function(SESSION_ID,prog_obj,obj){var worker_id=Object.keys(WEB_WORKER[SESSION_ID]).length+1;var _session=SESSION_OBJ[SESSION_ID];if(!_session.engine_mode==="docker"){ver=APP_OBJ[_session.app_id].app_version}var build_id=["live_preview","miniapp"].includes(_session.engine_mode)?"":_session.opt.app_build_id;if(typeof XUDA_BUILD_ID!=="undefined"){build_id=XUDA_BUILD_ID}const worker_name=`${typeof _session.SLIM_BUNDLE==="undefined"||!_session.SLIM_BUNDLE?"":"Slim "}${prog_obj.menuName} worker`+" "+glb.worker_type+": #"+worker_id.toString()+" "+(build_id||"")+" "+_session.domain;const init_worker_session=function(worker_id){var _session=_.cloneDeep(SESSION_OBJ[SESSION_ID]);delete _session.root_element;const get_parent_ds=function(ds){var ds_obj={};if(ds&&_session.DS_GLB[ds].parentDataSourceNo!==null){ds_obj[ds]=func.utils.clean_returned_datasource(SESSION_ID,ds);_.forEach(get_parent_ds(_session.DS_GLB[ds].parentDataSourceNo),function(val,key){ds_obj[key]=val})}else{ds_obj[ds]=func.utils.clean_returned_datasource(SESSION_ID,ds)}return ds_obj};var ds_obj={};if(typeof obj?.data?.parentDataSourceNoP!=="undefined"){ds_obj=get_parent_ds(obj.data.parentDataSourceNoP)}_session.DS_GLB={};_session.WORKER_OBJ={jobs:[],num:1e3,stat:null};var app_id=_session.app_id;var data={SESSION_ID:SESSION_ID,app_id:app_id,APP_OBJ:APP_OBJ[app_id],PROJECT_OBJ:PROJECT_OBJ[app_id],DOCS_OBJ:DOCS_OBJ[app_id],APP_INFO:glb.APP_INFO[app_id],DEBUG_MODE:glb.DEBUG_MODE,DEBUG_INFO_OBJ:glb.DEBUG_INFO_OBJ,WINDOW_LOCATION_SEARCH:glb.WINDOW_LOCATION_SEARCH,ROOT_ELEMENT_ATTRIBUTES:glb.ROOT_ELEMENT_ATTRIBUTES,DS_GLB:ds_obj,SESSION_INFO:JSON.parse(JSON.stringify(_session)),session_id:SESSION_ID,engine_mode:_session.engine_mode,STUDIO_WEBSOCKET_CONNECTION_ID:STUDIO_WEBSOCKET_CONNECTION_ID};if(_session.engine_mode==="live_preview"){data.DOCS_OBJ=DOCS_OBJ[app_id]}delete data.SESSION_INFO.root_element;data.SESSION_INFO.worker_id=worker_id;var ds_arr=[];$.map(_session.DS_GLB,function(val,i){ds_arr.push(i)});WEB_WORKER[SESSION_ID][worker_id].ds_arr=ds_arr;delete data.SESSION_INFO.DS_UI_EVENTS_GLB;if(RUNTIME_SERVER_WEBSOCKET&&RUNTIME_SERVER_WEBSOCKET_CONNECTED&&(!_session.opt.app_computing_mode||_session.opt.app_computing_mode==="server")){WEB_WORKER[SESSION_ID][worker_id].worker.emit("message",{service:"init",data:data,worker_id:worker_id})}else{WEB_WORKER[SESSION_ID][worker_id].worker.postMessage({service:"init",data:JSON.stringify(data),worker_id:worker_id})}};const create_worker=async function(){return new Promise((resolve,reject)=>{if(glb.worker_type==="Dev"){WEB_WORKER[SESSION_ID][worker_id]={worker:new Worker("js/xuda_worker.js",{name:worker_name}),promise_queue:{}}}else{function getWorkerURL(url){const content=`importScripts( "${url}" );`;return URL.createObjectURL(new Blob([content],{type:"text/javascript"}))}const _session=SESSION_OBJ[SESSION_ID];let blob=getWorkerURL(func.common.get_url(SESSION_ID,"dist",func.utils.get_resource_filename(["live_preview","miniapp"].includes(_session.engine_mode)?"":_session?.opt?.app_build_id,"runtime/js/xuda_worker.js")));WEB_WORKER[SESSION_ID][worker_id]={worker:new Worker(blob,{name:worker_name}),promise_queue:{}}}WEB_WORKER[SESSION_ID][worker_id].worker.addEventListener("message",function(e){if(e.data.service==="worker_ready"){return resolve()}worker_functions(e)},false)})};const create_websocket=async function(){return new Promise((resolve,reject)=>{WEB_WORKER[SESSION_ID][worker_id]={worker:RUNTIME_SERVER_WEBSOCKET,promise_queue:{}};WEB_WORKER[SESSION_ID][worker_id].worker.on("message",async e=>{if(["deployment_server","http_call"].includes(e.source))return;worker_functions({data:e})});resolve()})};const worker_functions=async function(e_raw){return new Promise(async(resolve,reject)=>{var e={};e.data=e_raw.data;if(RUNTIME_SERVER_WEBSOCKET&&RUNTIME_SERVER_WEBSOCKET_CONNECTED&&(!_session.opt.app_computing_mode||_session.opt.app_computing_mode==="server")){WEBSOCKET_PROCESS_PID=e.data.process_pid}var val=e.data.params;var fx={init_done:async function(){if(!obj){return _resolve()}},alert:function(){if(val[1]==="save_on"){func.UI.utils.save(SESSION_ID,true);return true}if(val[1]==="save_off"){func.UI.utils.save(SESSION_ID,false);return true}func.utils.alerts.execute(SESSION_ID,val[1],val[2],val[3],val[4]);return _resolve()},progress_on:function(){func.UI.utils.progressScreen.show(SESSION_ID,val,null);return _resolve()},progress_off:function(){func.UI.utils.progressScreen.hide();return _resolve()},worker_busy_on:function(){func.UI.utils.indicator.worker.busy();return _resolve()},worker_busy_off:function(){func.UI.utils.indicator.worker.normal();return _resolve()},screen_blocker_on:function(){func.UI.utils.screen_blocker(true,"Worker");return _resolve()},ajax_error:function(){func.utils.request_error(SESSION_ID,"ajax","Session error");return _resolve()},screen_blocker_off:function(){func.UI.utils.screen_blocker(false,"Worker");return _resolve()},job:function(){func.events.add_to_queue(SESSION_ID,val.typeP,val.eventIdP,val.triggerP,val.functionP,val.refIdP,val.containerP,val.elementP,val.rowP,null,val.descP,null,null,val.dsSessionP,null,null,val.event_propertiesP,val.calling_triggerP,val.paramsP,null,null,val.calling_trigger_prop,val.argumentsP,val.source_event_idP,val.calling_job,val.args);return _resolve()},update_client_eventChangesResults_from_worker:async function(){await func.datasource.update(SESSION_ID,val,true);if(!val.worker_id){return}fx.acknowledged_worker_with_eventChangesResults_done(val.dssession,val.worker_id);for await(const[worker_id,ds_arr]of Object.entries(WEB_WORKER[SESSION_ID])){if(val.worker_id==worker_id)continue;await func.index.call_worker(SESSION_ID,{service:"update_datasource_changes_from_client",data:data},{worker_id:worker_id})}},post_datasource:async function(){if(typeof val.dsSessionP==="undefined"||val.dsSessionP===null)return;if(!SESSION_OBJ[SESSION_ID].DS_GLB[val.dsSessionP]){SESSION_OBJ[SESSION_ID].DS_GLB[val.dsSessionP]=val.ds_obj}else{const update_existing_ds_object=function(old_obj,new_obj){for(const[key,val]of Object.entries(new_obj)){if(typeof val!=="object"){old_obj[key]=val2}else{if(!old_obj[key]){old_obj[key]=val}else update_existing_ds_object(old_obj[key],val)}}};update_existing_ds_object(SESSION_OBJ[SESSION_ID].DS_GLB[val.dsSessionP],val.ds_obj)}var verify_set_parent_ds=function(){var dsSession=val.dsSessionP;for(const[key,val]of Object.entries(SESSION_OBJ[SESSION_ID].DS_GLB[dsSession].parent_ds_chain)){if(SESSION_OBJ[SESSION_ID].DS_GLB[val]){SESSION_OBJ[SESSION_ID].DS_GLB[dsSession].parentDataSourceNo=val;break}}};verify_set_parent_ds();if(val.ds_obj.dataSourceSessionGlobal>SESSION_OBJ[SESSION_ID].dataSourceSessionGlobal)SESSION_OBJ[SESSION_ID].dataSourceSessionGlobal=val.ds_obj.dataSourceSessionGlobal},return_to_data_source:function(type,dsSessionP,ds){var data={session_id:SESSION_ID,dssession:dsSessionP,onscreen_events_active:ds.v.onscreen_events_active,viewEventExec_arr:JSON.stringify(ds.viewEventExec_arr),return_to_data_source_type:type};func.index.call_worker(SESSION_ID,{service:"return_to_data_source",data:data})},acknowledged_worker_with_eventChangesResults_done:async function(dsSessionP,worker_id){var data={session_id:SESSION_ID,dssession:dsSessionP};await func.index.call_worker(SESSION_ID,{service:"acknowledged_worker_with_eventChangesResults_done",data:data},{worker_id:worker_id});return _resolve()},execute_onscreen_view_events:async function(){await fx.post_datasource();var ds=SESSION_OBJ[SESSION_ID].DS_GLB[val.dsSessionP];await func.datasource.execute_onscreen_view_events(SESSION_ID,val.dsSessionP,"onscreen events");if(!ds.v.onscreen_events_active)return;var type=ds.v.onscreen_events_active.type;ds.v.onscreen_events_active=null;fx.return_to_data_source(type,val.dsSessionP,ds);return _resolve()},execute_local_db_query:async function(){await fx.post_datasource();const data=await func.db.get_query(SESSION_ID,val.fileIdP,val.queryP,val.dsSessionP,val.viewSourceDescP,val.sourceP,val.reduceP,val.skipP,val.limitP,val.countP,val.idsP);var msg={};msg.worker_id=worker_id;msg.data={};msg.service="return_from_db_query";msg.data.worker_id=worker_id;msg.data.callback_id=val.callback_id;msg.data.session_id=SESSION_ID;msg.data.data=data;if(RUNTIME_SERVER_WEBSOCKET&&RUNTIME_SERVER_WEBSOCKET_CONNECTED&&(!_session.opt.app_computing_mode||_session.opt.app_computing_mode==="server")){msg.process_pid=WEBSOCKET_PROCESS_PID;WEB_WORKER[SESSION_ID][worker_id].worker.emit("message",msg)}else{WEB_WORKER[SESSION_ID][worker_id].worker.postMessage(msg)}_resolve()},execute_local_sava_data:async function(){await fx.post_datasource();const data=await func.db.save_data(SESSION_ID,val.dsSessionP,val.keyP);var msg={};msg.worker_id=worker_id;msg.data={};msg.service="return_from_sava_data";msg.data.worker_id=worker_id;msg.data.callback_id=val.callback_id;msg.data.session_id=SESSION_ID;msg.data.data=data;if(RUNTIME_SERVER_WEBSOCKET&&RUNTIME_SERVER_WEBSOCKET_CONNECTED&&(!_session.opt.app_computing_mode||_session.opt.app_computing_mode==="server")){msg.process_pid=WEBSOCKET_PROCESS_PID;WEB_WORKER[SESSION_ID][worker_id].worker.emit("message",msg)}else{WEB_WORKER[SESSION_ID][worker_id].worker.postMessage(msg)}_resolve()},write_debug_log:function(params){func.utils.debug.write(SESSION_ID,val.data);_resolve()},write_log:async function(params){if(SESSION_OBJ[SESSION_ID].crawler)return;await func.common.db(SESSION_ID,"write_log",{msg:val.data,source:"runtime",log_type:"error"});_resolve()},change_loaded_image:function(params){const new_image=e.data.params.data;var $img=$("img");$.each($img,function(key,val){var src=$(val).prop("src");if(src.indexOf(new_image)>0){$(val).attr("src",src+"?ts="+(new Date).valueOf())}});_resolve()},send_watch_to_studio_websocket:function(params){STUDIO_WEBSOCKET.emit("message",val);_resolve()},get_doc_from_studio:async function(params){const module=await func.common.get_module(SESSION_ID,`xuda-progs-loader-module.mjs`);const data=await module.get_doc_from_studio(SESSION_ID,SESSION_OBJ[SESSION_ID].app_id,params.params.doc_id);func.index.call_worker(SESSION_ID,{service:"return_doc_from_studio",data:data});_resolve()},get_doc_from_websocket:async function(params){const module=await func.common.get_module(SESSION_ID,`xuda-progs-loader-module.mjs`);const data=await module.get_doc_from_websocket(SESSION_ID,SESSION_OBJ[SESSION_ID].app_id,params.params.doc_id);func.index.call_worker(SESSION_ID,{service:"return_doc_from_websocket",data:data});_resolve()},get_dbs_data_from_websocket:async function(params){const data=await func.common.get_data_from_websocket(SESSION_ID,params.params.service,params.params.data);func.index.call_worker(SESSION_ID,{service:"return_dbs_data_from_websocket",data:{data:data,websocket_queue_num:params.params.websocket_queue_num}});_resolve()},perform_rpi_request_from_studio:async function(params){const data=await func.common.db(SESSION_ID,params.params.service,params.params.data);func.index.call_worker(SESSION_ID,{service:"return_rpi_request_from_studio",data:{data:data.data,table_id:params.params.req_id}});_resolve()},refresh_document_changes_for_realtime_update:async function(params){func.UI.screen.refresh_document_changes_for_realtime_update(SESSION_ID,params.params.doc_change);_resolve()}};const get_promise_queue=function(t,worker_id){if(!WEB_WORKER[SESSION_ID][worker_id]){console.warn("worker job not found");return}return WEB_WORKER[SESSION_ID][worker_id].promise_queue[t]};const promise_ret=await get_promise_queue(e.data.promise_queue_id,e.data.worker_id);const _resolve=function(params){if(!promise_ret)return resolve();promise_ret.resolve(params);setTimeout(function(){if(WEB_WORKER[SESSION_ID][e.data.worker_id])delete WEB_WORKER[SESSION_ID][e.data.worker_id].promise_queue[e.data.promise_queue_id]},1e3)};if(fx[e.data.fx_to_execute]){return await fx[e.data.fx_to_execute](e.data)}if(!promise_ret)return console.error("promise not found");if(!e.data.fx_to_execute){return _resolve(e.data.params)}if(e.data.fx_to_execute==="worker_response"){return _resolve(e.data.params)}})};if(RUNTIME_SERVER_WEBSOCKET&&RUNTIME_SERVER_WEBSOCKET_CONNECTED&&(!_session.opt.app_computing_mode||_session.opt.app_computing_mode==="server")){await create_websocket()}else{await create_worker()}init_worker_session(worker_id);return worker_id};glb.CODE_BUNDLE=1;