Files
Home-Assistant/www/community/lovelace-wallpanel/wallpanel.js
T
2026-07-08 10:43:39 -04:00

2 lines
206 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
!function(){"use strict";function e(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function n(n){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?t(Object(i),!0).forEach(function(t){e(n,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):t(Object(i)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(i,e))})}return n}var r,i,o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},a={};function s(){if(i)return r;i=1;var e=function(e){return e&&e.Math===Math&&e};return r=e("object"==typeof globalThis&&globalThis)||e("object"==typeof window&&window)||e("object"==typeof self&&self)||e("object"==typeof o&&o)||e("object"==typeof r&&r)||function(){return this}()||Function("return this")()}var c,l,u,h,f,d,m,g,p={};function v(){return l?c:(l=1,c=function(e){try{return!!e()}catch(e){return!0}})}function y(){if(h)return u;h=1;var e=v();return u=!e(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})}function A(){if(d)return f;d=1;var e=v();return f=!e(function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})}function _(){if(g)return m;g=1;var e=A(),t=Function.prototype.call;return m=e?t.bind(t):function(){return t.apply(t,arguments)},m}var b,w,E,x,S,C,I,T,R,k,O,P,M,L,B,U,D,F,N,W,j,z,H,G,q,Y,V,X,$,J,Q,Z,K,ee,te,ne,re,ie,oe,ae,se,ce={};function le(){if(b)return ce;b=1;var e={}.propertyIsEnumerable,t=Object.getOwnPropertyDescriptor,n=t&&!e.call({1:2},1);return ce.f=n?function(e){var n=t(this,e);return!!n&&n.enumerable}:e,ce}function ue(){return E?w:(E=1,w=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}})}function he(){if(S)return x;S=1;var e=A(),t=Function.prototype,n=t.call,r=e&&t.bind.bind(n,n);return x=e?r:function(e){return function(){return n.apply(e,arguments)}},x}function fe(){if(I)return C;I=1;var e=he(),t=e({}.toString),n=e("".slice);return C=function(e){return n(t(e),8,-1)}}function de(){if(R)return T;R=1;var e=he(),t=v(),n=fe(),r=Object,i=e("".split);return T=t(function(){return!r("z").propertyIsEnumerable(0)})?function(e){return"String"===n(e)?i(e,""):r(e)}:r}function me(){return O?k:(O=1,k=function(e){return null==e})}function ge(){if(M)return P;M=1;var e=me(),t=TypeError;return P=function(n){if(e(n))throw new t("Can't call method on "+n);return n}}function pe(){if(B)return L;B=1;var e=de(),t=ge();return L=function(n){return e(t(n))}}function ve(){if(D)return U;D=1;var e="object"==typeof document&&document.all;return U=void 0===e&&void 0!==e?function(t){return"function"==typeof t||t===e}:function(e){return"function"==typeof e}}function ye(){if(N)return F;N=1;var e=ve();return F=function(t){return"object"==typeof t?null!==t:e(t)}}function Ae(){if(j)return W;j=1;var e=s(),t=ve();return W=function(n,r){return arguments.length<2?(i=e[n],t(i)?i:void 0):e[n]&&e[n][r];var i},W}function _e(){if(H)return z;H=1;var e=he();return z=e({}.isPrototypeOf)}function be(){if(q)return G;q=1;var e=s().navigator,t=e&&e.userAgent;return G=t?String(t):""}function we(){if(V)return Y;V=1;var e,t,n=s(),r=be(),i=n.process,o=n.Deno,a=i&&i.versions||o&&o.version,c=a&&a.v8;return c&&(t=(e=c.split("."))[0]>0&&e[0]<4?1:+(e[0]+e[1])),!t&&r&&(!(e=r.match(/Edge\/(\d+)/))||e[1]>=74)&&(e=r.match(/Chrome\/(\d+)/))&&(t=+e[1]),Y=t}function Ee(){if($)return X;$=1;var e=we(),t=v(),n=s().String;return X=!!Object.getOwnPropertySymbols&&!t(function(){var t=Symbol("symbol detection");return!n(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&e&&e<41})}function xe(){if(Q)return J;Q=1;var e=Ee();return J=e&&!Symbol.sham&&"symbol"==typeof Symbol.iterator}function Se(){if(K)return Z;K=1;var e=Ae(),t=ve(),n=_e(),r=xe(),i=Object;return Z=r?function(e){return"symbol"==typeof e}:function(r){var o=e("Symbol");return t(o)&&n(o.prototype,i(r))}}function Ce(){if(te)return ee;te=1;var e=String;return ee=function(t){try{return e(t)}catch(e){return"Object"}}}function Ie(){if(re)return ne;re=1;var e=ve(),t=Ce(),n=TypeError;return ne=function(r){if(e(r))return r;throw new n(t(r)+" is not a function")}}function Te(){if(oe)return ie;oe=1;var e=Ie(),t=me();return ie=function(n,r){var i=n[r];return t(i)?void 0:e(i)}}function Re(){if(se)return ae;se=1;var e=_(),t=ve(),n=ye(),r=TypeError;return ae=function(i,o){var a,s;if("string"===o&&t(a=i.toString)&&!n(s=e(a,i)))return s;if(t(a=i.valueOf)&&!n(s=e(a,i)))return s;if("string"!==o&&t(a=i.toString)&&!n(s=e(a,i)))return s;throw new r("Can't convert object to primitive value")}}var ke,Oe,Pe,Me,Le,Be,Ue,De,Fe,Ne,We,je,ze,He,Ge,qe,Ye,Ve,Xe,$e,Je,Qe,Ze,Ke,et={exports:{}};function tt(){return Oe?ke:(Oe=1,ke=!1)}function nt(){if(Me)return Pe;Me=1;var e=s(),t=Object.defineProperty;return Pe=function(n,r){try{t(e,n,{value:r,configurable:!0,writable:!0})}catch(t){e[n]=r}return r}}function rt(){if(Le)return et.exports;Le=1;var e=tt(),t=s(),n=nt(),r="__core-js_shared__",i=et.exports=t[r]||n(r,{});return(i.versions||(i.versions=[])).push({version:"3.43.0",mode:e?"pure":"global",copyright:"© 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.43.0/LICENSE",source:"https://github.com/zloirock/core-js"}),et.exports}function it(){if(Ue)return Be;Ue=1;var e=rt();return Be=function(t,n){return e[t]||(e[t]=n||{})}}function ot(){if(Fe)return De;Fe=1;var e=ge(),t=Object;return De=function(n){return t(e(n))}}function at(){if(We)return Ne;We=1;var e=he(),t=ot(),n=e({}.hasOwnProperty);return Ne=Object.hasOwn||function(e,r){return n(t(e),r)}}function st(){if(ze)return je;ze=1;var e=he(),t=0,n=Math.random(),r=e(1.1.toString);return je=function(e){return"Symbol("+(void 0===e?"":e)+")_"+r(++t+n,36)}}function ct(){if(Ge)return He;Ge=1;var e=s(),t=it(),n=at(),r=st(),i=Ee(),o=xe(),a=e.Symbol,c=t("wks"),l=o?a.for||a:a&&a.withoutSetter||r;return He=function(e){return n(c,e)||(c[e]=i&&n(a,e)?a[e]:l("Symbol."+e)),c[e]}}function lt(){if(Ye)return qe;Ye=1;var e=_(),t=ye(),n=Se(),r=Te(),i=Re(),o=ct(),a=TypeError,s=o("toPrimitive");return qe=function(o,c){if(!t(o)||n(o))return o;var l,u=r(o,s);if(u){if(void 0===c&&(c="default"),l=e(u,o,c),!t(l)||n(l))return l;throw new a("Can't convert object to primitive value")}return void 0===c&&(c="number"),i(o,c)}}function ut(){if(Xe)return Ve;Xe=1;var e=lt(),t=Se();return Ve=function(n){var r=e(n,"string");return t(r)?r:r+""}}function ht(){if(Je)return $e;Je=1;var e=s(),t=ye(),n=e.document,r=t(n)&&t(n.createElement);return $e=function(e){return r?n.createElement(e):{}}}function ft(){if(Ze)return Qe;Ze=1;var e=y(),t=v(),n=ht();return Qe=!e&&!t(function(){return 7!==Object.defineProperty(n("div"),"a",{get:function(){return 7}}).a})}function dt(){if(Ke)return p;Ke=1;var e=y(),t=_(),n=le(),r=ue(),i=pe(),o=ut(),a=at(),s=ft(),c=Object.getOwnPropertyDescriptor;return p.f=e?c:function(e,l){if(e=i(e),l=o(l),s)try{return c(e,l)}catch(e){}if(a(e,l))return r(!t(n.f,e,l),e[l])},p}var mt,gt,pt,vt,yt,At,_t,bt={};function wt(){if(gt)return mt;gt=1;var e=y(),t=v();return mt=e&&t(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})}function Et(){if(vt)return pt;vt=1;var e=ye(),t=String,n=TypeError;return pt=function(r){if(e(r))return r;throw new n(t(r)+" is not an object")}}function xt(){if(yt)return bt;yt=1;var e=y(),t=ft(),n=wt(),r=Et(),i=ut(),o=TypeError,a=Object.defineProperty,s=Object.getOwnPropertyDescriptor,c="enumerable",l="configurable",u="writable";return bt.f=e?n?function(e,t,n){if(r(e),t=i(t),r(n),"function"==typeof e&&"prototype"===t&&"value"in n&&u in n&&!n[u]){var o=s(e,t);o&&o[u]&&(e[t]=n.value,n={configurable:l in n?n[l]:o[l],enumerable:c in n?n[c]:o[c],writable:!1})}return a(e,t,n)}:a:function(e,n,s){if(r(e),n=i(n),r(s),t)try{return a(e,n,s)}catch(e){}if("get"in s||"set"in s)throw new o("Accessors not supported");return"value"in s&&(e[n]=s.value),e},bt}function St(){if(_t)return At;_t=1;var e=y(),t=xt(),n=ue();return At=e?function(e,r,i){return t.f(e,r,n(1,i))}:function(e,t,n){return e[t]=n,e}}var Ct,It,Tt,Rt,kt,Ot,Pt,Mt,Lt,Bt,Ut,Dt,Ft,Nt,Wt,jt={exports:{}};function zt(){if(It)return Ct;It=1;var e=y(),t=at(),n=Function.prototype,r=e&&Object.getOwnPropertyDescriptor,i=t(n,"name"),o=i&&"something"===function(){}.name,a=i&&(!e||e&&r(n,"name").configurable);return Ct={EXISTS:i,PROPER:o,CONFIGURABLE:a}}function Ht(){if(Rt)return Tt;Rt=1;var e=he(),t=ve(),n=rt(),r=e(Function.toString);return t(n.inspectSource)||(n.inspectSource=function(e){return r(e)}),Tt=n.inspectSource}function Gt(){if(Mt)return Pt;Mt=1;var e=it(),t=st(),n=e("keys");return Pt=function(e){return n[e]||(n[e]=t(e))}}function qt(){return Bt?Lt:(Bt=1,Lt={})}function Yt(){if(Dt)return Ut;Dt=1;var e,t,n,r=function(){if(Ot)return kt;Ot=1;var e=s(),t=ve(),n=e.WeakMap;return kt=t(n)&&/native code/.test(String(n))}(),i=s(),o=ye(),a=St(),c=at(),l=rt(),u=Gt(),h=qt(),f="Object already initialized",d=i.TypeError,m=i.WeakMap;if(r||l.state){var g=l.state||(l.state=new m);g.get=g.get,g.has=g.has,g.set=g.set,e=function(e,t){if(g.has(e))throw new d(f);return t.facade=e,g.set(e,t),t},t=function(e){return g.get(e)||{}},n=function(e){return g.has(e)}}else{var p=u("state");h[p]=!0,e=function(e,t){if(c(e,p))throw new d(f);return t.facade=e,a(e,p,t),t},t=function(e){return c(e,p)?e[p]:{}},n=function(e){return c(e,p)}}return Ut={set:e,get:t,has:n,enforce:function(r){return n(r)?t(r):e(r,{})},getterFor:function(e){return function(n){var r;if(!o(n)||(r=t(n)).type!==e)throw new d("Incompatible receiver, "+e+" required");return r}}}}function Vt(){if(Ft)return jt.exports;Ft=1;var e=he(),t=v(),n=ve(),r=at(),i=y(),o=zt().CONFIGURABLE,a=Ht(),s=Yt(),c=s.enforce,l=s.get,u=String,h=Object.defineProperty,f=e("".slice),d=e("".replace),m=e([].join),g=i&&!t(function(){return 8!==h(function(){},"length",{value:8}).length}),p=String(String).split("String"),A=jt.exports=function(e,t,n){"Symbol("===f(u(t),0,7)&&(t="["+d(u(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!r(e,"name")||o&&e.name!==t)&&(i?h(e,"name",{value:t,configurable:!0}):e.name=t),g&&n&&r(n,"arity")&&e.length!==n.arity&&h(e,"length",{value:n.arity});try{n&&r(n,"constructor")&&n.constructor?i&&h(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var a=c(e);return r(a,"source")||(a.source=m(p,"string"==typeof t?t:"")),e};return Function.prototype.toString=A(function(){return n(this)&&l(this).source||a(this)},"toString"),jt.exports}function Xt(){if(Wt)return Nt;Wt=1;var e=ve(),t=xt(),n=Vt(),r=nt();return Nt=function(i,o,a,s){s||(s={});var c=s.enumerable,l=void 0!==s.name?s.name:o;if(e(a)&&n(a,l,s),s.global)c?i[o]=a:r(o,a);else{try{s.unsafe?i[o]&&(c=!0):delete i[o]}catch(e){}c?i[o]=a:t.f(i,o,{value:a,enumerable:!1,configurable:!s.nonConfigurable,writable:!s.nonWritable})}return i}}var $t,Jt,Qt,Zt,Kt,en,tn,nn,rn,on,an,sn,cn,ln,un,hn,fn,dn={};function mn(){if(Zt)return Qt;Zt=1;var e=function(){if(Jt)return $t;Jt=1;var e=Math.ceil,t=Math.floor;return $t=Math.trunc||function(n){var r=+n;return(r>0?t:e)(r)}}();return Qt=function(t){var n=+t;return n!=n||0===n?0:e(n)}}function gn(){if(en)return Kt;en=1;var e=mn(),t=Math.max,n=Math.min;return Kt=function(r,i){var o=e(r);return o<0?t(o+i,0):n(o,i)}}function pn(){if(nn)return tn;nn=1;var e=mn(),t=Math.min;return tn=function(n){var r=e(n);return r>0?t(r,9007199254740991):0}}function vn(){if(on)return rn;on=1;var e=pn();return rn=function(t){return e(t.length)}}function yn(){if(ln)return cn;ln=1;var e=he(),t=at(),n=pe(),r=function(){if(sn)return an;sn=1;var e=pe(),t=gn(),n=vn(),r=function(r){return function(i,o,a){var s=e(i),c=n(s);if(0===c)return!r&&-1;var l,u=t(a,c);if(r&&o!=o){for(;c>u;)if((l=s[u++])!=l)return!0}else for(;c>u;u++)if((r||u in s)&&s[u]===o)return r||u||0;return!r&&-1}};return an={includes:r(!0),indexOf:r(!1)}}().indexOf,i=qt(),o=e([].push);return cn=function(e,a){var s,c=n(e),l=0,u=[];for(s in c)!t(i,s)&&t(c,s)&&o(u,s);for(;a.length>l;)t(c,s=a[l++])&&(~r(u,s)||o(u,s));return u}}function An(){return hn?un:(hn=1,un=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"])}function _n(){if(fn)return dn;fn=1;var e=yn(),t=An().concat("length","prototype");return dn.f=Object.getOwnPropertyNames||function(n){return e(n,t)},dn}var bn,wn,En,xn,Sn,Cn,In,Tn,Rn,kn,On,Pn,Mn,Ln,Bn,Un,Dn,Fn,Nn,Wn,jn,zn,Hn,Gn,qn,Yn,Vn,Xn,$n,Jn,Qn,Zn,Kn,er,tr,nr,rr,ir,or,ar,sr,cr,lr={};function ur(){return bn||(bn=1,lr.f=Object.getOwnPropertySymbols),lr}function hr(){if(En)return wn;En=1;var e=Ae(),t=he(),n=_n(),r=ur(),i=Et(),o=t([].concat);return wn=e("Reflect","ownKeys")||function(e){var t=n.f(i(e)),a=r.f;return a?o(t,a(e)):t}}function fr(){if(Sn)return xn;Sn=1;var e=at(),t=hr(),n=dt(),r=xt();return xn=function(i,o,a){for(var s=t(o),c=r.f,l=n.f,u=0;u<s.length;u++){var h=s[u];e(i,h)||a&&e(a,h)||c(i,h,l(o,h))}}}function dr(){if(In)return Cn;In=1;var e=v(),t=ve(),n=/#|\.prototype\./,r=function(n,r){var c=o[i(n)];return c===s||c!==a&&(t(r)?e(r):!!r)},i=r.normalize=function(e){return String(e).replace(n,".").toLowerCase()},o=r.data={},a=r.NATIVE="N",s=r.POLYFILL="P";return Cn=r}function mr(){if(Rn)return Tn;Rn=1;var e=s(),t=dt().f,n=St(),r=Xt(),i=nt(),o=fr(),a=dr();return Tn=function(s,c){var l,u,h,f,d,m=s.target,g=s.global,p=s.stat;if(l=g?e:p?e[m]||i(m,{}):e[m]&&e[m].prototype)for(u in c){if(f=c[u],h=s.dontCallGetSet?(d=t(l,u))&&d.value:l[u],!a(g?u:m+(p?".":"#")+u,s.forced)&&void 0!==h){if(typeof f==typeof h)continue;o(f,h)}(s.sham||h&&h.sham)&&n(f,"sham",!0),r(l,u,f,s)}}}function gr(){if(On)return kn;On=1;var e=A(),t=Function.prototype,n=t.apply,r=t.call;return kn="object"==typeof Reflect&&Reflect.apply||(e?r.bind(n):function(){return r.apply(n,arguments)}),kn}function pr(){if(Mn)return Pn;Mn=1;var e=he(),t=Ie();return Pn=function(n,r,i){try{return e(t(Object.getOwnPropertyDescriptor(n,r)[i]))}catch(e){}}}function vr(){if(Bn)return Ln;Bn=1;var e=ye();return Ln=function(t){return e(t)||null===t}}function yr(){if(Dn)return Un;Dn=1;var e=vr(),t=String,n=TypeError;return Un=function(r){if(e(r))return r;throw new n("Can't set "+t(r)+" as a prototype")}}function Ar(){if(Nn)return Fn;Nn=1;var e=pr(),t=ye(),n=ge(),r=yr();return Fn=Object.setPrototypeOf||("__proto__"in{}?function(){var i,o=!1,a={};try{(i=e(Object.prototype,"__proto__","set"))(a,[]),o=a instanceof Array}catch(e){}return function(e,a){return n(e),r(a),t(e)?(o?i(e,a):e.__proto__=a,e):e}}():void 0)}function _r(){if(jn)return Wn;jn=1;var e=xt().f;return Wn=function(t,n,r){r in t||e(t,r,{configurable:!0,get:function(){return n[r]},set:function(e){n[r]=e}})}}function br(){if(Hn)return zn;Hn=1;var e=ve(),t=ye(),n=Ar();return zn=function(r,i,o){var a,s;return n&&e(a=i.constructor)&&a!==o&&t(s=a.prototype)&&s!==o.prototype&&n(r,s),r}}function wr(){if(Vn)return Yn;Vn=1;var e=function(){if(qn)return Gn;qn=1;var e={};return e[ct()("toStringTag")]="z",Gn="[object z]"===String(e)}(),t=ve(),n=fe(),r=ct()("toStringTag"),i=Object,o="Arguments"===n(function(){return arguments}());return Yn=e?n:function(e){var a,s,c;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(s=function(e,t){try{return e[t]}catch(e){}}(a=i(e),r))?s:o?n(a):"Object"===(c=n(a))&&t(a.callee)?"Arguments":c}}function Er(){if($n)return Xn;$n=1;var e=wr(),t=String;return Xn=function(n){if("Symbol"===e(n))throw new TypeError("Cannot convert a Symbol value to a string");return t(n)}}function xr(){if(Qn)return Jn;Qn=1;var e=Er();return Jn=function(t,n){return void 0===t?arguments.length<2?"":n:e(t)},Jn}function Sr(){if(Kn)return Zn;Kn=1;var e=ye(),t=St();return Zn=function(n,r){e(r)&&"cause"in r&&t(n,"cause",r.cause)}}function Cr(){if(tr)return er;tr=1;var e=he(),t=Error,n=e("".replace),r=String(new t("zxcasd").stack),i=/\n\s*at [^:]*:[^\n]*/,o=i.test(r);return er=function(e,r){if(o&&"string"==typeof e&&!t.prepareStackTrace)for(;r--;)e=n(e,i,"");return e}}function Ir(){if(or)return ir;or=1;var e=St(),t=Cr(),n=function(){if(rr)return nr;rr=1;var e=v(),t=ue();return nr=!e(function(){var e=new Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",t(1,7)),7!==e.stack)})}(),r=Error.captureStackTrace;return ir=function(i,o,a,s){n&&(r?r(i,o):e(i,"stack",t(a,s)))}}function Tr(){if(sr)return ar;sr=1;var e=Ae(),t=at(),n=St(),r=_e(),i=Ar(),o=fr(),a=_r(),s=br(),c=xr(),l=Sr(),u=Ir(),h=y(),f=tt();return ar=function(d,m,g,p){var v="stackTraceLimit",y=p?2:1,A=d.split("."),_=A[A.length-1],b=e.apply(null,A);if(b){var w=b.prototype;if(!f&&t(w,"cause")&&delete w.cause,!g)return b;var E=e("Error"),x=m(function(e,t){var i=c(p?t:e,void 0),o=p?new b(e):new b;return void 0!==i&&n(o,"message",i),u(o,x,o.stack,2),this&&r(w,this)&&s(o,this,x),arguments.length>y&&l(o,arguments[y]),o});if(x.prototype=w,"Error"!==_?i?i(x,E):o(x,E,{name:!0}):h&&v in b&&(a(x,b,v),a(x,b,"prepareStackTrace")),o(x,b),!f)try{w.name!==_&&n(w,"name",_),w.constructor=x}catch(e){}return x}},ar}!function(){if(cr)return a;cr=1;var e=mr(),t=s(),n=gr(),r=Tr(),i="WebAssembly",o=t[i],c=7!==new Error("e",{cause:7}).cause,l=function(t,n){var i={};i[t]=r(t,n,c),e({global:!0,constructor:!0,arity:1,forced:c},i)},u=function(t,n){if(o&&o[t]){var a={};a[t]=r(i+"."+t,n,c),e({target:i,stat:!0,constructor:!0,arity:1,forced:c},a)}};l("Error",function(e){return function(t){return n(e,this,arguments)}}),l("EvalError",function(e){return function(t){return n(e,this,arguments)}}),l("RangeError",function(e){return function(t){return n(e,this,arguments)}}),l("ReferenceError",function(e){return function(t){return n(e,this,arguments)}}),l("SyntaxError",function(e){return function(t){return n(e,this,arguments)}}),l("TypeError",function(e){return function(t){return n(e,this,arguments)}}),l("URIError",function(e){return function(t){return n(e,this,arguments)}}),u("CompileError",function(e){return function(t){return n(e,this,arguments)}}),u("LinkError",function(e){return function(t){return n(e,this,arguments)}}),u("RuntimeError",function(e){return function(t){return n(e,this,arguments)}})}();var Rr,kr,Or,Pr,Mr,Lr,Br,Ur,Dr,Fr,Nr,Wr,jr,zr,Hr,Gr,qr,Yr={};function Vr(){if(kr)return Rr;kr=1;var e=fe();return Rr=Array.isArray||function(t){return"Array"===e(t)}}function Xr(){if(Pr)return Or;Pr=1;var e=TypeError;return Or=function(t){if(t>9007199254740991)throw e("Maximum allowed index exceeded");return t}}function $r(){if(Lr)return Mr;Lr=1;var e=fe(),t=he();return Mr=function(n){if("Function"===e(n))return t(n)}}function Jr(){if(Ur)return Br;Ur=1;var e=$r(),t=Ie(),n=A(),r=e(e.bind);return Br=function(e,i){return t(e),void 0===i?e:n?r(e,i):function(){return e.apply(i,arguments)}},Br}function Qr(){if(Wr)return Nr;Wr=1;var e=he(),t=v(),n=ve(),r=wr(),i=Ae(),o=Ht(),a=function(){},s=i("Reflect","construct"),c=/^\s*(?:class|function)\b/,l=e(c.exec),u=!c.test(a),h=function(e){if(!n(e))return!1;try{return s(a,[],e),!0}catch(e){return!1}},f=function(e){if(!n(e))return!1;switch(r(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return u||!!l(c,o(e))}catch(e){return!0}};return f.sham=!0,Nr=!s||t(function(){var e;return h(h.call)||!h(Object)||!h(function(){e=!0})||e})?f:h}function Zr(){if(zr)return jr;zr=1;var e=Vr(),t=Qr(),n=ye(),r=ct()("species"),i=Array;return jr=function(o){var a;return e(o)&&(a=o.constructor,(t(a)&&(a===i||e(a.prototype))||n(a)&&null===(a=a[r]))&&(a=void 0)),void 0===a?i:a}}function Kr(){if(Gr)return Hr;Gr=1;var e=Zr();return Hr=function(t,n){return new(e(t))(0===n?0:n)}}!function(){if(qr)return Yr;qr=1;var e=mr(),t=function(){if(Fr)return Dr;Fr=1;var e=Vr(),t=vn(),n=Xr(),r=Jr(),i=function(o,a,s,c,l,u,h,f){for(var d,m,g=l,p=0,v=!!h&&r(h,f);p<c;)p in s&&(d=v?v(s[p],p,a):s[p],u>0&&e(d)?(m=t(d),g=i(o,a,d,m,g,u-1)-1):(n(g+1),o[g]=d),g++),p++;return g};return Dr=i}(),n=ot(),r=vn(),i=mn(),o=Kr();e({target:"Array",proto:!0},{flat:function(){var e=arguments.length?arguments[0]:void 0,a=n(this),s=r(a),c=o(a,0);return c.length=t(c,a,a,s,0,void 0===e?1:i(e)),c}})}();var ei,ti,ni,ri={};!function(){if(ni)return ri;ni=1;var e=mr(),t=ot(),n=vn(),r=function(){if(ti)return ei;ti=1;var e=y(),t=Vr(),n=TypeError,r=Object.getOwnPropertyDescriptor,i=e&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}();return ei=i?function(e,i){if(t(e)&&!r(e,"length").writable)throw new n("Cannot set read only .length");return e.length=i}:function(e,t){return e.length=t}}(),i=Xr();e({target:"Array",proto:!0,arity:1,forced:v()(function(){return 4294967297!==[].push.call({length:4294967296},1)})||!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(e){return e instanceof TypeError}}()},{push:function(e){var o=t(this),a=n(o),s=arguments.length;i(a+s);for(var c=0;c<s;c++)o[a]=arguments[c],a++;return r(o,a),a}})}();var ii,oi,ai,si,ci,li,ui,hi,fi,di,mi,gi,pi,vi,yi,Ai={};function _i(){if(oi)return ii;oi=1;var e=Ce(),t=TypeError;return ii=function(n,r){if(!delete n[r])throw new t("Cannot delete property "+e(r)+" of "+e(n))}}function bi(){if(si)return ai;si=1;var e=he();return ai=e([].slice)}function wi(){if(li)return ci;li=1;var e=bi(),t=Math.floor,n=function(r,i){var o=r.length;if(o<8)for(var a,s,c=1;c<o;){for(s=c,a=r[c];s&&i(r[s-1],a)>0;)r[s]=r[--s];s!==c++&&(r[s]=a)}else for(var l=t(o/2),u=n(e(r,0,l),i),h=n(e(r,l),i),f=u.length,d=h.length,m=0,g=0;m<f||g<d;)r[m+g]=m<f&&g<d?i(u[m],h[g])<=0?u[m++]:h[g++]:m<f?u[m++]:h[g++];return r};return ci=n}function Ei(){if(hi)return ui;hi=1;var e=v();return ui=function(t,n){var r=[][t];return!!r&&e(function(){r.call(null,n||function(){return 1},1)})}}function xi(){if(di)return fi;di=1;var e=be().match(/firefox\/(\d+)/i);return fi=!!e&&+e[1]}function Si(){if(gi)return mi;gi=1;var e=be();return mi=/MSIE|Trident/.test(e)}function Ci(){if(vi)return pi;vi=1;var e=be().match(/AppleWebKit\/(\d+)\./);return pi=!!e&&+e[1]}!function(){if(yi)return Ai;yi=1;var e=mr(),t=he(),n=Ie(),r=ot(),i=vn(),o=_i(),a=Er(),s=v(),c=wi(),l=Ei(),u=xi(),h=Si(),f=we(),d=Ci(),m=[],g=t(m.sort),p=t(m.push),y=s(function(){m.sort(void 0)}),A=s(function(){m.sort(null)}),_=l("sort"),b=!s(function(){if(f)return f<70;if(!(u&&u>3)){if(h)return!0;if(d)return d<603;var e,t,n,r,i="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:n=3;break;case 68:case 71:n=4;break;default:n=2}for(r=0;r<47;r++)m.push({k:t+r,v:n})}for(m.sort(function(e,t){return t.v-e.v}),r=0;r<m.length;r++)t=m[r].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}});e({target:"Array",proto:!0,forced:y||!A||!_||!b},{sort:function(e){void 0!==e&&n(e);var t=r(this);if(b)return void 0===e?g(t):g(t,e);var s,l,u=[],h=i(t);for(l=0;l<h;l++)l in t&&p(u,t[l]);for(c(u,function(e){return function(t,n){return void 0===n?-1:void 0===t?1:void 0!==e?+e(t,n)||0:a(t)>a(n)?1:-1}}(e)),s=i(u),l=0;l<s;)t[l]=u[l++];for(;l<h;)o(t,l++);return t}})}();var Ii,Ti,Ri,ki,Oi,Pi,Mi,Li,Bi,Ui,Di={};function Fi(){if(Ti)return Ii;Ti=1;var e=yn(),t=An();return Ii=Object.keys||function(n){return e(n,t)}}function Ni(){if(Oi)return ki;Oi=1;var e=Ae();return ki=e("document","documentElement")}function Wi(){if(Mi)return Pi;Mi=1;var e,t=Et(),n=function(){if(Ri)return Di;Ri=1;var e=y(),t=wt(),n=xt(),r=Et(),i=pe(),o=Fi();return Di.f=e&&!t?Object.defineProperties:function(e,t){r(e);for(var a,s=i(t),c=o(t),l=c.length,u=0;l>u;)n.f(e,a=c[u++],s[a]);return e},Di}(),r=An(),i=qt(),o=Ni(),a=ht(),s=Gt(),c="prototype",l="script",u=s("IE_PROTO"),h=function(){},f=function(e){return"<"+l+">"+e+"</"+l+">"},d=function(e){e.write(f("")),e.close();var t=e.parentWindow.Object;return e=null,t},m=function(){try{e=new ActiveXObject("htmlfile")}catch(e){}var t,n,i;m="undefined"!=typeof document?document.domain&&e?d(e):(n=a("iframe"),i="java"+l+":",n.style.display="none",o.appendChild(n),n.src=String(i),(t=n.contentWindow.document).open(),t.write(f("document.F=Object")),t.close(),t.F):d(e);for(var s=r.length;s--;)delete m[c][r[s]];return m()};return i[u]=!0,Pi=Object.create||function(e,r){var i;return null!==e?(h[c]=t(e),i=new h,h[c]=null,i[u]=e):i=m(),void 0===r?i:n.f(i,r)}}function ji(){if(Bi)return Li;Bi=1;var e=ct(),t=Wi(),n=xt().f,r=e("unscopables"),i=Array.prototype;return void 0===i[r]&&n(i,r,{configurable:!0,value:t(null)}),Li=function(e){i[r][e]=!0}}Ui||(Ui=1,ji()("flat"));var zi,Hi,Gi,qi,Yi,Vi,Xi,$i,Ji,Qi,Zi,Ki,eo,to,no,ro,io,oo,ao,so,co,lo,uo,ho,fo,mo,go,po,vo,yo,Ao,_o,bo,wo={};function Eo(){return Hi?zi:(Hi=1,zi="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView)}function xo(){if(qi)return Gi;qi=1;var e=Vt(),t=xt();return Gi=function(n,r,i){return i.get&&e(i.get,r,{getter:!0}),i.set&&e(i.set,r,{setter:!0}),t.f(n,r,i)}}function So(){if(Vi)return Yi;Vi=1;var e=Xt();return Yi=function(t,n,r){for(var i in n)e(t,i,n[i],r);return t}}function Co(){if($i)return Xi;$i=1;var e=_e(),t=TypeError;return Xi=function(n,r){if(e(r,n))return n;throw new t("Incorrect invocation")}}function Io(){if(Qi)return Ji;Qi=1;var e=mn(),t=pn(),n=RangeError;return Ji=function(r){if(void 0===r)return 0;var i=e(r),o=t(i);if(i!==o)throw new n("Wrong length or index");return o}}function To(){if(ro)return no;ro=1;var e=Ki?Zi:(Ki=1,Zi=Math.sign||function(e){var t=+e;return 0===t||t!=t?t:t<0?-1:1}),t=function(){if(to)return eo;to=1;var e=4503599627370496;return eo=function(t){return t+e-e}}(),n=Math.abs;return no=function(r,i,o,a){var s=+r,c=n(s),l=e(s);if(c<a)return l*t(c/a/i)*a*i;var u=(1+i/2220446049250313e-31)*c,h=u-(u-c);return h>o||h!=h?l*(1/0):l*h}}function Ro(){if(so)return ao;so=1;var e=Array,t=Math.abs,n=Math.pow,r=Math.floor,i=Math.log,o=Math.LN2;return ao={pack:function(a,s,c){var l,u,h,f=e(c),d=8*c-s-1,m=(1<<d)-1,g=m>>1,p=23===s?n(2,-24)-n(2,-77):0,v=a<0||0===a&&1/a<0?1:0,y=0;for((a=t(a))!=a||a===1/0?(u=a!=a?1:0,l=m):(l=r(i(a)/o),a*(h=n(2,-l))<1&&(l--,h*=2),(a+=l+g>=1?p/h:p*n(2,1-g))*h>=2&&(l++,h/=2),l+g>=m?(u=0,l=m):l+g>=1?(u=(a*h-1)*n(2,s),l+=g):(u=a*n(2,g-1)*n(2,s),l=0));s>=8;)f[y++]=255&u,u/=256,s-=8;for(l=l<<s|u,d+=s;d>0;)f[y++]=255&l,l/=256,d-=8;return f[y-1]|=128*v,f},unpack:function(e,t){var r,i=e.length,o=8*i-t-1,a=(1<<o)-1,s=a>>1,c=o-7,l=i-1,u=e[l--],h=127&u;for(u>>=7;c>0;)h=256*h+e[l--],c-=8;for(r=h&(1<<-c)-1,h>>=-c,c+=t;c>0;)r=256*r+e[l--],c-=8;if(0===h)h=1-s;else{if(h===a)return r?NaN:u?-1/0:1/0;r+=n(2,t),h-=s}return(u?-1:1)*r*n(2,h-t)}}}function ko(){if(ho)return uo;ho=1;var e=at(),t=ve(),n=ot(),r=Gt(),i=function(){if(lo)return co;lo=1;var e=v();return co=!e(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})}(),o=r("IE_PROTO"),a=Object,s=a.prototype;return uo=i?a.getPrototypeOf:function(r){var i=n(r);if(e(i,o))return i[o];var c=i.constructor;return t(c)&&i instanceof c?c.prototype:i instanceof a?s:null}}function Oo(){if(mo)return fo;mo=1;var e=ot(),t=gn(),n=vn();return fo=function(r){for(var i=e(this),o=n(i),a=arguments.length,s=t(a>1?arguments[1]:void 0,o),c=a>2?arguments[2]:void 0,l=void 0===c?o:t(c,o);l>s;)i[s++]=r;return i},fo}function Po(){if(po)return go;po=1;var e=xt().f,t=at(),n=ct()("toStringTag");return go=function(r,i,o){r&&!o&&(r=r.prototype),r&&!t(r,n)&&e(r,n,{configurable:!0,value:i})}}function Mo(){if(yo)return vo;yo=1;var e=s(),t=he(),n=y(),r=Eo(),i=zt(),o=St(),a=xo(),c=So(),l=v(),u=Co(),h=mn(),f=pn(),d=Io(),m=function(){if(oo)return io;oo=1;var e=To();return io=Math.fround||function(t){return e(t,1.1920928955078125e-7,34028234663852886e22,11754943508222875e-54)}}(),g=Ro(),p=ko(),A=Ar(),_=Oo(),b=bi(),w=br(),E=fr(),x=Po(),S=Yt(),C=i.PROPER,I=i.CONFIGURABLE,T="ArrayBuffer",R="DataView",k="prototype",O="Wrong index",P=S.getterFor(T),M=S.getterFor(R),L=S.set,B=e[T],U=B,D=U&&U[k],F=e[R],N=F&&F[k],W=Object.prototype,j=e.Array,z=e.RangeError,H=t(_),G=t([].reverse),q=g.pack,Y=g.unpack,V=function(e){return[255&e]},X=function(e){return[255&e,e>>8&255]},$=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},J=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},Q=function(e){return q(m(e),23,4)},Z=function(e){return q(e,52,8)},K=function(e,t,n){a(e[k],t,{configurable:!0,get:function(){return n(this)[t]}})},ee=function(e,t,n,r){var i=M(e),o=d(n),a=!!r;if(o+t>i.byteLength)throw new z(O);var s=i.bytes,c=o+i.byteOffset,l=b(s,c,c+t);return a?l:G(l)},te=function(e,t,n,r,i,o){var a=M(e),s=d(n),c=r(+i),l=!!o;if(s+t>a.byteLength)throw new z(O);for(var u=a.bytes,h=s+a.byteOffset,f=0;f<t;f++)u[h+f]=c[l?f:t-f-1]};if(r){var ne=C&&B.name!==T;l(function(){B(1)})&&l(function(){new B(-1)})&&!l(function(){return new B,new B(1.5),new B(NaN),1!==B.length||ne&&!I})?ne&&I&&o(B,"name",T):((U=function(e){return u(this,D),w(new B(d(e)),this,U)})[k]=D,D.constructor=U,E(U,B)),A&&p(N)!==W&&A(N,W);var re=new F(new U(2)),ie=t(N.setInt8);re.setInt8(0,2147483648),re.setInt8(1,2147483649),!re.getInt8(0)&&re.getInt8(1)||c(N,{setInt8:function(e,t){ie(this,e,t<<24>>24)},setUint8:function(e,t){ie(this,e,t<<24>>24)}},{unsafe:!0})}else D=(U=function(e){u(this,D);var t=d(e);L(this,{type:T,bytes:H(j(t),0),byteLength:t}),n||(this.byteLength=t,this.detached=!1)})[k],N=(F=function(e,t,r){u(this,N),u(e,D);var i=P(e),o=i.byteLength,a=h(t);if(a<0||a>o)throw new z("Wrong offset");if(a+(r=void 0===r?o-a:f(r))>o)throw new z("Wrong length");L(this,{type:R,buffer:e,byteLength:r,byteOffset:a,bytes:i.bytes}),n||(this.buffer=e,this.byteLength=r,this.byteOffset=a)})[k],n&&(K(U,"byteLength",P),K(F,"buffer",M),K(F,"byteLength",M),K(F,"byteOffset",M)),c(N,{getInt8:function(e){return ee(this,1,e)[0]<<24>>24},getUint8:function(e){return ee(this,1,e)[0]},getInt16:function(e){var t=ee(this,2,e,arguments.length>1&&arguments[1]);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=ee(this,2,e,arguments.length>1&&arguments[1]);return t[1]<<8|t[0]},getInt32:function(e){return J(ee(this,4,e,arguments.length>1&&arguments[1]))},getUint32:function(e){return J(ee(this,4,e,arguments.length>1&&arguments[1]))>>>0},getFloat32:function(e){return Y(ee(this,4,e,arguments.length>1&&arguments[1]),23)},getFloat64:function(e){return Y(ee(this,8,e,arguments.length>1&&arguments[1]),52)},setInt8:function(e,t){te(this,1,e,V,t)},setUint8:function(e,t){te(this,1,e,V,t)},setInt16:function(e,t){te(this,2,e,X,t,arguments.length>2&&arguments[2])},setUint16:function(e,t){te(this,2,e,X,t,arguments.length>2&&arguments[2])},setInt32:function(e,t){te(this,4,e,$,t,arguments.length>2&&arguments[2])},setUint32:function(e,t){te(this,4,e,$,t,arguments.length>2&&arguments[2])},setFloat32:function(e,t){te(this,4,e,Q,t,arguments.length>2&&arguments[2])},setFloat64:function(e,t){te(this,8,e,Z,t,arguments.length>2&&arguments[2])}});return x(U,T),x(F,R),vo={ArrayBuffer:U,DataView:F}}function Lo(){if(_o)return Ao;_o=1;var e=Ae(),t=xo(),n=ct(),r=y(),i=n("species");return Ao=function(n){var o=e(n);r&&o&&!o[i]&&t(o,i,{configurable:!0,get:function(){return this}})}}!function(){if(bo)return wo;bo=1;var e=mr(),t=s(),n=Mo(),r=Lo(),i="ArrayBuffer",o=n[i];e({global:!0,constructor:!0,forced:t[i]!==o},{ArrayBuffer:o}),r(i)}();var Bo,Uo={};!function(){if(Bo)return Uo;Bo=1;var e=mr(),t=$r(),n=v(),r=Mo(),i=Et(),o=gn(),a=pn(),s=r.ArrayBuffer,c=r.DataView,l=c.prototype,u=t(s.prototype.slice),h=t(l.getUint8),f=t(l.setUint8);e({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:n(function(){return!new s(2).slice(1,void 0).byteLength})},{slice:function(e,t){if(u&&void 0===t)return u(i(this),e);for(var n=i(this).byteLength,r=o(e,n),l=o(void 0===t?n:t,n),d=new s(a(l-r)),m=new c(this),g=new c(d),p=0;r<l;)f(g,p++,h(m,r++));return d}})}();var Do,Fo,No,Wo,jo,zo={};function Ho(){if(Fo)return Do;Fo=1;var e=s(),t=pr(),n=fe(),r=e.ArrayBuffer,i=e.TypeError;return Do=r&&t(r.prototype,"byteLength","get")||function(e){if("ArrayBuffer"!==n(e))throw new i("ArrayBuffer expected");return e.byteLength}}function Go(){if(Wo)return No;Wo=1;var e=s(),t=Eo(),n=Ho(),r=e.DataView;return No=function(e){if(!t||0!==n(e))return!1;try{return new r(e),!1}catch(e){return!0}}}!function(){if(jo)return zo;jo=1;var e=y(),t=xo(),n=Go(),r=ArrayBuffer.prototype;e&&!("detached"in r)&&t(r,"detached",{configurable:!0,get:function(){return n(this)}})}();var qo,Yo,Vo,Xo,$o,Jo,Qo,Zo,Ko,ea,ta,na,ra,ia,oa,aa={};function sa(){if(Xo)return Vo;Xo=1;var e=s(),t=be(),n=fe(),r=function(e){return t.slice(0,e.length)===e};return Vo=r("Bun/")?"BUN":r("Cloudflare-Workers")?"CLOUDFLARE":r("Deno/")?"DENO":r("Node.js/")?"NODE":e.Bun&&"string"==typeof Bun.version?"BUN":e.Deno&&"object"==typeof Deno.version?"DENO":"process"===n(e.process)?"NODE":e.window&&e.document?"BROWSER":"REST"}function ca(){if(Zo)return Qo;Zo=1;var e=s(),t=function(){if(Jo)return $o;Jo=1;var e=sa();return $o="NODE"===e}();return Qo=function(n){if(t){try{return e.process.getBuiltinModule(n)}catch(e){}try{return Function('return require("'+n+'")')()}catch(e){}}}}function la(){if(ea)return Ko;ea=1;var e=s(),t=v(),n=we(),r=sa(),i=e.structuredClone;return Ko=!!i&&!t(function(){if("DENO"===r&&n>92||"NODE"===r&&n>94||"BROWSER"===r&&n>97)return!1;var e=new ArrayBuffer(8),t=i(e,{transfer:[e]});return 0!==e.byteLength||8!==t.byteLength})}function ua(){if(na)return ta;na=1;var e,t,n,r,i=s(),o=ca(),a=la(),c=i.structuredClone,l=i.ArrayBuffer,u=i.MessageChannel,h=!1;if(a)h=function(e){c(e,{transfer:[e]})};else if(l)try{u||(e=o("worker_threads"))&&(u=e.MessageChannel),u&&(t=new u,n=new l(2),r=function(e){t.port1.postMessage(null,[e])},2===n.byteLength&&(r(n),0===n.byteLength&&(h=r)))}catch(e){}return ta=h}function ha(){if(ia)return ra;ia=1;var e=s(),t=he(),n=pr(),r=Io(),i=function(){if(Yo)return qo;Yo=1;var e=Go(),t=TypeError;return qo=function(n){if(e(n))throw new t("ArrayBuffer is detached");return n}}(),o=Ho(),a=ua(),c=la(),l=e.structuredClone,u=e.ArrayBuffer,h=e.DataView,f=Math.min,d=u.prototype,m=h.prototype,g=t(d.slice),p=n(d,"resizable","get"),v=n(d,"maxByteLength","get"),y=t(m.getInt8),A=t(m.setInt8);return ra=(c||a)&&function(e,t,n){var s,d=o(e),m=void 0===t?d:r(t),_=!p||!p(e);if(i(e),c&&(e=l(e,{transfer:[e]}),d===m&&(n||_)))return e;if(d>=m&&(!n||_))s=g(e,0,m);else{var b=n&&!_&&v?{maxByteLength:v(e)}:void 0;s=new u(m,b);for(var w=new h(e),E=new h(s),x=f(m,d),S=0;S<x;S++)A(E,S,y(w,S))}return c||a(e),s},ra}!function(){if(oa)return aa;oa=1;var e=mr(),t=ha();t&&e({target:"ArrayBuffer",proto:!0},{transfer:function(){return t(this,arguments.length?arguments[0]:void 0,!0)}})}();var fa,da={};!function(){if(fa)return da;fa=1;var e=mr(),t=ha();t&&e({target:"ArrayBuffer",proto:!0},{transferToFixedLength:function(){return t(this,arguments.length?arguments[0]:void 0,!1)}})}();var ma,ga,pa,va,ya,Aa={};function _a(){if(ga)return ma;ga=1;var e=y(),t=xt(),n=ue();return ma=function(r,i,o){e?t.f(r,i,n(0,o)):r[i]=o}}function ba(){if(va)return pa;va=1;var e,t,n,r=v(),i=ve(),o=ye(),a=Wi(),s=ko(),c=Xt(),l=ct(),u=tt(),h=l("iterator"),f=!1;return[].keys&&("next"in(n=[].keys())?(t=s(s(n)))!==Object.prototype&&(e=t):f=!0),!o(e)||r(function(){var t={};return e[h].call(t)!==t})?e={}:u&&(e=a(e)),i(e[h])||c(e,h,function(){return this}),pa={IteratorPrototype:e,BUGGY_SAFARI_ITERATORS:f}}!function(){if(ya)return Aa;ya=1;var e=mr(),t=s(),n=Co(),r=Et(),i=ve(),o=ko(),a=xo(),c=_a(),l=v(),u=at(),h=ct(),f=ba().IteratorPrototype,d=y(),m=tt(),g="constructor",p="Iterator",A=h("toStringTag"),_=TypeError,b=t[p],w=m||!i(b)||b.prototype!==f||!l(function(){b({})}),E=function(){if(n(this,f),o(this)===f)throw new _("Abstract class Iterator not directly constructable")},x=function(e,t){d?a(f,e,{configurable:!0,get:function(){return t},set:function(t){if(r(this),this===f)throw new _("You can't redefine this property");u(this,e)?this[e]=t:c(this,e,t)}}):f[e]=t};u(f,A)||x(A,p),!w&&u(f,g)&&f[g]!==Object||x(g,E),E.prototype=f,e({global:!0,constructor:!0,forced:w},{Iterator:E})}();var wa,Ea,xa,Sa,Ca,Ia,Ta,Ra,ka,Oa,Pa,Ma,La,Ba,Ua,Da,Fa,Na={};function Wa(){return Ea?wa:(Ea=1,wa=function(e){return{iterator:e,next:e.next,done:!1}})}function ja(){return Sa?xa:(Sa=1,xa=function(e,t){return{value:e,done:t}})}function za(){if(Ia)return Ca;Ia=1;var e=_(),t=Et(),n=Te();return Ca=function(r,i,o){var a,s;t(r);try{if(!(a=n(r,"return"))){if("throw"===i)throw o;return o}a=e(a,r)}catch(e){s=!0,a=e}if("throw"===i)throw o;if(s)throw a;return t(a),o}}function Ha(){if(Ra)return Ta;Ra=1;var e=za();return Ta=function(t,n,r){for(var i=t.length-1;i>=0;i--)if(void 0!==t[i])try{r=e(t[i].iterator,n,r)}catch(e){n="throw",r=e}if("throw"===n)throw r;return r}}function Ga(){if(Oa)return ka;Oa=1;var e=_(),t=Wi(),n=St(),r=So(),i=ct(),o=Yt(),a=Te(),s=ba().IteratorPrototype,c=ja(),l=za(),u=Ha(),h=i("toStringTag"),f="IteratorHelper",d="WrapForValidIterator",m="normal",g="throw",p=o.set,v=function(n){var i=o.getterFor(n?d:f);return r(t(s),{next:function(){var e=i(this);if(n)return e.nextHandler();if(e.done)return c(void 0,!0);try{var t=e.nextHandler();return e.returnHandlerResult?t:c(t,e.done)}catch(t){throw e.done=!0,t}},return:function(){var t=i(this),r=t.iterator;if(t.done=!0,n){var o=a(r,"return");return o?e(o,r):c(void 0,!0)}if(t.inner)try{l(t.inner.iterator,m)}catch(e){return l(r,g,e)}if(t.openIters)try{u(t.openIters,m)}catch(e){return l(r,g,e)}return r&&l(r,m),c(void 0,!0)}})},y=v(!0),A=v(!1);return n(A,h,"Iterator Helper"),ka=function(e,t,n){var r=function(r,i){i?(i.iterator=r.iterator,i.next=r.next):i=r,i.type=t?d:f,i.returnHandlerResult=!!n,i.nextHandler=e,i.counter=0,i.done=!1,p(this,i)};return r.prototype=t?y:A,r}}function qa(){if(Ma)return Pa;Ma=1;var e=Et(),t=za();return Pa=function(n,r,i,o){try{return o?r(e(i)[0],i[1]):r(i)}catch(e){t(n,"throw",e)}}}function Ya(){return Ba?La:(Ba=1,La=function(e,t){var n="function"==typeof Iterator&&Iterator.prototype[e];if(n)try{n.call({next:null},t).next()}catch(e){return!0}})}function Va(){if(Da)return Ua;Da=1;var e=s();return Ua=function(t,n){var r=e.Iterator,i=r&&r.prototype,o=i&&i[t],a=!1;if(o)try{o.call({next:function(){return{done:!0}},return:function(){a=!0}},-1)}catch(e){e instanceof n||(a=!1)}if(!a)return o}}!function(){if(Fa)return Na;Fa=1;var e=mr(),t=_(),n=Ie(),r=Et(),i=Wa(),o=Ga(),a=qa(),s=tt(),c=za(),l=Ya(),u=Va(),h=!s&&!l("filter",function(){}),f=!s&&!h&&u("filter",TypeError),d=s||h||f,m=o(function(){for(var e,n,i=this.iterator,o=this.predicate,s=this.next;;){if(e=r(t(s,i)),this.done=!!e.done)return;if(n=e.value,a(i,o,[n,this.counter++],!0))return n}});e({target:"Iterator",proto:!0,real:!0,forced:d},{filter:function(e){r(this);try{n(e)}catch(e){c(this,"throw",e)}return f?t(f,this,e):new m(i(this),{predicate:e})}})}();var Xa,$a,Ja,Qa,Za,Ka,es,ts,ns,rs,is,os={};function as(){return $a?Xa:($a=1,Xa={})}function ss(){if(Qa)return Ja;Qa=1;var e=ct(),t=as(),n=e("iterator"),r=Array.prototype;return Ja=function(e){return void 0!==e&&(t.Array===e||r[n]===e)}}function cs(){if(Ka)return Za;Ka=1;var e=wr(),t=Te(),n=me(),r=as(),i=ct()("iterator");return Za=function(o){if(!n(o))return t(o,i)||t(o,"@@iterator")||r[e(o)]}}function ls(){if(ts)return es;ts=1;var e=_(),t=Ie(),n=Et(),r=Ce(),i=cs(),o=TypeError;return es=function(a,s){var c=arguments.length<2?i(a):s;if(t(c))return n(e(c,a));throw new o(r(a)+" is not iterable")},es}function us(){if(rs)return ns;rs=1;var e=Jr(),t=_(),n=Et(),r=Ce(),i=ss(),o=vn(),a=_e(),s=ls(),c=cs(),l=za(),u=TypeError,h=function(e,t){this.stopped=e,this.result=t},f=h.prototype;return ns=function(d,m,g){var p,v,y,A,_,b,w,E=g&&g.that,x=!(!g||!g.AS_ENTRIES),S=!(!g||!g.IS_RECORD),C=!(!g||!g.IS_ITERATOR),I=!(!g||!g.INTERRUPTED),T=e(m,E),R=function(e){return p&&l(p,"normal"),new h(!0,e)},k=function(e){return x?(n(e),I?T(e[0],e[1],R):T(e[0],e[1])):I?T(e,R):T(e)};if(S)p=d.iterator;else if(C)p=d;else{if(!(v=c(d)))throw new u(r(d)+" is not iterable");if(i(v)){for(y=0,A=o(d);A>y;y++)if((_=k(d[y]))&&a(f,_))return _;return new h(!1)}p=s(d,v)}for(b=S?d.next:p.next;!(w=t(b,p)).done;){try{_=k(w.value)}catch(e){l(p,"throw",e)}if("object"==typeof _&&_&&a(f,_))return _}return new h(!1)}}!function(){if(is)return os;is=1;var e=mr(),t=_(),n=us(),r=Ie(),i=Et(),o=Wa(),a=za(),s=Va()("forEach",TypeError);e({target:"Iterator",proto:!0,real:!0,forced:s},{forEach:function(e){i(this);try{r(e)}catch(e){a(this,"throw",e)}if(s)return t(s,this,e);var c=o(this),l=0;n(c,function(t){e(t,l++)},{IS_RECORD:!0})}})}();var hs,fs={};!function(){if(hs)return fs;hs=1;var e=mr(),t=_(),n=Ie(),r=Et(),i=Wa(),o=Ga(),a=qa(),s=za(),c=Ya(),l=Va(),u=tt(),h=!u&&!c("map",function(){}),f=!u&&!h&&l("map",TypeError),d=u||h||f,m=o(function(){var e=this.iterator,n=r(t(this.next,e));if(!(this.done=!!n.done))return a(e,this.mapper,[n.value,this.counter++],!0)});e({target:"Iterator",proto:!0,real:!0,forced:d},{map:function(e){r(this);try{n(e)}catch(e){s(this,"throw",e)}return f?t(f,this,e):new m(i(this),{mapper:e})}})}();var ds,ms,gs,ps={};!function(){if(gs)return ps;gs=1;var e=mr(),t=Ae(),n=gr(),r=_(),i=he(),o=v(),a=ve(),s=Se(),c=bi(),l=function(){if(ms)return ds;ms=1;var e=he(),t=Vr(),n=ve(),r=fe(),i=Er(),o=e([].push);return ds=function(e){if(n(e))return e;if(t(e)){for(var a=e.length,s=[],c=0;c<a;c++){var l=e[c];"string"==typeof l?o(s,l):"number"!=typeof l&&"Number"!==r(l)&&"String"!==r(l)||o(s,i(l))}var u=s.length,h=!0;return function(e,n){if(h)return h=!1,n;if(t(this))return n;for(var r=0;r<u;r++)if(s[r]===e)return n}}}}(),u=Ee(),h=String,f=t("JSON","stringify"),d=i(/./.exec),m=i("".charAt),g=i("".charCodeAt),p=i("".replace),y=i(1.1.toString),A=/[\uD800-\uDFFF]/g,b=/^[\uD800-\uDBFF]$/,w=/^[\uDC00-\uDFFF]$/,E=!u||o(function(){var e=t("Symbol")("stringify detection");return"[null]"!==f([e])||"{}"!==f({a:e})||"{}"!==f(Object(e))}),x=o(function(){return'"\\udf06\\ud834"'!==f("\udf06\ud834")||'"\\udead"'!==f("\udead")}),S=function(e,t){var i=c(arguments),o=l(t);if(a(o)||void 0!==e&&!s(e))return i[1]=function(e,t){if(a(o)&&(t=r(o,this,h(e),t)),!s(t))return t},n(f,null,i)},C=function(e,t,n){var r=m(n,t-1),i=m(n,t+1);return d(b,e)&&!d(w,i)||d(w,e)&&!d(b,r)?"\\u"+y(g(e,0),16):e};f&&e({target:"JSON",stat:!0,arity:3,forced:E||x},{stringify:function(e,t,r){var i=c(arguments),o=n(E?S:f,null,i);return x&&"string"==typeof o?p(o,A,C):o}})}();var vs,ys,As,_s,bs,ws,Es,xs,Ss,Cs,Is,Ts,Rs,ks,Os,Ps={};function Ms(){if(ws)return bs;ws=1;var e=Et();return bs=function(){var t=e(this),n="";return t.hasIndices&&(n+="d"),t.global&&(n+="g"),t.ignoreCase&&(n+="i"),t.multiline&&(n+="m"),t.dotAll&&(n+="s"),t.unicode&&(n+="u"),t.unicodeSets&&(n+="v"),t.sticky&&(n+="y"),n}}function Ls(){if(xs)return Es;xs=1;var e=_(),t=at(),n=_e(),r=function(){if(_s)return As;_s=1;var e=s(),t=v(),n=e.RegExp,r=!t(function(){var e=!0;try{n(".","d")}catch(t){e=!1}var t={},r="",i=e?"dgimsy":"gimsy",o=function(e,n){Object.defineProperty(t,e,{get:function(){return r+=n,!0}})},a={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var s in e&&(a.hasIndices="d"),a)o(s,a[s]);return Object.getOwnPropertyDescriptor(n.prototype,"flags").get.call(t)!==i||r!==i});return As={correct:r}}(),i=Ms(),o=RegExp.prototype;return Es=r.correct?function(e){return e.flags}:function(a){return r.correct||!n(o,a)||t(a,"flags")?a.flags:e(i,a)}}function Bs(){if(Cs)return Ss;Cs=1;var e=v(),t=s().RegExp,n=e(function(){var e=t("a","y");return e.lastIndex=2,null!==e.exec("abcd")}),r=n||e(function(){return!t("a","y").sticky}),i=n||e(function(){var e=t("^r","gy");return e.lastIndex=2,null!==e.exec("str")});return Ss={BROKEN_CARET:i,MISSED_STICKY:r,UNSUPPORTED_Y:n}}function Us(){if(Ts)return Is;Ts=1;var e=v(),t=s().RegExp;return Is=e(function(){var e=t(".","s");return!(e.dotAll&&e.test("\n")&&"s"===e.flags)})}function Ds(){if(ks)return Rs;ks=1;var e=v(),t=s().RegExp;return Rs=e(function(){var e=t("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})}!function(){if(Os)return Ps;Os=1;var e=y(),t=s(),n=he(),r=dr(),i=br(),o=St(),a=Wi(),c=_n().f,l=_e(),u=function(){if(ys)return vs;ys=1;var e=ye(),t=fe(),n=ct()("match");return vs=function(r){var i;return e(r)&&(void 0!==(i=r[n])?!!i:"RegExp"===t(r))}}(),h=Er(),f=Ls(),d=Bs(),m=_r(),g=Xt(),p=v(),A=at(),_=Yt().enforce,b=Lo(),w=ct(),E=Us(),x=Ds(),S=w("match"),C=t.RegExp,I=C.prototype,T=t.SyntaxError,R=n(I.exec),k=n("".charAt),O=n("".replace),P=n("".indexOf),M=n("".slice),L=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,B=/a/g,U=/a/g,D=new C(B)!==B,F=d.MISSED_STICKY,N=d.UNSUPPORTED_Y,W=e&&(!D||F||E||x||p(function(){return U[S]=!1,C(B)!==B||C(U)===U||"/a/i"!==String(C(B,"i"))}));if(r("RegExp",W)){for(var j=function(e,t){var n,r,s,c,d,m,g=l(I,this),p=u(e),v=void 0===t,y=[],b=e;if(!g&&p&&v&&e.constructor===j)return e;if((p||l(I,e))&&(e=e.source,v&&(t=f(b))),e=void 0===e?"":h(e),t=void 0===t?"":h(t),b=e,E&&"dotAll"in B&&(r=!!t&&P(t,"s")>-1)&&(t=O(t,/s/g,"")),n=t,F&&"sticky"in B&&(s=!!t&&P(t,"y")>-1)&&N&&(t=O(t,/y/g,"")),x&&(c=function(e){for(var t,n=e.length,r=0,i="",o=[],s=a(null),c=!1,l=!1,u=0,h="";r<=n;r++){if("\\"===(t=k(e,r)))t+=k(e,++r);else if("]"===t)c=!1;else if(!c)switch(!0){case"["===t:c=!0;break;case"("===t:if(i+=t,"?:"===M(e,r+1,r+3))continue;R(L,M(e,r+1))&&(r+=2,l=!0),u++;continue;case">"===t&&l:if(""===h||A(s,h))throw new T("Invalid capture group name");s[h]=!0,o[o.length]=[h,u],l=!1,h="";continue}l?h+=t:i+=t}return[i,o]}(e),e=c[0],y=c[1]),d=i(C(e,t),g?this:I,j),(r||s||y.length)&&(m=_(d),r&&(m.dotAll=!0,m.raw=j(function(e){for(var t,n=e.length,r=0,i="",o=!1;r<=n;r++)"\\"!==(t=k(e,r))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),i+=t):i+="[\\s\\S]":i+=t+k(e,++r);return i}(e),n)),s&&(m.sticky=!0),y.length&&(m.groups=y)),e!==b)try{o(d,"source",""===b?"(?:)":b)}catch(e){}return d},z=c(C),H=0;z.length>H;)m(j,C,z[H++]);I.constructor=j,j.prototype=I,g(t,"RegExp",j,{constructor:!0})}b("RegExp")}();var Fs,Ns={};!function(){if(Fs)return Ns;Fs=1;var e=y(),t=Us(),n=fe(),r=xo(),i=Yt().get,o=RegExp.prototype,a=TypeError;e&&t&&r(o,"dotAll",{configurable:!0,get:function(){if(this!==o){if("RegExp"===n(this))return!!i(this).dotAll;throw new a("Incompatible receiver, RegExp required")}}})}();var Ws,js,zs,Hs={};function Gs(){if(js)return Ws;js=1;var e,t,n=_(),r=he(),i=Er(),o=Ms(),a=Bs(),s=it(),c=Wi(),l=Yt().get,u=Us(),h=Ds(),f=s("native-string-replace",String.prototype.replace),d=RegExp.prototype.exec,m=d,g=r("".charAt),p=r("".indexOf),v=r("".replace),y=r("".slice),A=(t=/b*/g,n(d,e=/a/,"a"),n(d,t,"a"),0!==e.lastIndex||0!==t.lastIndex),b=a.BROKEN_CARET,w=void 0!==/()??/.exec("")[1];return(A||w||b||u||h)&&(m=function(e){var t,r,a,s,u,h,_,E=this,x=l(E),S=i(e),C=x.raw;if(C)return C.lastIndex=E.lastIndex,t=n(m,C,S),E.lastIndex=C.lastIndex,t;var I=x.groups,T=b&&E.sticky,R=n(o,E),k=E.source,O=0,P=S;if(T&&(R=v(R,"y",""),-1===p(R,"g")&&(R+="g"),P=y(S,E.lastIndex),E.lastIndex>0&&(!E.multiline||E.multiline&&"\n"!==g(S,E.lastIndex-1))&&(k="(?: "+k+")",P=" "+P,O++),r=new RegExp("^(?:"+k+")",R)),w&&(r=new RegExp("^"+k+"$(?!\\s)",R)),A&&(a=E.lastIndex),s=n(d,T?r:E,P),T?s?(s.input=y(s.input,O),s[0]=y(s[0],O),s.index=E.lastIndex,E.lastIndex+=s[0].length):E.lastIndex=0:A&&s&&(E.lastIndex=E.global?s.index+s[0].length:a),w&&s&&s.length>1&&n(f,s[0],r,function(){for(u=1;u<arguments.length-2;u++)void 0===arguments[u]&&(s[u]=void 0)}),s&&I)for(s.groups=h=c(null),u=0;u<I.length;u++)h[(_=I[u])[0]]=s[_[1]];return s}),Ws=m}function qs(){if(zs)return Hs;zs=1;var e=mr(),t=Gs();return e({target:"RegExp",proto:!0,forced:/./.exec!==t},{exec:t}),Hs}qs();var Ys,Vs,Xs,$s,Js,Qs,Zs,Ks,ec,tc,nc,rc={};function ic(){if($s)return Xs;$s=1;var e=he(),t=mn(),n=Er(),r=ge(),i=e("".charAt),o=e("".charCodeAt),a=e("".slice),s=function(e){return function(s,c){var l,u,h=n(r(s)),f=t(c),d=h.length;return f<0||f>=d?e?"":void 0:(l=o(h,f))<55296||l>56319||f+1===d||(u=o(h,f+1))<56320||u>57343?e?i(h,f):l:e?a(h,f,f+2):u-56320+(l-55296<<10)+65536}};return Xs={codeAt:s(!1),charAt:s(!0)}}function oc(){if(Qs)return Js;Qs=1;var e=ic().charAt;return Js=function(t,n,r){return n+(r?e(t,n).length:1)}}function ac(){if(Ks)return Zs;Ks=1;var e=he(),t=ot(),n=Math.floor,r=e("".charAt),i=e("".replace),o=e("".slice),a=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,s=/\$([$&'`]|\d{1,2})/g;return Zs=function(e,c,l,u,h,f){var d=l+e.length,m=u.length,g=s;return void 0!==h&&(h=t(h),g=a),i(f,g,function(t,i){var a;switch(r(i,0)){case"$":return"$";case"&":return e;case"`":return o(c,0,l);case"'":return o(c,d);case"<":a=h[o(i,1,-1)];break;default:var s=+i;if(0===s)return t;if(s>m){var f=n(s/10);return 0===f?t:f<=m?void 0===u[f-1]?r(i,1):u[f-1]+r(i,1):t}a=u[s-1]}return void 0===a?"":a})}}!function(){if(nc)return rc;nc=1;var e=gr(),t=_(),n=he(),r=function(){if(Vs)return Ys;Vs=1,qs();var e=_(),t=Xt(),n=Gs(),r=v(),i=ct(),o=St(),a=i("species"),s=RegExp.prototype;return Ys=function(c,l,u,h){var f=i(c),d=!r(function(){var e={};return e[f]=function(){return 7},7!==""[c](e)}),m=d&&!r(function(){var e=!1,t=/a/;return"split"===c&&((t={}).constructor={},t.constructor[a]=function(){return t},t.flags="",t[f]=/./[f]),t.exec=function(){return e=!0,null},t[f](""),!e});if(!d||!m||u){var g=/./[f],p=l(f,""[c],function(t,r,i,o,a){var c=r.exec;return c===n||c===s.exec?d&&!a?{done:!0,value:e(g,r,i,o)}:{done:!0,value:e(t,i,r,o)}:{done:!1}});t(String.prototype,c,p[0]),t(s,f,p[1])}h&&o(s[f],"sham",!0)}}(),i=v(),o=Et(),a=ve(),s=ye(),c=mn(),l=pn(),u=Er(),h=ge(),f=oc(),d=Te(),m=ac(),g=Ls(),p=function(){if(tc)return ec;tc=1;var e=_(),t=Et(),n=ve(),r=fe(),i=Gs(),o=TypeError;return ec=function(a,s){var c=a.exec;if(n(c)){var l=e(c,a,s);return null!==l&&t(l),l}if("RegExp"===r(a))return e(i,a,s);throw new o("RegExp#exec called on incompatible receiver")}}(),y=ct()("replace"),A=Math.max,b=Math.min,w=n([].concat),E=n([].push),x=n("".indexOf),S=n("".slice),C=function(e){return void 0===e?e:String(e)},I="$0"==="a".replace(/./,"$0"),T=!!/./[y]&&""===/./[y]("a","$0");r("replace",function(n,r,i){var v=T?"$":"$0";return[function(e,n){var i=h(this),o=s(e)?d(e,y):void 0;return o?t(o,e,i,n):t(r,u(i),e,n)},function(t,n){var s=o(this),h=u(t);if("string"==typeof n&&-1===x(n,v)&&-1===x(n,"$<")){var d=i(r,s,h,n);if(d.done)return d.value}var y=a(n);y||(n=u(n));var _,I=u(g(s)),T=-1!==x(I,"g");T&&(_=-1!==x(I,"u"),s.lastIndex=0);for(var R,k=[];null!==(R=p(s,h))&&(E(k,R),T);){""===u(R[0])&&(s.lastIndex=f(h,l(s.lastIndex),_))}for(var O="",P=0,M=0;M<k.length;M++){for(var L,B=u((R=k[M])[0]),U=A(b(c(R.index),h.length),0),D=[],F=1;F<R.length;F++)E(D,C(R[F]));var N=R.groups;if(y){var W=w([B],D,U,h);void 0!==N&&E(W,N),L=u(e(n,void 0,W))}else L=m(B,h,U,D,N,n);U>=P&&(O+=S(h,P,U)+L,P=U+B.length)}return O+S(h,P)}]},!!i(function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")})||!I||T)}();var sc,cc,lc,uc,hc,fc,dc,mc={};function gc(){return cc?sc:(cc=1,sc="\t\n\v\f\r    \u2028\u2029\ufeff")}!function(){if(dc)return mc;dc=1;var e=mr(),t=function(){if(uc)return lc;uc=1;var e=he(),t=ge(),n=Er(),r=gc(),i=e("".replace),o=RegExp("^["+r+"]+"),a=RegExp("(^|[^"+r+"])["+r+"]+$"),s=function(e){return function(r){var s=n(t(r));return 1&e&&(s=i(s,o,"")),2&e&&(s=i(s,a,"$1")),s}};return lc={start:s(1),end:s(2),trim:s(3)}}().trim,n=function(){if(fc)return hc;fc=1;var e=zt().PROPER,t=v(),n=gc();return hc=function(r){return t(function(){return!!n[r]()||"​…᠎"!=="​…᠎"[r]()||e&&n[r].name!==r})}}();e({target:"String",proto:!0,forced:n("trim")},{trim:function(){return t(this)}})}();var pc,vc,yc,Ac,_c,bc,wc,Ec,xc,Sc,Cc,Ic,Tc,Rc,kc,Oc,Pc,Mc,Lc,Bc,Uc,Dc,Fc,Nc,Wc,jc,zc,Hc,Gc={exports:{}};function qc(){if(vc)return pc;vc=1;var e=ct()("iterator"),t=!1;try{var n=0,r={next:function(){return{done:!!n++}},return:function(){t=!0}};r[e]=function(){return this},Array.from(r,function(){throw 2})}catch(e){}return pc=function(n,r){try{if(!r&&!t)return!1}catch(e){return!1}var i=!1;try{var o={};o[e]=function(){return{next:function(){return{done:i=!0}}}},n(o)}catch(e){}return i}}function Yc(){if(Ac)return yc;Ac=1;var e,t,n,r=Eo(),i=y(),o=s(),a=ve(),c=ye(),l=at(),u=wr(),h=Ce(),f=St(),d=Xt(),m=xo(),g=_e(),p=ko(),v=Ar(),A=ct(),_=st(),b=Yt(),w=b.enforce,E=b.get,x=o.Int8Array,S=x&&x.prototype,C=o.Uint8ClampedArray,I=C&&C.prototype,T=x&&p(x),R=S&&p(S),k=Object.prototype,O=o.TypeError,P=A("toStringTag"),M=_("TYPED_ARRAY_TAG"),L="TypedArrayConstructor",B=r&&!!v&&"Opera"!==u(o.opera),U=!1,D={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},F={BigInt64Array:8,BigUint64Array:8},N=function(e){var t=p(e);if(c(t)){var n=E(t);return n&&l(n,L)?n[L]:N(t)}},W=function(e){if(!c(e))return!1;var t=u(e);return l(D,t)||l(F,t)};for(e in D)(n=(t=o[e])&&t.prototype)?w(n)[L]=t:B=!1;for(e in F)(n=(t=o[e])&&t.prototype)&&(w(n)[L]=t);if((!B||!a(T)||T===Function.prototype)&&(T=function(){throw new O("Incorrect invocation")},B))for(e in D)o[e]&&v(o[e],T);if((!B||!R||R===k)&&(R=T.prototype,B))for(e in D)o[e]&&v(o[e].prototype,R);if(B&&p(I)!==R&&v(I,R),i&&!l(R,P))for(e in U=!0,m(R,P,{configurable:!0,get:function(){return c(this)?this[M]:void 0}}),D)o[e]&&f(o[e],M,e);return yc={NATIVE_ARRAY_BUFFER_VIEWS:B,TYPED_ARRAY_TAG:U&&M,aTypedArray:function(e){if(W(e))return e;throw new O("Target is not a typed array")},aTypedArrayConstructor:function(e){if(a(e)&&(!v||g(T,e)))return e;throw new O(h(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,n,r){if(i){if(n)for(var a in D){var s=o[a];if(s&&l(s.prototype,e))try{delete s.prototype[e]}catch(n){try{s.prototype[e]=t}catch(e){}}}R[e]&&!n||d(R,e,n?t:B&&S[e]||t,r)}},exportTypedArrayStaticMethod:function(e,t,n){var r,a;if(i){if(v){if(n)for(r in D)if((a=o[r])&&l(a,e))try{delete a[e]}catch(e){}if(T[e]&&!n)return;try{return d(T,e,n?t:B&&T[e]||t)}catch(e){}}for(r in D)!(a=o[r])||a[e]&&!n||d(a,e,t)}},getTypedArrayConstructor:N,isView:function(e){if(!c(e))return!1;var t=u(e);return"DataView"===t||l(D,t)||l(F,t)},isTypedArray:W,TypedArray:T,TypedArrayPrototype:R}}function Vc(){if(Ec)return wc;Ec=1;var e=ye(),t=Math.floor;return wc=Number.isInteger||function(n){return!e(n)&&isFinite(n)&&t(n)===n}}function Xc(){if(Sc)return xc;Sc=1;var e=mn(),t=RangeError;return xc=function(n){var r=e(n);if(r<0)throw new t("The argument can't be less than 0");return r}}function $c(){if(Ic)return Cc;Ic=1;var e=Xc(),t=RangeError;return Cc=function(n,r){var i=e(n);if(i%r)throw new t("Wrong offset");return i}}function Jc(){if(Rc)return Tc;Rc=1;var e=Math.round;return Tc=function(t){var n=e(t);return n<0?0:n>255?255:255&n}}function Qc(){if(Oc)return kc;Oc=1;var e=Qr(),t=Ce(),n=TypeError;return kc=function(r){if(e(r))return r;throw new n(t(r)+" is not a constructor")}}function Zc(){if(Mc)return Pc;Mc=1;var e=wr();return Pc=function(t){var n=e(t);return"BigInt64Array"===n||"BigUint64Array"===n}}function Kc(){if(Bc)return Lc;Bc=1;var e=lt(),t=TypeError;return Lc=function(n){var r=e(n,"number");if("number"==typeof r)throw new t("Can't convert number to bigint");return BigInt(r)}}function el(){if(Dc)return Uc;Dc=1;var e=Jr(),t=_(),n=Qc(),r=ot(),i=vn(),o=ls(),a=cs(),s=ss(),c=Zc(),l=Yc().aTypedArrayConstructor,u=Kc();return Uc=function(h){var f,d,m,g,p,v,y,A,_=n(this),b=r(h),w=arguments.length,E=w>1?arguments[1]:void 0,x=void 0!==E,S=a(b);if(S&&!s(S))for(A=(y=o(b,S)).next,b=[];!(v=t(A,y)).done;)b.push(v.value);for(x&&w>2&&(E=e(E,arguments[2])),d=i(b),m=new(l(_))(d),g=c(m),f=0;d>f;f++)p=x?E(b[f],f):b[f],m[f]=g?u(p):+p;return m},Uc}function tl(){if(jc)return Wc;jc=1;var e=vn();return Wc=function(t,n,r){for(var i=0,o=arguments.length>2?r:e(n),a=new t(o);o>i;)a[i]=n[i++];return a},Wc}function nl(){if(zc)return Gc.exports;zc=1;var e=mr(),t=s(),n=_(),r=y(),i=function(){if(bc)return _c;bc=1;var e=s(),t=v(),n=qc(),r=Yc().NATIVE_ARRAY_BUFFER_VIEWS,i=e.ArrayBuffer,o=e.Int8Array;return _c=!r||!t(function(){o(1)})||!t(function(){new o(-1)})||!n(function(e){new o,new o(null),new o(1.5),new o(e)},!0)||t(function(){return 1!==new o(new i(2),1,void 0).length})}(),o=Yc(),a=Mo(),c=Co(),l=ue(),u=St(),h=Vc(),f=pn(),d=Io(),m=$c(),g=Jc(),p=ut(),A=at(),b=wr(),w=ye(),E=Se(),x=Wi(),S=_e(),C=Ar(),I=_n().f,T=el(),R=function(){if(Nc)return Fc;Nc=1;var e=Jr(),t=he(),n=de(),r=ot(),i=vn(),o=Kr(),a=t([].push),s=function(t){var s=1===t,c=2===t,l=3===t,u=4===t,h=6===t,f=7===t,d=5===t||h;return function(m,g,p,v){for(var y,A,_=r(m),b=n(_),w=i(b),E=e(g,p),x=0,S=v||o,C=s?S(m,w):c||f?S(m,0):void 0;w>x;x++)if((d||x in b)&&(A=E(y=b[x],x,_),t))if(s)C[x]=A;else if(A)switch(t){case 3:return!0;case 5:return y;case 6:return x;case 2:a(C,y)}else switch(t){case 4:return!1;case 7:a(C,y)}return h?-1:l||u?u:C}};return Fc={forEach:s(0),map:s(1),filter:s(2),some:s(3),every:s(4),find:s(5),findIndex:s(6),filterReject:s(7)}}().forEach,k=Lo(),O=xo(),P=xt(),M=dt(),L=tl(),B=Yt(),U=br(),D=B.get,F=B.set,N=B.enforce,W=P.f,j=M.f,z=t.RangeError,H=a.ArrayBuffer,G=H.prototype,q=a.DataView,Y=o.NATIVE_ARRAY_BUFFER_VIEWS,V=o.TYPED_ARRAY_TAG,X=o.TypedArray,$=o.TypedArrayPrototype,J=o.isTypedArray,Q="BYTES_PER_ELEMENT",Z="Wrong length",K=function(e,t){O(e,t,{configurable:!0,get:function(){return D(this)[t]}})},ee=function(e){var t;return S(G,e)||"ArrayBuffer"===(t=b(e))||"SharedArrayBuffer"===t},te=function(e,t){return J(e)&&!E(t)&&t in e&&h(+t)&&t>=0},ne=function(e,t){return t=p(t),te(e,t)?l(2,e[t]):j(e,t)},re=function(e,t,n){return t=p(t),!(te(e,t)&&w(n)&&A(n,"value"))||A(n,"get")||A(n,"set")||n.configurable||A(n,"writable")&&!n.writable||A(n,"enumerable")&&!n.enumerable?W(e,t,n):(e[t]=n.value,e)};return r?(Y||(M.f=ne,P.f=re,K($,"buffer"),K($,"byteOffset"),K($,"byteLength"),K($,"length")),e({target:"Object",stat:!0,forced:!Y},{getOwnPropertyDescriptor:ne,defineProperty:re}),Gc.exports=function(r,o,a){var s=r.match(/\d+/)[0]/8,l=r+(a?"Clamped":"")+"Array",h="get"+r,p="set"+r,v=t[l],y=v,A=y&&y.prototype,_={},b=function(e,t){W(e,t,{get:function(){return function(e,t){var n=D(e);return n.view[h](t*s+n.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,n){var r=D(e);r.view[p](t*s+r.byteOffset,a?g(n):n,!0)}(this,t,e)},enumerable:!0})};Y?i&&(y=o(function(e,t,r,i){return c(e,A),U(w(t)?ee(t)?void 0!==i?new v(t,m(r,s),i):void 0!==r?new v(t,m(r,s)):new v(t):J(t)?L(y,t):n(T,y,t):new v(d(t)),e,y)}),C&&C(y,X),R(I(v),function(e){e in y||u(y,e,v[e])}),y.prototype=A):(y=o(function(e,t,r,i){c(e,A);var o,a,l,u=0,h=0;if(w(t)){if(!ee(t))return J(t)?L(y,t):n(T,y,t);o=t,h=m(r,s);var g=t.byteLength;if(void 0===i){if(g%s)throw new z(Z);if((a=g-h)<0)throw new z(Z)}else if((a=f(i)*s)+h>g)throw new z(Z);l=a/s}else l=d(t),o=new H(a=l*s);for(F(e,{buffer:o,byteOffset:h,byteLength:a,length:l,view:new q(o)});u<l;)b(e,u++)}),C&&C(y,X),A=y.prototype=x($)),A.constructor!==y&&u(A,"constructor",y),N(A).TypedArrayConstructor=y,V&&u(A,V,l);var E=y!==v;_[l]=y,e({global:!0,constructor:!0,forced:E,sham:!Y},_),Q in y||u(y,Q,s),Q in A||u(A,Q,s),k(l)}):Gc.exports=function(){},Gc.exports}Hc||(Hc=1,nl()("Uint8",function(e){return function(t,n,r){return e(this,t,n,r)}}));var rl,il={};!function(){if(rl)return il;rl=1;var e=Yc(),t=vn(),n=mn(),r=e.aTypedArray;(0,e.exportTypedArrayMethod)("at",function(e){var i=r(this),o=t(i),a=n(e),s=a>=0?a:o+a;return s<0||s>=o?void 0:i[s]})}();var ol,al={};!function(){if(ol)return al;ol=1;var e=Yc(),t=Oo(),n=Kc(),r=wr(),i=_(),o=he(),a=v(),s=e.aTypedArray,c=e.exportTypedArrayMethod,l=o("".slice);c("fill",function(e){var o=arguments.length;s(this);var a="Big"===l(r(this),0,3)?n(e):+e;return i(t,this,a,o>1?arguments[1]:void 0,o>2?arguments[2]:void 0)},a(function(){var e=0;return new Int8Array(2).fill({valueOf:function(){return e++}}),1!==e}))}();var sl,cl,ll,ul={};function hl(){if(cl)return sl;cl=1;var e=Jr(),t=de(),n=ot(),r=vn(),i=function(i){var o=1===i;return function(a,s,c){for(var l,u=n(a),h=t(u),f=r(h),d=e(s,c);f-- >0;)if(d(l=h[f],f,u))switch(i){case 0:return l;case 1:return f}return o?-1:void 0}};return sl={findLast:i(0),findLastIndex:i(1)}}!function(){if(ll)return ul;ll=1;var e=Yc(),t=hl().findLast,n=e.aTypedArray;(0,e.exportTypedArrayMethod)("findLast",function(e){return t(n(this),e,arguments.length>1?arguments[1]:void 0)})}();var fl,dl={};!function(){if(fl)return dl;fl=1;var e=Yc(),t=hl().findLastIndex,n=e.aTypedArray;(0,e.exportTypedArrayMethod)("findLastIndex",function(e){return t(n(this),e,arguments.length>1?arguments[1]:void 0)})}();var ml,gl={};!function(){if(ml)return gl;ml=1;var e=s(),t=_(),n=Yc(),r=vn(),i=$c(),o=ot(),a=v(),c=e.RangeError,l=e.Int8Array,u=l&&l.prototype,h=u&&u.set,f=n.aTypedArray,d=n.exportTypedArrayMethod,m=!a(function(){var e=new Uint8ClampedArray(2);return t(h,e,{length:1,0:3},1),3!==e[1]}),g=m&&n.NATIVE_ARRAY_BUFFER_VIEWS&&a(function(){var e=new l(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]});d("set",function(e){f(this);var n=i(arguments.length>1?arguments[1]:void 0,1),a=o(e);if(m)return t(h,this,a,n);var s=this.length,l=r(a),u=0;if(l+n>s)throw new c("Wrong length");for(;u<l;)this[n+u]=a[u++]},!m||g)}();var pl,vl={};!function(){if(pl)return vl;pl=1;var e=s(),t=$r(),n=v(),r=Ie(),i=wi(),o=Yc(),a=xi(),c=Si(),l=we(),u=Ci(),h=o.aTypedArray,f=o.exportTypedArrayMethod,d=e.Uint16Array,m=d&&t(d.prototype.sort),g=!(!m||n(function(){m(new d(2),null)})&&n(function(){m(new d(2),{})})),p=!!m&&!n(function(){if(l)return l<74;if(a)return a<67;if(c)return!0;if(u)return u<602;var e,t,n=new d(516),r=Array(516);for(e=0;e<516;e++)t=e%4,n[e]=515-e,r[e]=e-2*t+3;for(m(n,function(e,t){return(e/4|0)-(t/4|0)}),e=0;e<516;e++)if(n[e]!==r[e])return!0});f("sort",function(e){return void 0!==e&&r(e),p?m(this,e):i(h(this),function(e){return function(t,n){return void 0!==e?+e(t,n)||0:n!=n?-1:t!=t?1:0===t&&0===n?1/t>0&&1/n<0?1:-1:t>n}}(e))},!p||g)}();var yl,Al,_l,bl={};function wl(){if(Al)return yl;Al=1;var e=vn();return yl=function(t,n){for(var r=e(t),i=new n(r),o=0;o<r;o++)i[o]=t[r-o-1];return i}}!function(){if(_l)return bl;_l=1;var e=wl(),t=Yc(),n=t.aTypedArray,r=t.exportTypedArrayMethod,i=t.getTypedArrayConstructor;r("toReversed",function(){return e(n(this),i(this))})}();var El,xl={};!function(){if(El)return xl;El=1;var e=Yc(),t=he(),n=Ie(),r=tl(),i=e.aTypedArray,o=e.getTypedArrayConstructor,a=e.exportTypedArrayMethod,s=t(e.TypedArrayPrototype.sort);a("toSorted",function(e){void 0!==e&&n(e);var t=i(this),a=r(o(t),t);return s(a,e)})}();var Sl,Cl,Il,Tl={};function Rl(){if(Cl)return Sl;Cl=1;var e=vn(),t=mn(),n=RangeError;return Sl=function(r,i,o,a){var s=e(r),c=t(o),l=c<0?s+c:c;if(l>=s||l<0)throw new n("Incorrect index");for(var u=new i(s),h=0;h<s;h++)u[h]=h===l?a:r[h];return u}}!function(){if(Il)return Tl;Il=1;var e=Rl(),t=Yc(),n=Zc(),r=mn(),i=Kc(),o=t.aTypedArray,a=t.getTypedArrayConstructor,s=t.exportTypedArrayMethod,c=function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(e){return 8===e}}(),l=c&&function(){try{new Int8Array(1).with(-.5,1)}catch(e){return!0}}();s("with",{with:function(t,s){var c=o(this),l=r(t),u=n(c)?i(s):+s;return e(c,a(c),l,u)}}.with,!c||l)}();var kl,Ol,Pl,Ml,Ll,Bl,Ul,Dl,Fl,Nl,Wl,jl={};function zl(){if(Bl)return Ll;Bl=1;var e=ba().IteratorPrototype,t=Wi(),n=ue(),r=Po(),i=as(),o=function(){return this};return Ll=function(a,s,c,l){var u=s+" Iterator";return a.prototype=t(e,{next:n(+!l,c)}),r(a,u,!1,!0),i[u]=o,a}}function Hl(){if(Dl)return Ul;Dl=1;var e=mr(),t=_(),n=tt(),r=zt(),i=ve(),o=zl(),a=ko(),s=Ar(),c=Po(),l=St(),u=Xt(),h=ct(),f=as(),d=ba(),m=r.PROPER,g=r.CONFIGURABLE,p=d.IteratorPrototype,v=d.BUGGY_SAFARI_ITERATORS,y=h("iterator"),A="keys",b="values",w="entries",E=function(){return this};return Ul=function(r,h,d,_,x,S,C){o(d,h,_);var I,T,R,k=function(e){if(e===x&&B)return B;if(!v&&e&&e in M)return M[e];switch(e){case A:case b:case w:return function(){return new d(this,e)}}return function(){return new d(this)}},O=h+" Iterator",P=!1,M=r.prototype,L=M[y]||M["@@iterator"]||x&&M[x],B=!v&&L||k(x),U="Array"===h&&M.entries||L;if(U&&(I=a(U.call(new r)))!==Object.prototype&&I.next&&(n||a(I)===p||(s?s(I,p):i(I[y])||u(I,y,E)),c(I,O,!0,!0),n&&(f[O]=E)),m&&x===b&&L&&L.name!==b&&(!n&&g?l(M,"name",b):(P=!0,B=function(){return t(L,this)})),x)if(T={values:k(b),keys:S?B:k(A),entries:k(w)},C)for(R in T)(v||P||!(R in M))&&u(M,R,T[R]);else e({target:h,proto:!0,forced:v||P},T);return n&&!C||M[y]===B||u(M,y,B,{name:x}),f[h]=B,T}}function Gl(){if(Nl)return Fl;Nl=1;var e=pe(),t=ji(),n=as(),r=Yt(),i=xt().f,o=Hl(),a=ja(),s=tt(),c=y(),l="Array Iterator",u=r.set,h=r.getterFor(l);Fl=o(Array,"Array",function(t,n){u(this,{type:l,target:e(t),index:0,kind:n})},function(){var e=h(this),t=e.target,n=e.index++;if(!t||n>=t.length)return e.target=null,a(void 0,!0);switch(e.kind){case"keys":return a(n,!1);case"values":return a(t[n],!1)}return a([n,t[n]],!1)},"values");var f=n.Arguments=n.Array;if(t("keys"),t("values"),t("entries"),!s&&c&&"values"!==f.name)try{i(f,"name",{value:"values"})}catch(e){}return Fl}!function(){if(Wl)return jl;Wl=1;var e=s(),t=Ol?kl:(Ol=1,kl={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}),n=function(){if(Ml)return Pl;Ml=1;var e=ht()("span").classList,t=e&&e.constructor&&e.constructor.prototype;return Pl=t===Object.prototype?void 0:t}(),r=Gl(),i=St(),o=Po(),a=ct()("iterator"),c=r.values,l=function(e,n){if(e){if(e[a]!==c)try{i(e,a,c)}catch(t){e[a]=c}if(o(e,n,!0),t[n])for(var s in r)if(e[s]!==r[s])try{i(e,s,r[s])}catch(t){e[s]=r[s]}}};for(var u in t)l(e[u]&&e[u].prototype,u);l(n,"DOMTokenList")}();var ql,Yl,Vl,Xl,$l,Jl={};function Ql(){if(Yl)return ql;Yl=1;var e=y(),t=v(),n=Et(),r=xr(),i=Error.prototype.toString,o=t(function(){if(e){var t=Object.create(Object.defineProperty({},"name",{get:function(){return this===t}}));if("true"!==i.call(t))return!0}return"2: 1"!==i.call({message:1,name:2})||"Error"!==i.call({})});return ql=o?function(){var e=n(this),t=r(e.name,"Error"),i=r(e.message);return t?i?t+": "+i:t:i}:i}function Zl(){return Xl?Vl:(Xl=1,Vl={IndexSizeError:{s:"INDEX_SIZE_ERR",c:1,m:1},DOMStringSizeError:{s:"DOMSTRING_SIZE_ERR",c:2,m:0},HierarchyRequestError:{s:"HIERARCHY_REQUEST_ERR",c:3,m:1},WrongDocumentError:{s:"WRONG_DOCUMENT_ERR",c:4,m:1},InvalidCharacterError:{s:"INVALID_CHARACTER_ERR",c:5,m:1},NoDataAllowedError:{s:"NO_DATA_ALLOWED_ERR",c:6,m:0},NoModificationAllowedError:{s:"NO_MODIFICATION_ALLOWED_ERR",c:7,m:1},NotFoundError:{s:"NOT_FOUND_ERR",c:8,m:1},NotSupportedError:{s:"NOT_SUPPORTED_ERR",c:9,m:1},InUseAttributeError:{s:"INUSE_ATTRIBUTE_ERR",c:10,m:1},InvalidStateError:{s:"INVALID_STATE_ERR",c:11,m:1},SyntaxError:{s:"SYNTAX_ERR",c:12,m:1},InvalidModificationError:{s:"INVALID_MODIFICATION_ERR",c:13,m:1},NamespaceError:{s:"NAMESPACE_ERR",c:14,m:1},InvalidAccessError:{s:"INVALID_ACCESS_ERR",c:15,m:1},ValidationError:{s:"VALIDATION_ERR",c:16,m:0},TypeMismatchError:{s:"TYPE_MISMATCH_ERR",c:17,m:1},SecurityError:{s:"SECURITY_ERR",c:18,m:1},NetworkError:{s:"NETWORK_ERR",c:19,m:1},AbortError:{s:"ABORT_ERR",c:20,m:1},URLMismatchError:{s:"URL_MISMATCH_ERR",c:21,m:1},QuotaExceededError:{s:"QUOTA_EXCEEDED_ERR",c:22,m:1},TimeoutError:{s:"TIMEOUT_ERR",c:23,m:1},InvalidNodeTypeError:{s:"INVALID_NODE_TYPE_ERR",c:24,m:1},DataCloneError:{s:"DATA_CLONE_ERR",c:25,m:1}})}!function(){if($l)return Jl;$l=1;var e=mr(),t=Ae(),n=ca(),r=v(),i=Wi(),o=ue(),a=xt().f,s=Xt(),c=xo(),l=at(),u=Co(),h=Et(),f=Ql(),d=xr(),m=Zl(),g=Cr(),p=Yt(),A=y(),_=tt(),b="DOMException",w="DATA_CLONE_ERR",E=t("Error"),x=t(b)||function(){try{(new(t("MessageChannel")||n("worker_threads").MessageChannel)).port1.postMessage(new WeakMap)}catch(e){if(e.name===w&&25===e.code)return e.constructor}}(),S=x&&x.prototype,C=E.prototype,I=p.set,T=p.getterFor(b),R="stack"in new E(b),k=function(e){return l(m,e)&&m[e].m?m[e].c:0},O=function(){u(this,P);var e=arguments.length,t=d(e<1?void 0:arguments[0]),n=d(e<2?void 0:arguments[1],"Error"),r=k(n);if(I(this,{type:b,name:n,message:t,code:r}),A||(this.name=n,this.message=t,this.code=r),R){var i=new E(t);i.name=b,a(this,"stack",o(1,g(i.stack,1)))}},P=O.prototype=i(C),M=function(e){return{enumerable:!0,configurable:!0,get:e}},L=function(e){return M(function(){return T(this)[e]})};A&&(c(P,"code",L("code")),c(P,"message",L("message")),c(P,"name",L("name"))),a(P,"constructor",o(1,O));var B=r(function(){return!(new x instanceof E)}),U=B||r(function(){return C.toString!==f||"2: 1"!==String(new x(1,2))}),D=B||r(function(){return 25!==new x(1,"DataCloneError").code}),F=B||25!==x[w]||25!==S[w],N=_?U||D||F:B;e({global:!0,constructor:!0,forced:N},{DOMException:N?O:x});var W=t(b),j=W.prototype;for(var z in U&&(_||x===W)&&s(j,"toString",f),D&&A&&x===W&&c(j,"code",M(function(){return k(h(this).name)})),m)if(l(m,z)){var H=m[z],G=H.s,q=o(6,H.c);l(W,G)||a(W,G,q),l(j,G)||a(j,G,q)}}();var Kl,eu={};!function(){if(Kl)return eu;Kl=1;var e=mr(),t=s(),n=Ae(),r=ue(),i=xt().f,o=at(),a=Co(),c=br(),l=xr(),u=Zl(),h=Cr(),f=y(),d=tt(),m="DOMException",g=n("Error"),p=n(m),v=function(){a(this,A);var e=arguments.length,t=l(e<1?void 0:arguments[0]),n=l(e<2?void 0:arguments[1],"Error"),o=new p(t,n),s=new g(t);return s.name=m,i(o,"stack",r(1,h(s.stack,1))),c(o,this,v),o},A=v.prototype=p.prototype,_="stack"in new g(m),b="stack"in new p(1,2),w=p&&f&&Object.getOwnPropertyDescriptor(t,m),E=!(!w||w.writable&&w.configurable),x=_&&!E&&!b;e({global:!0,constructor:!0,forced:d||x},{DOMException:x?v:p});var S=n(m),C=S.prototype;if(C.constructor!==S)for(var I in d||i(C,"constructor",r(1,S)),u)if(o(u,I)){var T=u[I],R=T.s;o(S,R)||i(S,R,r(6,T.c))}}();var tu,nu={};!function(){if(tu)return nu;tu=1;var e=Ae(),t="DOMException";Po()(e(t),t)}();var ru,iu={};!function(){if(ru)return iu;ru=1;var e=mr(),t=s(),n=xo(),r=y(),i=TypeError,o=Object.defineProperty,a=t.self!==t;try{if(r){var c=Object.getOwnPropertyDescriptor(t,"self");!a&&c&&c.get&&c.enumerable||n(t,"self",{get:function(){return t},set:function(e){if(this!==t)throw new i("Illegal invocation");o(t,"self",{value:e,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}else e({global:!0,simple:!0,forced:a},{self:t})}catch(e){}}();var ou,au,su,cu,lu,uu,hu,fu,du,mu,gu,pu={},vu={};function yu(){if(su)return au;su=1;var e=v(),t=ct(),n=y(),r=tt(),i=t("iterator");return au=!e(function(){var e=new URL("b?a=1&b=2&c=3","https://a"),t=e.searchParams,o=new URLSearchParams("a=1&a=2&b=3"),a="";return e.pathname="c%20d",t.forEach(function(e,n){t.delete("b"),a+=n+e}),o.delete("a",2),o.delete("b",void 0),r&&(!e.toJSON||!o.has("a",1)||o.has("a",2)||!o.has("a",void 0)||o.has("b"))||!t.size&&(r||!n)||!t.sort||"https://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[i]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("https://тест").host||"#%D0%B1"!==new URL("https://a#б").hash||"a1c3"!==a||"x"!==new URL("https://x",void 0).host})}function Au(){if(hu)return uu;hu=1;var e=Jr(),t=_(),n=ot(),r=qa(),i=ss(),o=Qr(),a=vn(),s=_a(),c=ls(),l=cs(),u=Array;return uu=function(h){var f=n(h),d=o(this),m=arguments.length,g=m>1?arguments[1]:void 0,p=void 0!==g;p&&(g=e(g,m>2?arguments[2]:void 0));var v,y,A,_,b,w,E=l(f),x=0;if(!E||this===u&&i(E))for(v=a(f),y=d?new this(v):u(v);v>x;x++)w=p?g(f[x],x):f[x],s(y,x,w);else for(y=d?new this:[],b=(_=c(f,E)).next;!(A=t(b,_)).done;x++)w=p?r(_,g,[A.value,x],!0):A.value,s(y,x,w);return y.length=x,y},uu}function _u(){if(du)return fu;du=1;var e=he(),t=2147483647,n=/[^\0-\u007E]/,r=/[.\u3002\uFF0E\uFF61]/g,i="Overflow: input needs wider integers to process",o=RangeError,a=e(r.exec),s=Math.floor,c=String.fromCharCode,l=e("".charCodeAt),u=e([].join),h=e([].push),f=e("".replace),d=e("".split),m=e("".toLowerCase),g=function(e){return e+22+75*(e<26)},p=function(e,t,n){var r=0;for(e=n?s(e/700):e>>1,e+=s(e/t);e>455;)e=s(e/35),r+=36;return s(r+36*e/(e+38))},v=function(e){var n=[];e=function(e){for(var t=[],n=0,r=e.length;n<r;){var i=l(e,n++);if(i>=55296&&i<=56319&&n<r){var o=l(e,n++);56320==(64512&o)?h(t,((1023&i)<<10)+(1023&o)+65536):(h(t,i),n--)}else h(t,i)}return t}(e);var r,a,f=e.length,d=128,m=0,v=72;for(r=0;r<e.length;r++)(a=e[r])<128&&h(n,c(a));var y=n.length,A=y;for(y&&h(n,"-");A<f;){var _=t;for(r=0;r<e.length;r++)(a=e[r])>=d&&a<_&&(_=a);var b=A+1;if(_-d>s((t-m)/b))throw new o(i);for(m+=(_-d)*b,d=_,r=0;r<e.length;r++){if((a=e[r])<d&&++m>t)throw new o(i);if(a===d){for(var w=m,E=36;;){var x=E<=v?1:E>=v+26?26:E-v;if(w<x)break;var S=w-x,C=36-x;h(n,c(g(x+S%C))),w=s(S/C),E+=36}h(n,c(g(w))),v=p(m,b,A===y),m=0,A++}}m++,d++}return u(n,"")};return fu=function(e){var t,i,o=[],s=d(f(m(e),r,"."),".");for(t=0;t<s.length;t++)i=s[t],h(o,a(n,i)?"xn--"+v(i):i);return u(o,".")}}function bu(){if(gu)return mu;gu=1;var e=TypeError;return mu=function(t,n){if(t<n)throw new e("Not enough arguments");return t}}var wu,Eu,xu,Su,Cu,Iu,Tu,Ru={};function ku(){if(xu)return Eu;xu=1;var e=s(),t=y(),n=Object.getOwnPropertyDescriptor;return Eu=function(r){if(!t)return e[r];var i=n(e,r);return i&&i.value}}function Ou(){if(Cu)return Su;Cu=1,Gl(),function(){if(wu)return Ru;wu=1;var e=mr(),t=he(),n=gn(),r=RangeError,i=String.fromCharCode,o=String.fromCodePoint,a=t([].join);e({target:"String",stat:!0,arity:1,forced:!!o&&1!==o.length},{fromCodePoint:function(e){for(var t,o=[],s=arguments.length,c=0;s>c;){if(t=+arguments[c++],n(t,1114111)!==t)throw new r(t+" is not a valid code point");o[c]=t<65536?i(t):i(55296+((t-=65536)>>10),t%1024+56320)}return a(o,"")}})}();var e=mr(),t=s(),n=ku(),r=Ae(),i=_(),o=he(),a=y(),c=yu(),l=Xt(),u=xo(),h=So(),f=Po(),d=zl(),m=Yt(),g=Co(),p=ve(),v=at(),A=Jr(),b=wr(),w=Et(),E=ye(),x=Er(),S=Wi(),C=ue(),I=ls(),T=cs(),R=ja(),k=bu(),O=ct(),P=wi(),M=O("iterator"),L="URLSearchParams",B=L+"Iterator",U=m.set,D=m.getterFor(L),F=m.getterFor(B),N=n("fetch"),W=n("Request"),j=n("Headers"),z=W&&W.prototype,H=j&&j.prototype,G=t.TypeError,q=t.encodeURIComponent,Y=String.fromCharCode,V=r("String","fromCodePoint"),X=parseInt,$=o("".charAt),J=o([].join),Q=o([].push),Z=o("".replace),K=o([].shift),ee=o([].splice),te=o("".split),ne=o("".slice),re=o(/./.exec),ie=/\+/g,oe=/^[0-9a-f]+$/i,ae=function(e,t){var n=ne(e,t,t+2);return re(oe,n)?X(n,16):NaN},se=function(e){for(var t=0,n=128;n>0&&0!==(e&n);n>>=1)t++;return t},ce=function(e){var t=null;switch(e.length){case 1:t=e[0];break;case 2:t=(31&e[0])<<6|63&e[1];break;case 3:t=(15&e[0])<<12|(63&e[1])<<6|63&e[2];break;case 4:t=(7&e[0])<<18|(63&e[1])<<12|(63&e[2])<<6|63&e[3]}return t>1114111?null:t},le=function(e){for(var t=(e=Z(e,ie," ")).length,n="",r=0;r<t;){var i=$(e,r);if("%"===i){if("%"===$(e,r+1)||r+3>t){n+="%",r++;continue}var o=ae(e,r+1);if(o!=o){n+=i,r++;continue}r+=2;var a=se(o);if(0===a)i=Y(o);else{if(1===a||a>4){n+="",r++;continue}for(var s=[o],c=1;c<a&&!(++r+3>t||"%"!==$(e,r));){var l=ae(e,r+1);if(l!=l){r+=3;break}if(l>191||l<128)break;Q(s,l),r+=2,c++}if(s.length!==a){n+="";continue}var u=ce(s);null===u?n+="":i=V(u)}}n+=i,r++}return n},fe=/[!'()~]|%20/g,de={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},me=function(e){return de[e]},ge=function(e){return Z(q(e),fe,me)},pe=d(function(e,t){U(this,{type:B,target:D(e).entries,index:0,kind:t})},L,function(){var e=F(this),t=e.target,n=e.index++;if(!t||n>=t.length)return e.target=null,R(void 0,!0);var r=t[n];switch(e.kind){case"keys":return R(r.key,!1);case"values":return R(r.value,!1)}return R([r.key,r.value],!1)},!0),_e=function(e){this.entries=[],this.url=null,void 0!==e&&(E(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===$(e,0)?ne(e,1):e:x(e)))};_e.prototype={type:L,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,n,r,o,a,s,c,l=this.entries,u=T(e);if(u)for(n=(t=I(e,u)).next;!(r=i(n,t)).done;){if(a=(o=I(w(r.value))).next,(s=i(a,o)).done||(c=i(a,o)).done||!i(a,o).done)throw new G("Expected sequence with length 2");Q(l,{key:x(s.value),value:x(c.value)})}else for(var h in e)v(e,h)&&Q(l,{key:h,value:x(e[h])})},parseQuery:function(e){if(e)for(var t,n,r=this.entries,i=te(e,"&"),o=0;o<i.length;)(t=i[o++]).length&&(n=te(t,"="),Q(r,{key:le(K(n)),value:le(J(n,"="))}))},serialize:function(){for(var e,t=this.entries,n=[],r=0;r<t.length;)e=t[r++],Q(n,ge(e.key)+"="+ge(e.value));return J(n,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var be=function(){g(this,we);var e=U(this,new _e(arguments.length>0?arguments[0]:void 0));a||(this.size=e.entries.length)},we=be.prototype;if(h(we,{append:function(e,t){var n=D(this);k(arguments.length,2),Q(n.entries,{key:x(e),value:x(t)}),a||this.length++,n.updateURL()},delete:function(e){for(var t=D(this),n=k(arguments.length,1),r=t.entries,i=x(e),o=n<2?void 0:arguments[1],s=void 0===o?o:x(o),c=0;c<r.length;){var l=r[c];if(l.key!==i||void 0!==s&&l.value!==s)c++;else if(ee(r,c,1),void 0!==s)break}a||(this.size=r.length),t.updateURL()},get:function(e){var t=D(this).entries;k(arguments.length,1);for(var n=x(e),r=0;r<t.length;r++)if(t[r].key===n)return t[r].value;return null},getAll:function(e){var t=D(this).entries;k(arguments.length,1);for(var n=x(e),r=[],i=0;i<t.length;i++)t[i].key===n&&Q(r,t[i].value);return r},has:function(e){for(var t=D(this).entries,n=k(arguments.length,1),r=x(e),i=n<2?void 0:arguments[1],o=void 0===i?i:x(i),a=0;a<t.length;){var s=t[a++];if(s.key===r&&(void 0===o||s.value===o))return!0}return!1},set:function(e,t){var n=D(this);k(arguments.length,1);for(var r,i=n.entries,o=!1,s=x(e),c=x(t),l=0;l<i.length;l++)(r=i[l]).key===s&&(o?ee(i,l--,1):(o=!0,r.value=c));o||Q(i,{key:s,value:c}),a||(this.size=i.length),n.updateURL()},sort:function(){var e=D(this);P(e.entries,function(e,t){return e.key>t.key?1:-1}),e.updateURL()},forEach:function(e){for(var t,n=D(this).entries,r=A(e,arguments.length>1?arguments[1]:void 0),i=0;i<n.length;)r((t=n[i++]).value,t.key,this)},keys:function(){return new pe(this,"keys")},values:function(){return new pe(this,"values")},entries:function(){return new pe(this,"entries")}},{enumerable:!0}),l(we,M,we.entries,{name:"entries"}),l(we,"toString",function(){return D(this).serialize()},{enumerable:!0}),a&&u(we,"size",{get:function(){return D(this).entries.length},configurable:!0,enumerable:!0}),f(be,L),e({global:!0,constructor:!0,forced:!c},{URLSearchParams:be}),!c&&p(j)){var Ee=o(H.has),xe=o(H.set),Se=function(e){if(E(e)){var t,n=e.body;if(b(n)===L)return t=e.headers?new j(e.headers):new j,Ee(t,"content-type")||xe(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),S(e,{body:C(0,x(n)),headers:C(0,t)})}return e};if(p(N)&&e({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return N(e,arguments.length>1?Se(arguments[1]):{})}}),p(W)){var Ce=function(e){return g(this,z),new W(e,arguments.length>1?Se(arguments[1]):{})};z.constructor=Ce,Ce.prototype=z,e({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:Ce})}}return Su={URLSearchParams:be,getState:D}}function Pu(){if(Iu)return pu;Iu=1,function(){if(ou)return vu;ou=1;var e=ic().charAt,t=Er(),n=Yt(),r=Hl(),i=ja(),o="String Iterator",a=n.set,s=n.getterFor(o);r(String,"String",function(e){a(this,{type:o,string:t(e),index:0})},function(){var t,n=s(this),r=n.string,o=n.index;return o>=r.length?i(void 0,!0):(t=e(r,o),n.index+=t.length,i(t,!1))})}();var e,t=mr(),n=y(),r=yu(),i=s(),o=Jr(),a=he(),c=Xt(),l=xo(),u=Co(),h=at(),f=function(){if(lu)return cu;lu=1;var e=y(),t=he(),n=_(),r=v(),i=Fi(),o=ur(),a=le(),s=ot(),c=de(),l=Object.assign,u=Object.defineProperty,h=t([].concat);return cu=!l||r(function(){if(e&&1!==l({b:1},l(u({},"a",{enumerable:!0,get:function(){u(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},n={},r=Symbol("assign detection"),o="abcdefghijklmnopqrst";return t[r]=7,o.split("").forEach(function(e){n[e]=e}),7!==l({},t)[r]||i(l({},n)).join("")!==o})?function(t,r){for(var l=s(t),u=arguments.length,f=1,d=o.f,m=a.f;u>f;)for(var g,p=c(arguments[f++]),v=d?h(i(p),d(p)):i(p),y=v.length,A=0;y>A;)g=v[A++],e&&!n(m,p,g)||(l[g]=p[g]);return l}:l,cu}(),d=Au(),m=bi(),g=ic().codeAt,p=_u(),A=Er(),b=Po(),w=bu(),E=Ou(),x=Yt(),S=x.set,C=x.getterFor("URL"),I=E.URLSearchParams,T=E.getState,R=i.URL,k=i.TypeError,O=i.parseInt,P=Math.floor,M=Math.pow,L=a("".charAt),B=a(/./.exec),U=a([].join),D=a(1.1.toString),F=a([].pop),N=a([].push),W=a("".replace),j=a([].shift),z=a("".split),H=a("".slice),G=a("".toLowerCase),q=a([].unshift),Y="Invalid scheme",V="Invalid host",X="Invalid port",$=/[a-z]/i,J=/[\d+-.a-z]/i,Q=/\d/,Z=/^0x/i,K=/^[0-7]+$/,ee=/^\d+$/,te=/^[\da-f]+$/i,ne=/[\0\t\n\r #%/:<>?@[\\\]^|]/,re=/[\0\t\n\r #/:<>?@[\\\]^|]/,ie=/^[\u0000-\u0020]+/,oe=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,ae=/[\t\n\r]/g,se=function(e){var t,n,r,i;if("number"==typeof e){for(t=[],n=0;n<4;n++)q(t,e%256),e=P(e/256);return U(t,".")}if("object"==typeof e){for(t="",r=function(e){for(var t=null,n=1,r=null,i=0,o=0;o<8;o++)0!==e[o]?(i>n&&(t=r,n=i),r=null,i=0):(null===r&&(r=o),++i);return i>n?r:t}(e),n=0;n<8;n++)i&&0===e[n]||(i&&(i=!1),r===n?(t+=n?":":"::",i=!0):(t+=D(e[n],16),n<7&&(t+=":")));return"["+t+"]"}return e},ce={},ue=f({},ce,{" ":1,'"':1,"<":1,">":1,"`":1}),fe=f({},ue,{"#":1,"?":1,"{":1,"}":1}),me=f({},fe,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),ge=function(e,t){var n=g(e,0);return n>32&&n<127&&!h(t,e)?e:encodeURIComponent(e)},pe={ftp:21,file:null,http:80,https:443,ws:80,wss:443},ve=function(e,t){var n;return 2===e.length&&B($,L(e,0))&&(":"===(n=L(e,1))||!t&&"|"===n)},ye=function(e){var t;return e.length>1&&ve(H(e,0,2))&&(2===e.length||"/"===(t=L(e,2))||"\\"===t||"?"===t||"#"===t)},Ae=function(e){return"."===e||"%2e"===G(e)},_e=function(e){return".."===(e=G(e))||"%2e."===e||".%2e"===e||"%2e%2e"===e},be={},we={},Ee={},xe={},Se={},Ce={},Ie={},Te={},Re={},ke={},Oe={},Pe={},Me={},Le={},Be={},Ue={},De={},Fe={},Ne={},We={},je={},ze=function(e,t,n){var r,i,o,a=A(e);if(t){if(i=this.parse(a))throw new k(i);this.searchParams=null}else{if(void 0!==n&&(r=new ze(n,!0)),i=this.parse(a,null,r))throw new k(i);(o=T(new I)).bindURL(this),this.searchParams=o}};ze.prototype={type:"URL",parse:function(t,n,r){var i,o,a,s,c=this,l=n||be,u=0,f="",g=!1,p=!1,v=!1;for(t=A(t),n||(c.scheme="",c.username="",c.password="",c.host=null,c.port=null,c.path=[],c.query=null,c.fragment=null,c.cannotBeABaseURL=!1,t=W(t,ie,""),t=W(t,oe,"$1")),t=W(t,ae,""),i=d(t);u<=i.length;){switch(o=i[u],l){case be:if(!o||!B($,o)){if(n)return Y;l=Ee;continue}f+=G(o),l=we;break;case we:if(o&&(B(J,o)||"+"===o||"-"===o||"."===o))f+=G(o);else{if(":"!==o){if(n)return Y;f="",l=Ee,u=0;continue}if(n&&(c.isSpecial()!==h(pe,f)||"file"===f&&(c.includesCredentials()||null!==c.port)||"file"===c.scheme&&!c.host))return;if(c.scheme=f,n)return void(c.isSpecial()&&pe[c.scheme]===c.port&&(c.port=null));f="","file"===c.scheme?l=Le:c.isSpecial()&&r&&r.scheme===c.scheme?l=xe:c.isSpecial()?l=Te:"/"===i[u+1]?(l=Se,u++):(c.cannotBeABaseURL=!0,N(c.path,""),l=Ne)}break;case Ee:if(!r||r.cannotBeABaseURL&&"#"!==o)return Y;if(r.cannotBeABaseURL&&"#"===o){c.scheme=r.scheme,c.path=m(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,l=je;break}l="file"===r.scheme?Le:Ce;continue;case xe:if("/"!==o||"/"!==i[u+1]){l=Ce;continue}l=Re,u++;break;case Se:if("/"===o){l=ke;break}l=Fe;continue;case Ce:if(c.scheme=r.scheme,o===e)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=m(r.path),c.query=r.query;else if("/"===o||"\\"===o&&c.isSpecial())l=Ie;else if("?"===o)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=m(r.path),c.query="",l=We;else{if("#"!==o){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=m(r.path),c.path.length--,l=Fe;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=m(r.path),c.query=r.query,c.fragment="",l=je}break;case Ie:if(!c.isSpecial()||"/"!==o&&"\\"!==o){if("/"!==o){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,l=Fe;continue}l=ke}else l=Re;break;case Te:if(l=Re,"/"!==o||"/"!==L(f,u+1))continue;u++;break;case Re:if("/"!==o&&"\\"!==o){l=ke;continue}break;case ke:if("@"===o){g&&(f="%40"+f),g=!0,a=d(f);for(var y=0;y<a.length;y++){var _=a[y];if(":"!==_||v){var b=ge(_,me);v?c.password+=b:c.username+=b}else v=!0}f=""}else if(o===e||"/"===o||"?"===o||"#"===o||"\\"===o&&c.isSpecial()){if(g&&""===f)return"Invalid authority";u-=d(f).length+1,f="",l=Oe}else f+=o;break;case Oe:case Pe:if(n&&"file"===c.scheme){l=Ue;continue}if(":"!==o||p){if(o===e||"/"===o||"?"===o||"#"===o||"\\"===o&&c.isSpecial()){if(c.isSpecial()&&""===f)return V;if(n&&""===f&&(c.includesCredentials()||null!==c.port))return;if(s=c.parseHost(f))return s;if(f="",l=De,n)return;continue}"["===o?p=!0:"]"===o&&(p=!1),f+=o}else{if(""===f)return V;if(s=c.parseHost(f))return s;if(f="",l=Me,n===Pe)return}break;case Me:if(!B(Q,o)){if(o===e||"/"===o||"?"===o||"#"===o||"\\"===o&&c.isSpecial()||n){if(""!==f){var w=O(f,10);if(w>65535)return X;c.port=c.isSpecial()&&w===pe[c.scheme]?null:w,f=""}if(n)return;l=De;continue}return X}f+=o;break;case Le:if(c.scheme="file","/"===o||"\\"===o)l=Be;else{if(!r||"file"!==r.scheme){l=Fe;continue}switch(o){case e:c.host=r.host,c.path=m(r.path),c.query=r.query;break;case"?":c.host=r.host,c.path=m(r.path),c.query="",l=We;break;case"#":c.host=r.host,c.path=m(r.path),c.query=r.query,c.fragment="",l=je;break;default:ye(U(m(i,u),""))||(c.host=r.host,c.path=m(r.path),c.shortenPath()),l=Fe;continue}}break;case Be:if("/"===o||"\\"===o){l=Ue;break}r&&"file"===r.scheme&&!ye(U(m(i,u),""))&&(ve(r.path[0],!0)?N(c.path,r.path[0]):c.host=r.host),l=Fe;continue;case Ue:if(o===e||"/"===o||"\\"===o||"?"===o||"#"===o){if(!n&&ve(f))l=Fe;else if(""===f){if(c.host="",n)return;l=De}else{if(s=c.parseHost(f))return s;if("localhost"===c.host&&(c.host=""),n)return;f="",l=De}continue}f+=o;break;case De:if(c.isSpecial()){if(l=Fe,"/"!==o&&"\\"!==o)continue}else if(n||"?"!==o)if(n||"#"!==o){if(o!==e&&(l=Fe,"/"!==o))continue}else c.fragment="",l=je;else c.query="",l=We;break;case Fe:if(o===e||"/"===o||"\\"===o&&c.isSpecial()||!n&&("?"===o||"#"===o)){if(_e(f)?(c.shortenPath(),"/"===o||"\\"===o&&c.isSpecial()||N(c.path,"")):Ae(f)?"/"===o||"\\"===o&&c.isSpecial()||N(c.path,""):("file"===c.scheme&&!c.path.length&&ve(f)&&(c.host&&(c.host=""),f=L(f,0)+":"),N(c.path,f)),f="","file"===c.scheme&&(o===e||"?"===o||"#"===o))for(;c.path.length>1&&""===c.path[0];)j(c.path);"?"===o?(c.query="",l=We):"#"===o&&(c.fragment="",l=je)}else f+=ge(o,fe);break;case Ne:"?"===o?(c.query="",l=We):"#"===o?(c.fragment="",l=je):o!==e&&(c.path[0]+=ge(o,ce));break;case We:n||"#"!==o?o!==e&&("'"===o&&c.isSpecial()?c.query+="%27":c.query+="#"===o?"%23":ge(o,ce)):(c.fragment="",l=je);break;case je:o!==e&&(c.fragment+=ge(o,ue))}u++}},parseHost:function(e){var t,n,r;if("["===L(e,0)){if("]"!==L(e,e.length-1))return V;if(t=function(e){var t,n,r,i,o,a,s,c=[0,0,0,0,0,0,0,0],l=0,u=null,h=0,f=function(){return L(e,h)};if(":"===f()){if(":"!==L(e,1))return;h+=2,u=++l}for(;f();){if(8===l)return;if(":"!==f()){for(t=n=0;n<4&&B(te,f());)t=16*t+O(f(),16),h++,n++;if("."===f()){if(0===n)return;if(h-=n,l>6)return;for(r=0;f();){if(i=null,r>0){if(!("."===f()&&r<4))return;h++}if(!B(Q,f()))return;for(;B(Q,f());){if(o=O(f(),10),null===i)i=o;else{if(0===i)return;i=10*i+o}if(i>255)return;h++}c[l]=256*c[l]+i,2!==++r&&4!==r||l++}if(4!==r)return;break}if(":"===f()){if(h++,!f())return}else if(f())return;c[l++]=t}else{if(null!==u)return;h++,u=++l}}if(null!==u)for(a=l-u,l=7;0!==l&&a>0;)s=c[l],c[l--]=c[u+a-1],c[u+--a]=s;else if(8!==l)return;return c}(H(e,1,-1)),!t)return V;this.host=t}else if(this.isSpecial()){if(e=p(e),B(ne,e))return V;if(t=function(e){var t,n,r,i,o,a,s,c=z(e,".");if(c.length&&""===c[c.length-1]&&c.length--,(t=c.length)>4)return e;for(n=[],r=0;r<t;r++){if(""===(i=c[r]))return e;if(o=10,i.length>1&&"0"===L(i,0)&&(o=B(Z,i)?16:8,i=H(i,8===o?1:2)),""===i)a=0;else{if(!B(10===o?ee:8===o?K:te,i))return e;a=O(i,o)}N(n,a)}for(r=0;r<t;r++)if(a=n[r],r===t-1){if(a>=M(256,5-t))return null}else if(a>255)return null;for(s=F(n),r=0;r<n.length;r++)s+=n[r]*M(256,3-r);return s}(e),null===t)return V;this.host=t}else{if(B(re,e))return V;for(t="",n=d(e),r=0;r<n.length;r++)t+=ge(n[r],ce);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"===this.scheme},includesCredentials:function(){return""!==this.username||""!==this.password},isSpecial:function(){return h(pe,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"===this.scheme&&1===t&&ve(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,n=e.username,r=e.password,i=e.host,o=e.port,a=e.path,s=e.query,c=e.fragment,l=t+":";return null!==i?(l+="//",e.includesCredentials()&&(l+=n+(r?":"+r:"")+"@"),l+=se(i),null!==o&&(l+=":"+o)):"file"===t&&(l+="//"),l+=e.cannotBeABaseURL?a[0]:a.length?"/"+U(a,"/"):"",null!==s&&(l+="?"+s),null!==c&&(l+="#"+c),l},setHref:function(e){var t=this.parse(e);if(t)throw new k(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"===e)try{return new He(e.path[0]).origin}catch(e){return"null"}return"file"!==e&&this.isSpecial()?e+"://"+se(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(A(e)+":",be)},getUsername:function(){return this.username},setUsername:function(e){var t=d(A(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var n=0;n<t.length;n++)this.username+=ge(t[n],me)}},getPassword:function(){return this.password},setPassword:function(e){var t=d(A(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var n=0;n<t.length;n++)this.password+=ge(t[n],me)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?se(e):se(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,Oe)},getHostname:function(){var e=this.host;return null===e?"":se(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,Pe)},getPort:function(){var e=this.port;return null===e?"":A(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""===(e=A(e))?this.port=null:this.parse(e,Me))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+U(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,De))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""===(e=A(e))?this.query=null:("?"===L(e,0)&&(e=H(e,1)),this.query="",this.parse(e,We)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!==(e=A(e))?("#"===L(e,0)&&(e=H(e,1)),this.fragment="",this.parse(e,je)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var He=function(e){var t=u(this,Ge),r=w(arguments.length,1)>1?arguments[1]:void 0,i=S(t,new ze(e,!1,r));n||(t.href=i.serialize(),t.origin=i.getOrigin(),t.protocol=i.getProtocol(),t.username=i.getUsername(),t.password=i.getPassword(),t.host=i.getHost(),t.hostname=i.getHostname(),t.port=i.getPort(),t.pathname=i.getPathname(),t.search=i.getSearch(),t.searchParams=i.getSearchParams(),t.hash=i.getHash())},Ge=He.prototype,qe=function(e,t){return{get:function(){return C(this)[e]()},set:t&&function(e){return C(this)[t](e)},configurable:!0,enumerable:!0}};if(n&&(l(Ge,"href",qe("serialize","setHref")),l(Ge,"origin",qe("getOrigin")),l(Ge,"protocol",qe("getProtocol","setProtocol")),l(Ge,"username",qe("getUsername","setUsername")),l(Ge,"password",qe("getPassword","setPassword")),l(Ge,"host",qe("getHost","setHost")),l(Ge,"hostname",qe("getHostname","setHostname")),l(Ge,"port",qe("getPort","setPort")),l(Ge,"pathname",qe("getPathname","setPathname")),l(Ge,"search",qe("getSearch","setSearch")),l(Ge,"searchParams",qe("getSearchParams")),l(Ge,"hash",qe("getHash","setHash"))),c(Ge,"toJSON",function(){return C(this).serialize()},{enumerable:!0}),c(Ge,"toString",function(){return C(this).serialize()},{enumerable:!0}),R){var Ye=R.createObjectURL,Ve=R.revokeObjectURL;Ye&&c(He,"createObjectURL",o(Ye,R)),Ve&&c(He,"revokeObjectURL",o(Ve,R))}return b(He,"URL"),t({global:!0,constructor:!0,forced:!r,sham:!n},{URL:He}),pu}Tu||(Tu=1,Pu());var Mu,Lu={};!function(){if(Mu)return Lu;Mu=1;var e=mr(),t=_();e({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return t(URL.prototype.toString,this)}})}();var Bu;Bu||(Bu=1,Ou());var Uu,Du={};!function(){if(Uu)return Du;Uu=1;var e=Xt(),t=he(),n=Er(),r=bu(),i=URLSearchParams,o=i.prototype,a=t(o.append),s=t(o.delete),c=t(o.forEach),l=t([].push),u=new i("a=1&a=2&b=3");u.delete("a",1),u.delete("b",void 0),u+""!="a=2"&&e(o,"delete",function(e){var t=arguments.length,i=t<2?void 0:arguments[1];if(t&&void 0===i)return s(this,e);var o=[];c(this,function(e,t){l(o,{key:t,value:e})}),r(t,1);for(var u,h=n(e),f=n(i),d=0,m=0,g=!1,p=o.length;d<p;)u=o[d++],g||u.key===h?(g=!0,s(this,u.key)):m++;for(;m<p;)(u=o[m++]).key===h&&u.value===f||a(this,u.key,u.value)},{enumerable:!0,unsafe:!0})}();var Fu,Nu={};!function(){if(Fu)return Nu;Fu=1;var e=Xt(),t=he(),n=Er(),r=bu(),i=URLSearchParams,o=i.prototype,a=t(o.getAll),s=t(o.has),c=new i("a=1");!c.has("a",2)&&c.has("a",void 0)||e(o,"has",function(e){var t=arguments.length,i=t<2?void 0:arguments[1];if(t&&void 0===i)return s(this,e);var o=a(this,e);r(t,1);for(var c=n(i),l=0;l<o.length;)if(o[l++]===c)return!0;return!1},{enumerable:!0,unsafe:!0})}();var Wu,ju={};!function(){if(Wu)return ju;Wu=1;var e=y(),t=he(),n=xo(),r=URLSearchParams.prototype,i=t(r.forEach);e&&!("size"in r)&&n(r,"size",{get:function(){var e=0;return i(this,function(){e++}),e},configurable:!0,enumerable:!0})}();const zu="4.65.1",Hu={enabled:!1,enabled_on_views:[],debug:!1,wait_for_browser_mod_time:.25,log_level_console:"info",log_level_system:"warning",system_target_log_level:"",alert_errors:!0,hide_toolbar:!1,keep_toolbar_space:!1,hide_toolbar_action_icons:!1,hide_toolbar_on_subviews:!1,hide_sidebar:!1,close_more_info_dialog_time:0,fullscreen:!1,keep_fullscreen:!0,z_index:1e3,idle_time:15,fade_in_time:3,fade_out_time_motion_detected:1,fade_out_time_screensaver_entity:3,fade_out_time_browser_mod_popup:1,fade_out_time_interaction:.3,crossfade_time:3,display_time:15,keep_screen_on_time:0,black_screen_after_time:0,control_reactivation_time:1,disable_context_menu:!1,screensaver_start_navigation_path:"",screensaver_stop_close_browser_mod_popup:!1,screensaver_entity:"",stop_screensaver_on_mouse_move:!0,stop_screensaver_on_mouse_click:!0,stop_screensaver_on_key_down:!0,stop_screensaver_on_location_change:!0,disable_screensaver_on_browser_mod_popup:!1,disable_screensaver_on_browser_mod_popup_func:"",disable_screensaver_when_assist_active:!0,show_images:!0,image_url:"https://picsum.photos/${width}/${height}?random=${timestamp}",image_url_entity:"",force_load_media_with_fetch:!1,stream_load_media:!1,media_entity_load_unchanged:!0,iframe_load_unchanged:!1,iframe_interaction:!1,immich_api_keys:[],immich_api_request_timeout:15,immich_album_names:[],immich_shared_albums:!0,immich_tag_names:[],immich_exclude_tag_names:[],immich_persons:[],immich_memories:!1,immich_favorites:!1,immich_resolution:"preview",image_fit_landscape:"cover",image_fit_portrait:"contain",calculate_media_size:!0,media_horizontal_align:"center",media_vertical_align:"middle",media_list_update_interval:3600,media_list_max_size:500,media_order:"random",exclude_filenames:[],exclude_media_types:[],exclude_media_orientation:"",image_background:"color",video_loop:!1,video_volume:0,touch_zone_size_next_image:15,touch_zone_size_previous_image:15,show_progress_bar:!1,show_image_info:!1,fetch_address_data:!1,image_info_template:"${DateTimeOriginal}",info_animation_duration_x:0,info_animation_duration_y:0,info_animation_timing_function_x:"ease",info_animation_timing_function_y:"ease",info_move_pattern:"random",info_move_interval:0,info_move_fade_duration:2,image_animation_ken_burns:!1,image_animation_ken_burns_zoom:1.3,image_animation_ken_burns_delay:0,image_animation_ken_burns_duration:0,image_animation_ken_burns_animations:["simple"],camera_motion_detection_enabled:!1,camera_motion_detection_stop_screensaver:!0,camera_motion_detection_set_entity:"",camera_motion_detection_facing_mode:"user",camera_motion_detection_threshold:5,camera_motion_detection_capture_width:64,camera_motion_detection_capture_height:48,camera_motion_detection_capture_interval:.3,camera_motion_detection_capture_visible:!1,camera_motion_detection_motion_start_delay:0,camera_motion_detection_motion_stop_delay:2,theme:"",custom_css:"",style:{},badges:[],cards:[],views:[],content_interaction:!1,profile:"",profile_entity:"",profiles:{}},Gu={image_excludes:"exclude_filenames",image_fit:"image_fit_landscape",image_order:"media_order",enabled_on_tabs:"enabled_on_views",image_list_update_interval:"media_list_update_interval",screensaver_stop_navigation_path:"screensaver_start_navigation_path",card_interaction:"content_interaction",immich_api_key:"immich_api_keys",caclulate_media_size:"calculate_media_size"};let qu={},Yu={},Vu=null,Xu=null,$u=null,Ju=null,Qu=null,Zu=!1;const Ku={"wallpanel-screensaver-image-background":{filter:"blur(15px)",background:"#00000000","background-position":"center","background-size":"cover"},"wallpanel-screensaver-image-info-container":{},"wallpanel-screensaver-image-info":{position:"absolute",bottom:"0.5em",right:"0.5em","max-width":"calc(100% - 2em)","max-height":"calc(100% - 5em)",padding:"0.1em 0.5em 0.1em 0.5em","font-size":"2em",background:"#00000055","backdrop-filter":"blur(2px)","border-radius":"0.5rem"},"wallpanel-progress":{position:"absolute",bottom:"0",height:"2px",width:"100%"},"wallpanel-progress-inner":{height:"100%","background-color":"white"},"wallpanel-message":{width:"30em","max-width":"100%","box-sizing":"border-box",padding:"1em","border-radius":"0.5rem",border:"1px solid black","box-shadow":"0 4px 12px rgba(0, 0, 0, 0.3)","font-size":"1.5em",color:"white",cursor:"pointer",opacity:"0",transform:"translateX(100%)",transition:"all 0.4s ease"},"wallpanel-message.show":{opacity:1,transform:"translateX(0)"},"wallpanel-message.error":{"background-color":"#f8d7da",color:"#721c24","border-color":"#721c24"},"wallpanel-message.warning":{"background-color":"#fff3cd",color:"#856404","border-color":"#856404"},"wallpanel-message.info":{"background-color":"#d1ecf1",color:"#0c5460","border-color":"#0c5460"},"wallpanel-message.success":{"background-color":"#d4edda",color:"#155724","border-color":"#155724"},"wallpanel-message-title":{"font-weight":"bold","margin-bottom":"0.25rem"}},eh=new Map;function th(e,t){const n=Number(Yu.media_list_max_size);if(Number.isFinite(n)&&!(n<=0)){for(;!eh.has(e)&&eh.size>=n;){const e=eh.keys().next().value;eh.delete(e)}eh.set(e,t)}}const nh={};let rh=null,ih=null,oh=null,ah=null,sh=null,ch=null,lh=null;function uh(e){return e&&"object"==typeof e&&!Array.isArray(e)}function hh(e){const t=[];return JSON.stringify(e,function(e,n){if("object"==typeof n&&null!==n){if(-1!==t.indexOf(n))return;t.push(n)}return n})}const fh={messages:[],logLevelConsole:"warning",logLevelSystem:"error",systemTargetLogLevel:"",addMessage:function(e,t){if(!Yu.debug)return;const n={level:e,date:(new Date).toISOString(),text:"",objs:[],stack:""},r=new Error;r.stack&&(n.stack=r.stack.toString().replace(/^Error\r?\n/,""));for(let e=0;e<t.length;e++)0==e&&("string"==typeof t[0]||t[0]instanceof String)?n.text=t[e]:n.objs.push(t[e]);fh.messages.push(n),fh.messages.length>1e3&&fh.messages.shift()},systemLog(e,t){ih&&ih.hass&&ih.hass.callService("system_log","write",{logger:"frontend.wallpanel".concat(ah?"."+ah:""),message:t,level:fh.systemTargetLogLevel||e},void 0,!1).catch(()=>{})},downloadMessages:function(){const e=new Blob([hh(fh.messages)],{type:"text/plain"}),t=URL.createObjectURL(e),n=document.createElement("a");n.href=t,n.target="_blank",n.download="wallpanel_log.txt",document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(t),0)},purgeMessages:function(){fh.messages=[]},debug:function(){["debug"].includes(fh.logLevelConsole)&&console.debug.apply(this,arguments),["debug"].includes(fh.logLevelSystem)&&fh.systemLog("debug",hh(arguments)),fh.addMessage("debug",arguments)},info:function(){["debug","info"].includes(fh.logLevelConsole)&&console.info.apply(this,arguments),["debug","info"].includes(fh.logLevelSystem)&&fh.systemLog("info",hh(arguments)),fh.addMessage("info",arguments)},log:function(){fh.info.apply(this,arguments)},warning:function(){["debug","info","warning"].includes(fh.logLevelConsole)&&console.warn.apply(this,arguments),["debug","info","warning"].includes(fh.logLevelSystem)&&fh.systemLog("warning",hh(arguments)),fh.addMessage("warning",arguments)},warn:function(){fh.warning.apply(this,arguments)},error:function(){if(["debug","info","warning","error"].includes(fh.logLevelConsole)&&console.error.apply(this,arguments),["debug","info","warning","error"].includes(fh.logLevelSystem)&&fh.systemLog("error",hh(arguments)),fh.addMessage("error",arguments),Yu.alert_errors){const e="Wallpanel error: ".concat(hh(arguments));Qu?Qu.showMessage("error","Error",e,1e4):alert(e)}},err:function(){fh.error.apply(this,arguments)}};class dh{constructor(){this.enabled=!1,this.error=null,this.nativeWakeLockSupported="wakeLock"in navigator,this._lock=null,this._player=null,this._isPlaying=!1,this._onWakeLockRelease=null;const e=()=>{fh.debug("handleVisibilityChange"),this.enabled&&!document.hidden&&this.enable()};if(document.addEventListener("visibilitychange",e),document.addEventListener("fullscreenchange",e),!this.nativeWakeLockSupported){const e="data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAAA1NtZGF0AAACrwYF//+r3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE2NCByMzA5NSBiYWVlNDAwIC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDMtMjAyMiAtIGh0dHA6Ly93d3cudmlkZW9sYW4ub3JnL3gyNjQuaHRtbCAtIG9wdGlvbnM6IGNhYmFjPTEgcmVmPTMgZGVibG9jaz0xOi0zOi0zIGFuYWx5c2U9MHgzOjB4MTEzIG1lPWhleCBzdWJtZT03IHBzeT0xIHBzeV9yZD0yLjAwOjAuNzAgbWl4ZWRfcmVmPTEgbWVfcmFuZ2U9MTYgY2hyb21hX21lPTEgdHJlbGxpcz0xIDh4OGRjdD0xIGNxbT0wIGRlYWR6b25lPTIxLDExIGZhc3RfcHNraXA9MSBjaHJvbWFfcXBfb2Zmc2V0PS00IHRocmVhZHM9MSBsb29rYWhlYWRfdGhyZWFkcz0xIHNsaWNlZF90aHJlYWRzPTAgbnI9MCBkZWNpbWF0ZT0xIGludGVybGFjZWQ9MCBibHVyYXlfY29tcGF0PTAgY29uc3RyYWluZWRfaW50cmE9MCBiZnJhbWVzPTMgYl9weXJhbWlkPTIgYl9hZGFwdD0xIGJfYmlhcz0wIGRpcmVjdD0xIHdlaWdodGI9MSBvcGVuX2dvcD0wIHdlaWdodHA9MiBrZXlpbnQ9MjUwIGtleWludF9taW49MSBzY2VuZWN1dD00MCBpbnRyYV9yZWZyZXNoPTAgcmNfbG9va2FoZWFkPTQwIHJjPWNyZiBtYnRyZWU9MSBjcmY9MjMuMCBxY29tcD0wLjYwIHFwbWluPTAgcXBtYXg9NjkgcXBzdGVwPTQgaXBfcmF0aW89MS40MCBhcT0xOjEuMjAAgAAAABFliIQAF85//vfUt8yy7VNwgQAAAAlBmiRsQXzn/vAAAAAJQZ5CeIL5z4aBAAAACQGeYXRBfOeGgAAAAAkBnmNqQXznhoEAAAAPQZpoSahBaJlMCC+c//7xAAAAC0GehkURLBfOf4aBAAAACQGepXRBfOeGgQAAAAkBnqdqQXznhoAAAAAPQZqpSahBbJlMCC+c//7wAAADs21vb3YAAABsbXZoZAAAAAAAAAAAAAAAAAAAA+gAACcQAAEAAAEAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAALddHJhawAAAFx0a2hkAAAAAwAAAAAAAAAAAAAAAQAAAAAAACcQAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAIAAAACAAAAAAAJGVkdHMAAAAcZWxzdAAAAAAAAAABAAAnEAAAgAAAAQAAAAACVW1kaWEAAAAgbWRoZAAAAAAAAAAAAAAAAAAAQAAAAoAAVcQAAAAAAC1oZGxyAAAAAAAAAAB2aWRlAAAAAAAAAAAAAAAAVmlkZW9IYW5kbGVyAAAAAgBtaW5mAAAAFHZtaGQAAAABAAAAAAAAAAAAAAAkZGluZgAAABxkcmVmAAAAAAAAAAEAAAAMdXJsIAAAAAEAAAHAc3RibAAAAMBzdHNkAAAAAAAAAAEAAACwYXZjMQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAIAAgASAAAAEgAAAAAAAAAARVMYXZjNTkuMzcuMTAwIGxpYngyNjQAAAAAAAAAAAAAABj//wAAADZhdmNDAWQACv/hABlnZAAKrNlfllwEQAAAAwBAAAADAIPEiWWAAQAGaOvjxMhM/fj4AAAAABBwYXNwAAAAAQAAAAEAAAAUYnRydAAAAAAAAAKiAAACogAAABhzdHRzAAAAAAAAAAEAAAAKAABAAAAAABRzdHNzAAAAAAAAAAEAAAABAAAAYGN0dHMAAAAAAAAACgAAAAEAAIAAAAAAAQABQAAAAAABAACAAAAAAAEAAAAAAAAAAQAAQAAAAAABAAFAAAAAAAEAAIAAAAAAAQAAAAAAAAABAABAAAAAAAEAAIAAAAAAHHN0c2MAAAAAAAAAAQAAAAEAAAAKAAAAAQAAADxzdHN6AAAAAAAAAAAAAAAKAAACyAAAAA0AAAANAAAADQAAAA0AAAATAAAADwAAAA0AAAANAAAAEwAAABRzdGNvAAAAAAAAAAEAAAAwAAAAYnVkdGEAAABabWV0YQAAAAAAAAAhaGRscgAAAAAAAAAAbWRpcmFwcGwAAAAAAAAAAAAAAAAtaWxzdAAAACWpdG9vAAAAHWRhdGEAAAABAAAAAExhdmY1OS4yNy4xMDA=";this._player=document.createElement("video"),this._player.setAttribute("id","ScreenWakeLockVideo"),this._player.setAttribute("src",e),this._player.setAttribute("playsinline",""),this._player.setAttribute("muted",""),this._player.style.display="none",document.getElementById("ScreenWakeLockVideo")||document.body.appendChild(this._player),this._player.addEventListener("ended",()=>{fh.debug("Video ended"),this.enabled&&this.enable()}),this._player.addEventListener("playing",()=>{fh.debug("Video playing"),this._isPlaying=!0}),this._player.addEventListener("pause",()=>{fh.debug("Video pause"),this._isPlaying=!1})}}enable(){if(this.nativeWakeLockSupported){if(fh.debug("Requesting native screen wakelock"),this._lock)return void fh.debug("Screen wakelock already active");navigator.wakeLock.request("screen").then(e=>{fh.debug("Request screen wakelock successful"),this._lock=e,this._onWakeLockRelease=()=>{fh.debug("Screen wakelock released"),this.enabled=!1,this._lock=null},e.addEventListener("release",this._onWakeLockRelease),this.enabled=!0,this.error=null}).catch(e=>{this.enabled=!1,this.error=e,fh.warning("Failed to request screen wakeLock: ".concat(e))})}else{fh.debug("Starting video player"),!this._player.paused&&this._isPlaying&&this._player.pause();const e=this._player.play();e&&e.then(()=>{this.enabled=!0,this.error=null,fh.debug("Video play successful")}).catch(e=>{this.enabled=!1,this.error=e,fh.warning("Failed to play video: ".concat(e))})}}disable(){this.nativeWakeLockSupported?(fh.debug("Releasing native screen wakelock"),this._lock&&(this._onWakeLockRelease&&(this._lock.removeEventListener("release",this._onWakeLockRelease),this._onWakeLockRelease=null),this._lock.release()),this._lock=null):(fh.debug("Stopping video player"),!this._player.paused&&this._isPlaying&&this._player.pause()),this.enabled=!1}}class mh{constructor(){this.enabled=!1,this.error=!1,this.width=64,this.height=48,this.thresholdRatio=.05,this.threshold=this.width*this.height*this.thresholdRatio,this.captureInterval=300,this.motionActive=!1,this.motionStartDelay=0,this.motionStopDelay=2e3,this.motionDetectionRequiredRatio=.8,this.roomSettledRequiredRatio=1,this.motionStopTimeout=null,this.captureTimer=null,this.referenceImageData=null,this.previousImageData=null,this.referenceChangeRatios=[],this.previousChangeRatios=[],this.maxRatioHistorySize=Math.ceil(6e4/this.captureInterval),this.videoElement=document.createElement("video"),this.videoElement.setAttribute("id","wallpanelMotionDetectionVideo"),this.videoElement.style.display="none",document.body.appendChild(this.videoElement),this.canvasElement=document.createElement("canvas"),this.canvasElement.setAttribute("id","wallpanelMotionDetectionCanvas"),this.canvasElement.style.display="none",document.body.appendChild(this.canvasElement),this.context=this.canvasElement.getContext("2d",{willReadFrequently:!0}),this._elementsAppended=!0}compareImageData(e,t){if(!e||!t)return 0;let n=0;const r=e.data,i=t.data;for(let e=0;e<r.length;e+=4){Math.abs(r[e]-i[e])+Math.abs(r[e+1]-i[e+1])+Math.abs(r[e+2]-i[e+2])>=256&&n++}return n/(this.width*this.height)}storeRatio(e,t){for(e.push(t);e.length>this.maxRatioHistorySize;)e.shift()}getRatiosForInterval(e,t){const n=Math.max(1,Math.ceil(t/this.captureInterval));return e.length<n?[]:e.slice(-n)}hasRequiredRatioAboveThreshold(e,t){return e.length>0&&e.filter(e=>e>=this.thresholdRatio).length/e.length>=t}hasRequiredRatioBelowThreshold(e,t){return e.length>0&&e.filter(e=>e<this.thresholdRatio).length/e.length>=t}resetMotionState(){this.motionActive=!1,this.motionStopTimeout&&(clearTimeout(this.motionStopTimeout),this.motionStopTimeout=null),this.referenceImageData=null,this.previousImageData=null,this.referenceChangeRatios=[],this.previousChangeRatios=[]}capture(){this.context.globalCompositeOperation="source-over",this.context.drawImage(this.videoElement,0,0,this.width,this.height);const e=this.context.getImageData(0,0,this.width,this.height);if(!this.referenceImageData)return this.referenceImageData=e,void(this.previousImageData=e);const t=this.compareImageData(e,this.referenceImageData),n=this.compareImageData(e,this.previousImageData);this.previousImageData=e,this.storeRatio(this.referenceChangeRatios,t),this.storeRatio(this.previousChangeRatios,n);const r=this.getRatiosForInterval(this.referenceChangeRatios,this.motionStartDelay),i=this.hasRequiredRatioAboveThreshold(r,this.motionDetectionRequiredRatio),o=this.previousChangeRatios.length>=this.maxRatioHistorySize&&this.hasRequiredRatioBelowThreshold(this.previousChangeRatios,this.roomSettledRequiredRatio);i?(this.motionActive||(fh.debug("Motion started"),this.motionActive=!0,Qu.motionDetected()),this.motionStopTimeout&&(clearTimeout(this.motionStopTimeout),this.motionStopTimeout=null)):this.motionActive&&!this.motionStopTimeout&&(this.motionStopTimeout=setTimeout(()=>{fh.debug("Motion stopped"),this.motionActive=!1,this.motionStopTimeout=null,Qu.motionStopped()},this.motionStopDelay)),o&&(fh.info("Room settled, new reference image stored"),this.referenceImageData=e,this.referenceChangeRatios=[])}start(){if(!this.enabled&&!this.error){if(!navigator.mediaDevices)return this.error=!0,void fh.error("No media devices found");this._elementsAppended||(document.body.appendChild(this.videoElement),document.body.appendChild(this.canvasElement),this._elementsAppended=!0),this.enabled=!0,this.width=Yu.camera_motion_detection_capture_width,this.height=Yu.camera_motion_detection_capture_height,this.thresholdRatio=.01*Yu.camera_motion_detection_threshold,this.threshold=this.width*this.height*this.thresholdRatio,this.captureInterval=1e3*Yu.camera_motion_detection_capture_interval,this.motionStartDelay=1e3*Yu.camera_motion_detection_motion_start_delay,this.motionStopDelay=1e3*Yu.camera_motion_detection_motion_stop_delay,this.maxRatioHistorySize=Math.ceil(6e4/this.captureInterval),this.resetMotionState(),this.videoElement.width=this.width,this.videoElement.height=this.height,this.canvasElement.width=this.width,this.canvasElement.height=this.height,Yu.camera_motion_detection_capture_visible?(this.canvasElement.style.position="fixed",this.canvasElement.style.top=0,this.canvasElement.style.left=0,this.canvasElement.style.zIndex=1e4,this.canvasElement.style.border="1px solid black",this.canvasElement.style.display="block"):this.canvasElement.style.display="none",navigator.mediaDevices.getUserMedia({audio:!1,video:{facingMode:{ideal:Yu.camera_motion_detection_facing_mode},width:this.width,height:this.height}}).then(e=>{this.videoElement.srcObject=e;const t=this.videoElement.play();t&&t.catch(e=>{fh.warning("Camera motion detection video play failed: ".concat(e))}),this.enabled&&(this.captureTimer=setInterval(this.capture.bind(this),this.captureInterval))}).catch(e=>{this.enabled=!1,fh.error("Camera motion detection error:",e),this._elementsAppended&&(this.videoElement.remove(),this.canvasElement.remove(),this._elementsAppended=!1)})}}stop(){if(!this.enabled)return;this.enabled=!1,this.resetMotionState(),this.captureTimer&&(clearInterval(this.captureTimer),this.captureTimer=null),this.videoElement.pause();const e=this.videoElement.srcObject;e&&"function"==typeof e.getTracks&&e.getTracks().forEach(e=>{e.stop()}),this.videoElement.srcObject=null,this._elementsAppended&&(this.videoElement.remove(),this.canvasElement.remove(),this._elementsAppended=!1)}}function gh(e){const t=e.slice();for(let e=t.length-1;e>0;e--){const n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}return t}function ph(e){if(!e.shadowRoot)return[null,null];const t=e.shadowRoot.querySelector("ha-web-rtc-player")||e.shadowRoot.querySelector("ha-hls-player");if(!t||!t.shadowRoot)return[t,null];const n=t.shadowRoot.querySelector("video");return[t,n]}function vh(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(!n.length)return e;const i=n.shift();if(uh(e)&&uh(i))for(let o in i){let a=i[o];if(Gu[o]&&(fh.warn("The configuration option '".concat(o,"' has been renamed to '").concat(Gu[o],"'. Please update your wallpanel configuration accordingly.")),o=Gu[o]),"immich_api_keys"!=o||Array.isArray(a)||(a=[a]),uh(a))e[o]||Object.assign(e,{[o]:{}}),vh(e[o],a);else{function s(e,t){if(!(t in nh)){nh[t]="";const n=(ih.hass||ih.__hass).states[t];n?nh[t]=n.state:fh.error("Entity used in placeholder not found: ".concat(t," (").concat(e,")"))}const n=nh[t];return fh.debug("Replace ".concat(e," with ").concat(n)),n}function c(t){return("string"==typeof t||t instanceof String)&&(t=(t=t.replace(/\$\{browser_id\}/g,ah||"browser-id-unset")).replace(/\$\{entity:\s*([^}]+\.[^}]+)\}/g,s)),"boolean"==typeof e[o]&&(t=null!=t&&["true","on","yes","1"].includes(String(t).toLowerCase())),t}a=Array.isArray(a)?a.map(e=>c(e)):c(a),Array.isArray(e[o])&&"string"==typeof a&&(a=a.split(",").map(e=>e.trim())),Object.assign(e,{[o]:a})}}return vh(e,...n)}function yh(){const e=new URLSearchParams(window.location.search),t=Yu;Yu={},vh(Yu,Hu),0===Object.keys(qu).length&&(qu=xh(),0===Object.keys(qu).length&&fh.debug("No wallpanel config found in dashboard config")),vh(Yu,qu);const n={};for(let[t,r]of e)if(t.startsWith("wp_")&&(t=t.substring(3),Gu[t]&&(fh.warn("The configuration option '".concat(t,"' has been renamed to '").concat(Gu[t],"'. Please update your wallpanel configuration accordingly.")),t=Gu[t]),t in Hu&&r)){try{r=JSON.parse(r)}catch(e){}const e=Hu[t];if(Array.isArray(e))Array.isArray(r)?n[t]=r:n[t]="string"==typeof r?r.split(",").map(e=>e.trim()):[r];else if("boolean"==typeof e)n[t]=["true","on","yes","1"].includes(String(r));else if("number"==typeof e){const e=Number(r);Number.isFinite(e)?n[t]=e:fh.warn("Invalid numeric wp_ param '".concat(t,"': ").concat(r))}else n[t]=r}Yu=vh(Yu,n);const r=Yu.profile;if(Yu.profiles&&r&&Yu.profiles[r]&&(Yu=vh(Yu,Yu.profiles[r]),fh.debug("Profile set from config: ".concat(r))),Yu.profiles&&ah&&Yu.profiles["device.".concat(ah)]){const e="device.".concat(ah);Yu=vh(Yu,Yu.profiles[e]),fh.debug("Profile set from device: ".concat(e))}if(Yu.profiles){const e=[sh,ch,lh];for(let t=0;t<e.length;t++){let n=e[t];if(n&&(n=n.toLowerCase().replace(/\s/g,"_"),Yu.profiles["user.".concat(n)])){const e="user.".concat(n);Yu=vh(Yu,Yu.profiles[e]),fh.debug("Profile set from user: ".concat(e));break}}}Yu=vh(Yu,n);const i=Yu.profile_entity;if(Yu.profiles&&i&&(ih.hass||ih.__hass).states[i]&&Yu.profiles[(ih.hass||ih.__hass).states[i].state]){const e=(ih.hass||ih.__hass).states[i].state;Yu=vh(Yu,Yu.profiles[e]),fh.debug("Profile set from entity state: ".concat(e))}Yu.content_interaction&&(Yu.stop_screensaver_on_mouse_move=!1),Yu.image_url?(Yu.image_url=Yu.image_url.replace(/^media-entity:\/\//,"media-entity-image://"),Yu.image_url.startsWith("/")&&(Yu.image_url="media-source://media_source".concat(Yu.image_url)),"media-source"==wh()&&(Yu.image_url=Yu.image_url.replace(/\/+$/,"")),"unsplash-api"==wh()&&Yu.media_list_update_interval<90&&(Yu.media_list_update_interval=90)):Yu.show_images=!1,Yu.enabled||(Yu.debug=!1,Yu.hide_toolbar=!1,Yu.hide_sidebar=!1,Yu.hide_toolbar_action_icons=!1,Yu.fullscreen=!1,Yu.show_images=!1),"err"==Yu.log_level_console?Yu.log_level_console="error":"warn"==Yu.log_level_console&&(Yu.log_level_console="warning"),t&&Object.keys(t).length||(fh.logLevelConsole=Yu.log_level_console,fh.logLevelConsole),"err"==Yu.log_level_system?Yu.log_level_system="error":"warn"==Yu.log_level_system&&(Yu.log_level_system="warning"),fh.logLevelSystem=Yu.log_level_system,fh.systemTargetLogLevel=Yu.system_target_log_level,fh.debug("Wallpanel config is now:",Yu),Qu&&(bh()?Qu.reconfigure(t):Qu.screensaverRunning&&Qu.screensaverRunning()&&Qu.stopScreensaver())}function Ah(){const e=[];return ah&&ih&&ih.shadowRoot?(ih.shadowRoot.querySelectorAll("*").forEach(t=>{t.tagName.toLowerCase().startsWith("browser-mod-popup")&&t.shadowRoot&&t.shadowRoot.querySelector("ha-dialog")&&e.push(t)}),e):e}function _h(){const e=Ah();return e&&0!=e.length?e[0]:null}function bh(){if("1"==new URLSearchParams(window.location.search).get("edit"))return fh.debug("Edit mode active"),!1;if(!Yu.enabled)return fh.debug("Wallpanel not enabled in config"),!1;if(Yu.enabled_on_views&&Yu.enabled_on_views.length>0&&$u&&!Yu.enabled_on_views.includes($u))return fh.debug("Wallpanel not enabled on current tab ".concat($u)),!1;if(Yu.disable_screensaver_when_assist_active){const e=ih.shadowRoot.querySelector("ha-voice-command-dialog");if(e&&e.shadowRoot&&e.shadowRoot.querySelector("ha-dialog"))return fh.debug("Assist is active, wallpanel disabled"),!1}return Qu&&Qu.disable_screensaver_on_browser_mod_popup_function&&_h()&&Qu.disable_screensaver_on_browser_mod_popup_function(_h())?(fh.debug("Browser mod popup function returned true, wallpanel disabled"),!1):!Yu.disable_screensaver_on_browser_mod_popup||!_h()||(fh.debug("Browser mod popup active, wallpanel disabled"),!1)}function wh(){return Yu.show_images&&Yu.image_url?Yu.image_url.startsWith("media-entity-video://")?"media-entity-video":Yu.image_url.startsWith("media-entity-image://")?"media-entity-image":Yu.image_url.startsWith("media-source://")?"media-source":Yu.image_url.startsWith("https://api.unsplash")?"unsplash-api":Yu.image_url.startsWith("immich+")?"immich-api":Yu.image_url.startsWith("iframe+")?"iframe":Yu.image_url.startsWith("embed+")?"embed":"url":""}function Eh(){try{return oh.shadowRoot.querySelector("ha-panel-lovelace")}catch(e){fh.error("Failed to get ha-panel-lovelace:",e)}}function xh(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const t=Eh(),n={};if(t&&t.lovelace){let r;t.lovelace.config&&t.lovelace.config.wallpanel?r=t.lovelace.config.wallpanel:t.lovelace.rawConfig&&t.lovelace.rawConfig.wallpanel&&(r=t.lovelace.rawConfig.wallpanel),r&&(0===e.length&&(e=Object.keys(r)),e.forEach(e=>{(e in Hu||e in Gu)&&(n[e]=r[e])}))}return n}function Sh(e){fh.debug("setSidebarVisibility: hidden=".concat(e));try{const t=oh.shadowRoot.querySelector("ha-panel-lovelace");if(t){const n=t.shadowRoot.querySelector("hui-root");if(n){const t=n.shadowRoot.querySelector("ha-menu-button");t&&(e?t.style.display="none":t.style.removeProperty("display"))}}}catch(e){fh.warn(e)}try{const t=oh.shadowRoot.querySelector("ha-drawer");if(t){const n=t.shadowRoot.querySelector(".sidebar-shell")||t.shadowRoot.querySelector("aside"),r=n&&n.classList.contains("sidebar-shell")?"--ha-sidebar-width":"--mdc-drawer-width";n&&(e?(n.style.opacity=0,n.style.maxWidth="0px",oh.style.setProperty(r,"env(safe-area-inset-left)")):(n.style.opacity=1,n.style.maxWidth="",oh.style.removeProperty(r)),window.dispatchEvent(new Event("resize")))}}catch(e){fh.warn(e)}}function Ch(e,t){fh.debug("setToolbarVisibility: hideToolbar=".concat(e,", hideActionItems=").concat(t));try{const n=oh.shadowRoot.querySelector("ha-panel-lovelace");if(!n)return;let r=n.shadowRoot.querySelector("hui-root");if(!r)return;r=r.shadowRoot;const i=r.querySelector("#view");let o=r.querySelector("app-toolbar");if(o||(o=r.querySelector("div.toolbar")),e)o.style.setProperty("display","none"),Yu.keep_toolbar_space||(i.style.minHeight="100vh",i.style.marginTop="0",i.style.paddingTop="0");else{o.style.removeProperty("display"),i.style.removeProperty("min-height"),i.style.removeProperty("margin-top"),i.style.removeProperty("padding-top");const e=o.querySelector("div.action-items");t?e.style.setProperty("display","none"):e.style.setProperty("display","flex")}window.dispatchEvent(new Event("resize"))}catch(e){fh.warn(e)}}function Ih(){return void 0!==document.fullscreenElement?Boolean(document.fullscreenElement):void 0!==document.webkitCurrentFullScreenElement&&Boolean(document.webkitCurrentFullScreenElement)}function Th(){fh.debug("Enter fullscreen");const e=document.documentElement;e.requestFullscreen?e.requestFullscreen().then(()=>{fh.debug("Successfully requested fullscreen")},e=>{fh.debug("Failed to enter fullscreen:",e)}):e.mozRequestFullScreen?e.mozRequestFullScreen():e.msRequestFullscreen?e.msRequestFullscreen():e.webkitRequestFullscreen&&e.webkitRequestFullscreen()}function Rh(){const e=customElements.get("hui-view-container"),t=customElements.get("hui-view");if(!e||!t){throw new Error("Failed to get hui-view-container / hui-view from customElements")}class r extends e{}class i extends t{constructor(){super(),this.mediaList=[],this.mediaIndex=-1,this.mediaListDirection="forwards",this.lastMediaListUpdate,this.updatingMediaList=!1,this.updatingMedia=!1,this.lastMediaUpdate=0,this.isPaused=!1,this.mediaTimeElapsedBeforePause=0,this.lastImageUrlEntityValue=null,this.blockEventsUntil=0,this.screensaverStartedAt,this.screensaverStoppedAt=new Date,this.infoBoxContentCreatedDate,this.idleSince=Date.now(),this.lastProfileSet=Yu.profile,this.lastMove=null,this.lastCorner=0,this.translateTimeout=null,this.lastClickTime=0,this.clickCount=0,this.touchStartX=-1,this.currentWidth=0,this.currentHeight=0,this.energyCollectionUpdateEnabled=!1,this.energyCollectionUpdateInterval=60,this.lastEnergyCollectionUpdate=0,this.screensaverStopNavigationPathTimeout=null,this.disable_screensaver_on_browser_mod_popup_function=null,this.moreInfoDialogOpenedAt=0,this.timerInterval=null,this.windowEventHandlers=[],this.infoBoxResizeObserver=null,this.screenWakeLock=new dh,this.cameraMotionDetection=new mh,this.lovelace=null,this.__hass=ih.hass||ih.__hass,this.__cards=[],this.__badges=[],this.__views=[],ih.provideHass(this),this.timerInterval=setInterval(this.timer.bind(this),1e3),Ju.hass=this.__hass}set hass(e){fh.debug("Update hass"),this.__hass=e;let t=!1;for(const e in nh){const n=this.__hass.states[e];n&&n.state!=nh[e]&&(nh[e]=n.state,t=!0)}if(!this.updateProfile()&&t&&yh(),!bh())return;const n=Yu.screensaver_entity;if(n&&this.__hass.states[n]){const e=new Date(this.__hass.states[n].last_changed),t=this.__hass.states[n].state;"off"==t&&this.screensaverStartedAt&&e.getTime()-this.screensaverStartedAt>0?this.stopScreensaver(Yu.fade_out_time_screensaver_entity):"on"==t&&this.screensaverStoppedAt&&e.getTime()-this.screensaverStoppedAt>0&&this.startScreensaver()}this.screensaverRunning()&&(this.__cards.forEach(e=>{e.hass=this.hass}),this.__badges.forEach(e=>{e.hass=this.hass}),this.__views.forEach(e=>{e.hass=this.hass}),"media-entity-image"==wh()&&this.switchActiveMedia("entity_update"))}get hass(){return this.__hass}setScreensaverEntityState(){const e=Yu.screensaver_entity;if(!e||!this.__hass.states[e])return;if(this.screensaverRunning()&&"on"==this.__hass.states[e].state)return;if(!this.screensaverRunning()&&"off"==this.__hass.states[e].state)return;const t=this.screensaverRunning()?"turn_on":"turn_off";fh.debug("Updating screensaver_entity",e,t),this.__hass.callService("input_boolean",t,{entity_id:e}).then(e=>{fh.debug(e)},e=>{fh.error("Failed to set screensaver entity state:",e)})}setImageURLEntityState(){const e=Yu.image_url_entity;if(!e||!this.__hass.states[e])return;const t=this.getActiveMediaElement();if(!t||!t.mediaUrl)return;const n=t.mediaUrl.substring(0,255);this.lastImageUrlEntityValue!==n&&(fh.debug("Updating image_url_entity",e,n),this.__hass.callService("input_text","set_value",{entity_id:e,value:n}).then(e=>{fh.debug(e),this.lastImageUrlEntityValue=n},e=>{fh.error("Failed to set image url entity state:",e)}))}updateProfile(){const e=Yu.profile_entity;if(e&&this.__hass.states[e]){const t=this.__hass.states[e].state;if(t&&t!=this.lastProfileSet||!t&&this.lastProfileSet)return fh.debug("Set profile to ".concat(t)),this.lastProfileSet=t,yh(),!0}return!1}timer(){Yu.enabled&&Xu&&(this.screensaverRunning()?Yu.disable_screensaver_on_browser_mod_popup&&_h()?this.stopScreensaver(Yu.fade_out_time_browser_mod_popup):this.updateScreensaver():bh()&&Yu.idle_time>0&&Date.now()-this.idleSince>=1e3*Yu.idle_time&&(Yu.camera_motion_detection_stop_screensaver&&this.cameraMotionDetection&&this.cameraMotionDetection.motionActive||this.startScreensaver()))}setDefaultStyle(){this.messageContainer.removeAttribute("style"),this.messageContainer.style.position="fixed",this.messageContainer.style.top="1rem",this.messageContainer.style.left="1rem",this.messageContainer.style.bottom="1rem",this.messageContainer.style.right="1rem",this.messageContainer.style.alignItems="flex-end",this.messageContainer.style.display="flex",this.messageContainer.style.flexDirection="column",this.messageContainer.style.gap="0.5rem",this.messageContainer.style.zIndex=this.style.zIndex+1,this.messageContainer.style.pointerEvents="none",this.messageContainer.style.visibility="hidden",this.debugBox.removeAttribute("style"),this.debugBox.style.position="fixed",this.debugBox.style.pointerEvents="none",this.debugBox.style.top="0%",this.debugBox.style.left="0%",this.debugBox.style.width="100%",this.debugBox.style.height="100%",this.debugBox.style.background="#00000099",this.debugBox.style.color="#ffffff",this.debugBox.style.zIndex=this.style.zIndex+2,this.debugBox.style.fontFamily="monospace",this.debugBox.style.fontSize="12px",this.debugBox.style.overflowWrap="break-word",this.debugBox.style.overflowY="auto",this.debugBox.style.visibility="hidden",this.screensaverContainer.removeAttribute("style"),this.screensaverContainer.style.position="fixed",this.screensaverContainer.style.pointerEvents="auto",this.screensaverContainer.style.top=0,this.screensaverContainer.style.right=0,this.screensaverContainer.style.bottom=0,this.screensaverContainer.style.left=0,this.screensaverContainer.style.background="#000000",this.screensaverContainer.style.overflow="hidden",this.imageOneContainer.removeAttribute("style"),this.imageOneContainer.style.opacity=0,this.imageOneContainer.style.position="absolute",this.imageOneContainer.style.pointerEvents="none",this.imageOneContainer.style.top=0,this.imageOneContainer.style.left=0,this.imageOneContainer.style.width="100%",this.imageOneContainer.style.height="100%",this.imageOneContainer.style.border="none",this.imageOneBackground.style.position="absolute",this.imageOneBackground.style.pointerEvents="none",this.imageOneBackground.style.top=0,this.imageOneBackground.style.left=0,this.imageOneBackground.style.width="100%",this.imageOneBackground.style.height="100%",this.imageOneBackground.style.border="none",this.imageOne.removeAttribute("style"),this.imageOne.style.position="relative",this.imageOne.style.pointerEvents="none",this.imageOne.style.width="100%",this.imageOne.style.height="100%",this.imageOne.style.border="none",this.imageOneInfoContainer.removeAttribute("style"),this.imageOneInfoContainer.style.position="absolute",this.imageOneInfoContainer.style.pointerEvents="none",this.imageOneInfoContainer.style.top=0,this.imageOneInfoContainer.style.left=0,this.imageOneInfoContainer.style.width="100%",this.imageOneInfoContainer.style.height="100%",this.imageOneInfoContainer.style.border="none",this.imageOneInfo.style.overflowY="auto",this.imageTwoContainer.removeAttribute("style"),this.imageTwoContainer.style.opacity=0,this.imageTwoContainer.style.position="absolute",this.imageTwoContainer.style.pointerEvents="none",this.imageTwoContainer.style.top=0,this.imageTwoContainer.style.left=0,this.imageTwoContainer.style.width="100%",this.imageTwoContainer.style.height="100%",this.imageTwoContainer.style.border="none",this.imageTwoBackground.style.position="absolute",this.imageTwoBackground.style.pointerEvents="none",this.imageTwoBackground.style.top=0,this.imageTwoBackground.style.left=0,this.imageTwoBackground.style.width="100%",this.imageTwoBackground.style.height="100%",this.imageTwoBackground.style.border="none",this.imageTwo.removeAttribute("style"),this.imageTwo.style.position="relative",this.imageTwo.style.pointerEvents="none",this.imageTwo.style.width="100%",this.imageTwo.style.height="100%",this.imageTwo.style.border="none",this.imageTwoInfoContainer.removeAttribute("style"),this.imageTwoInfoContainer.style.position="absolute",this.imageTwoInfoContainer.style.pointerEvents="none",this.imageTwoInfoContainer.style.top=0,this.imageTwoInfoContainer.style.left=0,this.imageTwoInfoContainer.style.width="100%",this.imageTwoInfoContainer.style.height="100%",this.imageTwoInfoContainer.style.border="none",this.imageTwoInfo.style.overflowY="auto",this.screensaverImageOverlay.removeAttribute("style"),this.screensaverImageOverlay.style.position="absolute",this.screensaverImageOverlay.style.top=0,this.screensaverImageOverlay.style.left=0,this.screensaverImageOverlay.style.width="100%",this.screensaverImageOverlay.style.height="100%",this.screensaverImageOverlay.style.background="#00000000",this.infoContainer.removeAttribute("style"),this.infoContainer.style.position="absolute",this.infoContainer.style.pointerEvents="none",this.infoContainer.style.top=0,this.infoContainer.style.left=0,this.infoContainer.style.width="100%",this.infoContainer.style.height="100%",this.infoContainer.style.transition="opacity 2000ms ease-in-out",this.infoContainer.style.padding="25px",this.infoContainer.style.boxSizing="border-box",this.infoBox.removeAttribute("style"),this.infoBox.style.pointerEvents="none",this.infoBox.style.width="fit-content",this.infoBox.style.maxHeight="100%",this.infoBox.style.borderRadius="10px",this.infoBox.style.overflowY="auto",this.infoBox.style.scrollbarWidth="none",this.infoBox.style.setProperty("--wp-card-width","500px"),this.infoBox.style.setProperty("--wp-card-padding","0"),this.infoBox.style.setProperty("--wp-card-margin","5px"),this.infoBox.style.setProperty("--wp-card-backdrop-filter","none"),this.infoBox.style.setProperty("--wp-badges-minwidth","200px"),this.infoBoxPosX.style.pointerEvents="none",this.infoBoxPosX.style.height="100%",this.infoBoxPosX.style.width="100%",this.infoBoxPosY.style.pointerEvents="none",this.infoBoxPosY.style.height="100%",this.infoBoxPosY.style.width="100%",this.infoBoxContent.style.pointerEvents="none",this.infoBoxContent.style.width="fit-content",this.infoBoxContent.style.height="100%",this.infoBoxContent.style.display="grid",this.fixedInfoContainer.removeAttribute("style"),this.fixedInfoContainer.style.position="fixed",this.fixedInfoContainer.style.pointerEvents="none",this.fixedInfoContainer.style.top=0,this.fixedInfoContainer.style.left=0,this.fixedInfoContainer.style.width="100%",this.fixedInfoContainer.style.height="100%",this.fixedInfoBox.style.pointerEvents="none",this.fixedInfoBox.style.cssText=this.infoBox.style.cssText,this.screensaverOverlay.removeAttribute("style"),this.screensaverOverlay.style.position="absolute",this.screensaverOverlay.style.pointerEvents="none",this.screensaverOverlay.style.top=0,this.screensaverOverlay.style.left=0,this.screensaverOverlay.style.width="100%",this.screensaverOverlay.style.height="100%",this.screensaverOverlay.style.background="#00000000"}updateStyle(){this.screensaverOverlay.style.background="#00000000",this.debugBox.style.visibility=Yu.debug?"visible":"hidden",this.debugBox.style.pointerEvents=Yu.debug?"auto":"none",this.style.transition=Yu.fade_in_time>0?"opacity ".concat(Math.round(1e3*Yu.fade_in_time),"ms ease-in-out"):"",this.imageOneContainer.style.transition=Yu.crossfade_time>0?"opacity ".concat(Math.round(1e3*Yu.crossfade_time),"ms ease-in-out"):"",this.imageTwoContainer.style.transition=Yu.crossfade_time>0?"opacity ".concat(Math.round(1e3*Yu.crossfade_time),"ms ease-in-out"):"",this.messageContainer.style.visibility=this.screensaverRunning()?"visible":"hidden",this.screensaverImageOverlay.style.pointerEvents=Yu.content_interaction?"none":"auto";const e=Yu.show_image_info&&Boolean(Yu.image_info_template);if(this.imageOneInfoContainer.style.display=e?"block":"none",this.imageTwoInfoContainer.style.display=e?"block":"none",Yu.info_animation_duration_x?this.infoBoxPosX.style.animation="moveX ".concat(Yu.info_animation_duration_x,"s ").concat(Yu.info_animation_timing_function_x," infinite alternate"):this.infoBoxPosX.style.animation="",Yu.info_animation_duration_y?this.infoBoxPosY.style.animation="moveY ".concat(Yu.info_animation_duration_y,"s ").concat(Yu.info_animation_timing_function_y," infinite alternate"):this.infoBoxPosY.style.animation="",Yu.style)for(const e in Yu.style)if(e.startsWith("wallpanel-")&&"wallpanel-shadow-host"!=e&&"wallpanel-screensaver-info-box-badges"!=e&&"wallpanel-screensaver-info-box-views"!=e&&!Ku[e]){const t=this.shadowRoot.getElementById(e);if(t){fh.debug("Setting style attributes for element #".concat(e));for(const n in Yu.style[e])fh.debug("Setting style attribute ".concat(n," to ").concat(Yu.style[e][n])),t.style.setProperty(n,Yu.style[e][n]);t==this.infoBox?this.fixedInfoBox.style.cssText=this.infoBox.style.cssText:t==this.infoBoxContent&&(this.fixedInfoBoxContent.style.cssText=this.infoBoxContent.style.cssText)}else fh.error("Element #".concat(e," not found"))}}updateShadowStyle(){const e=getComputedStyle(this.infoContainer),t=this.infoContainer.offsetWidth-parseInt(e.paddingLeft)-parseInt(e.paddingRight)-this.infoBox.offsetWidth,n=this.infoContainer.offsetHeight-parseInt(e.paddingTop)-parseInt(e.paddingBottom)-this.infoBox.offsetHeight;let r="";if(Yu.style){if(Yu.style["wallpanel-shadow-host"])for(const e in Yu.style["wallpanel-shadow-host"])r+="".concat(e,": ").concat(Yu.style["wallpanel-shadow-host"][e],";\n");for(const e in Ku)Yu.style[e]&&vh(Ku[e],Yu.style[e])}let i="";for(const e in Ku){i+=".".concat(e," {\n");for(const t in Ku[e])i+="".concat(t,": ").concat(Ku[e][t],";\n");i+="}\n"}this.shadowStyle.innerHTML="\n\t\t\t\t:host {\n\t\t\t\t\t".concat(r,"\n\t\t\t\t}\n\t\t\t\t@keyframes moveX {\n\t\t\t\t\t100% {\n\t\t\t\t\t\ttransform: translate3d(").concat(t,"px, 0, 0);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t@keyframes moveY {\n\t\t\t\t\t100% {\n\t\t\t\t\t\ttransform: translate3d(0, ").concat(n,"px, 0);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t@keyframes horizontalProgress {\n\t\t\t\t\t0% {\n\t\t\t\t\t\twidth: 0%;\n\t\t\t\t\t}\n\t\t\t\t\t100% {\n\t\t\t\t\t\twidth: 100%;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t@keyframes kenBurnsEffect-experimental {\n\t\t\t\t\t0% {\n\t\t\t\t\t\ttransform: scale(1.0) translateX(calc(var(--hidden-width) / -2 * 1px)) translateY(calc(var(--hidden-height) / -2 * 1px));\n\t\t\t\t\t}\n\t\t\t\t\t50% {\n\t\t\t\t\t\ttransform: scale(var(--ken-burns-zoom));\n\t\t\t\t\t}\n\t\t\t\t\t90% {\n\t\t\t\t\t\ttransform: scale(calc(1.0 + ((var(--ken-burns-zoom) - 1.0)/2))) translateX(calc(var(--hidden-width) / 2 * 1px)) translateY(calc(var(--hidden-height) / 2 * 1px));\n\t\t\t\t\t}\n\t\t\t\t\t100% {\n\t\t\t\t\t\ttransform: scale(1.0);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t@keyframes kenBurnsEffect-experimental2 {\n\t\t\t\t\t0% {\n\t\t\t\t\t\ttransform: scale(1.0);\n\t\t\t\t\t}\n\t\t\t\t\t25% {\n\t\t\t\t\t\ttransform: scale(calc(1.0 + ((var(--ken-burns-zoom) - 1.0)/2))) translateX(calc(var(--hidden-width) / 2 * 1px)) translateY(calc(var(--hidden-height) / 2 * 1px));\n\t\t\t\t\t}\n\t\t\t\t\t50% {\n\t\t\t\t\t\ttransform: scale(var(--ken-burns-zoom));\n\t\t\t\t\t}\n\t\t\t\t\t75% {\n\t\t\t\t\t\ttransform: scale(calc(1.0 + ((var(--ken-burns-zoom) - 1.0)/2))) translateX(calc(var(--hidden-width) / -2 * 1px)) translateY(calc(var(--hidden-height) / -2 * 1px));\n\t\t\t\t\t}\n\t\t\t\t\t100% {\n\t\t\t\t\t\ttransform: scale(1.0);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t@keyframes kenBurnsEffect-simple {\n\t\t\t\t\t0% {\n\t\t\t\t\t\ttransform-origin: bottom left;\n\t\t\t\t\t\ttransform: scale(1.0);\n\t\t\t\t\t}\n\t\t\t\t\t100% {\n\t\t\t\t\t\ttransform: scale(var(--ken-burns-zoom));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t").concat(i,"\n\t\t\t\t").concat(Yu.custom_css,"\n\t\t\t")}randomMove(){const e=getComputedStyle(this.infoContainer),t=this.infoContainer.offsetWidth-parseInt(e.paddingLeft)-parseInt(e.paddingRight)-this.infoBox.offsetWidth,n=this.infoContainer.offsetHeight-parseInt(e.paddingTop)-parseInt(e.paddingBottom)-this.infoBox.offsetHeight,r=Math.floor(Math.random()*t),i=Math.floor(Math.random()*n);this.moveInfoBox(r,i)}moveAroundCorners(){let e=null;arguments.length>0&&void 0!==arguments[0]&&arguments[0]?e=0:this.lastCorner=(this.lastCorner+1)%4;const t=getComputedStyle(this.infoContainer),n=[2,3].includes(this.lastCorner)?this.infoContainer.offsetWidth-parseInt(t.paddingLeft)-parseInt(t.paddingRight)-this.infoBox.offsetWidth:0,r=[1,2].includes(this.lastCorner)?this.infoContainer.offsetHeight-parseInt(t.paddingTop)-parseInt(t.paddingBottom)-this.infoBox.offsetHeight:0;this.moveInfoBox(n,r,e)}moveInfoBox(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(this.lastMove=Date.now(),null===n&&(n=Yu.info_move_fade_duration),n>0)if(this.infoBox.animate){const e=[{opacity:1},{opacity:0,offset:.5},{opacity:1}];this.infoBox.animate(e,{duration:Math.round(1e3*n),iterations:1})}else fh.warn("This browser does not support the animate() method, please set info_move_fade_duration to 0");const r=this;let i=Math.round(500*n);i<0&&(i=0),r.translateTimeout&&clearTimeout(r.translateTimeout),r.translateTimeout=setTimeout(function(){r.infoBoxPosX.style.transform="translate3d(".concat(e,"px, 0, 0)"),r.infoBoxPosY.style.transform="translate3d(0, ".concat(t,"px, 0)")},i)}createInfoBoxContent(){fh.debug("Creating info box content");const e=Eh();if(e){if(this.lovelace=e.lovelace||e.__lovelace,this.infoBoxContentCreatedDate=new Date,this.infoBoxContent.innerHTML="",this.__badges=[],this.__cards=[],this.__views=[],this.energyCollectionUpdateEnabled=!1,this.shadowRoot.querySelectorAll(".wp-card").forEach(e=>{e.parentElement.removeChild(e)}),Yu.badges&&Yu.badges.length>0){const e=document.createElement("div");if(e.id="wallpanel-screensaver-info-box-badges",e.classList.add("wp-badges"),e.style.padding="var(--wp-card-padding)",e.style.margin="var(--wp-card-margin)",e.style.textAlign="center",e.style.display="flex",e.style.alignItems="flex-start",e.style.flexWrap="wrap",e.style.justifyContent="center",e.style.gap="8px",e.style.margin="0px",e.style.minWidth="var(--wp-badges-minwidth)",Yu.style[e.id])for(const t in Yu.style[e.id])fh.debug("Setting style attribute ".concat(t," to ").concat(Yu.style[e.id][t])),e.style.setProperty(t,Yu.style[e.id][t]);Yu.badges.forEach(t=>{const n=JSON.parse(JSON.stringify(t));fh.debug("Creating badge:",n);let r={};n.wp_style&&(r=n.wp_style,delete n.wp_style);const i=(this._createBadgeElement?this._createBadgeElement:this.createBadgeElement).bind(this)(n);i.hass=this.hass;for(const e in r)i.style.setProperty(e,r[e]);this.__badges.push(i),e.append(i)}),this.infoBoxContent.appendChild(e)}if(Yu.views&&Yu.views.length>0){const e=document.createElement("div");if(e.id="wallpanel-screensaver-info-box-views",e.classList.add("wp-views"),Yu.style[e.id])for(const t in Yu.style[e.id])fh.debug("Setting style attribute ".concat(t," to ").concat(Yu.style[e.id][t])),e.style.setProperty(t,Yu.style[e.id][t]);const t=this.lovelace.config.views;Yu.views.forEach(n=>{let r=-1;const i=JSON.parse(JSON.stringify(n));for(var o=0;o<t.length;o++)if(t[o].path&&n.path&&t[o].path.toLowerCase()==n.path.toLowerCase()||t[o].title&&n.title&&t[o].title.toLowerCase()==n.title.toLowerCase()){r=o,i.title=t[o].title,i.path=t[o].path;break}-1==r&&(fh.error("View with path '".concat(i.path,"' / tile '").concat(i.title,"' not found")),r=0);const a=document.createElement("hui-view");a.route={prefix:"/"+Xu,path:"/"+n.path},a.lovelace=this.lovelace,a.panel=this.hass.panels[Xu],a.hass=this.hass,a.index=r,"boolean"==typeof i.narrow&&(a.narrow=i.narrow),this.__views.push(a);const s=document.createElement("div");if(Yu.content_interaction?a.style.pointerEvents="auto":a.style.pointerEvents="none",i.wp_style)for(const e in i.wp_style)s.style.setProperty(e,i.wp_style[e]);s.append(a),e.append(s)}),this.infoBoxContent.appendChild(e)}Yu.cards&&Yu.cards.length>0&&Yu.cards.forEach(e=>{const t=JSON.parse(JSON.stringify(e));fh.debug("Creating card:",t);let n={};t.wp_style&&(n=t.wp_style,delete t.wp_style),t.type&&t.type.includes("energy")&&(t.collection_key="energy_wallpanel",this.energyCollectionUpdateEnabled=!0);const r=(this._createCardElement?this._createCardElement:this.createCardElement).bind(this)(t);r.hass=this.hass,this.__cards.push(r);let i=this.infoBoxContent;const o=document.createElement("div");o.classList.add("wp-card"),o.style.width="var(--wp-card-width)",o.style.padding="var(--wp-card-padding)",o.style.margin="var(--wp-card-margin)",o.style.backdropFilter="var(--wp-card-backdrop-filter)",Yu.content_interaction?o.style.pointerEvents="auto":o.style.pointerEvents="none";for(const e in n)if("parent"==e){const t=this.shadowRoot.getElementById(n[e]);t&&(i=t)}else o.style.setProperty(e,n[e]);o.append(r),i.appendChild(o)}),setTimeout(this.updateShadowStyle.bind(this),500)}}restartProgressBarAnimation(){if(!this.progressBarContainer)return;if(this.progressBar.style.animation="none",!Yu.show_progress_bar)return;const e=this;setTimeout(function(){e.progressBar.style.animation="horizontalProgress ".concat(Yu.display_time,"s linear"),e.progressBar.style.animationPlayState=e.isPaused?"paused":"running"},25)}restartKenBurnsEffect(){if(!Yu.image_animation_ken_burns||!Yu.image_animation_ken_burns_animations.length)return;const e=this.getActiveMediaElement();e.style.animation="none",e.style.setProperty("--ken-burns-zoom",Yu.image_animation_ken_burns_zoom);let t=Math.floor(1e3*Yu.image_animation_ken_burns_delay);t<50&&(t=50);const n=Math.ceil(Yu.image_animation_ken_burns_duration||1.2*(Yu.display_time+2*Yu.crossfade_time)),r=Yu.image_animation_ken_burns_animations[Math.floor(Math.random()*Yu.image_animation_ken_burns_animations.length)];this.kenburnsDelayStartTimer&&clearTimeout(this.kenburnsDelayStartTimer),e.animationIterationCount=1,this.kenburnsDelayStartTimer=setTimeout(function(){e.style.animation="kenBurnsEffect-".concat(r," ").concat(n,"s linear forwards")},t)}getMediaElement(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.imageOneContainer.style.opacity==(e?1:0)?this.imageOne:this.imageTwo;if(t&&"ha-camera-stream"==n.tagName.toLowerCase()){const e=ph(n)[1];e&&(n=e)}return n}getActiveMediaElement(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.getMediaElement(!0,e)}getInactiveMediaElement(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.getMediaElement(!1,e)}replaceMediaElement(e,t){if("string"==typeof e.src&&e.src.startsWith("blob:")&&URL.revokeObjectURL(e.src),"function"==typeof e.pause&&e.pause(),"ha-camera-stream"==e.tagName.toLowerCase()){const[t,n]=ph(e);n&&n.pause(),t&&"function"==typeof t.stop&&t.stop()}t=t.toLowerCase();const n=document.createElement(t);return[...e.attributes].filter(e=>"src"!=e.name).forEach(e=>n.setAttribute(e.name,e.value)),n.mediaUrl=e.mediaUrl,n.infoCacheUrl=e.infoCacheUrl,"video"===t&&Object.assign(n,{preload:"auto",muted:!1,volume:Yu.video_volume}),e.replaceWith(n),e===this.imageOne?this.imageOne=n:this.imageTwo=n,e.remove(),n}loadBackgroundImage(e){let t=e.src;const n=e.tagName.toLowerCase();if("ha-camera-stream"===n){const n=ph(e)[1];if(!n||!n.poster)return;t=n.poster}else if("video"===n){const n=document.createElement("canvas");n.width=e.videoWidth,n.height=e.videoHeight;n.getContext("2d").drawImage(e,0,0,n.width,n.height);try{t=n.toDataURL("image/png")}catch(e){t=null,fh.error("Error extracting canvas image:",e)}}let r=this.imageOneBackground;e==this.imageTwo&&(r=this.imageTwoBackground),r.style.backgroundImage=t?"url('".concat(t.replace(/'/g,"%27"),"')"):""}connectedCallback(){this.style.zIndex=Yu.z_index,this.style.visibility="hidden",this.style.opacity=0,this.style.position="fixed",this.timerInterval||(this.timerInterval=setInterval(this.timer.bind(this),1e3)),this.messageContainer=document.createElement("div"),this.messageContainer.id="wallpanel-message-container",this.debugBox=document.createElement("div"),this.debugBox.id="wallpanel-debug-box",this.screensaverContainer=document.createElement("div"),this.screensaverContainer.id="wallpanel-screensaver-container",this.imageOneContainer=document.createElement("div"),this.imageOneContainer.id="wallpanel-screensaver-image-one-container",this.imageOneBackground=document.createElement("div"),this.imageOneBackground.className="wallpanel-screensaver-image-background",this.imageOneBackground.id="wallpanel-screensaver-image-one-background",this.imageOne=document.createElement("img"),this.imageOne.id="wallpanel-screensaver-image-one",this.imageOneInfoContainer=document.createElement("div"),this.imageOneInfoContainer.className="wallpanel-screensaver-image-info-container",this.imageOneInfoContainer.id="wallpanel-screensaver-image-one-info-container",this.imageOneInfo=document.createElement("div"),this.imageOneInfo.className="wallpanel-screensaver-image-info",this.imageOneInfo.id="wallpanel-screensaver-image-one-info",this.imageOneInfoContainer.appendChild(this.imageOneInfo),this.imageOneContainer.appendChild(this.imageOneBackground),this.imageOneContainer.appendChild(this.imageOne),this.imageOneContainer.appendChild(this.imageOneInfoContainer),this.screensaverContainer.appendChild(this.imageOneContainer),this.imageTwoContainer=document.createElement("div"),this.imageTwoContainer.id="wallpanel-screensaver-image-two-container",this.imageTwoBackground=document.createElement("div"),this.imageTwoBackground.className="wallpanel-screensaver-image-background",this.imageTwoBackground.id="wallpanel-screensaver-image-two-background",this.imageTwo=document.createElement("img"),this.imageTwo.id="wallpanel-screensaver-image-two",this.imageTwoInfoContainer=document.createElement("div"),this.imageTwoInfoContainer.className="wallpanel-screensaver-image-info-container",this.imageTwoInfoContainer.id="wallpanel-screensaver-image-two-info-container",this.imageTwoInfo=document.createElement("div"),this.imageTwoInfo.className="wallpanel-screensaver-image-info",this.imageTwoInfo.id="wallpanel-screensaver-image-two-info",this.imageTwoInfoContainer.appendChild(this.imageTwoInfo),this.imageTwoContainer.appendChild(this.imageTwoBackground),this.imageTwoContainer.appendChild(this.imageTwo),this.imageTwoContainer.appendChild(this.imageTwoInfoContainer),this.screensaverContainer.appendChild(this.imageTwoContainer),this.screensaverImageOverlay=document.createElement("div"),this.screensaverImageOverlay.id="wallpanel-screensaver-image-overlay",this.screensaverContainer.appendChild(this.screensaverImageOverlay),this.progressBarContainer=document.createElement("div"),this.progressBarContainer.className="wallpanel-progress",this.progressBar=document.createElement("div"),this.progressBar.className="wallpanel-progress-inner",this.progressBar.id="wallpanel-progress-inner",this.progressBarContainer.appendChild(this.progressBar),Yu.show_progress_bar&&this.screensaverContainer.appendChild(this.progressBarContainer),this.pauseIndicator=document.createElement("div"),this.pauseIndicator.id="wp-pause-indicator",this.pauseIndicator.innerHTML="⏸️",this.pauseIndicator.style.position="absolute",this.pauseIndicator.style.top="1rem",this.pauseIndicator.style.left="1rem",this.pauseIndicator.style.fontSize="4rem",this.pauseIndicator.style.lineHeight="1",this.pauseIndicator.style.color="white",this.pauseIndicator.style.filter="drop-shadow(0 0 8px rgba(0,0,0,0.8))",this.pauseIndicator.style.zIndex="9999",this.pauseIndicator.style.pointerEvents="none",this.pauseIndicator.style.display="none",this.screensaverContainer.appendChild(this.pauseIndicator),this.infoContainer=document.createElement("div"),this.infoContainer.id="wallpanel-screensaver-info-container",this.fixedInfoContainer=document.createElement("div"),this.fixedInfoContainer.id="wallpanel-screensaver-fixed-info-container",this.fixedInfoBox=document.createElement("div"),this.fixedInfoBox.id="wallpanel-screensaver-fixed-info-box",this.fixedInfoBoxContent=document.createElement("div"),this.fixedInfoBoxContent.id="wallpanel-screensaver-fixed-info-box-content",this.screensaverContainer.appendChild(this.infoContainer),this.infoBoxPosX=document.createElement("div"),this.infoBoxPosX.id="wallpanel-screensaver-info-box-pos-x",this.infoBoxPosX.x="0",this.infoBoxPosY=document.createElement("div"),this.infoBoxPosY.id="wallpanel-screensaver-info-box-pos-y",this.infoBoxPosY.y="0",this.infoBox=document.createElement("div"),this.infoBox.id="wallpanel-screensaver-info-box",this.infoBoxContent=document.createElement("div"),this.infoBoxContent.id="wallpanel-screensaver-info-box-content",this.infoBoxContent.style.display="grid",this.infoBox.appendChild(this.infoBoxContent),this.infoBoxPosX.appendChild(this.infoBox),this.infoBoxPosY.appendChild(this.infoBoxPosX),this.infoContainer.appendChild(this.infoBoxPosY),this.fixedInfoBox.appendChild(this.fixedInfoBoxContent),this.fixedInfoContainer.appendChild(this.fixedInfoBox),this.infoContainer.appendChild(this.fixedInfoContainer),this.screensaverOverlay=document.createElement("div"),this.screensaverOverlay.id="wallpanel-screensaver-overlay",this.screensaverContainer.appendChild(this.screensaverOverlay),this.shadowStyle=document.createElement("style");const e=this.attachShadow({mode:"open"});e.appendChild(this.shadowStyle),e.appendChild(this.screensaverContainer),e.appendChild(this.messageContainer),e.appendChild(this.debugBox);const t=this,n=["click","touchstart","touchend","wheel"];Yu.stop_screensaver_on_key_down&&n.push("keydown"),Yu.stop_screensaver_on_mouse_move&&n.push("mousemove");const r=e=>{try{t.handleInteractionEvent(e)}catch(e){fh.error(e.stack)}};n.forEach(function(e){window.addEventListener(e,r,!0),t.windowEventHandlers.push({eventName:e,handler:r,options:!0})});const i=e=>{Yu.disable_context_menu&&t.screensaverRunning()&&e.preventDefault()};window.addEventListener("contextmenu",i),this.windowEventHandlers.push({eventName:"contextmenu",handler:i});const o=()=>{try{const e=this.screensaverContainer.clientWidth,n=this.screensaverContainer.clientHeight;!t.screensaverRunning()||t.currentWidth==e&&t.currentHeight==n||(fh.debug("Size changed from ".concat(t.currentWidth,"x").concat(t.currentHeight," to ").concat(e,"x").concat(n)),t.currentWidth=e,t.currentHeight=n,t.updateShadowStyle(),t.setMediaDimensions())}catch(e){fh.error(e.stack)}};window.addEventListener("resize",o),this.windowEventHandlers.push({eventName:"resize",handler:o});const a=()=>{try{t.screensaverRunning()&&t.moreInfoDialogToForeground()}catch(e){fh.error(e.stack)}};window.addEventListener("hass-more-info",a),this.windowEventHandlers.push({eventName:"hass-more-info",handler:a}),this.infoBoxResizeObserver=new ResizeObserver(()=>{"corners"===Yu.info_move_pattern&&this.moveAroundCorners(!0)}),this.infoBoxResizeObserver.observe(this.infoBoxContent),this.setScreensaverEntityState()}disconnectedCallback(){this.timerInterval&&(clearInterval(this.timerInterval),this.timerInterval=null),this.translateTimeout&&(clearTimeout(this.translateTimeout),this.translateTimeout=null),this.windowEventHandlers.length&&(this.windowEventHandlers.forEach(e=>{let{eventName:t,handler:n,options:r}=e;window.removeEventListener(t,n,r)}),this.windowEventHandlers=[]),this.infoBoxResizeObserver&&(this.infoBoxResizeObserver.disconnect(),this.infoBoxResizeObserver=null)}reconfigure(e){const t=e&&Object.keys(e).length>0;!t||e.hide_toolbar==Yu.hide_toolbar&&e.hide_toolbar_action_icons==Yu.hide_toolbar_action_icons&&e.hide_toolbar_on_subviews==Yu.hide_toolbar_on_subviews&&e.hide_sidebar==Yu.hide_sidebar&&e.fullscreen==Yu.fullscreen||kh(),Yu.theme&&(fh.info("Apply theme",Yu.theme),Ju.theme=Yu.theme,Ju._applyTheme()),this.updateStyle(),this.screensaverRunning()&&this.createInfoBoxContent(),!Yu.info_move_interval&&t&&e.info_move_interval&&Qu.moveInfoBox(0,0);const n=e.image_url!=Yu.image_url||"immich-api"==wh()&&(Yu.immich_shared_albums!=e.immich_shared_albums||Yu.immich_memories!=e.immich_memories||Yu.immich_favorites!=e.immich_favorites||JSON.stringify(Yu.immich_album_names)!=JSON.stringify(e.immich_album_names)||JSON.stringify(Yu.immich_tag_names)!=JSON.stringify(e.immich_tag_names)||JSON.stringify(Yu.immich_persons)!=JSON.stringify(e.immich_persons));if(Yu.show_images&&(!this.mediaList||!this.mediaList.length||!t||!e.show_images||n)){const e=this,r=this.screensaverRunning()&&t;n&&(this.mediaList=[],this.mediaIndex=-1),this.updateMediaList(function(){r&&e.switchActiveMedia("reconfigure")},n)}if(Yu.disable_screensaver_on_browser_mod_popup_func)try{this.disable_screensaver_on_browser_mod_popup_function=new Function("bmp",Yu.disable_screensaver_on_browser_mod_popup_func)}catch(e){this.disable_screensaver_on_browser_mod_popup_function=null,fh.error("Invalid disable_screensaver_on_browser_mod_popup_func:",e)}bh()&&Yu.camera_motion_detection_enabled?this.cameraMotionDetection.start():this.cameraMotionDetection.stop()}getMoreInfoDialog(){const e=ih.shadowRoot.querySelector("ha-more-info-dialog");if(!e)return;const t=e.shadowRoot.querySelector("ha-dialog");return t||void 0}moreInfoDialogToForeground(){const e=this;!function t(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;const r=e.getMoreInfoDialog();if(r)return r.style.position="absolute",void(r.style.zIndex=e.style.zIndex+1);n<10&&setTimeout(t,50,n+1)}()}fetchEXIFInfo(e){const t=this;if(eh.get(e.infoCacheUrl))return;const n=document.createElement("img");n.src=e.src,n.mediaUrl=e.mediaUrl,n.infoCacheUrl=e.infoCacheUrl,Hh(n,function(){fh.debug("EXIF data:",n.exifdata),th(n.infoCacheUrl,n.exifdata),t.setMediaDataInfo(n);const e=n.exifdata.GPSLongitude,r=n.exifdata.GPSLatitude;if(Yu.fetch_address_data&&e&&!isNaN(e[0])&&r&&!isNaN(r[0])){let i="S"==n.exifdata.GPSLatitudeRef?-1:1;const o=r[0]*i+(r[1]*i*60+r[2]*i)/3600;i="W"==n.exifdata.GPSLongitudeRef?-1:1;const a=e[0]*i+(e[1]*i*60+e[2]*i)/3600;fh.debug("Fetching nominatim data for lat=".concat(o," lon=").concat(a));const s=new XMLHttpRequest;s.onload=function(){if(200==this.status||0===this.status){const e=JSON.parse(s.responseText);if(fh.debug("nominatim data:",e),e&&e.address){const r=eh.get(n.infoCacheUrl);r?(r.address=e.address,t.setMediaDataInfo(n)):fh.warn("URL not in cache:",n.infoCacheUrl)}}else fh.error("nominatim error:",this.status,s.status,s.responseText)},s.onerror=function(e){fh.error("nominatim error:",e)},s.ontimeout=function(e){fh.error("nominatim timeout:",e)},s.open("GET","https://nominatim.openstreetmap.org/reverse?lat=".concat(o,"&lon=").concat(a,"&format=json")),s.timeout=15e3,s.send()}})}setMediaDataInfo(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const t=Yu.show_image_info&&Boolean(Yu.image_info_template);if(this.imageOneInfoContainer.style.display=t?"block":"none",this.imageTwoInfoContainer.style.display=t?"block":"none",!t)return this.imageOneInfo.innerHTML="",void(this.imageTwoInfo.innerHTML="");e||(e=this.getActiveMediaElement());const n=e.infoCacheUrl;let r=e.mediaUrl;if(!n)return void fh.debug("infoCacheUrl missing:",e);if(!r)return void fh.debug("mediaUrl missing:",e);r=decodeURI(r);const i=[];if(this.imageOne.infoCacheUrl==n&&i.push(this.imageOneInfo),this.imageTwo.infoCacheUrl==n&&i.push(this.imageTwoInfo),0==i.length)return;let o=eh.get(n);o||(o={}),o.image||(o.image={}),void 0===o.image.url&&(o.image.url=r);const a=r.replace(/\?[^?]*$/,"").replace(/\/+$/,"");if(void 0===o.image.path&&(o.image.path=a.replace(/^[^:]+:\/\/[^/]+/,"")),void 0===o.image.relativePath){const c="media-source"===wh()?n.replace(/\?[^?]*$/,"").replace(/\/+$/,""):a;o.image.relativePath=c.replace(Yu.image_url,"").replace(/^\/+/,"")}if(void 0===o.image.filename&&(o.image.filename=a.replace(/^.*[\\/]/,"")),void 0===o.image.folderName){o.image.folderName="";const l=a.split("/");l.length>=2&&(o.image.folderName=l[l.length-2])}o.mediaPosition=this.mediaIndex+1,o.mediaCount=this.mediaList.length,fh.debug("Media info:",o);let s=Yu.image_info_template||"";if("analyze"==s){function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const n=Object.keys(e);n.sort(),n.forEach(n=>{const r=e[n];"object"==typeof r&&null!==r?u(r,n+"."):s+="".concat(t).concat(n,": ").concat(hh(r),"<br>")})}s="",u(o),this.imageOneInfo.style.pointerEvents="none",this.imageTwoInfo.style.pointerEvents="none",i.forEach(e=>{e.style.pointerEvents="auto"})}else s=s.replace(/\${([^}]+)}/g,(e,t)=>{const n=t.split("||");for(let e=0;e<n.length;e++){let t=n[e];fh.debug("Processing tags: ".concat(t));let r="",i="",a=null;if(t.includes("!")){const e=t.split("!");t=e[0];for(let t=1;t<e.length;t++){const n=e[t].substring(0,e[t].indexOf("=")),o=e[t].substring(e[t].indexOf("=")+1);"prefix"==n?r=o:"suffix"==n?i=o:"options"==n&&(a={},o.split(",").forEach(e=>{const t=e.split(":",2);t[0]&&t[1]&&(a[t[0].replace(/\s/g,"")]=t[1].replace(/\s/g,""))}))}}let s="";const c=t.split("|");let l="";for(let e=0;e<c.length;e++){l=c[e];const t=l.replace(/\s/g,"").split(".");if(s=o,t.forEach(e=>{s&&(s=s[e])}),s)break}if(s){if(/DateTime/i.test(l)){const e=new Date(s.replace(/(\d\d\d\d):(\d\d):(\d\d) (\d\d):(\d\d):(\d\d)/,"$1-$2-$3T$4:$5:$6"));if(isNaN(e))continue;a||(a={year:"numeric",month:"2-digit",day:"2-digit"}),s=e.toLocaleDateString((ih.hass||ih.__hass).locale.language,a)}return"object"==typeof s&&(s=JSON.stringify(s)),r+s+i}}return""});i.forEach(e=>{e.innerHTML=s,e.style.display="block"})}async updateMediaList(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!Yu.image_url)return;if(this.updatingMediaList)return;if(!t&&(new Date).getTime()-this.lastMediaListUpdate<1e3*Yu.media_list_update_interval)return;const r=this;let i=null;const o=wh();if("unsplash-api"==o)i=r.updateMediaListFromUnsplashAPI;else if("immich-api"==o)i=r.updateMediaListFromImmichAPI;else{if("media-source"!=o){let t=Yu.image_url;return"iframe"==o?t=t.replace(/^iframe\+/,""):"embed"==o&&(t=t.replace(/^embed\+/,"")),this.mediaList=[t],void(e&&e())}i=r.updateMediaListFromMediaSource}this.updatingMediaList=!0,this.lastMediaListUpdate=Date.now();try{await i.bind(r)(),fh.debug("Media list from ".concat(o," is now:"),r.mediaList),e&&e()}catch(t){const i=3,a=3e3;if(fh.warn("Failed to update media list from ".concat(o,":"),t),n<i)fh.warn("Retrying media list update in ".concat(a/1e3," seconds (attempt ").concat(n+1,"/").concat(i,")...")),setTimeout(()=>r.updateMediaList(e,!0,n+1),a);else{const e="Failed to update media list from ".concat(Yu.image_url," after ").concat(i," retries: ").concat(t.message||hh(t));fh.error(e)}}this.updatingMediaList=!1}async findMedias(e){const t=this;fh.debug("findMedias: ".concat(e));const n=[];if(Yu.exclude_filenames)for(const e of Yu.exclude_filenames)n.push(new RegExp(e));try{const r=await t.hass.callWS({type:"media_source/browse_media",media_content_id:e});fh.debug("Found media entry",r);const i=r.children.map(async e=>{const r=e.media_content_id.replace(/^media-source:\/\/[^/]+/,"");for(const e of n)if(e.test(r))return null;return["image","video"].includes(e.media_class)?Yu.exclude_media_types&&Yu.exclude_media_types.includes(e.media_class)?null:e.media_content_id:"directory"==e.media_class?await t.findMedias(e.media_content_id):null});return(await Promise.all(i)).flat().filter(e=>null!==e)}catch(t){throw fh.warn("Error browsing media ".concat(e,":"),t),t}}async updateMediaListFromMediaSource(){const e=Yu.image_url,t=this;try{let n=await t.findMedias(e);n="random"==Yu.media_order?gh(n):n.sort(),n.length>Yu.media_list_max_size&&(fh.info("Using only ".concat(Yu.media_list_max_size," of ").concat(n.length," media items")),n=n.slice(0,Yu.media_list_max_size)),t.mediaList=n}catch(e){throw new Error("Failed to update image list from ".concat(Yu.image_url,": ").concat(e.message||hh(e)))}}async updateMediaListFromUnsplashAPI(){const e=[],t="".concat(Yu.image_url,"&count=30");fh.debug("Unsplash API request: ".concat(t));try{const n={method:"GET",headers:{Accept:"application/json"}};"undefined"!=typeof AbortSignal&&void 0!==AbortSignal.timeout&&(fh.debug("Using AbortSignal"),n.signal=AbortSignal.timeout(1e3*Yu.immich_api_request_timeout));const r=await fetch(t,n);if(!r.ok){const e=await r.text();throw new Error("Unsplash API request failed: ".concat(r.status," ").concat(r.statusText," - ").concat(e))}const i=await r.json();fh.debug("Got Unsplash API response"),i.forEach(t=>{fh.debug(t);const n="".concat(t.urls.raw,"&w=${width}&h=${height}&auto=format");e.push(n),th(n,t)}),this.mediaList=e}catch(e){if("AbortError"===e.name)throw new Error("Unsplash API request timed out: ".concat(t));throw e}}async _immichFetch(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i={headers:{"x-api-key":t,"Content-Type":"application/json",Accept:"application/json"}},o=n(n({},i),r);o.headers=n(n({},i.headers),r.headers),"undefined"!=typeof AbortSignal&&void 0!==AbortSignal.timeout&&(fh.debug("Using AbortSignal"),o.signal=AbortSignal.timeout(1e4)),fh.debug("Immich API request: ".concat(e));try{const t=await fetch(e,o);if(!t.ok){const e=await t.text();throw new Error("Immich API request failed: ".concat(t.status," ").concat(t.statusText," - ").concat(e))}return await t.json()}catch(t){if("AbortError"===t.name)throw new Error("Immich API request timed out: ".concat(e));throw t}}async updateMediaListFromImmichAPI(){if(!Yu.immich_api_keys||!Yu.immich_api_keys.length)throw new Error("No immich_api_key configured");const e=this,t=this.screensaverContainer.clientWidth>=this.screensaverContainer.clientHeight?"landscape":"portrait";let n=Yu.exclude_media_orientation;"auto"==n&&(n="landscape"==t?"portrait":"landscape"),fh.debug("config.exclude_media_orientation=".concat(Yu.exclude_media_orientation,", screenOrientation=").concat(t,", exclude_media_orientation=").concat(n));let r=[];const i={},o=Yu.image_url.replace(/^immich\+/,""),a=[];if(Yu.exclude_filenames)for(const e of Yu.exclude_filenames)a.push(new RegExp(e));async function s(t,s){let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;await async function(t,n){const r=Yu.immich_exclude_tag_names&&Yu.immich_exclude_tag_names.length;await Promise.all(t.map(async t=>{if(!t.exifInfo||r&&!t.tags){fh.debug("Fetching asset info for ".concat(t.id));const r=await e._immichFetch("".concat(o,"/assets/").concat(t.id),n);t.exifInfo=r.exifInfo,t.tags=r.tags.map(e=>e.value)}}))}(t,s);for(const e of t){fh.debug("Processing immich asset",e);const t=e.type.toLowerCase();if(!["image","video"].includes(t)){fh.debug("Neither image nor video, skipping");continue}if(Yu.exclude_media_types&&Yu.exclude_media_types.includes(t)){fh.debug('Media type "'.concat(t,'" excluded'));continue}let l=!1;for(const t of a)t.test(e.originalFileName)&&(fh.debug('Media item excluded by regex "'.concat(t,'"')),l=!0);if(l)continue;if(Yu.immich_exclude_tag_names&&Yu.immich_exclude_tag_names.length){const t=e.tags.filter(e=>Yu.immich_exclude_tag_names.includes(e));if(t.length>0){fh.debug("Media item excluded due to tag(s): ".concat(t.join(", ")));continue}}if(n&&e.exifInfo&&e.exifInfo.exifImageWidth&&e.exifInfo.exifImageHeight){let t=e.exifInfo.exifImageWidth>=e.exifInfo.exifImageHeight?"landscape":"portrait";if(e.exifInfo.orientation&&[5,6,7,8].includes(parseInt(e.exifInfo.orientation))&&(t="landscape"==t?"portrait":"landscape"),t===n){fh.debug('Media item with orientation "'.concat(t,'" excluded'));continue}}let u="original";"preview"==Yu.immich_resolution&&(u="video"==t?"video/playback":"thumbnail?size=preview");const h="".concat(o,"/assets/").concat(e.id,"/").concat(u);if(r.indexOf(h)>=0)continue;r.push(h);const f=e.exifInfo||{};f.immichApiKey=s,f.mediaType=t,f.image={filename:e.originalFileName,folderName:c},i[h]=f}}try{for(const t of Yu.immich_api_keys)if(fh.debug("Using immich API key ".concat(t)),Yu.immich_persons&&Yu.immich_persons.length){fh.debug("Searching for assets based on persons");const n=Yu.immich_persons.map(e=>(Array.isArray(e)?e:[e]).map(e=>e.toLowerCase())),r={};let i=[],a=1,c=!0;for(;c;){const n=await e._immichFetch("".concat(o,"/people?size=1000&page=").concat(a),t);i=i.concat(n.people),c=n.hasNextPage,a++}i.forEach(e=>{e.name&&e.id&&(r[e.name.toLowerCase()]=e.id)});for(const i of n){const n=[];if(i.forEach(e=>{const t=r[e.toLowerCase()];t?n.push(t):fh.error("Person not found in immich: ".concat(e))}),n.length>0){fh.debug("Searching asset metadata for persons: ",n);let r=1;for(;;){fh.debug("Fetching asset metadata page ".concat(r));const a=await e._immichFetch("".concat(o,"/search/metadata"),t,{method:"POST",body:JSON.stringify({personIds:n,withExif:!0,page:r,size:1e3})});if(fh.debug("Got immich API response",a),!a.assets.count){if(1==r){const e="No media items found in immich that contain all these people: ".concat(i);fh.error(e)}break}if(await s(a.assets.items,t),!a.assets.nextPage)break;r=a.assets.nextPage}}}}else if(Yu.immich_memories){fh.debug("Fetching immich memories (on_this_day)");const n=await e._immichFetch("".concat(o,"/memories?type=on_this_day"),t);fh.debug("Got immich API response",n);const r=new Date,i=n.filter(e=>{const t=new Date(e.showAt),n=new Date(e.hideAt);return r>=t&&r<=n});fh.debug("Found ".concat(i.length," visible memories")),await Promise.all(i.map(async e=>{fh.debug("Processing memory:",e),await s(e.assets,t)}))}else if(Yu.immich_favorites){fh.debug("Search for favorites in asset metadata");let n=1;for(;;){fh.debug("Fetching asset metadata page ".concat(n));const r=await e._immichFetch("".concat(o,"/search/metadata"),t,{method:"POST",body:JSON.stringify({isFavorite:!0,withExif:!0,page:n,size:1e3})});if(fh.debug("Got immich API response",r),!r.assets.count){if(1==n){const e="No favorite media items found in immich";fh.error(e)}break}if(await s(r.assets.items,t),!r.assets.nextPage)break;n=r.assets.nextPage}}else if(Yu.immich_tag_names&&Yu.immich_tag_names.length){fh.debug("Searching for assets based on tag names");const n=Yu.immich_tag_names.map(e=>e.toLowerCase());fh.debug("Fetching immich tags");const r=await e._immichFetch("".concat(o,"/tags"),t);fh.debug("Got immich API response",r);const i=r.filter(e=>{const t=n.includes(e.name.toLowerCase());return fh.debug("".concat(t?"Adding":"Skipping"," tag: ").concat(e.name)),t}).map(e=>e.id);if(i.length>0){fh.debug("Searching asset metadata for tags: ",i);let r=1;for(;;){fh.debug("Fetching asset metadata page ".concat(r));const a=await e._immichFetch("".concat(o,"/search/metadata"),t,{method:"POST",body:JSON.stringify({tagIds:i,withExif:!0,page:r,size:1e3})});if(fh.debug("Got immich API response",a),!a.assets.count){if(1==r){const e="No media items found in immich that contain these tags: ".concat(n);fh.error(e)}break}if(await s(a.assets.items,t),!a.assets.nextPage)break;r=a.assets.nextPage}}else{const e="No matching immich tags found or selected.";fh.error(e)}}else{fh.debug("Searching for assets based on albums");const n=(Yu.immich_album_names||[]).map(e=>e.toLowerCase());fh.debug("Fetching immich albums (shared=".concat(Yu.immich_shared_albums,")"));const r=await e._immichFetch("".concat(o,"/albums?shared=").concat(Yu.immich_shared_albums),t);fh.debug("Got immich API response",r);const i=r.filter(e=>{const t=!n.length||n.includes(e.albumName.toLowerCase());return fh.debug("".concat(t?"Adding":"Skipping"," album: ").concat(e.albumName)),t}).map(e=>e.id);if(i.length>0){const n=i.map(n=>(fh.debug("Fetching album metadata: ",n),e._immichFetch("".concat(o,"/albums/").concat(n),t))),r=await Promise.all(n);for(const e of r)fh.debug("Got immich album details",e),await s(e.assets,t,e.albumName)}else fh.debug("No matching immich albums found or selected.")}!function(){if(0==r.length){const e="No matching media assets found";fh.error(e)}r="random"==Yu.media_order?gh(r):r.sort(),r.length>Yu.media_list_max_size&&(fh.info("Using only ".concat(Yu.media_list_max_size," of ").concat(r.length," media items")),r=r.slice(0,Yu.media_list_max_size)),r.forEach(e=>{th(e,i[e])}),e.mediaList=r}()}catch(e){throw fh.error("Immich API processing failed:",e),e}}fillPlaceholders(e){const t=this.screensaverContainer.clientWidth,n=this.screensaverContainer.clientHeight,r=Date.now(),i=Math.floor(r/1e3);return e=(e=(e=(e=e.replace(/\${width}/g,t)).replace(/\${height}/g,n)).replace(/\${timestamp_ms}/g,r)).replace(/\${timestamp}/g,i)}async updateMediaFromUrl(e,t){var n=this;let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];Yu.force_load_media_with_fetch&&(o=!0);const a=async e=>{const n={img:"load",video:"loadeddata",iframe:"load",embed:"load"}[e.tagName.toLowerCase()];if(!n)throw new Error('Unsupported element tag "'.concat(e.tagName,'"'));const r=new Promise((r,i)=>{const o=()=>{e.onerror=null,e.removeEventListener(n,a)},a=()=>{o(),r()};e.addEventListener(n,a),e.onerror=()=>{o(),i(new Error("Failed to load ".concat(e.tagName,' "').concat(t,'"')))}});if(o)if(Yu.stream_load_media)fetch(t,{headers:i}).then(n=>{if(!n.ok)throw new Error("Failed to load ".concat(e.tagName,' "').concat(t,'": ').concat(n));if(!n.body)throw new Error("Failed to load ".concat(e.tagName,' "').concat(t,'": empty body'));const r=n.body.getReader();return new ReadableStream({start:e=>function t(){return r.read().then(n=>{let{done:r,value:i}=n;if(!r)return e.enqueue(i),t();e.close()})}()})}).then(e=>new Response(e)).then(e=>e.blob()).then(t=>{"string"==typeof e.src&&e.src.startsWith("blob:")&&URL.revokeObjectURL(e.src),e.src=URL.createObjectURL(t)});else{i=i||{};const n=await fetch(t,{headers:i});if(fh.debug("Got respone",n),!n.ok)throw new Error("Failed to load ".concat(e.tagName,' "').concat(t,'": ').concat(n));"string"==typeof e.src&&e.src.startsWith("blob:")&&URL.revokeObjectURL(e.src);const r=await n.blob();e.src=URL.createObjectURL(r)}else e.src=t;return r},s=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;t||(t="img"===e.tagName.toLowerCase()?"video":"img");const i=n.replaceMediaElement(e,t);try{return await a(i),i}catch(e){throw r||e}},c=async(e,t)=>{try{return await a(e),e}catch(n){if(t)return await s(e,null,n);throw n}};return r?r===e.tagName.toLowerCase()?await c(e,!1):await s(e,r):await c(e,!0)}getNextMediaURL(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(!this.mediaList.length)return null;let t=this.mediaIndex;return"forwards"==this.mediaListDirection?t++:t--,t>=this.mediaList.length?t=0:t<0&&(t=this.mediaList.length-1),e&&(this.mediaIndex=t),this.mediaList[t]}async updateMediaFromMediaSource(e){var t;const n=await this.hass.callWS({type:"media_source/resolve_media",media_content_id:e.mediaUrl}),r=null===(t=n.mime_type)||void 0===t?void 0:t.match(/^(image|video)\//),i={image:"img",video:"video"}[null==r?void 0:r[1]]||null;let o=n.url;return o.startsWith("http://")||o.startsWith("https://")||(o="".concat(document.location.origin).concat(o)),fh.debug("Setting image src: ".concat(o)),e.mediaUrl=o,await this.updateMediaFromUrl(e,e.mediaUrl,i)}async updateMediaFromImmichAPI(e){const t=eh.get(e.mediaUrl)||{},n="video"==t.mediaType?"video":"img";return await this.updateMediaFromUrl(e,e.mediaUrl,n,{"x-api-key":t.immichApiKey},!0)}async updateMediaFromMediaEntity(e){const t=e.mediaUrl.match(/^media-entity-(image|video):\/\/(.*)/);if(!t)throw new Error('Invalid URL "'.concat(e.mediaUrl,'"'));const n=t[1],r=t[2],i=this.hass.states[r];if(!i)throw new Error('Entity "'.concat(r,'" not available'));function o(){"media_exif"in i.attributes?th(e.infoCacheUrl,i.attributes.media_exif):th(e.infoCacheUrl,i.attributes)}if(rh=i.state,"video"==n)return e.infoCacheUrl=e.mediaUrl,o(),(e=this.replaceMediaElement(e,"ha-camera-stream")).style.visibility="hidden",Object.assign(e,{hass:this.__hass,stateObj:this.__hass.states[r],"allow-exoplayer":!1,controls:!1}),new Promise((t,n)=>{let r=0;e.addEventListener("load",async function e(i){const o=i.currentTarget;o.removeEventListener("load",e),await o.updateComplete;const[a,s]=ph(o);if(!a||!s)return r++,r<=20?void setTimeout(()=>e(i),100):void n(new Error("Failed to initialize camera stream player"));if(a.style.height="100%",s.autoplay=!1,s.muted=!1,s.volume=Yu.video_volume,s.style.maxHeight="100%",s.style.height="100%",s.readyState>=s.HAVE_ENOUGH_DATA)t(o);else{const e=()=>{s.removeEventListener("canplay",e),t(o)};s.addEventListener("canplay",e)}})});{if(!i.attributes||!i.attributes.entity_picture)throw new Error('Entity "'.concat(r,'" has no entity_picture attribute'));const t=i.attributes.entity_picture;let n=t.indexOf("?")>0?"&":"?";return n+=this.fillPlaceholders("width=${width}&height=${height}&ts=${timestamp_ms}"),e.mediaUrl=t+n,e.infoCacheUrl=e.mediaUrl,o(),await this.updateMediaFromUrl(e,e.mediaUrl,"img",null,!0)}}async updateMediaFromUnsplashAPI(e){const t=eh.get(e.mediaUrl);return e.mediaUrl=this.fillPlaceholders(e.mediaUrl),t&&th(e.mediaUrl,t),await this.updateMediaFromUrl(e,e.mediaUrl,"img")}async updateMediaFromMediaIframe(e){return await this.updateMediaFromUrl(e,e.mediaUrl,"iframe")}async updateMediaFromMediaEmbed(e){return await this.updateMediaFromUrl(e,e.mediaUrl,"embed")}async updateMediaFromOtherSrc(e){return e.mediaUrl=this.fillPlaceholders(e.mediaUrl),await this.updateMediaFromUrl(e,e.mediaUrl)}async updateMedia(e){if(Yu.show_images){this.updatingMedia=!0;try{if(e==this.getActiveMediaElement()){const e=this.getInactiveMediaElement();if("video"===e.tagName.toLowerCase())try{e.pause()}catch(e){fh.debug(e)}else if("ha-camera-stream"===e.tagName.toLowerCase())try{const[t,n]=ph(e);n&&n.pause(),t&&"function"==typeof t.stop&&t.stop()}catch(e){fh.debug(e)}}if(e.mediaUrl=this.getNextMediaURL(),!e.mediaUrl)return;if(e.infoCacheUrl=e.mediaUrl,e="media-source"==wh()?await this.updateMediaFromMediaSource(e):"unsplash-api"==wh()?await this.updateMediaFromUnsplashAPI(e):"immich-api"==wh()?await this.updateMediaFromImmichAPI(e):wh().startsWith("media-entity")?await this.updateMediaFromMediaEntity(e):"iframe"==wh()?await this.updateMediaFromMediaIframe(e):"embed"==wh()?await this.updateMediaFromMediaEmbed(e):await this.updateMediaFromOtherSrc(e)){e.style.visibility="visible";const t="video"===e.tagName.toLowerCase();t&&await new Promise((t,n)=>{if(e.readyState>=e.HAVE_ENOUGH_DATA)t();else{const r=()=>{e.removeEventListener("canplay",r),e.removeEventListener("error",i),t()},i=()=>{e.removeEventListener("canplay",r),e.removeEventListener("error",i),n(new Error("Video failed to load"))};e.addEventListener("canplay",r),e.addEventListener("error",i)}}),"image"===Yu.image_background&&this.loadBackgroundImage(e),!t&&Yu.show_image_info&&/.*\.jpe?g$/i.test(e.mediaUrl.split("?")[0].replace(/\/*$/,""))&&this.fetchEXIFInfo(e)}}catch(t){fh.error("Failed to update media from ".concat(e.mediaUrl,":"),t)}finally{this.updatingMedia=!1}return e}}setMediaDimensions(){if(!Yu.calculate_media_size)return;const e=this.getActiveMediaElement(),t=this.getActiveMediaElement(!0);if(fh.debug("Setting dimensions for media element",e),!e.mediaUrl)return;const n=t.tagName.toLowerCase();let r=0,i=0;"video"===n?(r=t.videoWidth,i=t.videoHeight):"img"===n&&(r=t.naturalWidth,i=t.naturalHeight);const o=!r||!i||r>=i?Yu.image_fit_landscape:Yu.image_fit_portrait;e.style.position="absolute",e.style.left="0px",e.style.top="0px",e.style.objectFit=o;const a=this.screensaverContainer.clientWidth,s=this.screensaverContainer.clientHeight;let c=s,l=a,u=0,h=0,f=0,d=0;if(fh.debug("Available size is ".concat(a,"x").concat(s,", media size is ").concat(r,"x").concat(i)),r&&i){const e=a/r,t=s/i,n=a-r*t,m=s-i*e;fh.debug("Diff is ".concat(n,"x").concat(m)),"contain"==o&&n<m||"cover"==o&&n>=m?(fh.debug("Using available width"),l=a,c=Math.floor(i*e),f="top"==Yu.media_vertical_align?0:"bottom"==Yu.media_vertical_align?s-c:Math.floor((c-s)/-2),u=Math.max(c-s,0)):(fh.debug("Using available height"),c=s,l=Math.floor(r*t),d="left"==Yu.media_horizontal_align?0:"right"==Yu.media_horizontal_align?a-l:Math.floor((l-a)/-2),h=Math.max(l-a,0))}else"iframe"!==n&&"embed"!==n&&fh.warn("Size not available for media element",t);fh.debug("Setting dimensions: size=".concat(l,"x").concat(c," - position=").concat(d,"x").concat(f," - hidden=").concat(h,"x").concat(u)),e.style.width="".concat(l,"px"),e.style.height="".concat(c,"px"),e.style.top="".concat(f,"px"),e.style.left="".concat(d,"px"),e.style.setProperty("--hidden-width",h),e.style.setProperty("--hidden-height",u)}startPlayingActiveMedia(){const e=this.getActiveMediaElement(),t=this.getActiveMediaElement(!0);if("function"!=typeof t.play)return;const n=()=>{t._wp_video_playback_listeners&&(Object.entries(t._wp_video_playback_listeners).forEach(e=>{let[n,r]=e;t.removeEventListener(n,r)}),t._wp_video_playback_listeners=null)};if(t.loop=Yu.video_loop,!Yu.video_loop&&!t._wp_video_playback_listeners){const e=()=>{if(this.getActiveMediaElement()===t){if(t.currentTime>Yu.crossfade_time){t.duration-t.currentTime<=Yu.crossfade_time&&(this.switchActiveMedia("display_time_elapsed"),n())}}else n()},r=()=>{this.getActiveMediaElement()===t&&this.switchActiveMedia("media_end"),n()},i=()=>{n()};t._wp_video_playback_listeners={timeupdate:e,ended:r,pause:i},Object.entries(t._wp_video_playback_listeners).forEach(e=>{let[n,r]=e;t.addEventListener(n,r)})}t.play().catch(r=>{n(),e===this.getActiveMediaElement()&&fh.error('Failed to play media "'.concat(e.mediaUrl,'" (src=').concat(t.src,"):"),r)})}async switchActiveMedia(e){this.afterFadeoutTimer&&clearTimeout(this.afterFadeoutTimer);const t=wh();if(t.startsWith("media-entity")){const t=Yu.image_url.replace(/^media-entity-(image|video):\/\//,""),n=this.hass.states[t];if(!n)return void fh.error('Media entity "'.concat(t,'" not available'));if(rh!=n.state)fh.debug("Media entity ".concat(t," state has changed"));else{if("entity_update"==e)return;if("start"==e||"user_action"==e)fh.debug("Media entity ".concat(t," state unchanged, but eventType = ").concat(e));else{if(!Yu.media_entity_load_unchanged)return this.lastMediaUpdate=Date.now(),this.isPaused&&(this.mediaTimeElapsedBeforePause=0),void this.restartProgressBarAnimation();fh.debug("Media entity ".concat(t," state unchanged, but media_entity_load_unchanged = true"))}}rh=n.state}this.lastMediaUpdate=Date.now(),this.isPaused&&(this.mediaTimeElapsedBeforePause=0);const n=this.getActiveMediaElement();if(("iframe"===t||"embed"===t)&&!Yu.iframe_load_unchanged&&this.getNextMediaURL(!1)==n.mediaUrl)return;let r=0;"start"!=e&&(Yu.crossfade_time>0&&(r=Math.round(1e3*Yu.crossfade_time)),"user_action"==e&&r>250&&(r=250));const i=this.getInactiveMediaElement(),o=await this.updateMedia(i);o&&this._switchActiveMedia(o,r)}_switchActiveMedia(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.lastMediaUpdate=Date.now(),this.isPaused&&(this.mediaTimeElapsedBeforePause=0),this.imageOneContainer.style.transition="opacity ".concat(t,"ms ease-in-out"),this.imageTwoContainer.style.transition="opacity ".concat(t,"ms ease-in-out");let n=this.imageOneContainer,r=this.imageTwoContainer,i=this.imageOne,o=this.imageTwo;e==this.imageOne&&(n=this.imageTwoContainer,r=this.imageOneContainer,i=this.imageTwo,o=this.imageOne),fh.debug("Switching active media to '".concat(r.id,"'")),1!=r.style.opacity&&(r.style.opacity=1),0!=n.style.opacity&&(n.style.opacity=0),"iframe"==o.tagName.toLowerCase()&&Yu.iframe_interaction?o.style.pointerEvents="auto":o.style.pointerEvents="none",this.setMediaDataInfo(),this.setMediaDimensions(),this.setImageURLEntityState(),this.startPlayingActiveMedia(),this.restartProgressBarAnimation(),this.restartKenBurnsEffect(),"video"===i.tagName.toLowerCase()&&(this.afterFadeoutTimer=setTimeout(function(){if("video"===i.tagName.toLowerCase())try{i.pause()}catch(e){fh.debug(e)}},t))}showMessage(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5e3;if(!this.messageContainer)return;const i=document.createElement("div");i.className="wallpanel-message ".concat(e);const o=document.createElement("div");o.className="wallpanel-message-title",o.textContent=t,i.appendChild(o);const a=document.createElement("div");a.className="wallpanel-message-text",a.textContent=n,i.appendChild(a),this.messageContainer.appendChild(i),requestAnimationFrame(()=>i.classList.add("show"));const s=this;setTimeout(()=>s.hideMessage(i),r)}hideMessage(e){e.classList.remove("show"),e.addEventListener("transitionend",()=>e.remove())}hideAllMessages(){const e=this.messageContainer.querySelectorAll(".wallpanel-message");if(!e.length)return!1;const t=this;return e.forEach(e=>t.hideMessage(e)),!0}setupScreensaver(){fh.debug("Setup screensaver"),Yu.keep_screen_on_time>0&&!this.screenWakeLock.enabled&&this.screenWakeLock.enable(),Yu.fullscreen&&!Ih()&&Th()}async startScreensaver(){if(fh.debug("Start screensaver"),this.screensaverStartedAt=Date.now(),this.screensaverStoppedAt=null,this.currentWidth=this.screensaverContainer.clientWidth,this.currentHeight=this.screensaverContainer.clientHeight,this.setDefaultStyle(),yh(),!bh())return fh.debug("Wallpanel not active, not starting screensaver"),this.screensaverStartedAt=null,void(this.screensaverStoppedAt=Date.now());if(this.getActiveMediaElement()==this.imageOne?(this.imageOneContainer.style.opacity=1,this.imageTwoContainer.style.opacity=0):(this.imageOneContainer.style.opacity=0,this.imageTwoContainer.style.opacity=1),await this.switchActiveMedia("start"),this.setupScreensaver(),Yu.keep_screen_on_time>0){const e=this;setTimeout(function(){e.screensaverRunning()&&!e.screenWakeLock.enabled&&(fh.warning("Keep screen on will not work because the user didn't interact with the document first. https://goo.gl/xX8pDD"),e.showMessage("info","Keep screen on","Please tap the screen for a moment to keep it awake and prevent it from turning off.",15e3))},2e3)}this.lastMove=Date.now(),this.lastMediaUpdate=Date.now(),document.documentElement.style.overflow="hidden",this.isPaused=!1,this.mediaTimeElapsedBeforePause=0,this.pauseIndicator.style.display="none",this.createInfoBoxContent(),this.style.visibility="visible",this.style.opacity=1,this.style.pointerEvents="auto",this.setScreensaverEntityState(),(Yu.screensaver_start_navigation_path||Yu.screensaver_stop_close_browser_mod_popup)&&(this.screensaverStopNavigationPathTimeout=setTimeout(()=>{Yu.screensaver_start_navigation_path&&(Zu=!0,function(e){(!(arguments.length>1&&void 0!==arguments[1])||arguments[1])&&!e.includes("?")&&(e+=window.location.search),history.pushState(null,"",e),ih.dispatchEvent(new Event("location-changed",{bubbles:!0,cancelable:!1,composed:!0}))}(Yu.screensaver_start_navigation_path),setTimeout(()=>{Zu=!1},5e3)),Yu.screensaver_stop_close_browser_mod_popup&&Ah().forEach(e=>{e.closeDialog()})},1e3*(Yu.fade_in_time+1)))}screensaverRunning(){return Boolean(this.screensaverStartedAt)&&this.screensaverStartedAt>0}stopScreensaver(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;fh.debug("Stop screensaver"),this.screensaverStartedAt=null,this.screensaverStoppedAt=Date.now(),document.documentElement.style.removeProperty("overflow"),this.screensaverStopNavigationPathTimeout&&clearTimeout(this.screensaverStopNavigationPathTimeout),this.hideAllMessages(),this.debugBox.style.pointerEvents="none",this.style.transition=e>0?"opacity ".concat(Math.round(1e3*e),"ms ease-in-out"):"",this.style.opacity=0,this.style.visibility="hidden",this.style.pointerEvents="none",this.imageOneInfo.style.pointerEvents="none",this.imageTwoInfo.style.pointerEvents="none",this.infoBoxPosX.style.animation="",this.infoBoxPosY.style.animation="",this.idleSince=Date.now(),this.screenWakeLock.enabled&&this.screenWakeLock.disable(),setTimeout(this.setScreensaverEntityState.bind(this),25)}updateScreensaver(){const e=new Date,t=e.getTime();if(this.energyCollectionUpdateEnabled&&t-this.lastEnergyCollectionUpdate>=1e3*this.energyCollectionUpdateInterval&&(this.hass.connection._energy_wallpanel&&this.hass.connection._energy_wallpanel.refresh(),this.lastEnergyCollectionUpdate=t),this.infoBoxContentCreatedDate&&this.infoBoxContentCreatedDate.getDate()!=e.getDate()&&this.createInfoBoxContent(),Yu.info_move_interval>0&&t-this.lastMove>=1e3*Yu.info_move_interval&&("random"===Yu.info_move_pattern?this.randomMove():"corners"===Yu.info_move_pattern?this.moveAroundCorners():fh.error("Unknown info move type ".concat(Yu.info_move_pattern))),Yu.black_screen_after_time>0&&t-this.screensaverStartedAt>=1e3*Yu.black_screen_after_time?(fh.debug("Setting screen to black"),this.screensaverOverlay.style.background="#000000"):Yu.show_images?(!this.isPaused&&t-this.lastMediaUpdate>=1e3*Yu.display_time&&this.switchActiveMedia("display_time_elapsed"),t-this.lastMediaListUpdate>=1e3*Yu.media_list_update_interval&&this.updateMediaList(null,!0),"visible"!=this.imageOneContainer.style.visibility&&(this.imageOneContainer.style.visibility="visible"),"visible"!=this.imageOne.style.visibility&&(this.imageOne.style.visibility="visible"),"visible"!=this.imageTwoContainer.style.visibility&&(this.imageTwoContainer.style.visibility="visible"),"visible"!=this.imageTwo.style.visibility&&(this.imageTwo.style.visibility="visible")):("hidden"!=this.imageOneContainer.style.visibility&&(this.imageOneContainer.style.visibility="hidden"),"hidden"!=this.imageOne.style.visibility&&(this.imageOne.style.visibility="hidden"),"hidden"!=this.imageTwoContainer.style.visibility&&(this.imageTwoContainer.style.visibility="hidden"),"hidden"!=this.imageTwo.style.visibility&&(this.imageTwo.style.visibility="hidden")),Yu.close_more_info_dialog_time>0){const e=this.getMoreInfoDialog();if(e){const t=new Date;this.moreInfoDialogOpenedAt?t-this.moreInfoDialogOpenedAt>=1e3*Yu.close_more_info_dialog_time&&e.close():this.moreInfoDialogOpenedAt=t}else this.moreInfoDialogOpenedAt=0}if(Yu.debug){let e="";const t={};for(const e in Yu)["profiles"].includes(e)?t[e]="...":t[e]=Yu[e];if(e+='<a id="download_log" href="">Download log</a><br />',e+="<b>Version:</b> ".concat(zu,"<br/>"),e+="<b>User-Agent:</b> ".concat(navigator.userAgent,"<br/>"),e+="<b>Config:</b> ".concat(JSON.stringify(t),"<br/>"),e+="<b>Fullscreen:</b> ".concat(Ih(),"<br/>"),e+="<b>Screensaver started at:</b> ".concat(Qu.screensaverStartedAt,"<br/>"),e+="<b>Screen wake lock:</b> enabled=".concat(this.screenWakeLock.enabled," native=").concat(this.screenWakeLock.nativeWakeLockSupported," lock=").concat(this.screenWakeLock._lock," player=").concat(this.screenWakeLock._player," error=").concat(this.screenWakeLock.error,"<br/>"),this.screenWakeLock._player){const t=this.screenWakeLock._player;e+="<b>Screen wake lock video</b>: readyState=".concat(t.readyState," currentTime=").concat(t.currentTime," paused=").concat(t.paused," ended=").concat(t.ended,"<br/>")}e+="<b>Media list size:</b> ".concat(this.mediaList.length,"<br/>");const n=this.getActiveMediaElement();if(n){e+="<b>Current media:</b> ".concat(n.mediaUrl,"<br/>");const t=eh.get(n.infoCacheUrl);t&&(e+="<b>Media info:</b> ".concat(JSON.stringify(t),"<br/>"))}this.debugBox.innerHTML!==e&&(this.debugBox.innerHTML=e,this.debugBox.querySelector("#download_log").addEventListener("click",function(e){fh.downloadMessages(),e.preventDefault()})),this.debugBox.scrollTop=this.debugBox.scrollHeight}this.screenWakeLock.enabled&&Yu.keep_screen_on_time>0&&t-this.screensaverStartedAt>=1e3*Yu.keep_screen_on_time&&(fh.info("Disable wake lock after ".concat(Yu.keep_screen_on_time," seconds")),this.screenWakeLock.disable())}switchMediaDirection(e){this.mediaListDirection=e,this.switchActiveMedia("user_action")}async nextImage(){if(this.updatingMedia)return void fh.debug("Already switching media");fh.debug("Next image");const e=this.mediaListDirection;this.mediaListDirection="forwards";try{await this.switchActiveMedia("user_action")}finally{this.mediaListDirection=e}}async previousImage(){if(this.updatingMedia)return void fh.debug("Already switching media");fh.debug("Previous image");const e=this.mediaListDirection;this.mediaListDirection="backwards";try{await this.switchActiveMedia("user_action")}finally{this.mediaListDirection=e}}togglePlayPause(){if(fh.debug("Toggle play/pause"),this.screensaverRunning())if(this.isPaused)this.isPaused=!1,this.lastMediaUpdate=Date.now()-(this.mediaTimeElapsedBeforePause||0),this.pauseIndicator.style.display="none",this.progressBar.style.animationPlayState="running",this.startPlayingActiveMedia();else{this.isPaused=!0,this.mediaTimeElapsedBeforePause=Date.now()-this.lastMediaUpdate,this.lastMediaUpdate=Date.now(),this.pauseIndicator.style.display="block",this.progressBar.style.animationPlayState="paused";const e=this.getActiveMediaElement(!0);e&&"function"==typeof e.pause&&e.pause()}}setCameraMotionDetectionEntityState(e){const t=Yu.camera_motion_detection_set_entity;t&&this.__hass.states[t]&&(fh.debug("Updating camera motion detection entity",t,e),this.__hass.callService("input_boolean",e?"turn_on":"turn_off",{entity_id:t}).then(e=>{fh.debug(e)},e=>{fh.error("Failed to set camera motion detection entity state:",e)}))}motionDetected(){Yu.camera_motion_detection_stop_screensaver&&this.screensaverRunning()&&this.stopScreensaver(Yu.fade_out_time_motion_detected),this.setCameraMotionDetectionEntityState(!0)}motionStopped(){this.setCameraMotionDetectionEntityState(!1)}handleInteractionEvent(e){const t=["click","touchend"].includes(e.type),n=Date.now();this.idleSince=n;let r="";if("touchstart"==e.type)return void(e.touches&&e.touches[0]&&(this.touchStartX=e.touches[0].clientX));if("touchend"==e.type&&this.touchStartX>=0&&e.changedTouches&&e.changedTouches[0]){const t=e.changedTouches[0].clientX-this.touchStartX;t>=5?r="right":t<=-5&&(r="left"),this.touchStartX=-1}if(!this.screensaverRunning())return this.blockEventsUntil>n&&(t&&e.preventDefault(),e.stopImmediatePropagation()),void(t&&this.setupScreensaver());if(t&&this.hideAllMessages())return void(this.blockEventsUntil=n+1e3);let i=e.clientX,o=e.clientY;if(!i&&e.changedTouches&&e.changedTouches[0]&&(i=e.changedTouches[0].clientX),!o&&e.changedTouches&&e.changedTouches[0]&&(o=e.changedTouches[0].clientY),Yu.debug&&i&&i<100&&o&&o<100)return;const a=_h();if(a){const e=[a.shadowRoot.querySelector(".content"),a.shadowRoot.querySelector("ha-dialog-header")];for(let t=0;t<e.length;t++)if(e[t]){const n=e[t].getBoundingClientRect();if(fh.debug("Event position:",e[t],i,o,n.left,n.right,n.top,n.bottom),i>=n.left&&i<=n.right&&o>=n.top&&o<=n.bottom)return void fh.debug("Event on browser mod popup:",e[t])}}if(Yu.iframe_interaction&&"iframe"==wh())return;if(Yu.content_interaction){if(this.getMoreInfoDialog())return;let e=[];e=e.concat(this.__cards||[]),e=e.concat(this.__badges||[]),e=e.concat(this.__views||[]),e.push(this.shadowRoot.getElementById("wallpanel-screensaver-info-box-content")),e.push(this.shadowRoot.getElementById("wallpanel-screensaver-fixed-info-box-content")),"analyze"==Yu.image_info_template&&(e.push(this.imageOneInfo),e.push(this.imageTwoInfo));for(let t=0;t<e.length;t++){const n=e[t].getBoundingClientRect();if(fh.debug("Event position:",e[t],i,o,n.left,n.right,n.top,n.bottom),i>=n.left&&i<=n.right&&o>=n.top&&o<=n.bottom)return void fh.debug("Event on:",e[t])}}let s="";if(r)s="left"==r?"forwards":"backwards",e.stopImmediatePropagation();else if(e instanceof MouseEvent||"TouchEvent"in window&&e instanceof TouchEvent){let n=0,r=0;const a=this.screensaverContainer.getBoundingClientRect();if(i&&(n=(a.right-i)/this.screensaverContainer.clientWidth),o&&(r=(a.bottom-o)/this.screensaverContainer.clientHeight),fh.debug("Event position screensaver:",i,o,a.left,a.right,a.top,a.bottom),r>1||r<0||n>1||n<0)return;if(t&&e.preventDefault(),e.stopImmediatePropagation(),Yu.touch_zone_size_next_image>0&&n<=Yu.touch_zone_size_next_image/100){if(!t)return;s="forwards"}else if(Yu.touch_zone_size_previous_image>0&&n>=(100-Yu.touch_zone_size_previous_image)/100){if(!t)return;s="backwards"}else if(n>=.4&&n<=.6&&r<=.1){const e=new Date;return t&&e-this.lastClickTime<500?(this.clickCount+=1,3==this.clickCount&&(fh.purgeMessages(),Yu.debug=!Yu.debug,this.debugBox.style.visibility=Yu.debug?"visible":"hidden",this.debugBox.style.pointerEvents=Yu.debug?"auto":"none")):this.clickCount=1,void(this.lastClickTime=e)}}s?this.updatingMedia?fh.debug("Already switching media"):(fh.debug("Switching media, direction ".concat(s)),this.mediaListDirection!=s?this.switchMediaDirection(s):this.switchActiveMedia("user_action")):t&&!Yu.stop_screensaver_on_mouse_click||(this.blockEventsUntil=n+1e3*Yu.control_reactivation_time,this.stopScreensaver(Yu.fade_out_time_interaction))}}customElements.get("wallpanel-view-container")||customElements.define("wallpanel-view-container",r),customElements.get("wallpanel-view")||customElements.define("wallpanel-view",i),Ju=document.createElement("wallpanel-view-container"),Qu=document.createElement("wallpanel-view"),Ju.appendChild(Qu),oh.shadowRoot.appendChild(Ju)}function kh(){fh.debug("activateWallpanel");let e=Yu.hide_toolbar,t=Yu.hide_toolbar_action_icons;if(e&&!Yu.hide_toolbar_on_subviews&&$u){const n=Eh();if(n&&n.lovelace&&n.lovelace.rawConfig&&n.lovelace.rawConfig.views)for(let r=0;r<n.lovelace.rawConfig.views.length;r++)if(n.lovelace.rawConfig.views[r].path==$u){n.lovelace.rawConfig.views[r].subview&&(fh.debug("Current tab '".concat($u,"' is a subview, not hiding toolbar")),e=!1,t=!1);break}}Ch(e,t),Sh(Yu.hide_sidebar),Yu.fullscreen&&!Ih()&&Th()}function Oh(){fh.debug("deactivateWallpanel"),Qu.screensaverRunning()&&Qu.stopScreensaver(),Ch(!1,!1),Sh(!1),!Yu.keep_fullscreen&&Ih()&&(fh.debug("Exit fullscreen"),document.exitFullscreen?document.exitFullscreen().then(()=>{fh.debug("Successfully exited fullscreen")},e=>{fh.debug("Failed to exit fullscreen:",e)}):document.mozCancelFullScreen?document.mozCancelFullScreen():document.msRequestFullscreen?document.msRequestFullscreen():document.webkitExitFullscreen&&document.webkitExitFullscreen())}function Ph(){Xu&&$u?(yh(),bh()?kh():Oh()):Oh()}function Mh(){if(fh.debug("Location changed from '".concat(Vu,"' to '").concat(window.location.href,"'")),window.location.href==Vu)return;Vu=window.location.href,Qu&&Qu.screensaverRunning&&Qu.screensaverRunning()&&Yu.stop_screensaver_on_location_change&&(Zu?(Zu=!1,Qu.screensaverStopNavigationPathTimeout&&clearTimeout(Qu.screensaverStopNavigationPathTimeout)):Qu.stopScreensaver());let e=null,t=null;const n=window.location.pathname.split("/");n.length>1&&(e=n[1],n.length>2&&(t=n[2]));const r=Xu&&e!=Xu;Xu=e,$u=t,r?(fh.debug("Reset dashboard config"),qu={},Lh(Ph)):Ph()}function Lh(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const n=Date.now();null===t&&(t=n);const r=(n-t)/1e3;if(ih=document.querySelector("body > home-assistant"),ih&&ih.shadowRoot&&(oh=ih.shadowRoot.querySelector("home-assistant-main")),!ih||!ih.shadowRoot||!oh)return r>=5?void fh.error("Wallpanel startup failed after ".concat(r," seconds, element home-assistant / home-assistant-main not found.")):void setTimeout(Lh,100,e,t);const i=Eh();if(!(i&&i.lovelace&&i.lovelace.config&&i.lovelace.config))return r>=5?void fh.info("No lovelace config found after ".concat(r," seconds")):void setTimeout(Lh,100,e,t);if(!customElements.get("hui-view"))return r>=5?void fh.error("Wallpanel startup failed after ".concat(r," seconds, hui-view not found.")):void setTimeout(Lh,100,e,t);if(!window.browser_mod){let n=xh(["wait_for_browser_mod_time"]).wait_for_browser_mod_time;if(void 0===n&&(n=Hu.wait_for_browser_mod_time),r<n)return void setTimeout(Lh,100,e,t)}window.browser_mod&&(window.browser_mod.entity_id?ah=window.browser_mod.entity_id:window.browser_mod.browserID&&(ah=window.browser_mod.browserID.replace("-","_"))),e()}console.info("%c🖼️ Wallpanel version ".concat(zu),"color: #34b6f9; font-weight: bold;");try{Lh(function(){const e=(ih.hass||ih.__hass).user;sh=e.id,ch=e.username||null,lh=e.name,fh.debug("userId: ".concat(sh,", userName: ").concat(ch,", userDisplayname: ").concat(lh)),yh(),Rh(),window.addEventListener("location-changed",e=>{let t=null;try{t=e.target.location.href}catch(e){fh.debug(e)}fh.debug("location-changed",t,e),setTimeout(Mh,20)}),window.navigation&&window.navigation.addEventListener("navigate",e=>{let t=null;try{t=e.destination.url}catch(e){fh.debug(e)}fh.debug("navigate",t,e),setTimeout(Mh,30)}),(ih.hass||ih.__hass).connection.subscribeEvents(function(e){fh.debug("lovelace_updated",e),(e.data.url_path?e.data.url_path:"lovelace")==Xu&&(ih.hass||ih.__hass).connection.sendMessagePromise({type:"lovelace/config",url_path:e.data.url_path}).then(e=>{if(qu={},e.wallpanel)for(const t in e.wallpanel)(t in Hu||t in Gu)&&(qu[t]=e.wallpanel[t]);Ph()})},"lovelace_updated"),setTimeout(Mh,0)})}catch(e){fh.error(e.stack)}var Bh=!1,Uh=function(e){return e instanceof Uh?e:this instanceof Uh?void(this.EXIFwrapped=e):new Uh(e)},Dh=Uh.Tags={36864:"ExifVersion",40960:"FlashpixVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",37121:"ComponentsConfiguration",37122:"CompressedBitsPerPixel",37500:"MakerNote",37510:"UserComment",40964:"RelatedSoundFile",36867:"DateTimeOriginal",36868:"DateTimeDigitized",37520:"SubsecTime",37521:"SubsecTimeOriginal",37522:"SubsecTimeDigitized",33434:"ExposureTime",33437:"FNumber",34850:"ExposureProgram",34852:"SpectralSensitivity",34855:"ISOSpeedRatings",34856:"OECF",37377:"ShutterSpeedValue",37378:"ApertureValue",37379:"BrightnessValue",37380:"ExposureBias",37381:"MaxApertureValue",37382:"SubjectDistance",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37396:"SubjectArea",37386:"FocalLength",41483:"FlashEnergy",41484:"SpatialFrequencyResponse",41486:"FocalPlaneXResolution",41487:"FocalPlaneYResolution",41488:"FocalPlaneResolutionUnit",41492:"SubjectLocation",41493:"ExposureIndex",41495:"SensingMethod",41728:"FileSource",41729:"SceneType",41730:"CFAPattern",41985:"CustomRendered",41986:"ExposureMode",41987:"WhiteBalance",41988:"DigitalZoomRation",41989:"FocalLengthIn35mmFilm",41990:"SceneCaptureType",41991:"GainControl",41992:"Contrast",41993:"Saturation",41994:"Sharpness",41995:"DeviceSettingDescription",41996:"SubjectDistanceRange",40965:"InteroperabilityIFDPointer",42016:"ImageUniqueID"},Fh=Uh.TiffTags={256:"ImageWidth",257:"ImageHeight",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer",40965:"InteroperabilityIFDPointer",258:"BitsPerSample",259:"Compression",262:"PhotometricInterpretation",274:"Orientation",277:"SamplesPerPixel",284:"PlanarConfiguration",530:"YCbCrSubSampling",531:"YCbCrPositioning",282:"XResolution",283:"YResolution",296:"ResolutionUnit",273:"StripOffsets",278:"RowsPerStrip",279:"StripByteCounts",513:"JPEGInterchangeFormat",514:"JPEGInterchangeFormatLength",301:"TransferFunction",318:"WhitePoint",319:"PrimaryChromaticities",529:"YCbCrCoefficients",532:"ReferenceBlackWhite",306:"DateTime",270:"ImageDescription",271:"Make",272:"Model",305:"Software",315:"Artist",33432:"Copyright"},Nh=Uh.GPSTags={0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude",5:"GPSAltitudeRef",6:"GPSAltitude",7:"GPSTimeStamp",8:"GPSSatellites",9:"GPSStatus",10:"GPSMeasureMode",11:"GPSDOP",12:"GPSSpeedRef",13:"GPSSpeed",14:"GPSTrackRef",15:"GPSTrack",16:"GPSImgDirectionRef",17:"GPSImgDirection",18:"GPSMapDatum",19:"GPSDestLatitudeRef",20:"GPSDestLatitude",21:"GPSDestLongitudeRef",22:"GPSDestLongitude",23:"GPSDestBearingRef",24:"GPSDestBearing",25:"GPSDestDistanceRef",26:"GPSDestDistance",27:"GPSProcessingMethod",28:"GPSAreaInformation",29:"GPSDateStamp",30:"GPSDifferential"},Wh=Uh.IFD1Tags={256:"ImageWidth",257:"ImageHeight",258:"BitsPerSample",259:"Compression",262:"PhotometricInterpretation",273:"StripOffsets",274:"Orientation",277:"SamplesPerPixel",278:"RowsPerStrip",279:"StripByteCounts",282:"XResolution",283:"YResolution",284:"PlanarConfiguration",296:"ResolutionUnit",513:"JpegIFOffset",514:"JpegIFByteCount",529:"YCbCrCoefficients",530:"YCbCrSubSampling",531:"YCbCrPositioning",532:"ReferenceBlackWhite"},jh=Uh.StringValues={ExposureProgram:{0:"Not defined",1:"Manual",2:"Normal program",3:"Aperture priority",4:"Shutter priority",5:"Creative program",6:"Action program",7:"Portrait mode",8:"Landscape mode"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{0:"Unknown",1:"Daylight",2:"Fluorescent",3:"Tungsten (incandescent light)",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 - 5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},SensingMethod:{1:"Not defined",2:"One-chip color area sensor",3:"Two-chip color area sensor",4:"Three-chip color area sensor",5:"Color sequential area sensor",7:"Trilinear sensor",8:"Color sequential linear sensor"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},SceneType:{1:"Directly photographed"},CustomRendered:{0:"Normal process",1:"Custom process"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},GainControl:{0:"None",1:"Low gain up",2:"High gain up",3:"Low gain down",4:"High gain down"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},SubjectDistanceRange:{0:"Unknown",1:"Macro",2:"Close view",3:"Distant view"},FileSource:{3:"DSC"},Components:{0:"",1:"Y",2:"Cb",3:"Cr",4:"R",5:"G",6:"B"}};function zh(e){return!!e.exifdata}function Hh(e,t){function n(n){var r=Gh(n);e.exifdata=r||{};var i=function(e){var t=new DataView(e);if(255!=t.getUint8(0)||216!=t.getUint8(1))return!1;var n=2,r=e.byteLength,i=function(e,t){return 56===e.getUint8(t)&&66===e.getUint8(t+1)&&73===e.getUint8(t+2)&&77===e.getUint8(t+3)&&4===e.getUint8(t+4)&&4===e.getUint8(t+5)};for(;n<r;){if(i(t,n)){var o=t.getUint8(n+7);return o%2!=0&&(o+=1),0===o&&(o=4),Yh(e,n+8+o,t.getUint16(n+6+o))}n++}}(n);if(e.iptcdata=i||{},Uh.isXmpEnabled){var o=function(e){if(!("DOMParser"in self))return;var t=new DataView(e);if(255!=t.getUint8(0)||216!=t.getUint8(1))return!1;var n=2,r=e.byteLength,i=new DOMParser;for(;n<r-4;){if("http"==$h(t,n,4)){var o=n-1,a=t.getUint16(n-2)-1,s=$h(t,o,a),c=s.indexOf("xmpmeta>")+8,l=(s=s.substring(s.indexOf("<x:xmpmeta"),c)).indexOf("x:xmpmeta")+10;return s=s.slice(0,l)+'xmlns:Iptc4xmpCore="http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tiff="http://ns.adobe.com/tiff/1.0/" xmlns:plus="http://schemas.android.com/apk/lib/com.google.android.gms.plus" xmlns:ext="http://www.gettyimages.com/xsltExtension/1.0" xmlns:exif="http://ns.adobe.com/exif/1.0/" xmlns:stEvt="http://ns.adobe.com/xap/1.0/sType/ResourceEvent#" xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#" xmlns:crs="http://ns.adobe.com/camera-raw-settings/1.0/" xmlns:xapGImg="http://ns.adobe.com/xap/1.0/g/img/" xmlns:Iptc4xmpExt="http://iptc.org/std/Iptc4xmpExt/2008-02-29/" '+s.slice(l),Zh(i.parseFromString(s,"text/xml"))}n++}}(n);e.xmpdata=o||{}}t&&t.call(e)}if(e.src)if(/^data:/i.test(e.src))n(function(e){e=e.replace(/^data:([^;]+);base64,/gim,"");for(var t=atob(e),n=t.length,r=new ArrayBuffer(n),i=new Uint8Array(r),o=0;o<n;o++)i[o]=t.charCodeAt(o);return r}(e.src));else if(/^blob:/i.test(e.src)){var r=new FileReader;r.onload=function(e){n(e.target.result)},function(e,t){var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="blob",n.onload=function(){200!=this.status&&0!==this.status||t(this.response)},n.send()}(e.src,function(e){r.readAsArrayBuffer(e)})}else{var i=new XMLHttpRequest;i.onload=function(){200==this.status||0===this.status?(n(i.response),i=null):fh.error("Could not load image")},i.open("GET",e.src,!0),i.responseType="arraybuffer",i.send(null)}else if(self.FileReader&&(e instanceof self.Blob||e instanceof self.File)){var o=new FileReader;o.onload=function(e){n(e.target.result)},o.readAsArrayBuffer(e)}}function Gh(e){var t=new DataView(e);if(255!=t.getUint8(0)||216!=t.getUint8(1))return!1;for(var n=2,r=e.byteLength;n<r;){if(255!=t.getUint8(n))return!1;if(225==t.getUint8(n+1))return Jh(t,n+4,t.getUint16(n+2));n+=2+t.getUint16(n+2)}}var qh={25:"keywords",55:"dateCreated",80:"byline",85:"bylineTitle",90:"city",92:"sublocation",94:"state",100:"countryCode",101:"countryName",103:"OriginalTransmissionReference",105:"headline",109:"credit",110:"credit",116:"copyright",118:"contact",120:"caption",122:"captionWriter",125:"rasterizedCaption",130:"imageType",131:"imageOrientation",135:"languageID",150:"audioType",151:"audioSamplingRate",152:"audioSamplingRes",153:"audioDuration",154:"audioOutcue",200:"previewFileFormat",201:"previewFileFormatVer",202:"previewData",15:"category"};function Yh(e,t,n){for(var r,i,o,a,s=new DataView(e),c={},l=t;l<t+n;)28===s.getUint8(l)&&2===s.getUint8(l+1)&&(a=s.getUint8(l+2))in qh&&(o=s.getInt16(l+3),i=qh[a],r=$h(s,l+5,o),Object.prototype.hasOwnProperty.call(c,i)?c[i]instanceof Array?c[i].push(r):c[i]=[c[i],r]:c[i]=r),l++;return c}function Vh(e,t,n,r,i){var o,a,s,c=e.getUint16(n,!i),l={};for(s=0;s<c;s++)o=n+12*s+2,!(a=r[e.getUint16(o,!i)])&&Bh&&fh.log("Unknown tag: "+e.getUint16(o,!i)),l[a]=Xh(e,o,t,n,i);return l}function Xh(e,t,n,r,i){var o,a,s,c,l,u,h=e.getUint16(t+2,!i),f=e.getUint32(t+4,!i),d=e.getUint32(t+8,!i)+n;switch(h){case 1:case 7:if(1==f)return e.getUint8(t+8,!i);for(o=f>4?d:t+8,a=[],c=0;c<f;c++)a[c]=e.getUint8(o+c);return a;case 2:return $h(e,o=f>4?d:t+8,f-1);case 3:if(1==f)return e.getUint16(t+8,!i);for(o=f>2?d:t+8,a=[],c=0;c<f;c++)a[c]=e.getUint16(o+2*c,!i);return a;case 4:if(1==f)return e.getUint32(t+8,!i);for(a=[],c=0;c<f;c++)a[c]=e.getUint32(d+4*c,!i);return a;case 5:if(1==f)return l=e.getUint32(d,!i),u=e.getUint32(d+4,!i),(s=new Number(l/u)).numerator=l,s.denominator=u,s;for(a=[],c=0;c<f;c++)l=e.getUint32(d+8*c,!i),u=e.getUint32(d+4+8*c,!i),a[c]=new Number(l/u),a[c].numerator=l,a[c].denominator=u;return a;case 9:if(1==f)return e.getInt32(t+8,!i);for(a=[],c=0;c<f;c++)a[c]=e.getInt32(d+4*c,!i);return a;case 10:if(1==f)return e.getInt32(d,!i)/e.getInt32(d+4,!i);for(a=[],c=0;c<f;c++)a[c]=e.getInt32(d+8*c,!i)/e.getInt32(d+4+8*c,!i);return a}}function $h(e,t,n){for(var r=[],i=0,o=t;o<t+n;o++)r[i]="0x"+e.getUint8(o).toString(16),i++;return function(e){var t,n,r,i,o,a;t="",r=e.length,n=0;for(;n<r;)switch((i=e[n++])>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:t+=String.fromCharCode(i);break;case 12:case 13:o=e[n++],t+=String.fromCharCode((31&i)<<6|63&o);break;case 14:o=e[n++],a=e[n++],t+=String.fromCharCode((15&i)<<12|(63&o)<<6|63&a)}return t}(r)}function Jh(e,t){if("Exif"!=$h(e,t,4))return!1;var n,r,i,o,a,s=t+6;if(18761==e.getUint16(s))n=!1;else{if(19789!=e.getUint16(s))return!1;n=!0}if(42!=e.getUint16(s+2,!n))return!1;var c=e.getUint32(s+4,!n);if(c<8)return!1;if((r=Vh(e,s,s+c,Fh,n)).ExifIFDPointer)for(i in o=Vh(e,s,s+r.ExifIFDPointer,Dh,n)){switch(i){case"LightSource":case"Flash":case"MeteringMode":case"ExposureProgram":case"SensingMethod":case"SceneCaptureType":case"SceneType":case"CustomRendered":case"WhiteBalance":case"GainControl":case"Contrast":case"Saturation":case"Sharpness":case"SubjectDistanceRange":case"FileSource":o[i]=jh[i][o[i]];break;case"ExifVersion":case"FlashpixVersion":o[i]=String.fromCharCode(o[i][0],o[i][1],o[i][2],o[i][3]);break;case"ComponentsConfiguration":o[i]=jh.Components[o[i][0]]+jh.Components[o[i][1]]+jh.Components[o[i][2]]+jh.Components[o[i][3]]}r[i]=o[i]}if(r.GPSInfoIFDPointer)for(i in a=Vh(e,s,s+r.GPSInfoIFDPointer,Nh,n)){if("GPSVersionID"==i)try{a[i]=a[i][0]+"."+a[i][1]+"."+a[i][2]+"."+a[i][3]}catch(e){}r[i]=a[i]}return r.thumbnail=function(e,t,n,r){var i=function(e,t,n){var r=e.getUint16(t,!n);return e.getUint32(t+2+12*r,!n)}(e,t+n,r);if(!i)return{};if(i>e.byteLength)return{};var o=Vh(e,t,t+i,Wh,r);if(o.Compression)switch(o.Compression){case 6:if(o.JpegIFOffset&&o.JpegIFByteCount){var a=t+o.JpegIFOffset,s=o.JpegIFByteCount;o.blob=new Blob([new Uint8Array(e.buffer,a,s)],{type:"image/jpeg"})}break;case 1:fh.log("Thumbnail image format is TIFF, which is not implemented.");break;default:fh.log("Unknown thumbnail image format '%s'",o.Compression)}else 2==o.PhotometricInterpretation&&fh.log("Thumbnail image format is RGB, which is not implemented.");return o}(e,s,c,n),r}function Qh(e){var t={};if(1==e.nodeType){if(e.attributes.length>0){t["@attributes"]={};for(var n=0;n<e.attributes.length;n++){var r=e.attributes.item(n);t["@attributes"][r.nodeName]=r.nodeValue}}}else if(3==e.nodeType)return e.nodeValue;if(e.hasChildNodes())for(var i=0;i<e.childNodes.length;i++){var o=e.childNodes.item(i),a=o.nodeName;if(null==t[a])t[a]=Qh(o);else{if(null==t[a].push){var s=t[a];t[a]=[],t[a].push(s)}t[a].push(Qh(o))}}return t}function Zh(e){try{var t={};if(e.children.length>0)for(var n=0;n<e.children.length;n++){var r=e.children.item(n),i=r.attributes;for(var o in i){var a=i[o],s=a.nodeName,c=a.nodeValue;void 0!==s&&(t[s]=c)}var l=r.nodeName;if(void 0===t[l])t[l]=Qh(r);else{if(void 0===t[l].push){var u=t[l];t[l]=[],t[l].push(u)}t[l].push(Qh(r))}}else t=e.textContent;return t}catch(e){fh.log(e.message)}}Uh.enableXmp=function(){Uh.isXmpEnabled=!0},Uh.disableXmp=function(){Uh.isXmpEnabled=!1},Uh.getData=function(e,t){return!((self.Image&&e instanceof self.Image||self.HTMLImageElement&&e instanceof self.HTMLImageElement)&&!e.complete)&&(zh(e)?t&&t.call(e):Hh(e,t),!0)},Uh.getTag=function(e,t){if(zh(e))return e.exifdata[t]},Uh.getIptcTag=function(e,t){if(zh(e))return e.iptcdata[t]},Uh.getAllTags=function(e){if(!zh(e))return{};var t,n=e.exifdata,r={};for(t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=n[t]);return r},Uh.getAllIptcTags=function(e){if(!zh(e))return{};var t,n=e.iptcdata,r={};for(t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=n[t]);return r},Uh.ConvertDMSToDD=function(e,t,n,r){var i=e+t/60+n/3600;return"S"!=r&&"W"!=r||(i*=-1),i},Uh.pretty=function(e){if(!zh(e))return"";var t,n=e.exifdata,r="";for(t in n)Object.prototype.hasOwnProperty.call(n,t)&&("object"==typeof n[t]?n[t]instanceof Number?r+=t+" : "+n[t]+" ["+n[t].numerator+"/"+n[t].denominator+"]\r\n":r+=t+" : ["+n[t].length+" values]\r\n":r+=t+" : "+n[t]+"\r\n");return r},Uh.readFromBinaryFile=function(e){return Gh(e)}}();