3 lines
No EOL
22 KiB
JavaScript
3 lines
No EOL
22 KiB
JavaScript
/*! For license information please see 7765.Pjs8utIBMys.js.LICENSE.txt */
|
|
"use strict";(self.webpackChunkhacs_frontend=self.webpackChunkhacs_frontend||[]).push([[7765],{52996:function(t,e,n){n.d(e,{p:function(){return r}});n(40271),n(60163);var r=function(t,e){return t&&t.config.components.includes(e)}},92295:function(t,e,n){var r,i=n(88962),a=n(33368),o=n(71650),c=n(68308),s=n(82390),l=n(69205),u=n(91808),d=(n(97393),n(14271)),h=n(5095),f=n(95260),p=n(3712);(0,u.Z)([(0,f.Mo)("ha-button")],(function(t,e){var n=function(e){function n(){var e;(0,o.Z)(this,n);for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return e=(0,c.Z)(this,n,[].concat(i)),t((0,s.Z)(e)),e}return(0,l.Z)(n,e),(0,a.Z)(n)}(e);return{F:n,d:[{kind:"field",static:!0,key:"styles",value:function(){return[p.W,(0,h.iv)(r||(r=(0,i.Z)(["::slotted([slot=icon]){margin-inline-start:0px;margin-inline-end:8px;direction:var(--direction);display:block}.mdc-button{height:var(--button-height,36px)}.trailing-icon{display:flex}.slot-container{overflow:var(--button-slot-container-overflow,visible)}"])))]}}]}}),d.z)},41911:function(t,e,n){var r,i=n(88962),a=n(99312),o=n(81043),c=n(33368),s=n(71650),l=n(68308),u=n(82390),d=n(69205),h=n(91808),f=n(34541),p=n(47838),m=(n(97393),n(5095)),g=n(63335),v=n(21270),y=n(96762),_=n(95260),b=n(18394);(0,h.Z)([(0,_.Mo)("ha-check-list-item")],(function(t,e){var n,h=function(e){function n(){var e;(0,s.Z)(this,n);for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return e=(0,l.Z)(this,n,[].concat(i)),t((0,u.Z)(e)),e}return(0,d.Z)(n,e),(0,c.Z)(n)}(e);return{F:h,d:[{kind:"method",key:"onChange",value:(n=(0,o.Z)((0,a.Z)().mark((function t(e){return(0,a.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:(0,f.Z)((0,p.Z)(h.prototype),"onChange",this).call(this,e),(0,b.B)(this,e.type);case 2:case"end":return t.stop()}}),t,this)}))),function(t){return n.apply(this,arguments)})},{kind:"field",static:!0,key:"styles",value:function(){return[y.W,v.W,(0,m.iv)(r||(r=(0,i.Z)([":host{--mdc-theme-secondary:var(--primary-color)}:host([graphic=avatar]) .mdc-deprecated-list-item__graphic,:host([graphic=control]) .mdc-deprecated-list-item__graphic,:host([graphic=large]) .mdc-deprecated-list-item__graphic,:host([graphic=medium]) .mdc-deprecated-list-item__graphic{margin-inline-end:var(--mdc-list-item-graphic-margin,16px);margin-inline-start:0px;direction:var(--direction)}.mdc-deprecated-list-item__meta{flex-shrink:0;direction:var(--direction);margin-inline-start:auto;margin-inline-end:0}.mdc-deprecated-list-item__graphic{margin-top:var(--check-list-item-graphic-margin-top)}"])))]}}]}}),g.F)},29708:function(t,e,n){var r,i,a=n(88962),o=n(33368),c=n(71650),s=n(68308),l=n(82390),u=n(69205),d=n(91808),h=(n(97393),n(5095)),f=n(95260);n(37662),(0,d.Z)([(0,f.Mo)("ha-tip")],(function(t,e){var n=function(e){function n(){var e;(0,c.Z)(this,n);for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return e=(0,s.Z)(this,n,[].concat(i)),t((0,l.Z)(e)),e}return(0,u.Z)(n,e),(0,o.Z)(n)}(e);return{F:n,d:[{kind:"field",decorators:[(0,f.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"method",key:"render",value:function(){return this.hass?(0,h.dy)(r||(r=(0,a.Z)([' <ha-svg-icon .path="','"></ha-svg-icon> <span class="prefix">','</span> <span class="text"><slot></slot></span> '])),"M12,2A7,7 0 0,1 19,9C19,11.38 17.81,13.47 16,14.74V17A1,1 0 0,1 15,18H9A1,1 0 0,1 8,17V14.74C6.19,13.47 5,11.38 5,9A7,7 0 0,1 12,2M9,21V20H15V21A1,1 0 0,1 14,22H10A1,1 0 0,1 9,21M12,4A5,5 0 0,0 7,9C7,11.05 8.23,12.81 10,13.58V16H14V13.58C15.77,12.81 17,11.05 17,9A5,5 0 0,0 12,4Z",this.hass.localize("ui.panel.config.tips.tip")):h.Ld}},{kind:"field",static:!0,key:"styles",value:function(){return(0,h.iv)(i||(i=(0,a.Z)([":host{display:block;text-align:center}.text{direction:var(--direction);margin-left:2px;margin-inline-start:2px;margin-inline-end:initial;color:var(--secondary-text-color)}.prefix{font-weight:500}"])))}}]}}),h.oi)},77765:function(t,e,n){function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function i(){i=function(){return e};var t,e={},n=Object.prototype,a=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},c="function"==typeof Symbol?Symbol:{},s=c.iterator||"@@iterator",l=c.asyncIterator||"@@asyncIterator",u=c.toStringTag||"@@toStringTag";function d(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{d({},"")}catch(t){d=function(t,e,n){return t[e]=n}}function h(t,e,n,r){var i=e&&e.prototype instanceof _?e:_,a=Object.create(i.prototype),c=new j(r||[]);return o(a,"_invoke",{value:A(t,n,c)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var p="suspendedStart",m="suspendedYield",g="executing",v="completed",y={};function _(){}function b(){}function k(){}var w={};d(w,s,(function(){return this}));var x=Object.getPrototypeOf,Z=x&&x(x(M([])));Z&&Z!==n&&a.call(Z,s)&&(w=Z);var L=k.prototype=_.prototype=Object.create(w);function E(t){["next","throw","return"].forEach((function(e){d(t,e,(function(t){return this._invoke(e,t)}))}))}function I(t,e){function n(i,o,c,s){var l=f(t[i],t,o);if("throw"!==l.type){var u=l.arg,d=u.value;return d&&"object"==r(d)&&a.call(d,"__await")?e.resolve(d.__await).then((function(t){n("next",t,c,s)}),(function(t){n("throw",t,c,s)})):e.resolve(d).then((function(t){u.value=t,c(u)}),(function(t){return n("throw",t,c,s)}))}s(l.arg)}var i;o(this,"_invoke",{value:function(t,r){function a(){return new e((function(e,i){n(t,r,e,i)}))}return i=i?i.then(a,a):a()}})}function A(e,n,r){var i=p;return function(a,o){if(i===g)throw new Error("Generator is already running");if(i===v){if("throw"===a)throw o;return{value:t,done:!0}}for(r.method=a,r.arg=o;;){var c=r.delegate;if(c){var s=C(c,r);if(s){if(s===y)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===p)throw i=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=g;var l=f(e,n,r);if("normal"===l.type){if(i=r.done?v:m,l.arg===y)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=v,r.method="throw",r.arg=l.arg)}}}function C(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,C(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var a=f(i,e.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,y;var o=a.arg;return o?o.done?(n[e.resultName]=o.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,y):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function z(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function M(e){if(e||""===e){var n=e[s];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(a.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}throw new TypeError(r(e)+" is not iterable")}return b.prototype=k,o(L,"constructor",{value:k,configurable:!0}),o(k,"constructor",{value:b,configurable:!0}),b.displayName=d(k,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===b||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,k):(t.__proto__=k,d(t,u,"GeneratorFunction")),t.prototype=Object.create(L),t},e.awrap=function(t){return{__await:t}},E(I.prototype),d(I.prototype,l,(function(){return this})),e.AsyncIterator=I,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var o=new I(h(t,n,r,i),a);return e.isGeneratorFunction(n)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},E(L),d(L,u,"Generator"),d(L,s,(function(){return this})),d(L,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=M,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(z),!e)for(var n in this)"t"===n.charAt(0)&&a.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function r(r,i){return c.type="throw",c.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],c=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var s=a.call(o,"catchLoc"),l=a.call(o,"finallyLoc");if(s&&l){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&a.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),z(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;z(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:M(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),y}},e}function a(t,e,n,r,i,a,o){try{var c=t[a](o),s=c.value}catch(l){return void n(l)}c.done?e(s):Promise.resolve(s).then(r,i)}n.a(t,function(){var t,r=(t=i().mark((function t(r,a){var o,c,s,l,u,d,h,f,p,m,g,v,y,_,b,k,w,x,Z,L,E,I,A,C,S,z,j,M,O,H,V,F,B,P,D,N,G;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,n.r(e),o=n(99312),c=n(81043),s=n(88962),l=n(33368),u=n(71650),d=n(68308),h=n(82390),f=n(69205),p=n(91808),n(97393),n(51358),n(46798),n(78399),n(5239),n(56086),n(47884),n(81912),n(64584),n(41483),n(12367),n(9454),n(98490),n(87438),n(9849),n(22890),n(50289),n(94167),n(36513),n(47084),n(46349),n(85717),n(70320),m=n(62434),n(61641),n(44577),g=n(5095),v=n(95260),y=n(99266),_=n(18394),b=n(51750),k=n(78889),w=n(23469),x=n(11285),Z=n(29950),n(92295),n(41911),n(7006),n(9828),n(78680),n(37662),n(29708),L=n(15758),n(86986),E=n(52996),!(I=r([L])).then){t.next=87;break}return t.next=83,I;case 83:t.t1=t.sent,t.t0=(0,t.t1)(),t.next=88;break;case 87:t.t0=I;case 88:L=t.t0[0],G="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z",(0,p.Z)([(0,v.Mo)("dialog-media-manage")],(function(t,e){var n,r,i=function(e){function n(){var e;(0,u.Z)(this,n);for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return e=(0,d.Z)(this,n,[].concat(i)),t((0,h.Z)(e)),e}return(0,f.Z)(n,e),(0,l.Z)(n)}(e);return{F:i,d:[{kind:"field",decorators:[(0,v.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,v.SB)()],key:"_currentItem",value:void 0},{kind:"field",decorators:[(0,v.SB)()],key:"_params",value:void 0},{kind:"field",decorators:[(0,v.SB)()],key:"_uploading",value:function(){return!1}},{kind:"field",decorators:[(0,v.SB)()],key:"_deleting",value:function(){return!1}},{kind:"field",decorators:[(0,v.SB)()],key:"_selected",value:function(){return new Set}},{kind:"field",key:"_filesChanged",value:function(){return!1}},{kind:"method",key:"showDialog",value:function(t){this._params=t,this._refreshMedia()}},{kind:"method",key:"closeDialog",value:function(){this._filesChanged&&this._params.onClose&&this._params.onClose(),this._params=void 0,this._currentItem=void 0,this._uploading=!1,this._deleting=!1,this._filesChanged=!1,(0,_.B)(this,"dialog-closed",{dialog:this.localName})}},{kind:"method",key:"render",value:function(){var t,e,n=this;if(!this._params)return g.Ld;var r=(null===(t=this._currentItem)||void 0===t||null===(t=t.children)||void 0===t?void 0:t.filter((function(t){return!t.can_expand})))||[],i=0;return(0,g.dy)(A||(A=(0,s.Z)([' <ha-dialog open scrimClickAction escapeKeyAction hideActions flexContent .heading="','" @closed="','"> <ha-dialog-header slot="heading"> '," </ha-dialog-header> "," "," </ha-dialog> "])),this._params.currentItem.title,this.closeDialog,0===this._selected.size?(0,g.dy)(C||(C=(0,s.Z)([' <span slot="title"> ',' </span> <ha-media-upload-button .disabled="','" .hass="','" .currentItem="','" @uploading="','" @media-refresh="','" slot="actionItems"></ha-media-upload-button> '," "])),this.hass.localize("ui.components.media-browser.file_management.title"),this._deleting,this.hass,this._params.currentItem,this._startUploading,this._doneUploading,this._uploading?"":(0,g.dy)(S||(S=(0,s.Z)([' <ha-icon-button .label="','" .path="','" dialogAction="close" slot="navigationIcon" dir="','"></ha-icon-button> '])),this.hass.localize("ui.dialogs.generic.close"),G,(0,b.Zu)(this.hass))):(0,g.dy)(z||(z=(0,s.Z)([' <ha-button class="danger" slot="title" .disabled="','" .label="','" @click="','"> <ha-svg-icon .path="','" slot="icon"></ha-svg-icon> </ha-button> '," "])),this._deleting,this.hass.localize("ui.components.media-browser.file_management.".concat(this._deleting?"deleting":"delete"),{count:this._selected.size}),this._handleDelete,"M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",this._deleting?"":(0,g.dy)(j||(j=(0,s.Z)([' <ha-button slot="actionItems" .label="','" @click="','"> <ha-svg-icon .path="','" slot="icon"></ha-svg-icon> </ha-button> '])),"Deselect all",this._handleDeselectAll,G)),this._currentItem?r.length?(0,g.dy)(V||(V=(0,s.Z)([' <mwc-list multi @selected="','"> '," </mwc-list> "])),this._handleSelected,(0,y.r)(r,(function(t){return t.media_content_id}),(function(t){var e=(0,g.dy)(F||(F=(0,s.Z)([' <ha-svg-icon slot="graphic" .path="','"></ha-svg-icon> '])),k.Fn["directory"===t.media_class&&t.children_media_class||t.media_class].icon);return(0,g.dy)(B||(B=(0,s.Z)([" <ha-check-list-item ",' graphic="icon" .disabled="','" .selected="','" .item="','"> '," "," </ha-check-list-item> "])),(0,m.jt)({id:t.media_content_id,skipInitial:!0}),n._uploading||n._deleting,n._selected.has(i++),t,e,t.title)}))):(0,g.dy)(O||(O=(0,s.Z)(['<div class="no-items"> <p> '," </p> "," </div>"])),this.hass.localize("ui.components.media-browser.file_management.no_items"),null!==(e=this._currentItem)&&void 0!==e&&null!==(e=e.children)&&void 0!==e&&e.length?(0,g.dy)(H||(H=(0,s.Z)(['<span class="folders">',"</span>"])),this.hass.localize("ui.components.media-browser.file_management.folders_not_supported")):""):(0,g.dy)(M||(M=(0,s.Z)([' <div class="refresh"> <ha-circular-progress indeterminate></ha-circular-progress> </div> ']))),(0,E.p)(this.hass,"hassio")?(0,g.dy)(P||(P=(0,s.Z)(['<ha-tip .hass="','"> '," </ha-tip>"])),this.hass,this.hass.localize("ui.components.media-browser.file_management.tip_media_storage",{storage:(0,g.dy)(D||(D=(0,s.Z)(['<a href="/config/storage" @click="','"> '," </a>"])),this.closeDialog,this.hass.localize("ui.components.media-browser.file_management.tip_storage_panel").toLowerCase())})):g.Ld)}},{kind:"method",key:"_handleSelected",value:function(t){this._selected=t.detail.index}},{kind:"method",key:"_startUploading",value:function(){this._uploading=!0,this._filesChanged=!0}},{kind:"method",key:"_doneUploading",value:function(){this._uploading=!1,this._refreshMedia()}},{kind:"method",key:"_handleDeselectAll",value:function(){this._selected.size&&(this._selected=new Set)}},{kind:"method",key:"_handleDelete",value:(r=(0,c.Z)((0,o.Z)().mark((function t(){var e,n,r=this;return(0,o.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,x.g7)(this,{text:this.hass.localize("ui.components.media-browser.file_management.confirm_delete",{count:this._selected.size}),warning:!0});case 2:if(t.sent){t.next=4;break}return t.abrupt("return");case 4:return this._filesChanged=!0,this._deleting=!0,e=[],n=0,this._currentItem.children.forEach((function(t){t.can_expand||r._selected.has(n++)&&e.push(t)})),t.prev=9,t.next=12,Promise.all(e.map(function(){var t=(0,c.Z)((0,o.Z)().mark((function t(e){return(0,o.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,w.Qr)(r.hass,e.media_content_id);case 2:r._currentItem=Object.assign(Object.assign({},r._currentItem),{},{children:r._currentItem.children.filter((function(t){return t!==e}))});case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 12:return t.prev=12,this._deleting=!1,this._selected=new Set,t.finish(12);case 16:case"end":return t.stop()}}),t,this,[[9,,12,16]])}))),function(){return r.apply(this,arguments)})},{kind:"method",key:"_refreshMedia",value:(n=(0,c.Z)((0,o.Z)().mark((function t(){return(0,o.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._selected=new Set,this._currentItem=void 0,t.next=4,(0,w.b)(this.hass,this._params.currentItem.media_content_id);case 4:this._currentItem=t.sent;case 5:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)})},{kind:"get",static:!0,key:"styles",value:function(){return[Z.yu,(0,g.iv)(N||(N=(0,s.Z)(["ha-dialog{--dialog-z-index:9;--dialog-content-padding:0}@media (min-width:800px){ha-dialog{--mdc-dialog-max-width:800px;--dialog-surface-position:fixed;--dialog-surface-top:40px;--mdc-dialog-max-height:calc(100vh - 72px)}}ha-dialog-header ha-button,ha-dialog-header ha-media-upload-button{--mdc-theme-primary:var(--primary-text-color);margin:6px;display:block}mwc-list{direction:ltr}.danger{--mdc-theme-primary:var(--error-color)}ha-svg-icon[slot=icon]{vertical-align:middle}ha-tip{margin:16px}ha-svg-icon[slot=icon]{margin-inline-start:0px!important;margin-inline-end:8px!important;direction:var(--direction)}.refresh{display:flex;height:200px;justify-content:center;align-items:center}.no-items{text-align:center;padding:16px}.folders{color:var(--secondary-text-color);font-style:italic}"])))]}}]}}),g.oi),a(),t.next=98;break;case 95:t.prev=95,t.t2=t.catch(0),a(t.t2);case 98:case"end":return t.stop()}}),t,null,[[0,95]])})),function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function c(t){a(o,r,i,c,s,"next",t)}function s(t){a(o,r,i,c,s,"throw",t)}c(void 0)}))});return function(t,e){return r.apply(this,arguments)}}())},86986:function(t,e,n){var r,i,a,o,c=n(99312),s=n(81043),l=n(88962),u=n(33368),d=n(71650),h=n(68308),f=n(82390),p=n(69205),m=n(91808),g=(n(97393),n(14271),n(5095)),v=n(95260),y=n(18394),_=n(23469),b=n(11285);n(7006),n(37662),(0,m.Z)([(0,v.Mo)("ha-media-upload-button")],(function(t,e){var n,m=function(e){function n(){var e;(0,d.Z)(this,n);for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return e=(0,h.Z)(this,n,[].concat(i)),t((0,f.Z)(e)),e}return(0,p.Z)(n,e),(0,u.Z)(n)}(e);return{F:m,d:[{kind:"field",decorators:[(0,v.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,v.Cb)()],key:"currentItem",value:void 0},{kind:"field",decorators:[(0,v.SB)()],key:"_uploading",value:function(){return 0}},{kind:"method",key:"render",value:function(){return this.currentItem&&(0,_.aV)(this.currentItem.media_content_id||"")?(0,g.dy)(r||(r=(0,l.Z)([' <mwc-button .label="','" .disabled="','" @click="','"> '," </mwc-button> "])),this._uploading>0?this.hass.localize("ui.components.media-browser.file_management.uploading",{count:this._uploading}):this.hass.localize("ui.components.media-browser.file_management.add_media"),this._uploading>0,this._startUpload,this._uploading>0?(0,g.dy)(i||(i=(0,l.Z)([' <ha-circular-progress size="small" indeterminate area-label="Uploading" slot="icon"></ha-circular-progress> ']))):(0,g.dy)(a||(a=(0,l.Z)([' <ha-svg-icon .path="','" slot="icon"></ha-svg-icon> '])),"M9,16V10H5L12,3L19,10H15V16H9M5,20V18H19V20H5Z")):g.Ld}},{kind:"method",key:"_startUpload",value:(n=(0,s.Z)((0,c.Z)().mark((function t(){var e,n=this;return(0,c.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(this._uploading>0)){t.next=2;break}return t.abrupt("return");case 2:(e=document.createElement("input")).type="file",e.accept="audio/*,video/*,image/*",e.multiple=!0,e.addEventListener("change",(0,s.Z)((0,c.Z)().mark((function t(){var r,i,a;return(0,c.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:(0,y.B)(n,"uploading"),r=e.files,document.body.removeChild(e),i=n.currentItem.media_content_id,a=0;case 5:if(!(a<r.length)){t.next=19;break}return n._uploading=r.length-a,t.prev=7,t.next=10,(0,_.oE)(n.hass,i,r[a]);case 10:t.next=16;break;case 12:return t.prev=12,t.t0=t.catch(7),(0,b.Ys)(n,{text:n.hass.localize("ui.components.media-browser.file_management.upload_failed",{reason:t.t0.message||t.t0})}),t.abrupt("break",19);case 16:a++,t.next=5;break;case 19:n._uploading=0,(0,y.B)(n,"media-refresh");case 21:case"end":return t.stop()}}),t,null,[[7,12]])}))),{once:!0}),e.style.display="none",document.body.append(e),e.click();case 10:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)})},{kind:"field",static:!0,key:"styles",value:function(){return(0,g.iv)(o||(o=(0,l.Z)(["mwc-button{--mdc-button-disabled-ink-color:--mdc-theme-primary}ha-circular-progress[slot=icon],ha-svg-icon[slot=icon]{vertical-align:middle}ha-svg-icon[slot=icon]{margin-inline-start:0px;margin-inline-end:8px;direction:var(--direction)}"])))}}]}}),g.oi)}}]);
|
|
//# sourceMappingURL=7765.Pjs8utIBMys.js.map
|