@htmlbricks/hb-downloader 0.7.0 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@htmlbricks/hb-downloader",
3
3
  "displayName": "Svelte-Bootstrap Downloader WebComponent",
4
4
  "description": "Svelte-Bootstrap Downloader WebComponent",
5
- "version": "0.7.0",
5
+ "version": "0.7.2",
6
6
  "main": "release/release.js",
7
7
  "publishConfig": {
8
8
  "access": "public"
@@ -27,7 +27,7 @@
27
27
  "prepublish": "npm run build:release"
28
28
  },
29
29
  "devDependencies": {
30
- "@htmlbricks/hb-jsutils": "^0.7.0",
30
+ "@htmlbricks/hb-jsutils": "^0.7.2",
31
31
  "@rollup/plugin-alias": "^3.1.2",
32
32
  "@rollup/plugin-commonjs": "^18.0.0",
33
33
  "@rollup/plugin-json": "^4.1.0",
@@ -70,5 +70,5 @@
70
70
  "webcomponents"
71
71
  ],
72
72
  "contributors": [],
73
- "gitHead": "6445565e4054ea28d63ea7b29b15c9d19e8b197f"
73
+ "gitHead": "29a471b88545e4f3a630d257666e35f717a3712c"
74
74
  }
@@ -1,2 +1,2 @@
1
- var release=function(){"use strict";function t(){}function e(t){return t()}function n(){return Object.create(null)}function o(t){t.forEach(e)}function r(t){return"function"==typeof t}function a(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function i(t,e){t.appendChild(e)}function s(t,e,n){t.insertBefore(e,n||null)}function d(t){t.parentNode.removeChild(t)}function l(t){return document.createElement(t)}function c(t){return document.createTextNode(t)}function u(){return c(" ")}function f(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function p(t,e,n){e in t?t[e]="boolean"==typeof t[e]&&""===n||n:f(t,e,n)}function h(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function g(t,e,n,o){null===n?t.style.removeProperty(e):t.style.setProperty(e,n,o?"important":"")}function m(t){const e={};for(const n of t)e[n.name]=n.value;return e}let v;function $(t){v=t}function b(){if(!v)throw new Error("Function called outside component initialization");return v}function w(){const t=b();return(e,n)=>{const o=t.$$.callbacks[e];if(o){const r=function(t,e,n=!1){const o=document.createEvent("CustomEvent");return o.initCustomEvent(t,n,!1,e),o}(e,n);o.slice().forEach((e=>{e.call(t,r)}))}}}const y=[],E=[],x=[],_=[],k=Promise.resolve();let L=!1;function C(t){x.push(t)}const M=new Set;let T=0;function D(){const t=v;do{for(;T<y.length;){const t=y[T];T++,$(t),j(t.$$)}for($(null),y.length=0,T=0;E.length;)E.pop()();for(let t=0;t<x.length;t+=1){const e=x[t];M.has(e)||(M.add(e),e())}x.length=0}while(y.length);for(;_.length;)_.pop()();L=!1,M.clear(),$(t)}function j(t){if(null!==t.fragment){t.update(),o(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(C)}}const R=new Set;function H(t,e){-1===t.$$.dirty[0]&&(y.push(t),L||(L=!0,k.then(D)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function O(a,i,s,l,c,u,f,p=[-1]){const h=v;$(a);const g=a.$$={fragment:null,ctx:null,props:u,update:t,not_equal:c,bound:n(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(i.context||(h?h.$$.context:[])),callbacks:n(),dirty:p,skip_bound:!1,root:i.target||h.$$.root};f&&f(g.root);let m=!1;if(g.ctx=s?s(a,i.props||{},((t,e,...n)=>{const o=n.length?n[0]:e;return g.ctx&&c(g.ctx[t],g.ctx[t]=o)&&(!g.skip_bound&&g.bound[t]&&g.bound[t](o),m&&H(a,t)),e})):[],g.update(),m=!0,o(g.before_update),g.fragment=!!l&&l(g.ctx),i.target){if(i.hydrate){const t=function(t){return Array.from(t.childNodes)}(i.target);g.fragment&&g.fragment.l(t),t.forEach(d)}else g.fragment&&g.fragment.c();i.intro&&((b=a.$$.fragment)&&b.i&&(R.delete(b),b.i(w))),function(t,n,a,i){const{fragment:s,on_mount:d,on_destroy:l,after_update:c}=t.$$;s&&s.m(n,a),i||C((()=>{const n=d.map(e).filter(r);l?l.push(...n):o(n),t.$$.on_mount=[]})),c.forEach(C)}(a,i.target,i.anchor,i.customElement),D()}var b,w;$(h)}let A;"function"==typeof HTMLElement&&(A=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){const{on_mount:t}=this.$$;this.$$.on_disconnect=t.map(e).filter(r);for(const t in this.$$.slotted)this.appendChild(this.$$.slotted[t])}attributeChangedCallback(t,e,n){this[t]=n}disconnectedCallback(){o(this.$$.on_disconnect)}$destroy(){!function(t,e){const n=t.$$;null!==n.fragment&&(o(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}(this,1),this.$destroy=t}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}});var S="0.7.0";var q,N,z=(q=function(t,e){e.__esModule=!0,e.LanguageTranslator=e.addComponent=void 0,e.addComponent=function(t,e,n){if(!document.getElementById("hb-"+t+"-script")){var o=document.createElement("script");o.id="hb-"+t+"-script",o.src="https://cdn.jsdelivr.net/npm/@htmlbricks/hb-".concat(t,"@").concat(e,"/release/release.js"),n&&location.href.includes("localhost")&&(o.src="http://localhost:6006/".concat(t,"/dist/release.js")),document.head.appendChild(o)}};var n=function(){function t(t){if(!(null==t?void 0:t.dictionary))throw new Error("no dictionary provided");this.dictionary=t.dictionary,this.setLang(null==t?void 0:t.lang)}return t.prototype.setLang=function(e){e||(e=t.getDefaultLang()),this.lang=e},t.prototype.translateWord=function(e,n){return t.getDictionaryWord(e,this.dictionary,n||this.lang)},t.prototype.translateDate=function(e,n,o){return t.formatDate(e,n,o||this.lang)},t.getDefaultLang=function(){var t,e,n,o,r,a="en";return(null===navigator||void 0===navigator?void 0:navigator.languages)&&(null===(n=null===(e=null===(t=navigator.languages[0])||void 0===t?void 0:t.split("-")[0])||void 0===e?void 0:e.toLowerCase())||void 0===n?void 0:n.length)&&(a=null===(r=null===(o=navigator.languages[0])||void 0===o?void 0:o.split("-")[0])||void 0===r?void 0:r.toLowerCase()),a},t.getDictionaryWord=function(e,n,o){var r;if(!e)throw new Error("no wordKey provided");if(!n)throw new Error("no dictionary provided");if(o&&(null===(r=n[o])||void 0===r?void 0:r[e]))return n[o][e];var a="",i=t.getDefaultLang();if(!o||i!==o){var s=null==n?void 0:n[i];(null==s?void 0:s[e])&&(a=s[e])}return a},t.formatDate=function(e,n,o){if(!e)throw new Error("no date provided");if("function"!=typeof e.getMonth)throw new Error("wrong date format");return new Intl.DateTimeFormat(o||t.getDefaultLang(),n).format(e)},t}();e.LanguageTranslator=n},q(N={exports:{}},N.exports),N.exports);function P(t){let e;return{c(){e=c(t[4])},m(t,n){s(t,e,n)},p(t,n){16&n&&h(e,t[4])},d(t){t&&d(e)}}}function U(t){let e,n,o,r,a,u=Math.round(t[3]/t[2]*100)+"";return{c(){e=l("div"),n=l("div"),o=c(u),r=c("%"),f(n,"class","progress-bar"),g(n,"width",Math.round(t[3]/t[2]*100)+"%"),f(n,"role","progressbar"),f(n,"aria-valuenow",a=Math.round(t[3]/t[2]*100)),f(n,"aria-valuemin","0"),f(n,"aria-valuemax","100"),f(e,"class","progress")},m(t,a){s(t,e,a),i(e,n),i(n,o),i(n,r)},p(t,e){12&e&&u!==(u=Math.round(t[3]/t[2]*100)+"")&&h(o,u),12&e&&g(n,"width",Math.round(t[3]/t[2]*100)+"%"),12&e&&a!==(a=Math.round(t[3]/t[2]*100))&&f(n,"aria-valuenow",a)},d(t){t&&d(e)}}}function W(e){let n;return{c(){n=l("div"),n.innerHTML='<div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%"></div>',f(n,"class","progress")},m(t,e){s(t,n,e)},p:t,d(t){t&&d(n)}}}function B(e){let n,o,r,a,c,h,g,m,v;function $(t,e){return t[2]||t[4]?t[4]?t[4]?P:void 0:U:W}let b=$(e),w=b&&b(e);return{c(){n=l("hb-dialog"),o=l("span"),o.innerHTML='<slot name="title">Downloading</slot>',r=u(),a=l("div"),w&&w.c(),c=u(),h=l("span"),this.c=t,f(o,"slot","title"),f(a,"slot","body-content"),f(h,"slot","modal-footer"),p(n,"id",e[0]),p(n,"show",g=e[1]?"yes":"no")},m(t,d){var l,u,f,p;s(t,n,d),i(n,o),i(n,r),i(n,a),w&&w.m(a,null),i(n,c),i(n,h),m||(l=n,u="modalShow",f=e[9],l.addEventListener(u,f,p),v=()=>l.removeEventListener(u,f,p),m=!0)},p(t,[e]){b===(b=$(t))&&w?w.p(t,e):(w&&w.d(1),w=b&&b(t),w&&(w.c(),w.m(a,null))),1&e&&p(n,"id",t[0]),2&e&&g!==(g=t[1]?"yes":"no")&&p(n,"show",g)},i:t,o:t,d(t){t&&d(n),w&&w.d(),m=!1,v()}}}function F(t,e,n){const o=b(),r=w();function a(t,e){r(t,e),o.dispatchEvent&&o.dispatchEvent(new CustomEvent(t,{detail:e}))}z.addComponent("dialog",S);let i,s,d,l,{downloadid:c}=e,{uri:u}=e,{headers:f}=e,{targetfilename:p}=e,h=0;function g(t){t.show?(n(0,c=t.id),function(){function t(t){console.error(t),t&&n(4,l=t),s=null,a("downloadError",{downloaded:d,id:c,error:t})}n(3,h=0),s=new XMLHttpRequest;try{if(s.open("GET",u,!0),f)for(const t of Object.keys(f))s.setRequestHeader(t,f[t]);s.responseType="blob",s.onload=function(){if(s.status&&(s.status>299||s.status<200))return t("request error");const e=(window.URL||window.webkitURL).createObjectURL(this.response),o=document.createElement("a");return o.href=e,o.target="_blank",o.download=p,document.body.appendChild(o),o.click(),document.body.removeChild(o),console.log("loadEnd"),n(0,c=""),n(1,u=""),s=null,n(8,d=!0),n(4,l=null),a("downloadComplete",{downloaded:d,id:c})},s.onerror=e=>t(e),s.onprogress=function(t){n(2,i=(null==t?void 0:t.total)||0),n(3,h=(null==t?void 0:t.loaded)||0)},s.onloadend=function(t){},s.send()}catch(e){return console.error("download err ",e),t(e)}}()):(n(1,u=""),n(0,c=""),n(4,l=null),s&&s.abort(),s=null)}return t.$$set=t=>{"downloadid"in t&&n(0,c=t.downloadid),"uri"in t&&n(1,u=t.uri),"headers"in t&&n(6,f=t.headers),"targetfilename"in t&&n(7,p=t.targetfilename)},t.$$.update=()=>{if(451&t.$$.dirty){c||n(0,c=""),d||n(8,d=!1),u||n(1,u="");try{f&&"string"==typeof f&&n(6,f=JSON.parse(f))}catch(t){}!p&&u&&n(7,p=u.split("/")[u.split("/").length-1].split("?")[0])}},[c,u,i,h,l,g,f,p,d,t=>g(t.detail)]}class I extends A{constructor(t){super(),this.shadowRoot.innerHTML='<style>@import url("https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap");@keyframes progress-bar-stripes{0%{background-position-x:1rem}}.progress{display:flex;height:1rem;overflow:hidden;font-size:0.75rem;background-color:#e9ecef;border-radius:0.25rem}.progress-bar{display:flex;flex-direction:column;justify-content:center;overflow:hidden;color:#fff;text-align:center;white-space:nowrap;background-color:#07689f;transition:width 0.6s ease}@media(prefers-reduced-motion: reduce){.progress-bar{transition:none}}.progress-bar-striped{background-image:linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-size:1rem 1rem}.progress-bar-animated{animation:1s linear infinite progress-bar-stripes}@media(prefers-reduced-motion: reduce){.progress-bar-animated{animation:none}}:host{font-family:"Roboto", sans-serif}</style>',O(this,{target:this.shadowRoot,props:m(this.attributes),customElement:!0},F,B,a,{downloadid:0,uri:1,headers:6,targetfilename:7},null),t&&(t.target&&s(t.target,this,t.anchor),t.props&&(this.$set(t.props),D()))}static get observedAttributes(){return["downloadid","uri","headers","targetfilename"]}get downloadid(){return this.$$.ctx[0]}set downloadid(t){this.$$set({downloadid:t}),D()}get uri(){return this.$$.ctx[1]}set uri(t){this.$$set({uri:t}),D()}get headers(){return this.$$.ctx[6]}set headers(t){this.$$set({headers:t}),D()}get targetfilename(){return this.$$.ctx[7]}set targetfilename(t){this.$$set({targetfilename:t}),D()}}return customElements.define("hb-downloader",I),I}();
1
+ var release=function(){"use strict";function t(){}function e(t){return t()}function n(){return Object.create(null)}function o(t){t.forEach(e)}function r(t){return"function"==typeof t}function a(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function i(t,e){t.appendChild(e)}function s(t,e,n){t.insertBefore(e,n||null)}function d(t){t.parentNode.removeChild(t)}function l(t){return document.createElement(t)}function c(t){return document.createTextNode(t)}function u(){return c(" ")}function f(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function p(t,e,n){e in t?t[e]="boolean"==typeof t[e]&&""===n||n:f(t,e,n)}function h(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function g(t,e,n,o){null===n?t.style.removeProperty(e):t.style.setProperty(e,n,o?"important":"")}function m(t){const e={};for(const n of t)e[n.name]=n.value;return e}let v;function $(t){v=t}function b(){if(!v)throw new Error("Function called outside component initialization");return v}function w(){const t=b();return(e,n)=>{const o=t.$$.callbacks[e];if(o){const r=function(t,e,n=!1){const o=document.createEvent("CustomEvent");return o.initCustomEvent(t,n,!1,e),o}(e,n);o.slice().forEach((e=>{e.call(t,r)}))}}}const y=[],E=[],x=[],_=[],k=Promise.resolve();let L=!1;function C(t){x.push(t)}const M=new Set;let T=0;function D(){const t=v;do{for(;T<y.length;){const t=y[T];T++,$(t),j(t.$$)}for($(null),y.length=0,T=0;E.length;)E.pop()();for(let t=0;t<x.length;t+=1){const e=x[t];M.has(e)||(M.add(e),e())}x.length=0}while(y.length);for(;_.length;)_.pop()();L=!1,M.clear(),$(t)}function j(t){if(null!==t.fragment){t.update(),o(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(C)}}const R=new Set;function H(t,e){-1===t.$$.dirty[0]&&(y.push(t),L||(L=!0,k.then(D)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function O(a,i,s,l,c,u,f,p=[-1]){const h=v;$(a);const g=a.$$={fragment:null,ctx:null,props:u,update:t,not_equal:c,bound:n(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(i.context||(h?h.$$.context:[])),callbacks:n(),dirty:p,skip_bound:!1,root:i.target||h.$$.root};f&&f(g.root);let m=!1;if(g.ctx=s?s(a,i.props||{},((t,e,...n)=>{const o=n.length?n[0]:e;return g.ctx&&c(g.ctx[t],g.ctx[t]=o)&&(!g.skip_bound&&g.bound[t]&&g.bound[t](o),m&&H(a,t)),e})):[],g.update(),m=!0,o(g.before_update),g.fragment=!!l&&l(g.ctx),i.target){if(i.hydrate){const t=function(t){return Array.from(t.childNodes)}(i.target);g.fragment&&g.fragment.l(t),t.forEach(d)}else g.fragment&&g.fragment.c();i.intro&&((b=a.$$.fragment)&&b.i&&(R.delete(b),b.i(w))),function(t,n,a,i){const{fragment:s,on_mount:d,on_destroy:l,after_update:c}=t.$$;s&&s.m(n,a),i||C((()=>{const n=d.map(e).filter(r);l?l.push(...n):o(n),t.$$.on_mount=[]})),c.forEach(C)}(a,i.target,i.anchor,i.customElement),D()}var b,w;$(h)}let A;"function"==typeof HTMLElement&&(A=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){const{on_mount:t}=this.$$;this.$$.on_disconnect=t.map(e).filter(r);for(const t in this.$$.slotted)this.appendChild(this.$$.slotted[t])}attributeChangedCallback(t,e,n){this[t]=n}disconnectedCallback(){o(this.$$.on_disconnect)}$destroy(){!function(t,e){const n=t.$$;null!==n.fragment&&(o(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}(this,1),this.$destroy=t}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}});var S="0.7.2";var q,N,z=(q=function(t,e){e.__esModule=!0,e.LanguageTranslator=e.addComponent=void 0,e.addComponent=function(t,e,n){if(!document.getElementById("hb-"+t+"-script")){var o=document.createElement("script");o.id="hb-"+t+"-script",o.src="https://cdn.jsdelivr.net/npm/@htmlbricks/hb-".concat(t,"@").concat(e,"/release/release.js"),n&&location.href.includes("localhost")&&(o.src="http://localhost:6006/".concat(t,"/dist/release.js")),document.head.appendChild(o)}};var n=function(){function t(t){if(!(null==t?void 0:t.dictionary))throw new Error("no dictionary provided");this.dictionary=t.dictionary,this.setLang(null==t?void 0:t.lang)}return t.prototype.setLang=function(e){e||(e=t.getDefaultLang()),this.lang=e},t.prototype.translateWord=function(e,n){return t.getDictionaryWord(e,this.dictionary,n||this.lang)},t.prototype.translateDate=function(e,n,o){return t.formatDate(e,n,o||this.lang)},t.getDefaultLang=function(){var t,e,n,o,r,a="en";return(null===navigator||void 0===navigator?void 0:navigator.languages)&&(null===(n=null===(e=null===(t=navigator.languages[0])||void 0===t?void 0:t.split("-")[0])||void 0===e?void 0:e.toLowerCase())||void 0===n?void 0:n.length)&&(a=null===(r=null===(o=navigator.languages[0])||void 0===o?void 0:o.split("-")[0])||void 0===r?void 0:r.toLowerCase()),a},t.getDictionaryWord=function(e,n,o){var r;if(!e)throw new Error("no wordKey provided");if(!n)throw new Error("no dictionary provided");if(o&&(null===(r=n[o])||void 0===r?void 0:r[e]))return n[o][e];var a="",i=t.getDefaultLang();if(!o||i!==o){var s=null==n?void 0:n[i];(null==s?void 0:s[e])&&(a=s[e])}return a},t.formatDate=function(e,n,o){if(!e)throw new Error("no date provided");if("function"!=typeof e.getMonth)throw new Error("wrong date format");return new Intl.DateTimeFormat(o||t.getDefaultLang(),n).format(e)},t}();e.LanguageTranslator=n},q(N={exports:{}},N.exports),N.exports);function P(t){let e;return{c(){e=c(t[4])},m(t,n){s(t,e,n)},p(t,n){16&n&&h(e,t[4])},d(t){t&&d(e)}}}function U(t){let e,n,o,r,a,u=Math.round(t[3]/t[2]*100)+"";return{c(){e=l("div"),n=l("div"),o=c(u),r=c("%"),f(n,"class","progress-bar"),g(n,"width",Math.round(t[3]/t[2]*100)+"%"),f(n,"role","progressbar"),f(n,"aria-valuenow",a=Math.round(t[3]/t[2]*100)),f(n,"aria-valuemin","0"),f(n,"aria-valuemax","100"),f(e,"class","progress")},m(t,a){s(t,e,a),i(e,n),i(n,o),i(n,r)},p(t,e){12&e&&u!==(u=Math.round(t[3]/t[2]*100)+"")&&h(o,u),12&e&&g(n,"width",Math.round(t[3]/t[2]*100)+"%"),12&e&&a!==(a=Math.round(t[3]/t[2]*100))&&f(n,"aria-valuenow",a)},d(t){t&&d(e)}}}function W(e){let n;return{c(){n=l("div"),n.innerHTML='<div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%"></div>',f(n,"class","progress")},m(t,e){s(t,n,e)},p:t,d(t){t&&d(n)}}}function B(e){let n,o,r,a,c,h,g,m,v;function $(t,e){return t[2]||t[4]?t[4]?t[4]?P:void 0:U:W}let b=$(e),w=b&&b(e);return{c(){n=l("hb-dialog"),o=l("span"),o.innerHTML='<slot name="title">Downloading</slot>',r=u(),a=l("div"),w&&w.c(),c=u(),h=l("span"),this.c=t,f(o,"slot","title"),f(a,"slot","body-content"),f(h,"slot","modal-footer"),p(n,"id",e[0]),p(n,"show",g=e[1]?"yes":"no")},m(t,d){var l,u,f,p;s(t,n,d),i(n,o),i(n,r),i(n,a),w&&w.m(a,null),i(n,c),i(n,h),m||(l=n,u="modalShow",f=e[9],l.addEventListener(u,f,p),v=()=>l.removeEventListener(u,f,p),m=!0)},p(t,[e]){b===(b=$(t))&&w?w.p(t,e):(w&&w.d(1),w=b&&b(t),w&&(w.c(),w.m(a,null))),1&e&&p(n,"id",t[0]),2&e&&g!==(g=t[1]?"yes":"no")&&p(n,"show",g)},i:t,o:t,d(t){t&&d(n),w&&w.d(),m=!1,v()}}}function F(t,e,n){const o=b(),r=w();function a(t,e){r(t,e),o.dispatchEvent&&o.dispatchEvent(new CustomEvent(t,{detail:e}))}z.addComponent("dialog",S);let i,s,d,l,{downloadid:c}=e,{uri:u}=e,{headers:f}=e,{targetfilename:p}=e,h=0;function g(t){t.show?(n(0,c=t.id),function(){function t(t){console.error(t),t&&n(4,l=t),s=null,a("downloadError",{downloaded:d,id:c,error:t})}n(3,h=0),s=new XMLHttpRequest;try{if(s.open("GET",u,!0),f)for(const t of Object.keys(f))s.setRequestHeader(t,f[t]);s.responseType="blob",s.onload=function(){if(s.status&&(s.status>299||s.status<200))return t("request error");const e=(window.URL||window.webkitURL).createObjectURL(this.response),o=document.createElement("a");return o.href=e,o.target="_blank",o.download=p,document.body.appendChild(o),o.click(),document.body.removeChild(o),console.log("loadEnd"),n(0,c=""),n(1,u=""),s=null,n(8,d=!0),n(4,l=null),a("downloadComplete",{downloaded:d,id:c})},s.onerror=e=>t(e),s.onprogress=function(t){n(2,i=(null==t?void 0:t.total)||0),n(3,h=(null==t?void 0:t.loaded)||0)},s.onloadend=function(t){},s.send()}catch(e){return console.error("download err ",e),t(e)}}()):(n(1,u=""),n(0,c=""),n(4,l=null),s&&s.abort(),s=null)}return t.$$set=t=>{"downloadid"in t&&n(0,c=t.downloadid),"uri"in t&&n(1,u=t.uri),"headers"in t&&n(6,f=t.headers),"targetfilename"in t&&n(7,p=t.targetfilename)},t.$$.update=()=>{if(451&t.$$.dirty){c||n(0,c=""),d||n(8,d=!1),u||n(1,u="");try{f&&"string"==typeof f&&n(6,f=JSON.parse(f))}catch(t){}!p&&u&&n(7,p=u.split("/")[u.split("/").length-1].split("?")[0])}},[c,u,i,h,l,g,f,p,d,t=>g(t.detail)]}class I extends A{constructor(t){super(),this.shadowRoot.innerHTML='<style>@import url("https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap");@keyframes progress-bar-stripes{0%{background-position-x:1rem}}.progress{display:flex;height:1rem;overflow:hidden;font-size:0.75rem;background-color:#e9ecef;border-radius:0.25rem}.progress-bar{display:flex;flex-direction:column;justify-content:center;overflow:hidden;color:#fff;text-align:center;white-space:nowrap;background-color:#07689f;transition:width 0.6s ease}@media(prefers-reduced-motion: reduce){.progress-bar{transition:none}}.progress-bar-striped{background-image:linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-size:1rem 1rem}.progress-bar-animated{animation:1s linear infinite progress-bar-stripes}@media(prefers-reduced-motion: reduce){.progress-bar-animated{animation:none}}:host{font-family:"Roboto", sans-serif}</style>',O(this,{target:this.shadowRoot,props:m(this.attributes),customElement:!0},F,B,a,{downloadid:0,uri:1,headers:6,targetfilename:7},null),t&&(t.target&&s(t.target,this,t.anchor),t.props&&(this.$set(t.props),D()))}static get observedAttributes(){return["downloadid","uri","headers","targetfilename"]}get downloadid(){return this.$$.ctx[0]}set downloadid(t){this.$$set({downloadid:t}),D()}get uri(){return this.$$.ctx[1]}set uri(t){this.$$set({uri:t}),D()}get headers(){return this.$$.ctx[6]}set headers(t){this.$$set({headers:t}),D()}get targetfilename(){return this.$$.ctx[7]}set targetfilename(t){this.$$set({targetfilename:t}),D()}}return customElements.define("hb-downloader",I),I}();
2
2
  //# sourceMappingURL=release.js.map