luxen-ui 0.19.1 → 0.21.0
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/README.md +1 -0
- package/cdn/chunks/iconify-icon.js +1 -1
- package/cdn/custom-elements.json +331 -189
- package/cdn/elements/badge/badge.d.ts +36 -0
- package/cdn/elements/badge/badge.d.ts.map +1 -1
- package/cdn/elements/badge/badge.js.map +1 -1
- package/cdn/elements/button-group/button-group.d.ts +12 -7
- package/cdn/elements/button-group/button-group.d.ts.map +1 -1
- package/cdn/elements/button-group/button-group.js.map +1 -1
- package/cdn/elements/icon/icon.d.ts +37 -0
- package/cdn/elements/icon/icon.d.ts.map +1 -1
- package/cdn/elements/icon/icon.js +2 -2
- package/cdn/elements/icon/icon.js.map +1 -1
- package/cdn/elements/input-stepper/input-stepper.d.ts +1 -1
- package/cdn/elements/input-stepper/input-stepper.js.map +1 -1
- package/cdn/elements/popover/popover.d.ts +15 -0
- package/cdn/elements/popover/popover.d.ts.map +1 -1
- package/cdn/elements/popover/popover.js +1 -1
- package/cdn/elements/popover/popover.js.map +1 -1
- package/cdn/elements/radio-group/radio-group.meta.d.ts +41 -0
- package/cdn/elements/radio-group/radio-group.meta.d.ts.map +1 -0
- package/cdn/elements/radio-group/radio-group.meta.js +0 -0
- package/cdn/elements/segmented-control/segmented-control.d.ts +8 -4
- package/cdn/elements/segmented-control/segmented-control.d.ts.map +1 -1
- package/cdn/elements/segmented-control/segmented-control.js.map +1 -1
- package/cdn/elements/select/select.js +1 -1
- package/cdn/elements/select/select.js.map +1 -1
- package/cdn/elements/tag/tag.d.ts +8 -6
- package/cdn/elements/tag/tag.d.ts.map +1 -1
- package/cdn/elements/tag/tag.js +1 -1
- package/cdn/elements/tag/tag.js.map +1 -1
- package/cdn/elements/tooltip/tooltip.d.ts +15 -0
- package/cdn/elements/tooltip/tooltip.d.ts.map +1 -1
- package/cdn/elements/tooltip/tooltip.js +1 -1
- package/cdn/elements/tooltip/tooltip.js.map +1 -1
- package/cdn/shared/controllers/popover.d.ts +40 -0
- package/cdn/shared/controllers/popover.d.ts.map +1 -1
- package/cdn/shared/controllers/popover.js +1 -1
- package/cdn/shared/controllers/popover.js.map +1 -1
- package/cdn/shared/styles/button-core.styles.js +1 -1
- package/cdn/shared/styles/button-core.styles.js.map +1 -1
- package/cdn/standalone.css +832 -36
- package/cdn/styles/elements/badge.css +58 -8
- package/cdn/styles/elements/button-group.css +4 -3
- package/cdn/styles/elements/button.css +28 -1
- package/cdn/styles/elements/disclosure.css +3 -3
- package/cdn/styles/elements/input-stepper/default.css +29 -2
- package/cdn/styles/elements/input-stepper/pill.css +420 -0
- package/cdn/styles/elements/input-stepper/rounded.css +69 -8
- package/cdn/styles/elements/kbd.css +2 -2
- package/cdn/styles/elements/radio-group.css +206 -0
- package/cdn/styles/elements/segmented-control.css +3 -3
- package/cdn/styles/elements/tabs/enclosed.css +4 -4
- package/cdn/styles/elements/tabs/line.css +2 -2
- package/dist/css/elements/badge.css +58 -8
- package/dist/css/elements/button-group.css +4 -3
- package/dist/css/elements/button.css +28 -1
- package/dist/css/elements/disclosure.css +3 -3
- package/dist/css/elements/input-stepper/default.css +29 -2
- package/dist/css/elements/input-stepper/pill.css +420 -0
- package/dist/css/elements/input-stepper/rounded.css +69 -8
- package/dist/css/elements/kbd.css +2 -2
- package/dist/css/elements/radio-group.css +206 -0
- package/dist/css/elements/segmented-control.css +3 -3
- package/dist/css/elements/tabs/enclosed.css +4 -4
- package/dist/css/elements/tabs/line.css +2 -2
- package/dist/custom-elements.json +331 -189
- package/dist/elements/badge/badge.d.ts +36 -0
- package/dist/elements/badge/badge.d.ts.map +1 -1
- package/dist/elements/badge/badge.js +36 -0
- package/dist/elements/button-group/button-group.d.ts +12 -7
- package/dist/elements/button-group/button-group.d.ts.map +1 -1
- package/dist/elements/button-group/button-group.js +12 -7
- package/dist/elements/icon/icon.d.ts +37 -1
- package/dist/elements/icon/icon.d.ts.map +1 -1
- package/dist/elements/icon/icon.js +59 -1
- package/dist/elements/input-stepper/input-stepper.d.ts +1 -1
- package/dist/elements/input-stepper/input-stepper.js +1 -1
- package/dist/elements/popover/popover.d.ts +15 -0
- package/dist/elements/popover/popover.d.ts.map +1 -1
- package/dist/elements/popover/popover.js +61 -14
- package/dist/elements/radio-group/radio-group.meta.d.ts +41 -0
- package/dist/elements/radio-group/radio-group.meta.d.ts.map +1 -0
- package/dist/elements/radio-group/radio-group.meta.js +51 -0
- package/dist/elements/segmented-control/segmented-control.d.ts +8 -4
- package/dist/elements/segmented-control/segmented-control.d.ts.map +1 -1
- package/dist/elements/segmented-control/segmented-control.js +8 -4
- package/dist/elements/select/select.css +15 -0
- package/dist/elements/tag/tag.css +134 -55
- package/dist/elements/tag/tag.d.ts +8 -6
- package/dist/elements/tag/tag.d.ts.map +1 -1
- package/dist/elements/tag/tag.js +8 -6
- package/dist/elements/tooltip/tooltip.d.ts +15 -0
- package/dist/elements/tooltip/tooltip.d.ts.map +1 -1
- package/dist/elements/tooltip/tooltip.js +61 -14
- package/dist/metadata/badge.json +29 -2
- package/dist/metadata/button-group.json +2 -2
- package/dist/metadata/index.json +140 -25
- package/dist/metadata/input-stepper.json +3 -2
- package/dist/metadata/popover.json +6 -0
- package/dist/metadata/radio-group.json +65 -0
- package/dist/metadata/segmented-control.json +1 -1
- package/dist/metadata/tag.json +27 -17
- package/dist/metadata/tooltip.json +6 -0
- package/dist/shared/controllers/popover.d.ts +40 -0
- package/dist/shared/controllers/popover.d.ts.map +1 -1
- package/dist/shared/controllers/popover.js +69 -0
- package/dist/shared/styles/button-core.css +28 -1
- package/dist/templates/elements/badge.md +90 -0
- package/dist/templates/elements/button-group.md +159 -41
- package/dist/templates/elements/button.md +1 -1
- package/dist/templates/elements/icon.md +33 -0
- package/dist/templates/elements/input-stepper.md +220 -58
- package/dist/templates/elements/popover.md +3 -0
- package/dist/templates/elements/radio-group.md +351 -0
- package/dist/templates/elements/radio.md +34 -30
- package/dist/templates/elements/segmented-control.md +5 -63
- package/dist/templates/elements/tag.md +83 -10
- package/dist/templates/elements/tooltip.md +3 -0
- package/elements.json +10 -1
- package/package.json +1 -1
- package/templates/choosing-elements.md.tpl +8 -4
package/README.md
CHANGED
|
@@ -55,6 +55,7 @@ Visit https://luxen-ui.com to explore the documentation.
|
|
|
55
55
|
| Progress | `<progress>` | ⏣ Native HTML Element |
|
|
56
56
|
| Prose editor | `<l-prose-editor>` | ⬢ Custom HTML Element (with Shadow DOM) |
|
|
57
57
|
| Radio | `<input>` | ⏣ Native HTML Element |
|
|
58
|
+
| Radio group | `<fieldset>` | ⏣ Native HTML Element |
|
|
58
59
|
| Rating | `<l-rating>` | ⬢ Custom HTML Element (with Shadow DOM) |
|
|
59
60
|
| Segmented control | `<l-segmented-control>` | ⬡ Progressive Custom HTML Element |
|
|
60
61
|
| Select | `<l-select>` | ⬢ Custom HTML Element (with Shadow DOM) |
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=Object.freeze({left:0,top:0,width:16,height:16}),t=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),n=Object.freeze({...e,...t}),r=Object.freeze({...n,body:``,hidden:!1}),i=Object.freeze({width:null,height:null}),a=Object.freeze({...i,...t});function o(e,t=0){let n=e.replace(/^-?[0-9.]*/,``);function r(e){for(;e<0;)e+=4;return e%4}if(n===``){let t=parseInt(e);return isNaN(t)?0:r(t)}else if(n!==e){let t=0;switch(n){case`%`:t=25;break;case`deg`:t=90}if(t){let i=parseFloat(e.slice(0,e.length-n.length));return isNaN(i)?0:(i/=t,i%1==0?r(i):0)}}return t}var s=/[\s,]+/;function c(e,t){t.split(s).forEach(t=>{switch(t.trim()){case`horizontal`:e.hFlip=!0;break;case`vertical`:e.vFlip=!0;break}})}var l={...a,preserveAspectRatio:``};function u(e){let t={...l},n=(t,n)=>e.getAttribute(t)||n;return t.width=n(`width`,null),t.height=n(`height`,null),t.rotate=o(n(`rotate`,``)),c(t,n(`flip`,``)),t.preserveAspectRatio=n(`preserveAspectRatio`,n(`preserveaspectratio`,``)),t}function d(e,t){for(let n in l)if(e[n]!==t[n])return!0;return!1}var f=/^[a-z0-9]+(-[a-z0-9]+)*$/,p=(e,t,n,r=``)=>{let i=e.split(`:`);if(e.slice(0,1)===`@`){if(i.length<2||i.length>3)return null;r=i.shift().slice(1)}if(i.length>3||!i.length)return null;if(i.length>1){let e=i.pop(),n=i.pop(),a={provider:i.length>0?i[0]:r,prefix:n,name:e};return t&&!m(a)?null:a}let a=i[0],o=a.split(`-`);if(o.length>1){let e={provider:r,prefix:o.shift(),name:o.join(`-`)};return t&&!m(e)?null:e}if(n&&r===``){let e={provider:r,prefix:``,name:a};return t&&!m(e,n)?null:e}return null},m=(e,t)=>e?!!((t&&e.prefix===``||e.prefix)&&e.name):!1;function h(e,t){let n=e.icons,r=e.aliases||Object.create(null),i=Object.create(null);function a(e){if(n[e])return i[e]=[];if(!(e in i)){i[e]=null;let t=r[e]&&r[e].parent,n=t&&a(t);n&&(i[e]=[t].concat(n))}return i[e]}return Object.keys(n).concat(Object.keys(r)).forEach(a),i}function g(e,t){let n={};!e.hFlip!=!t.hFlip&&(n.hFlip=!0),!e.vFlip!=!t.vFlip&&(n.vFlip=!0);let r=((e.rotate||0)+(t.rotate||0))%4;return r&&(n.rotate=r),n}function _(e,n){let i=g(e,n);for(let a in r)a in t?a in e&&!(a in i)&&(i[a]=t[a]):a in n?i[a]=n[a]:a in e&&(i[a]=e[a]);return i}function v(e,t,n){let r=e.icons,i=e.aliases||Object.create(null),a={};function o(e){a=_(r[e]||i[e],a)}return o(t),n.forEach(o),_(e,a)}function y(e,t){let n=[];if(typeof e!=`object`||typeof e.icons!=`object`)return n;e.not_found instanceof Array&&e.not_found.forEach(e=>{t(e,null),n.push(e)});let r=h(e);for(let i in r){let a=r[i];a&&(t(i,v(e,i,a)),n.push(i))}return n}var b={provider:``,aliases:{},not_found:{},...e};function x(e,t){for(let n in t)if(n in e&&typeof e[n]!=typeof t[n])return!1;return!0}function ee(e){if(typeof e!=`object`||!e)return null;let t=e;if(typeof t.prefix!=`string`||!e.icons||typeof e.icons!=`object`||!x(e,b))return null;let n=t.icons;for(let e in n){let t=n[e];if(!e||typeof t.body!=`string`||!x(t,r))return null}let i=t.aliases||Object.create(null);for(let e in i){let t=i[e],a=t.parent;if(!e||typeof a!=`string`||!n[a]&&!i[a]||!x(t,r))return null}return t}var S=Object.create(null);function te(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function C(e,t){let n=S[e]||(S[e]=Object.create(null));return n[t]||(n[t]=te(e,t))}function w(e,t){return ee(t)?y(t,(t,n)=>{n?e.icons[t]=n:e.missing.add(t)}):[]}function ne(e,t,n){try{if(typeof n.body==`string`)return e.icons[t]={...n},!0}catch{}return!1}function re(e,t){let n=[];return(typeof e==`string`?[e]:Object.keys(S)).forEach(e=>{(typeof e==`string`&&typeof t==`string`?[t]:Object.keys(S[e]||{})).forEach(t=>{let r=C(e,t);n=n.concat(Object.keys(r.icons).map(n=>(e===``?``:`@`+e+`:`)+t+`:`+n))})}),n}var T=!1;function E(e){return typeof e==`boolean`&&(T=e),T}function D(e){let t=typeof e==`string`?p(e,!0,T):e;if(t){let e=C(t.provider,t.prefix),n=t.name;return e.icons[n]||(e.missing.has(n)?null:void 0)}}function ie(e,t){let n=p(e,!0,T);if(!n)return!1;let r=C(n.provider,n.prefix);return t?ne(r,n.name,t):(r.missing.add(n.name),!0)}function O(e,t){if(typeof e!=`object`)return!1;if(typeof t!=`string`&&(t=e.provider||``),T&&!t&&!e.prefix){let t=!1;return ee(e)&&(e.prefix=``,y(e,(e,n)=>{ie(e,n)&&(t=!0)})),t}let n=e.prefix;return m({prefix:n,name:`a`})?!!w(C(t,n),e):!1}function ae(e){return!!D(e)}function oe(e){let t=D(e);return t&&{...n,...t}}function k(e,t){e.forEach(e=>{let n=e.loaderCallbacks;n&&(e.loaderCallbacks=n.filter(e=>e.id!==t))})}function se(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;let t=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!t.length)return;let n=!1,r=e.provider,i=e.prefix;t.forEach(t=>{let a=t.icons,o=a.pending.length;a.pending=a.pending.filter(t=>{if(t.prefix!==i)return!0;let o=t.name;if(e.icons[o])a.loaded.push({provider:r,prefix:i,name:o});else if(e.missing.has(o))a.missing.push({provider:r,prefix:i,name:o});else return n=!0,!0;return!1}),a.pending.length!==o&&(n||k([e],t.id),t.callback(a.loaded.slice(0),a.missing.slice(0),a.pending.slice(0),t.abort))})}))}var ce=0;function le(e,t,n){let r=ce++,i=k.bind(null,n,r);if(!t.pending.length)return i;let a={id:r,icons:t,callback:e,abort:i};return n.forEach(e=>{(e.loaderCallbacks||=[]).push(a)}),i}function ue(e){let t={loaded:[],missing:[],pending:[]},n=Object.create(null);e.sort((e,t)=>e.provider===t.provider?e.prefix===t.prefix?e.name.localeCompare(t.name):e.prefix.localeCompare(t.prefix):e.provider.localeCompare(t.provider));let r={provider:``,prefix:``,name:``};return e.forEach(e=>{if(r.name===e.name&&r.prefix===e.prefix&&r.provider===e.provider)return;r=e;let i=e.provider,a=e.prefix,o=e.name,s=n[i]||(n[i]=Object.create(null)),c=s[a]||(s[a]=C(i,a)),l;l=o in c.icons?t.loaded:a===``||c.missing.has(o)?t.missing:t.pending;let u={provider:i,prefix:a,name:o};l.push(u)}),t}var A=Object.create(null);function de(e,t){A[e]=t}function j(e){return A[e]||A[``]}function fe(e,t=!0,n=!1){let r=[];return e.forEach(e=>{let i=typeof e==`string`?p(e,t,n):e;i&&r.push(i)}),r}function M(e){let t;if(typeof e.resources==`string`)t=[e.resources];else if(t=e.resources,!(t instanceof Array)||!t.length)return null;return{resources:t,path:e.path||`/`,maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}for(var N=Object.create(null),P=[`https://api.simplesvg.com`,`https://api.unisvg.com`],F=[];P.length>0;)P.length===1||Math.random()>.5?F.push(P.shift()):F.push(P.pop());N[``]=M({resources:[`https://api.iconify.design`].concat(F)});function pe(e,t){let n=M(t);return n===null?!1:(N[e]=n,!0)}function I(e){return N[e]}function me(){return Object.keys(N)}var he={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function ge(e,t,n,r){let i=e.resources.length,a=e.random?Math.floor(Math.random()*i):e.index,o;if(e.random){let t=e.resources.slice(0);for(o=[];t.length>1;){let e=Math.floor(Math.random()*t.length);o.push(t[e]),t=t.slice(0,e).concat(t.slice(e+1))}o=o.concat(t)}else o=e.resources.slice(a).concat(e.resources.slice(0,a));let s=Date.now(),c=`pending`,l=0,u,d=null,f=[],p=[];typeof r==`function`&&p.push(r);function m(){d&&=(clearTimeout(d),null)}function h(){c===`pending`&&(c=`aborted`),m(),f.forEach(e=>{e.status===`pending`&&(e.status=`aborted`)}),f=[]}function g(e,t){t&&(p=[]),typeof e==`function`&&p.push(e)}function _(){return{startTime:s,payload:t,status:c,queriesSent:l,queriesPending:f.length,subscribe:g,abort:h}}function v(){c=`failed`,p.forEach(e=>{e(void 0,u)})}function y(){f.forEach(e=>{e.status===`pending`&&(e.status=`aborted`)}),f=[]}function b(t,n,r){let i=n!==`success`;switch(f=f.filter(e=>e!==t),c){case`pending`:break;case`failed`:if(i||!e.dataAfterTimeout)return;break;default:return}if(n===`abort`){u=r,v();return}if(i){u=r,f.length||(o.length?x():v());return}if(m(),y(),!e.random){let n=e.resources.indexOf(t.resource);n!==-1&&n!==e.index&&(e.index=n)}c=`completed`,p.forEach(e=>{e(r)})}function x(){if(c!==`pending`)return;m();let r=o.shift();if(r===void 0){if(f.length){d=setTimeout(()=>{m(),c===`pending`&&(y(),v())},e.timeout);return}v();return}let i={status:`pending`,resource:r,callback:(e,t)=>{b(i,e,t)}};f.push(i),l++,d=setTimeout(x,e.rotate),n(r,t,i.callback)}return setTimeout(x),_}function _e(e){let t={...he,...e},n=[];function r(){n=n.filter(e=>e().status===`pending`)}function i(e,i,a){let o=ge(t,e,i,(e,t)=>{r(),a&&a(e,t)});return n.push(o),o}function a(e){return n.find(t=>e(t))||null}return{query:i,find:a,setIndex:e=>{t.index=e},getIndex:()=>t.index,cleanup:r}}function ve(){}var L=Object.create(null);function ye(e){if(!L[e]){let t=I(e);if(!t)return;L[e]={config:t,redundancy:_e(t)}}return L[e]}function be(e,t,n){let r,i;if(typeof e==`string`){let t=j(e);if(!t)return n(void 0,424),ve;i=t.send;let a=ye(e);a&&(r=a.redundancy)}else{let t=M(e);if(t){r=_e(t);let n=j(e.resources?e.resources[0]:``);n&&(i=n.send)}}return!r||!i?(n(void 0,424),ve):r.query(t,i,n)().abort}function R(){}function xe(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,se(e)}))}function Se(e){let t=[],n=[];return e.forEach(e=>{(e.match(f)?t:n).push(e)}),{valid:t,invalid:n}}function z(e,t,n){function r(){let n=e.pendingIcons;t.forEach(t=>{n&&n.delete(t),e.icons[t]||e.missing.add(t)})}if(n&&typeof n==`object`)try{if(!w(e,n).length){r();return}}catch(e){console.error(e)}r(),xe(e)}function B(e,t){e instanceof Promise?e.then(e=>{t(e)}).catch(()=>{t(null)}):t(e)}function Ce(e,t){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(t).sort():e.iconsToLoad=t,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;let{provider:t,prefix:n}=e,r=e.iconsToLoad;if(delete e.iconsToLoad,!r||!r.length)return;let i=e.loadIcon;if(e.loadIcons&&(r.length>1||!i)){B(e.loadIcons(r,n,t),t=>{z(e,r,t)});return}if(i){r.forEach(r=>{B(i(r,n,t),t=>{z(e,[r],t?{prefix:n,icons:{[r]:t}}:null)})});return}let{valid:a,invalid:o}=Se(r);if(o.length&&z(e,o,null),!a.length)return;let s=n.match(f)?j(t):null;if(!s){z(e,a,null);return}s.prepare(t,n,a).forEach(n=>{be(t,n,t=>{z(e,n.icons,t)})})}))}var V=(e,t)=>{let n=ue(fe(e,!0,E()));if(!n.pending.length){let e=!0;return t&&setTimeout(()=>{e&&t(n.loaded,n.missing,n.pending,R)}),()=>{e=!1}}let r=Object.create(null),i=[],a,o;return n.pending.forEach(e=>{let{provider:t,prefix:n}=e;if(n===o&&t===a)return;a=t,o=n,i.push(C(t,n));let s=r[t]||(r[t]=Object.create(null));s[n]||(s[n]=[])}),n.pending.forEach(e=>{let{provider:t,prefix:n,name:i}=e,a=C(t,n),o=a.pendingIcons||=new Set;o.has(i)||(o.add(i),r[t][n].push(i))}),i.forEach(e=>{let t=r[e.provider][e.prefix];t.length&&Ce(e,t)}),t?le(t,n,i):R},we=e=>new Promise((t,r)=>{let i=typeof e==`string`?p(e,!0):e;if(!i){r(e);return}V([i||e],a=>{if(a.length&&i){let e=D(i);if(e){t({...n,...e});return}}r(e)})});function H(e){try{let t=typeof e==`string`?JSON.parse(e):e;if(typeof t.body==`string`)return{...t}}catch{}}function Te(e,t){if(typeof e==`object`)return{data:H(e),value:e};if(typeof e!=`string`)return{value:e};if(e.includes(`{`)){let t=H(e);if(t)return{data:t,value:e}}let n=p(e,!0,!0);if(!n)return{value:e};let r=D(n);return r!==void 0||!n.prefix?{value:e,name:n,data:r}:{value:e,name:n,loading:V([n],()=>t(e,n,D(n)))}}var U=!1;try{U=navigator.vendor.indexOf(`Apple`)===0}catch{}function Ee(e,t){switch(t){case`svg`:case`bg`:case`mask`:return t}return t!==`style`&&(U||e.indexOf(`<a`)===-1)?`svg`:e.indexOf(`currentColor`)===-1?`bg`:`mask`}var De=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Oe=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function W(e,t,n){if(t===1)return e;if(n||=100,typeof e==`number`)return Math.ceil(e*t*n)/n;if(typeof e!=`string`)return e;let r=e.split(De);if(r===null||!r.length)return e;let i=[],a=r.shift(),o=Oe.test(a);for(;;){if(o){let e=parseFloat(a);isNaN(e)?i.push(a):i.push(Math.ceil(e*t*n)/n)}else i.push(a);if(a=r.shift(),a===void 0)return i.join(``);o=!o}}function ke(e,t=`defs`){let n=``,r=e.indexOf(`<`+t);for(;r>=0;){let i=e.indexOf(`>`,r),a=e.indexOf(`</`+t);if(i===-1||a===-1)break;let o=e.indexOf(`>`,a);if(o===-1)break;n+=e.slice(i+1,a).trim(),e=e.slice(0,r).trim()+e.slice(o+1)}return{defs:n,content:e}}function Ae(e,t){return e?`<defs>`+e+`</defs>`+t:t}function je(e,t,n){let r=ke(e);return Ae(r.defs,t+r.content+n)}var Me=e=>e===`unset`||e===`undefined`||e===`none`;function G(e,t){let r={...n,...e},i={...a,...t},o={left:r.left,top:r.top,width:r.width,height:r.height},s=r.body;[r,i].forEach(e=>{let t=[],n=e.hFlip,r=e.vFlip,i=e.rotate;n?r?i+=2:(t.push(`translate(`+(o.width+o.left).toString()+` `+(0-o.top).toString()+`)`),t.push(`scale(-1 1)`),o.top=o.left=0):r&&(t.push(`translate(`+(0-o.left).toString()+` `+(o.height+o.top).toString()+`)`),t.push(`scale(1 -1)`),o.top=o.left=0);let a;switch(i<0&&(i-=Math.floor(i/4)*4),i%=4,i){case 1:a=o.height/2+o.top,t.unshift(`rotate(90 `+a.toString()+` `+a.toString()+`)`);break;case 2:t.unshift(`rotate(180 `+(o.width/2+o.left).toString()+` `+(o.height/2+o.top).toString()+`)`);break;case 3:a=o.width/2+o.left,t.unshift(`rotate(-90 `+a.toString()+` `+a.toString()+`)`);break}i%2==1&&(o.left!==o.top&&(a=o.left,o.left=o.top,o.top=a),o.width!==o.height&&(a=o.width,o.width=o.height,o.height=a)),t.length&&(s=je(s,`<g transform="`+t.join(` `)+`">`,`</g>`))});let c=i.width,l=i.height,u=o.width,d=o.height,f,p;c===null?(p=l===null?`1em`:l===`auto`?d:l,f=W(p,u/d)):(f=c===`auto`?u:c,p=l===null?W(f,d/u):l===`auto`?d:l);let m={},h=(e,t)=>{Me(t)||(m[e]=t.toString())};h(`width`,f),h(`height`,p);let g=[o.left,o.top,u,d];return m.viewBox=g.join(` `),{attributes:m,viewBox:g,body:s}}function K(e,t){let n=e.indexOf(`xlink:`)===-1?``:` xmlns:xlink="http://www.w3.org/1999/xlink"`;for(let e in t)n+=` `+e+`="`+t[e]+`"`;return`<svg xmlns="http://www.w3.org/2000/svg"`+n+`>`+e+`</svg>`}function Ne(e){return e.replace(/"/g,`'`).replace(/%/g,`%25`).replace(/#/g,`%23`).replace(/</g,`%3C`).replace(/>/g,`%3E`).replace(/\s+/g,` `)}function Pe(e){return`data:image/svg+xml,`+Ne(e)}function q(e){return`url("`+Pe(e)+`")`}var J=(()=>{let e;try{if(e=fetch,typeof e==`function`)return e}catch{}})();function Fe(e){J=e}function Ie(){return J}function Le(e,t){let n=I(e);if(!n)return 0;let r;if(!n.maxURL)r=0;else{let e=0;n.resources.forEach(t=>{e=Math.max(e,t.length)});let i=t+`.json?icons=`;r=n.maxURL-e-n.path.length-i.length}return r}function Re(e){return e===404}var ze=(e,t,n)=>{let r=[],i=Le(e,t),a=`icons`,o={type:a,provider:e,prefix:t,icons:[]},s=0;return n.forEach((n,c)=>{s+=n.length+1,s>=i&&c>0&&(r.push(o),o={type:a,provider:e,prefix:t,icons:[]},s=n.length),o.icons.push(n)}),r.push(o),r};function Be(e){if(typeof e==`string`){let t=I(e);if(t)return t.path}return`/`}var Ve={prepare:ze,send:(e,t,n)=>{if(!J){n(`abort`,424);return}let r=Be(t.provider);switch(t.type){case`icons`:{let e=t.prefix,n=t.icons.join(`,`),i=new URLSearchParams({icons:n});r+=e+`.json?`+i.toString();break}case`custom`:{let e=t.uri;r+=e.slice(0,1)===`/`?e.slice(1):e;break}default:n(`abort`,400);return}let i=503;J(e+r).then(e=>{let t=e.status;if(t!==200){setTimeout(()=>{n(Re(t)?`abort`:`next`,t)});return}return i=501,e.json()}).then(e=>{if(typeof e!=`object`||!e){setTimeout(()=>{e===404?n(`abort`,e):n(`next`,i)});return}setTimeout(()=>{n(`success`,e)})}).catch(()=>{n(`next`,i)})}};function He(e,t,n){C(n||``,t).loadIcons=e}function Ue(e,t,n){C(n||``,t).loadIcon=e}var Y=`data-style`,We=``;function Ge(e){We=e}function Ke(e,t){let n=Array.from(e.childNodes).find(e=>e.hasAttribute&&e.hasAttribute(Y));n||(n=document.createElement(`style`),n.setAttribute(Y,Y),e.appendChild(n)),n.textContent=`:host{display:inline-block;vertical-align:`+(t?`-0.125em`:`0`)+`}span,svg{display:block;margin:auto}`+We}function X(){de(``,Ve),E(!0);let e;try{e=window}catch{}if(e){if(e.IconifyPreload!==void 0){let t=e.IconifyPreload,n=`Invalid IconifyPreload syntax.`;typeof t==`object`&&t&&(t instanceof Array?t:[t]).forEach(e=>{try{(typeof e!=`object`||!e||e instanceof Array||typeof e.icons!=`object`||typeof e.prefix!=`string`||!O(e))&&console.error(n)}catch{console.error(n)}})}if(e.IconifyProviders!==void 0){let t=e.IconifyProviders;if(typeof t==`object`&&t)for(let e in t){let n=`IconifyProviders[`+e+`] is invalid.`;try{let r=t[e];if(typeof r!=`object`||!r||r.resources===void 0)continue;pe(e,r)||console.error(n)}catch{console.error(n)}}}}return{iconLoaded:ae,getIcon:oe,listIcons:re,addIcon:ie,addCollection:O,calculateSize:W,buildIcon:G,iconToHTML:K,svgToURL:q,loadIcons:V,loadIcon:we,addAPIProvider:pe,setCustomIconLoader:Ue,setCustomIconsLoader:He,appendCustomStyle:Ge,_api:{getAPIConfig:I,setAPIModule:de,sendAPIQuery:be,setFetch:Fe,getFetch:Ie,listAPIProviders:me}}}var Z={"background-color":`currentColor`},qe={"background-color":`transparent`},Je={image:`var(--svg)`,repeat:`no-repeat`,size:`100% 100%`},Ye={"-webkit-mask":Z,mask:Z,background:qe};for(let e in Ye){let t=Ye[e];for(let n in Je)t[e+`-`+n]=Je[n]}function Xe(e){return e?e+(e.match(/^[-0-9.]+$/)?`px`:``):`inherit`}function Ze(e,t,n){let r=document.createElement(`span`),i=e.body;i.indexOf(`<a`)!==-1&&(i+=`<!-- `+Date.now()+` -->`);let a=e.attributes,o=q(K(i,{...a,width:t.width+``,height:t.height+``})),s=r.style,c={"--svg":o,width:Xe(a.width),height:Xe(a.height),...n?Z:qe};for(let e in c)s.setProperty(e,c[e]);return r}var Q;function Qe(){try{Q=window.trustedTypes.createPolicy(`iconify`,{createHTML:e=>e})}catch{Q=null}}function $e(e){return Q===void 0&&Qe(),Q?Q.createHTML(e):e}function et(e){let t=document.createElement(`span`),n=e.attributes,r=``;return n.width||(r=`width: inherit;`),n.height||(r+=`height: inherit;`),r&&(n.style=r),t.innerHTML=$e(K(e.body,n)),t.firstChild}function $(e){return Array.from(e.childNodes).find(e=>{let t=e.tagName&&e.tagName.toUpperCase();return t===`SPAN`||t===`SVG`})}function tt(e,t){let r=t.icon.data,i=t.customisations,a=G(r,i);i.preserveAspectRatio&&(a.attributes.preserveAspectRatio=i.preserveAspectRatio);let o=t.renderedMode,s;switch(o){case`svg`:s=et(a);break;default:s=Ze(a,{...n,...r},o===`mask`)}let c=$(e);c?s.tagName===`SPAN`&&c.tagName===s.tagName?c.setAttribute(`style`,s.getAttribute(`style`)):e.replaceChild(s,c):e.appendChild(s)}function nt(e,t,n){return{rendered:!1,inline:t,icon:e,lastRender:n&&(n.rendered?n:n.lastRender)}}function rt(e=`iconify-icon`){let t,n;try{t=window.customElements,n=window.HTMLElement}catch{return}if(!t||!n)return;let r=t.get(e);if(r)return r;let i=[`icon`,`mode`,`inline`,`noobserver`,`width`,`height`,`rotate`,`flip`],a=class extends n{_shadowRoot;_initialised=!1;_state;_checkQueued=!1;_connected=!1;_observer=null;_visible=!0;constructor(){super();let e=this._shadowRoot=this.attachShadow({mode:`open`}),t=this.hasAttribute(`inline`);Ke(e,t),this._state=nt({value:``},t),this._queueCheck()}connectedCallback(){this._connected=!0,this.startObserver()}disconnectedCallback(){this._connected=!1,this.stopObserver()}static get observedAttributes(){return i.slice(0)}attributeChangedCallback(e){switch(e){case`inline`:{let e=this.hasAttribute(`inline`),t=this._state;e!==t.inline&&(t.inline=e,Ke(this._shadowRoot,e));break}case`noobserver`:this.hasAttribute(`noobserver`)?this.startObserver():this.stopObserver();break;default:this._queueCheck()}}get icon(){let e=this.getAttribute(`icon`);if(e&&e.slice(0,1)===`{`)try{return JSON.parse(e)}catch{}return e}set icon(e){typeof e==`object`&&(e=JSON.stringify(e)),this.setAttribute(`icon`,e)}get inline(){return this.hasAttribute(`inline`)}set inline(e){e?this.setAttribute(`inline`,`true`):this.removeAttribute(`inline`)}get observer(){return this.hasAttribute(`observer`)}set observer(e){e?this.setAttribute(`observer`,`true`):this.removeAttribute(`observer`)}restartAnimation(){let e=this._state;if(e.rendered){let t=this._shadowRoot;if(e.renderedMode===`svg`)try{t.lastChild.setCurrentTime(0);return}catch{}tt(t,e)}}get status(){let e=this._state;return e.rendered?`rendered`:e.icon.data===null?`failed`:`loading`}_queueCheck(){this._checkQueued||(this._checkQueued=!0,setTimeout(()=>{this._check()}))}_check(){if(!this._checkQueued)return;this._checkQueued=!1;let e=this._state,t=this.getAttribute(`icon`);if(t!==e.icon.value){this._iconChanged(t);return}if(!e.rendered||!this._visible)return;let n=this.getAttribute(`mode`),r=u(this);(e.attrMode!==n||d(e.customisations,r)||!$(this._shadowRoot))&&this._renderIcon(e.icon,r,n)}_iconChanged(e){let t=Te(e,(e,t,n)=>{let r=this._state;if(r.rendered||this.getAttribute(`icon`)!==e)return;let i={value:e,name:t,data:n};i.data?this._gotIconData(i):r.icon=i});t.data?this._gotIconData(t):this._state=nt(t,this._state.inline,this._state)}_forceRender(){if(!this._visible){let e=$(this._shadowRoot);e&&this._shadowRoot.removeChild(e);return}this._queueCheck()}_gotIconData(e){this._checkQueued=!1,this._renderIcon(e,u(this),this.getAttribute(`mode`))}_renderIcon(e,t,n){let r=Ee(e.data.body,n),i=this._state.inline;tt(this._shadowRoot,this._state={rendered:!0,icon:e,inline:i,customisations:t,attrMode:n,renderedMode:r})}startObserver(){if(!this._observer&&!this.hasAttribute(`noobserver`))try{this._observer=new IntersectionObserver(e=>{let t=e.some(e=>e.isIntersecting);t!==this._visible&&(this._visible=t,this._forceRender())}),this._observer.observe(this)}catch{if(this._observer){try{this._observer.disconnect()}catch{}this._observer=null}}}stopObserver(){this._observer&&(this._observer.disconnect(),this._observer=null,this._visible=!0,this._connected&&this._forceRender())}};i.forEach(e=>{e in a.prototype||Object.defineProperty(a.prototype,e,{get:function(){return this.getAttribute(e)},set:function(t){t===null?this.removeAttribute(e):this.setAttribute(e,t)}})});let o=X();for(let e in o)a[e]=a.prototype[e]=o[e];return t.define(e,a),a}var{iconLoaded:it,getIcon:at,listIcons:ot,addIcon:st,addCollection:ct,calculateSize:lt,buildIcon:ut,iconToHTML:dt,svgToURL:ft,loadIcons:pt,loadIcon:mt,setCustomIconLoader:ht,setCustomIconsLoader:gt,addAPIProvider:_t,_api:vt}=rt()||X();
|
|
1
|
+
var e=Object.freeze({left:0,top:0,width:16,height:16}),t=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),n=Object.freeze({...e,...t}),r=Object.freeze({...n,body:``,hidden:!1}),i=Object.freeze({width:null,height:null}),a=Object.freeze({...i,...t});function o(e,t=0){let n=e.replace(/^-?[0-9.]*/,``);function r(e){for(;e<0;)e+=4;return e%4}if(n===``){let t=parseInt(e);return isNaN(t)?0:r(t)}else if(n!==e){let t=0;switch(n){case`%`:t=25;break;case`deg`:t=90}if(t){let i=parseFloat(e.slice(0,e.length-n.length));return isNaN(i)?0:(i/=t,i%1==0?r(i):0)}}return t}var s=/[\s,]+/;function c(e,t){t.split(s).forEach(t=>{switch(t.trim()){case`horizontal`:e.hFlip=!0;break;case`vertical`:e.vFlip=!0;break}})}var l={...a,preserveAspectRatio:``};function u(e){let t={...l},n=(t,n)=>e.getAttribute(t)||n;return t.width=n(`width`,null),t.height=n(`height`,null),t.rotate=o(n(`rotate`,``)),c(t,n(`flip`,``)),t.preserveAspectRatio=n(`preserveAspectRatio`,n(`preserveaspectratio`,``)),t}function d(e,t){for(let n in l)if(e[n]!==t[n])return!0;return!1}var f=/^[a-z0-9]+(-[a-z0-9]+)*$/,p=(e,t,n,r=``)=>{let i=e.split(`:`);if(e.slice(0,1)===`@`){if(i.length<2||i.length>3)return null;r=i.shift().slice(1)}if(i.length>3||!i.length)return null;if(i.length>1){let e=i.pop(),n=i.pop(),a={provider:i.length>0?i[0]:r,prefix:n,name:e};return t&&!m(a)?null:a}let a=i[0],o=a.split(`-`);if(o.length>1){let e={provider:r,prefix:o.shift(),name:o.join(`-`)};return t&&!m(e)?null:e}if(n&&r===``){let e={provider:r,prefix:``,name:a};return t&&!m(e,n)?null:e}return null},m=(e,t)=>e?!!((t&&e.prefix===``||e.prefix)&&e.name):!1;function h(e,t){let n=e.icons,r=e.aliases||Object.create(null),i=Object.create(null);function a(e){if(n[e])return i[e]=[];if(!(e in i)){i[e]=null;let t=r[e]&&r[e].parent,n=t&&a(t);n&&(i[e]=[t].concat(n))}return i[e]}return Object.keys(n).concat(Object.keys(r)).forEach(a),i}function g(e,t){let n={};!e.hFlip!=!t.hFlip&&(n.hFlip=!0),!e.vFlip!=!t.vFlip&&(n.vFlip=!0);let r=((e.rotate||0)+(t.rotate||0))%4;return r&&(n.rotate=r),n}function _(e,n){let i=g(e,n);for(let a in r)a in t?a in e&&!(a in i)&&(i[a]=t[a]):a in n?i[a]=n[a]:a in e&&(i[a]=e[a]);return i}function v(e,t,n){let r=e.icons,i=e.aliases||Object.create(null),a={};function o(e){a=_(r[e]||i[e],a)}return o(t),n.forEach(o),_(e,a)}function y(e,t){let n=[];if(typeof e!=`object`||typeof e.icons!=`object`)return n;e.not_found instanceof Array&&e.not_found.forEach(e=>{t(e,null),n.push(e)});let r=h(e);for(let i in r){let a=r[i];a&&(t(i,v(e,i,a)),n.push(i))}return n}var b={provider:``,aliases:{},not_found:{},...e};function x(e,t){for(let n in t)if(n in e&&typeof e[n]!=typeof t[n])return!1;return!0}function ee(e){if(typeof e!=`object`||!e)return null;let t=e;if(typeof t.prefix!=`string`||!e.icons||typeof e.icons!=`object`||!x(e,b))return null;let n=t.icons;for(let e in n){let t=n[e];if(!e||typeof t.body!=`string`||!x(t,r))return null}let i=t.aliases||Object.create(null);for(let e in i){let t=i[e],a=t.parent;if(!e||typeof a!=`string`||!n[a]&&!i[a]||!x(t,r))return null}return t}var S=Object.create(null);function te(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function C(e,t){let n=S[e]||(S[e]=Object.create(null));return n[t]||(n[t]=te(e,t))}function w(e,t){return ee(t)?y(t,(t,n)=>{n?e.icons[t]=n:e.missing.add(t)}):[]}function ne(e,t,n){try{if(typeof n.body==`string`)return e.icons[t]={...n},!0}catch{}return!1}function re(e,t){let n=[];return(typeof e==`string`?[e]:Object.keys(S)).forEach(e=>{(typeof e==`string`&&typeof t==`string`?[t]:Object.keys(S[e]||{})).forEach(t=>{let r=C(e,t);n=n.concat(Object.keys(r.icons).map(n=>(e===``?``:`@`+e+`:`)+t+`:`+n))})}),n}var T=!1;function E(e){return typeof e==`boolean`&&(T=e),T}function D(e){let t=typeof e==`string`?p(e,!0,T):e;if(t){let e=C(t.provider,t.prefix),n=t.name;return e.icons[n]||(e.missing.has(n)?null:void 0)}}function ie(e,t){let n=p(e,!0,T);if(!n)return!1;let r=C(n.provider,n.prefix);return t?ne(r,n.name,t):(r.missing.add(n.name),!0)}function O(e,t){if(typeof e!=`object`)return!1;if(typeof t!=`string`&&(t=e.provider||``),T&&!t&&!e.prefix){let t=!1;return ee(e)&&(e.prefix=``,y(e,(e,n)=>{ie(e,n)&&(t=!0)})),t}let n=e.prefix;return m({prefix:n,name:`a`})?!!w(C(t,n),e):!1}function ae(e){return!!D(e)}function oe(e){let t=D(e);return t&&{...n,...t}}function k(e,t){e.forEach(e=>{let n=e.loaderCallbacks;n&&(e.loaderCallbacks=n.filter(e=>e.id!==t))})}function se(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;let t=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!t.length)return;let n=!1,r=e.provider,i=e.prefix;t.forEach(t=>{let a=t.icons,o=a.pending.length;a.pending=a.pending.filter(t=>{if(t.prefix!==i)return!0;let o=t.name;if(e.icons[o])a.loaded.push({provider:r,prefix:i,name:o});else if(e.missing.has(o))a.missing.push({provider:r,prefix:i,name:o});else return n=!0,!0;return!1}),a.pending.length!==o&&(n||k([e],t.id),t.callback(a.loaded.slice(0),a.missing.slice(0),a.pending.slice(0),t.abort))})}))}var ce=0;function le(e,t,n){let r=ce++,i=k.bind(null,n,r);if(!t.pending.length)return i;let a={id:r,icons:t,callback:e,abort:i};return n.forEach(e=>{(e.loaderCallbacks||=[]).push(a)}),i}function ue(e){let t={loaded:[],missing:[],pending:[]},n=Object.create(null);e.sort((e,t)=>e.provider===t.provider?e.prefix===t.prefix?e.name.localeCompare(t.name):e.prefix.localeCompare(t.prefix):e.provider.localeCompare(t.provider));let r={provider:``,prefix:``,name:``};return e.forEach(e=>{if(r.name===e.name&&r.prefix===e.prefix&&r.provider===e.provider)return;r=e;let i=e.provider,a=e.prefix,o=e.name,s=n[i]||(n[i]=Object.create(null)),c=s[a]||(s[a]=C(i,a)),l;l=o in c.icons?t.loaded:a===``||c.missing.has(o)?t.missing:t.pending;let u={provider:i,prefix:a,name:o};l.push(u)}),t}var A=Object.create(null);function de(e,t){A[e]=t}function j(e){return A[e]||A[``]}function fe(e,t=!0,n=!1){let r=[];return e.forEach(e=>{let i=typeof e==`string`?p(e,t,n):e;i&&r.push(i)}),r}function M(e){let t;if(typeof e.resources==`string`)t=[e.resources];else if(t=e.resources,!(t instanceof Array)||!t.length)return null;return{resources:t,path:e.path||`/`,maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}for(var N=Object.create(null),P=[`https://api.simplesvg.com`,`https://api.unisvg.com`],F=[];P.length>0;)P.length===1||Math.random()>.5?F.push(P.shift()):F.push(P.pop());N[``]=M({resources:[`https://api.iconify.design`].concat(F)});function pe(e,t){let n=M(t);return n===null?!1:(N[e]=n,!0)}function I(e){return N[e]}function me(){return Object.keys(N)}var he={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function ge(e,t,n,r){let i=e.resources.length,a=e.random?Math.floor(Math.random()*i):e.index,o;if(e.random){let t=e.resources.slice(0);for(o=[];t.length>1;){let e=Math.floor(Math.random()*t.length);o.push(t[e]),t=t.slice(0,e).concat(t.slice(e+1))}o=o.concat(t)}else o=e.resources.slice(a).concat(e.resources.slice(0,a));let s=Date.now(),c=`pending`,l=0,u,d=null,f=[],p=[];typeof r==`function`&&p.push(r);function m(){d&&=(clearTimeout(d),null)}function h(){c===`pending`&&(c=`aborted`),m(),f.forEach(e=>{e.status===`pending`&&(e.status=`aborted`)}),f=[]}function g(e,t){t&&(p=[]),typeof e==`function`&&p.push(e)}function _(){return{startTime:s,payload:t,status:c,queriesSent:l,queriesPending:f.length,subscribe:g,abort:h}}function v(){c=`failed`,p.forEach(e=>{e(void 0,u)})}function y(){f.forEach(e=>{e.status===`pending`&&(e.status=`aborted`)}),f=[]}function b(t,n,r){let i=n!==`success`;switch(f=f.filter(e=>e!==t),c){case`pending`:break;case`failed`:if(i||!e.dataAfterTimeout)return;break;default:return}if(n===`abort`){u=r,v();return}if(i){u=r,f.length||(o.length?x():v());return}if(m(),y(),!e.random){let n=e.resources.indexOf(t.resource);n!==-1&&n!==e.index&&(e.index=n)}c=`completed`,p.forEach(e=>{e(r)})}function x(){if(c!==`pending`)return;m();let r=o.shift();if(r===void 0){if(f.length){d=setTimeout(()=>{m(),c===`pending`&&(y(),v())},e.timeout);return}v();return}let i={status:`pending`,resource:r,callback:(e,t)=>{b(i,e,t)}};f.push(i),l++,d=setTimeout(x,e.rotate),n(r,t,i.callback)}return setTimeout(x),_}function _e(e){let t={...he,...e},n=[];function r(){n=n.filter(e=>e().status===`pending`)}function i(e,i,a){let o=ge(t,e,i,(e,t)=>{r(),a&&a(e,t)});return n.push(o),o}function a(e){return n.find(t=>e(t))||null}return{query:i,find:a,setIndex:e=>{t.index=e},getIndex:()=>t.index,cleanup:r}}function ve(){}var L=Object.create(null);function ye(e){if(!L[e]){let t=I(e);if(!t)return;L[e]={config:t,redundancy:_e(t)}}return L[e]}function be(e,t,n){let r,i;if(typeof e==`string`){let t=j(e);if(!t)return n(void 0,424),ve;i=t.send;let a=ye(e);a&&(r=a.redundancy)}else{let t=M(e);if(t){r=_e(t);let n=j(e.resources?e.resources[0]:``);n&&(i=n.send)}}return!r||!i?(n(void 0,424),ve):r.query(t,i,n)().abort}function R(){}function xe(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,se(e)}))}function Se(e){let t=[],n=[];return e.forEach(e=>{(e.match(f)?t:n).push(e)}),{valid:t,invalid:n}}function z(e,t,n){function r(){let n=e.pendingIcons;t.forEach(t=>{n&&n.delete(t),e.icons[t]||e.missing.add(t)})}if(n&&typeof n==`object`)try{if(!w(e,n).length){r();return}}catch(e){console.error(e)}r(),xe(e)}function B(e,t){e instanceof Promise?e.then(e=>{t(e)}).catch(()=>{t(null)}):t(e)}function Ce(e,t){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(t).sort():e.iconsToLoad=t,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;let{provider:t,prefix:n}=e,r=e.iconsToLoad;if(delete e.iconsToLoad,!r||!r.length)return;let i=e.loadIcon;if(e.loadIcons&&(r.length>1||!i)){B(e.loadIcons(r,n,t),t=>{z(e,r,t)});return}if(i){r.forEach(r=>{B(i(r,n,t),t=>{z(e,[r],t?{prefix:n,icons:{[r]:t}}:null)})});return}let{valid:a,invalid:o}=Se(r);if(o.length&&z(e,o,null),!a.length)return;let s=n.match(f)?j(t):null;if(!s){z(e,a,null);return}s.prepare(t,n,a).forEach(n=>{be(t,n,t=>{z(e,n.icons,t)})})}))}var V=(e,t)=>{let n=ue(fe(e,!0,E()));if(!n.pending.length){let e=!0;return t&&setTimeout(()=>{e&&t(n.loaded,n.missing,n.pending,R)}),()=>{e=!1}}let r=Object.create(null),i=[],a,o;return n.pending.forEach(e=>{let{provider:t,prefix:n}=e;if(n===o&&t===a)return;a=t,o=n,i.push(C(t,n));let s=r[t]||(r[t]=Object.create(null));s[n]||(s[n]=[])}),n.pending.forEach(e=>{let{provider:t,prefix:n,name:i}=e,a=C(t,n),o=a.pendingIcons||=new Set;o.has(i)||(o.add(i),r[t][n].push(i))}),i.forEach(e=>{let t=r[e.provider][e.prefix];t.length&&Ce(e,t)}),t?le(t,n,i):R},we=e=>new Promise((t,r)=>{let i=typeof e==`string`?p(e,!0):e;if(!i){r(e);return}V([i||e],a=>{if(a.length&&i){let e=D(i);if(e){t({...n,...e});return}}r(e)})});function H(e){try{let t=typeof e==`string`?JSON.parse(e):e;if(typeof t.body==`string`)return{...t}}catch{}}function Te(e,t){if(typeof e==`object`)return{data:H(e),value:e};if(typeof e!=`string`)return{value:e};if(e.includes(`{`)){let t=H(e);if(t)return{data:t,value:e}}let n=p(e,!0,!0);if(!n)return{value:e};let r=D(n);return r!==void 0||!n.prefix?{value:e,name:n,data:r}:{value:e,name:n,loading:V([n],()=>t(e,n,D(n)))}}var U=!1;try{U=navigator.vendor.indexOf(`Apple`)===0}catch{}function Ee(e,t){switch(t){case`svg`:case`bg`:case`mask`:return t}return t!==`style`&&(U||e.indexOf(`<a`)===-1)?`svg`:e.indexOf(`currentColor`)===-1?`bg`:`mask`}var De=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Oe=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function W(e,t,n){if(t===1)return e;if(n||=100,typeof e==`number`)return Math.ceil(e*t*n)/n;if(typeof e!=`string`)return e;let r=e.split(De);if(r===null||!r.length)return e;let i=[],a=r.shift(),o=Oe.test(a);for(;;){if(o){let e=parseFloat(a);isNaN(e)?i.push(a):i.push(Math.ceil(e*t*n)/n)}else i.push(a);if(a=r.shift(),a===void 0)return i.join(``);o=!o}}function ke(e,t=`defs`){let n=``,r=e.indexOf(`<`+t);for(;r>=0;){let i=e.indexOf(`>`,r),a=e.indexOf(`</`+t);if(i===-1||a===-1)break;let o=e.indexOf(`>`,a);if(o===-1)break;n+=e.slice(i+1,a).trim(),e=e.slice(0,r).trim()+e.slice(o+1)}return{defs:n,content:e}}function Ae(e,t){return e?`<defs>`+e+`</defs>`+t:t}function je(e,t,n){let r=ke(e);return Ae(r.defs,t+r.content+n)}var Me=e=>e===`unset`||e===`undefined`||e===`none`;function G(e,t){let r={...n,...e},i={...a,...t},o={left:r.left,top:r.top,width:r.width,height:r.height},s=r.body;[r,i].forEach(e=>{let t=[],n=e.hFlip,r=e.vFlip,i=e.rotate;n?r?i+=2:(t.push(`translate(`+(o.width+o.left).toString()+` `+(0-o.top).toString()+`)`),t.push(`scale(-1 1)`),o.top=o.left=0):r&&(t.push(`translate(`+(0-o.left).toString()+` `+(o.height+o.top).toString()+`)`),t.push(`scale(1 -1)`),o.top=o.left=0);let a;switch(i<0&&(i-=Math.floor(i/4)*4),i%=4,i){case 1:a=o.height/2+o.top,t.unshift(`rotate(90 `+a.toString()+` `+a.toString()+`)`);break;case 2:t.unshift(`rotate(180 `+(o.width/2+o.left).toString()+` `+(o.height/2+o.top).toString()+`)`);break;case 3:a=o.width/2+o.left,t.unshift(`rotate(-90 `+a.toString()+` `+a.toString()+`)`);break}i%2==1&&(o.left!==o.top&&(a=o.left,o.left=o.top,o.top=a),o.width!==o.height&&(a=o.width,o.width=o.height,o.height=a)),t.length&&(s=je(s,`<g transform="`+t.join(` `)+`">`,`</g>`))});let c=i.width,l=i.height,u=o.width,d=o.height,f,p;c===null?(p=l===null?`1em`:l===`auto`?d:l,f=W(p,u/d)):(f=c===`auto`?u:c,p=l===null?W(f,d/u):l===`auto`?d:l);let m={},h=(e,t)=>{Me(t)||(m[e]=t.toString())};h(`width`,f),h(`height`,p);let g=[o.left,o.top,u,d];return m.viewBox=g.join(` `),{attributes:m,viewBox:g,body:s}}function K(e,t){let n=e.indexOf(`xlink:`)===-1?``:` xmlns:xlink="http://www.w3.org/1999/xlink"`;for(let e in t)n+=` `+e+`="`+t[e]+`"`;return`<svg xmlns="http://www.w3.org/2000/svg"`+n+`>`+e+`</svg>`}function Ne(e){return e.replace(/"/g,`'`).replace(/%/g,`%25`).replace(/#/g,`%23`).replace(/</g,`%3C`).replace(/>/g,`%3E`).replace(/\s+/g,` `)}function Pe(e){return`data:image/svg+xml,`+Ne(e)}function q(e){return`url("`+Pe(e)+`")`}var J=(()=>{let e;try{if(e=fetch,typeof e==`function`)return e}catch{}})();function Fe(e){J=e}function Ie(){return J}function Le(e,t){let n=I(e);if(!n)return 0;let r;if(!n.maxURL)r=0;else{let e=0;n.resources.forEach(t=>{e=Math.max(e,t.length)});let i=t+`.json?icons=`;r=n.maxURL-e-n.path.length-i.length}return r}function Re(e){return e===404}var ze=(e,t,n)=>{let r=[],i=Le(e,t),a=`icons`,o={type:a,provider:e,prefix:t,icons:[]},s=0;return n.forEach((n,c)=>{s+=n.length+1,s>=i&&c>0&&(r.push(o),o={type:a,provider:e,prefix:t,icons:[]},s=n.length),o.icons.push(n)}),r.push(o),r};function Be(e){if(typeof e==`string`){let t=I(e);if(t)return t.path}return`/`}var Ve={prepare:ze,send:(e,t,n)=>{if(!J){n(`abort`,424);return}let r=Be(t.provider);switch(t.type){case`icons`:{let e=t.prefix,n=t.icons.join(`,`),i=new URLSearchParams({icons:n});r+=e+`.json?`+i.toString();break}case`custom`:{let e=t.uri;r+=e.slice(0,1)===`/`?e.slice(1):e;break}default:n(`abort`,400);return}let i=503;J(e+r).then(e=>{let t=e.status;if(t!==200){setTimeout(()=>{n(Re(t)?`abort`:`next`,t)});return}return i=501,e.json()}).then(e=>{if(typeof e!=`object`||!e){setTimeout(()=>{e===404?n(`abort`,e):n(`next`,i)});return}setTimeout(()=>{n(`success`,e)})}).catch(()=>{n(`next`,i)})}};function He(e,t,n){C(n||``,t).loadIcons=e}function Ue(e,t,n){C(n||``,t).loadIcon=e}var Y=`data-style`,We=``;function Ge(e){We=e}function Ke(e,t){let n=Array.from(e.childNodes).find(e=>e.hasAttribute&&e.hasAttribute(Y));n||(n=document.createElement(`style`),n.setAttribute(Y,Y),e.appendChild(n)),n.textContent=`:host{display:inline-block;vertical-align:`+(t?`-0.125em`:`0`)+`}span,svg{display:block;margin:auto}`+We}function X(){de(``,Ve),E(!0);let e;try{e=window}catch{}if(e){if(e.IconifyPreload!==void 0){let t=e.IconifyPreload,n=`Invalid IconifyPreload syntax.`;typeof t==`object`&&t&&(t instanceof Array?t:[t]).forEach(e=>{try{(typeof e!=`object`||!e||e instanceof Array||typeof e.icons!=`object`||typeof e.prefix!=`string`||!O(e))&&console.error(n)}catch{console.error(n)}})}if(e.IconifyProviders!==void 0){let t=e.IconifyProviders;if(typeof t==`object`&&t)for(let e in t){let n=`IconifyProviders[`+e+`] is invalid.`;try{let r=t[e];if(typeof r!=`object`||!r||r.resources===void 0)continue;pe(e,r)||console.error(n)}catch{console.error(n)}}}}return{iconLoaded:ae,getIcon:oe,listIcons:re,addIcon:ie,addCollection:O,calculateSize:W,buildIcon:G,iconToHTML:K,svgToURL:q,loadIcons:V,loadIcon:we,addAPIProvider:pe,setCustomIconLoader:Ue,setCustomIconsLoader:He,appendCustomStyle:Ge,_api:{getAPIConfig:I,setAPIModule:de,sendAPIQuery:be,setFetch:Fe,getFetch:Ie,listAPIProviders:me}}}var Z={"background-color":`currentColor`},qe={"background-color":`transparent`},Je={image:`var(--svg)`,repeat:`no-repeat`,size:`100% 100%`},Ye={"-webkit-mask":Z,mask:Z,background:qe};for(let e in Ye){let t=Ye[e];for(let n in Je)t[e+`-`+n]=Je[n]}function Xe(e){return e?e+(e.match(/^[-0-9.]+$/)?`px`:``):`inherit`}function Ze(e,t,n){let r=document.createElement(`span`),i=e.body;i.indexOf(`<a`)!==-1&&(i+=`<!-- `+Date.now()+` -->`);let a=e.attributes,o=q(K(i,{...a,width:t.width+``,height:t.height+``})),s=r.style,c={"--svg":o,width:Xe(a.width),height:Xe(a.height),...n?Z:qe};for(let e in c)s.setProperty(e,c[e]);return r}var Q;function Qe(){try{Q=window.trustedTypes.createPolicy(`iconify`,{createHTML:e=>e})}catch{Q=null}}function $e(e){return Q===void 0&&Qe(),Q?Q.createHTML(e):e}function et(e){let t=document.createElement(`span`),n=e.attributes,r=``;return n.width||(r=`width: inherit;`),n.height||(r+=`height: inherit;`),r&&(n.style=r),t.innerHTML=$e(K(e.body,n)),t.firstChild}function $(e){return Array.from(e.childNodes).find(e=>{let t=e.tagName&&e.tagName.toUpperCase();return t===`SPAN`||t===`SVG`})}function tt(e,t){let r=t.icon.data,i=t.customisations,a=G(r,i);i.preserveAspectRatio&&(a.attributes.preserveAspectRatio=i.preserveAspectRatio);let o=t.renderedMode,s;switch(o){case`svg`:s=et(a);break;default:s=Ze(a,{...n,...r},o===`mask`)}let c=$(e);c?s.tagName===`SPAN`&&c.tagName===s.tagName?c.setAttribute(`style`,s.getAttribute(`style`)):e.replaceChild(s,c):e.appendChild(s)}function nt(e,t,n){return{rendered:!1,inline:t,icon:e,lastRender:n&&(n.rendered?n:n.lastRender)}}function rt(e=`iconify-icon`){let t,n;try{t=window.customElements,n=window.HTMLElement}catch{return}if(!t||!n)return;let r=t.get(e);if(r)return r;let i=[`icon`,`mode`,`inline`,`noobserver`,`width`,`height`,`rotate`,`flip`],a=class extends n{_shadowRoot;_initialised=!1;_state;_checkQueued=!1;_connected=!1;_observer=null;_visible=!0;constructor(){super();let e=this._shadowRoot=this.attachShadow({mode:`open`}),t=this.hasAttribute(`inline`);Ke(e,t),this._state=nt({value:``},t),this._queueCheck()}connectedCallback(){this._connected=!0,this.startObserver()}disconnectedCallback(){this._connected=!1,this.stopObserver()}static get observedAttributes(){return i.slice(0)}attributeChangedCallback(e){switch(e){case`inline`:{let e=this.hasAttribute(`inline`),t=this._state;e!==t.inline&&(t.inline=e,Ke(this._shadowRoot,e));break}case`noobserver`:this.hasAttribute(`noobserver`)?this.startObserver():this.stopObserver();break;default:this._queueCheck()}}get icon(){let e=this.getAttribute(`icon`);if(e&&e.slice(0,1)===`{`)try{return JSON.parse(e)}catch{}return e}set icon(e){typeof e==`object`&&(e=JSON.stringify(e)),this.setAttribute(`icon`,e)}get inline(){return this.hasAttribute(`inline`)}set inline(e){e?this.setAttribute(`inline`,`true`):this.removeAttribute(`inline`)}get observer(){return this.hasAttribute(`observer`)}set observer(e){e?this.setAttribute(`observer`,`true`):this.removeAttribute(`observer`)}restartAnimation(){let e=this._state;if(e.rendered){let t=this._shadowRoot;if(e.renderedMode===`svg`)try{t.lastChild.setCurrentTime(0);return}catch{}tt(t,e)}}get status(){let e=this._state;return e.rendered?`rendered`:e.icon.data===null?`failed`:`loading`}_queueCheck(){this._checkQueued||(this._checkQueued=!0,setTimeout(()=>{this._check()}))}_check(){if(!this._checkQueued)return;this._checkQueued=!1;let e=this._state,t=this.getAttribute(`icon`);if(t!==e.icon.value){this._iconChanged(t);return}if(!e.rendered||!this._visible)return;let n=this.getAttribute(`mode`),r=u(this);(e.attrMode!==n||d(e.customisations,r)||!$(this._shadowRoot))&&this._renderIcon(e.icon,r,n)}_iconChanged(e){let t=Te(e,(e,t,n)=>{let r=this._state;if(r.rendered||this.getAttribute(`icon`)!==e)return;let i={value:e,name:t,data:n};i.data?this._gotIconData(i):r.icon=i});t.data?this._gotIconData(t):this._state=nt(t,this._state.inline,this._state)}_forceRender(){if(!this._visible){let e=$(this._shadowRoot);e&&this._shadowRoot.removeChild(e);return}this._queueCheck()}_gotIconData(e){this._checkQueued=!1,this._renderIcon(e,u(this),this.getAttribute(`mode`))}_renderIcon(e,t,n){let r=Ee(e.data.body,n),i=this._state.inline;tt(this._shadowRoot,this._state={rendered:!0,icon:e,inline:i,customisations:t,attrMode:n,renderedMode:r})}startObserver(){if(!this._observer&&!this.hasAttribute(`noobserver`))try{this._observer=new IntersectionObserver(e=>{let t=e.some(e=>e.isIntersecting);t!==this._visible&&(this._visible=t,this._forceRender())}),this._observer.observe(this)}catch{if(this._observer){try{this._observer.disconnect()}catch{}this._observer=null}}}stopObserver(){this._observer&&(this._observer.disconnect(),this._observer=null,this._visible=!0,this._connected&&this._forceRender())}};i.forEach(e=>{e in a.prototype||Object.defineProperty(a.prototype,e,{get:function(){return this.getAttribute(e)},set:function(t){t===null?this.removeAttribute(e):this.setAttribute(e,t)}})});let o=X();for(let e in o)a[e]=a.prototype[e]=o[e];return t.define(e,a),a}var{iconLoaded:it,getIcon:at,listIcons:ot,addIcon:st,addCollection:ct,calculateSize:lt,buildIcon:ut,iconToHTML:dt,svgToURL:ft,loadIcons:pt,loadIcon:mt,setCustomIconLoader:ht,setCustomIconsLoader:gt,addAPIProvider:_t,_api:vt}=rt()||X();export{mt as t};
|
|
2
2
|
//# sourceMappingURL=iconify-icon.js.map
|