%{
def caller = _caller
while (caller._caller) caller = caller._caller
def sm = caller.gsSM
( _arg ) && ( _import = _arg);
def a = _import
if (!a) a = _require
if (!(a || _load || _loadMissing || _loadAll)) throw new RuntimeException("either load or import statement needed");
if (a) sm.addJsMissings(a);
if (_load) {
def missings = play.modules.greenscript.utils.DependencyManager.JS_DEP_MGR.comprehend(_load)
sm.addJsMissings(missings)
}
if (!_charset) _charset='utf-8'
if (!_loadAll) _loadAll = _loadMissing
}%
#{if (sm.minimize())}
%{
def fn = "", l = null, cdn = null;
if (_load) {
l = sm.addJsLoaded(_load)
fn = play.modules.greenscript.utils.Minimizor.minimizeJs(l)
cdn = sm.getCdnItems(l)
}
%}
#{if (cdn != null && !cdn.isEmpty()) }
#{list items:cdn, as: '_'}
#{/list}
#{/if}
#{if (!fn.isEmpty())}
#{/if}
%{sm.clearLoaded()}%
#{if _loadAll}
%{
l = sm.getJsMissings()
fn = play.modules.greenscript.utils.Minimizor.minimizeJs(l);
cdn = sm.getCdnItems(l)
}%
#{if (cdn != null && !cdn.isEmpty()) }
#{list items: cdn, as: '_'}
#{/list}
#{/if}
#{if (!fn.isEmpty())}
#{/if}
#{/if}
#{/if}
#{else}
#{if _load}
#{list items:sm.addJsLoaded(_load), as:'name'}
#{/list}
#{/if}
%{sm.clearLoaded()}%
#{if _loadAll}
#{list items:sm.getJsMissings(), as:'name'}
#{/list}
#{/if}
#{/else}