11/*! Built with http://stenciljs.com */
2- ! function ( t , e , n , o , i , s , r , c , a , u , p ) { ! function ( t , e , n , o , i , s , r , c , a , u , p , h , l ) { ( t . stopwatchbox = t . stopwatchbox || { } ) . components = p , ( l = p . filter ( function ( t ) { return t [ 2 ] } ) . map ( function ( t ) { return t [ 0 ] } ) ) . length && ( ( h = e . createElement ( "style" ) ) . innerHTML = l . join ( ) + "{visibility:hidden}.hydrated{visibility:inherit}" , h . setAttribute ( "data-styles" , "" ) , e . head . insertBefore ( h , e . head . firstChild ) ) , ( h = n [ n . length - 1 ] ) && h . src && ( s = ( l = h . src . split ( "/" ) . slice ( 0 , - 1 ) ) . join ( "/" ) + ( l . length ?"/" :"" ) + "stopwatchbox/" ) , ( h = e . createElement ( "script" ) ) . src = s + ( ! function ( t ) { return t . location . search . indexOf ( "core=es5" ) > - 1 } ( t ) && function ( t ) { return t . customElements } ( t ) && function ( t ) { if ( ! ( "noModule" in h ) ) return ! 1 ; try { return new Function ( 'import("")' ) , ! 0 } catch ( t ) { return ! 1 } } ( ) && function ( t ) { return t . fetch } ( t ) && function ( t ) { return t . CSS && t . CSS . supports && t . CSS . supports ( "color" , "var(--c)" ) } ( t ) ?"stopwatchbox.5ac9z1fx.js" :"stopwatchbox.6jj17ql2.js" ) , h . setAttribute ( "data-path" , s ) , h . setAttribute ( "data-namespace" , "stopwatchbox" ) , e . head . appendChild ( h ) } ( t , e , e . scripts , 0 , 0 , "/build/stopwatchbox/" , 0 , 0 , 0 , 0 , [ [ "stop-watch" , "mbcice7o" , 1 , [ [ "applyHover" , 1 , "apply-hover" , 3 ] , [ "hours" , 1 , 1 , 2 ] , [ "milliseconds" , 1 , 1 , 2 ] , [ "minutes" , 1 , 1 , 2 ] , [ "seconds" , 1 , 1 , 2 ] ] ] , [ "stop-watch-box" , "mbcice7o" , 1 , [ [ "applyHover" , 1 , "apply-hover" , 3 ] , [ "hours" , 5 ] , [ "isTimerRunning" , 5 ] , [ "milliseconds" , 5 ] , [ "minutes" , 5 ] , [ "seconds" , 5 ] ] ] ] , void 0 ) } ( window , document ) ;
2+ ( function ( win , doc , namespace , fsNamespace , resourcesUrl , appCore , appCoreSsr , appCorePolyfilled , hydratedCssClass , components ) {
3+
4+ function init ( win , doc , namespace , fsNamespace , resourcesUrl , appCore , appCorePolyfilled , hydratedCssClass , components , HTMLElementPrototype , App , x , y , scriptElm , orgComponentOnReady ) {
5+ // create global namespace if it doesn't already exist
6+ App = win [ namespace ] = win [ namespace ] || { } ;
7+ App . components = components ;
8+ y = components . filter ( function ( c ) { return c [ 2 ] ; } ) . map ( function ( c ) { return c [ 0 ] ; } ) ;
9+ if ( y . length ) {
10+ // auto hide components until they been fully hydrated
11+ // reusing the "x" and "i" variables from the args for funzies
12+ x = doc . createElement ( 'style' ) ;
13+ x . innerHTML = y . join ( ) + '{visibility:hidden}.' + hydratedCssClass + '{visibility:inherit}' ;
14+ x . setAttribute ( 'data-styles' , '' ) ;
15+ doc . head . insertBefore ( x , doc . head . firstChild ) ;
16+ }
17+ // create a temporary array to store the resolves
18+ // before the core file has fully loaded
19+ App . $r = [ ] ;
20+ // add componentOnReady to HTMLElement.prototype
21+ orgComponentOnReady = HTMLElementPrototype . componentOnReady ;
22+ HTMLElementPrototype . componentOnReady = function componentOnReady ( cb ) {
23+ const elm = this ;
24+ // there may be more than one app on the window so
25+ // call original HTMLElement.prototype.componentOnReady
26+ // if one exists already
27+ orgComponentOnReady && orgComponentOnReady . call ( elm ) ;
28+ function executor ( resolve ) {
29+ if ( App . $r ) {
30+ // core file hasn't loaded yet
31+ // so let's throw it in this temporary queue
32+ // and when the core does load it'll handle these
33+ App . $r . push ( [ elm , resolve ] ) ;
34+ }
35+ else {
36+ // core has finished loading because there's no temporary queue
37+ // call the core's logic to handle this
38+ App . componentOnReady ( elm , resolve ) ;
39+ }
40+ }
41+ if ( cb ) {
42+ // just a callback
43+ return executor ( cb ) ;
44+ }
45+ // callback wasn't provided, let's return a promise
46+ if ( win . Promise ) {
47+ // use native/polyfilled promise
48+ return new Promise ( executor ) ;
49+ }
50+ // promise may not have been polyfilled yet
51+ return { then : executor } ;
52+ } ;
53+ // figure out the script element for this current script
54+ y = doc . querySelectorAll ( 'script' ) ;
55+ for ( x = y . length - 1 ; x >= 0 ; x -- ) {
56+ scriptElm = y [ x ] ;
57+ if ( scriptElm . src || scriptElm . hasAttribute ( 'data-resources-url' ) ) {
58+ break ;
59+ }
60+ }
61+ // get the resource path attribute on this script element
62+ y = scriptElm . getAttribute ( 'data-resources-url' ) ;
63+ if ( y ) {
64+ // the script element has a data-resources-url attribute, always use that
65+ resourcesUrl = y ;
66+ }
67+ if ( ! resourcesUrl && scriptElm . src ) {
68+ // we don't have an exact resourcesUrl, so let's
69+ // figure it out relative to this script's src and app's filesystem namespace
70+ y = scriptElm . src . split ( '/' ) . slice ( 0 , - 1 ) ;
71+ resourcesUrl = ( y . join ( '/' ) ) + ( y . length ? '/' : '' ) + fsNamespace + '/' ;
72+ }
73+ // request the core this browser needs
74+ // test for native support of custom elements and fetch
75+ // if either of those are not supported, then use the core w/ polyfills
76+ // also check if the page was build with ssr or not
77+ x = doc . createElement ( 'script' ) ;
78+ if ( usePolyfills ( win , win . location , x , 'import("")' ) ) {
79+ // requires the es5/polyfilled core
80+ x . src = resourcesUrl + appCorePolyfilled ;
81+ }
82+ else {
83+ // let's do this!
84+ x . src = resourcesUrl + appCore ;
85+ x . setAttribute ( 'type' , 'module' ) ;
86+ x . setAttribute ( 'crossorigin' , true ) ;
87+ }
88+ x . setAttribute ( 'data-resources-url' , resourcesUrl ) ;
89+ x . setAttribute ( 'data-namespace' , fsNamespace ) ;
90+ doc . head . appendChild ( x ) ;
91+ }
92+ function usePolyfills ( win , location , scriptElm , dynamicImportTest ) {
93+ // fyi, dev mode has verbose if/return statements
94+ // but it minifies to a nice 'lil one-liner ;)
95+ if ( location . search . indexOf ( 'core=esm' ) > 0 ) {
96+ // force esm build
97+ return false ;
98+ }
99+ if ( ( location . search . indexOf ( 'core=es5' ) > 0 ) ||
100+ ( location . protocol === 'file:' ) ||
101+ ( ! ( win . customElements && win . customElements . define ) ) ||
102+ ( ! win . fetch ) ||
103+ ( ! ( win . CSS && win . CSS . supports && win . CSS . supports ( 'color' , 'var(--c)' ) ) ) ||
104+ ( ! ( 'noModule' in scriptElm ) ) ) {
105+ // es5 build w/ polyfills
106+ return true ;
107+ }
108+ // final test to see if this browser support dynamic imports
109+ return doesNotSupportsDynamicImports ( dynamicImportTest ) ;
110+ }
111+ function doesNotSupportsDynamicImports ( dynamicImportTest ) {
112+ try {
113+ new Function ( dynamicImportTest ) ;
114+ return false ;
115+ }
116+ catch ( e ) { }
117+ return true ;
118+ }
119+
120+
121+ init ( win , doc , namespace , fsNamespace , resourcesUrl , appCore , appCoreSsr , appCorePolyfilled , hydratedCssClass , components ) ;
122+
123+ } ) ( window , document , "stopwatchbox" , "stopwatchbox" , 0 , "stopwatchbox.core.js" , "es5-build-disabled.js" , "hydrated" , [ [ "stop-watch" , "stop-watch" , 1 , [ [ "applyHover" , 1 , 0 , "apply-hover" , 3 ] , [ "hours" , 1 , 0 , 1 , 2 ] , [ "milliseconds" , 1 , 0 , 1 , 2 ] , [ "minutes" , 1 , 0 , 1 , 2 ] , [ "seconds" , 1 , 0 , 1 , 2 ] ] ] , [ "stop-watch-box" , "stop-watch" , 1 , [ [ "applyHover" , 1 , 0 , "apply-hover" , 3 ] , [ "hours" , 5 ] , [ "isTimerRunning" , 5 ] , [ "milliseconds" , 5 ] , [ "minutes" , 5 ] , [ "seconds" , 5 ] ] ] ] , HTMLElement . prototype ) ;
0 commit comments