require(["jquery","../../../webjars/xwiki-platform-tree-webjar/9.8.1/require-config.min.js"],function(a){var b=function(d,e){var c=this;c.path=d;c.params=e;c.initFromURL=function(h){c.params={};var m=h.indexOf("?");if(m==-1){c.path=h}else{c.path=h.substring(0,m);var g=h.substring(m+1);var k=g.split("&");for(var l=0;l<k.length;++l){var o=k[l].split("=");var j=decodeURIComponent(o[0]);var n=decodeURIComponent(o[1]);if(c.params[j]!==undefined){if(Array.isArray(c.params[j])){c.params[j].push(n)}else{var f=c.params[j];c.params[j]=[f,n]}}else{c.params[j]=n}}}};c.serialize=function(){var f=c.path;var j="?";for(var k in c.params){var h=c.params[k];if(k!=""&&h!==undefined){if(Array.isArray(h)){for(var g=0;g<h.length;++g){f+=j+encodeURIComponent(k)+"="+encodeURIComponent(h[g]);j="&"}}else{if(typeof h==="string"){f+=j+encodeURIComponent(k)+"="+encodeURIComponent(h);j="&"}}}}return f};c.clone=function(){var h=new b();h.path=c.path;h.params=[];for(var g in c.params){if(Array.isArray(c.params[g])){h.params[g]=[];for(var f=0;f<c.params[g].length;++f){h.params[g].push(c.params[g][f])}}else{if(typeof c.params[g]==="string"){h.params[g]=c.params[g]}}}return h}};require(["tree"],function(){a(document).ready(function(){a("#exportModal a.btn").each(function(){var e=a(this);var d=new b();d.initFromURL(e.attr("href"));e.data("url",d)});var c=a("#exportModal .xtree");c.on("loaded.jstree",function(){var d=a.jstree.reference(c);d.settings.checkbox.cascade="down";d.settings.checkbox.three_state=false;d.settings.contextmenu.select_node=false;d.check_all();d.settings.contextmenu.items=function(f){var e={};e.select_children={label:"Select all children",action:function(){for(var g=0;g<f.children.length;++g){var h=f.children[g];d.check_node(h)}},_disabled:!f.state.opened};e.unselect_children={label:"Unselect all children",action:function(){for(var g=0;g<f.children.length;++g){var h=f.children[g];d.uncheck_node(h)}},_disabled:!f.state.opened};return e};a("#exportModal .tree_select_all").click(function(){d.check_all();return false});a("#exportModal .tree_select_none").click(function(){d.uncheck_all();return false});a("#exportModal #exportModelOtherCollapse a.btn").click(function(e){var l=a(this);var f=l.data("url").clone();var n=d.get_checked(true);if(f.params===undefined){f.params={pages:[]}}f.params.pages=[];for(var k=0;k<n.length;++k){var g=n[k];var j=XWiki.Model.resolve(g.data.id,XWiki.EntityType.DOCUMENT);f.params.pages.push(XWiki.Model.serialize(j));if(j.getName()=="WebHome"){if(g.state.loaded==false){var h=new XWiki.EntityReference("%",XWiki.EntityType.DOCUMENT,j.parent);f.params.pages.push(XWiki.Model.serialize(h))}if(f.params.format=="xar"){var m=new XWiki.EntityReference("WebPreferences",XWiki.EntityType.DOCUMENT,j.parent);f.params.pages.push(XWiki.Model.serialize(m))}}}l.attr("href",f.serialize())})})})})});