require.config({paths:{"xwiki-selectize":"../../../../../../../../resources/uicomponents/suggest/xwiki.selectize.js?v=11.10.13"}});define("xwiki-suggestPages",["jquery","xwiki-selectize"],function(e){var g={"iconSetName":"Font Awesome","cssClass":"fa fa-file-o","iconSetType":"FONT","url":""};var a="WebHome"||"WebHome";var f=function(l){return{create:true,documentReference:l.data("documentReference"),searchScope:l.data("searchScope"),searchField:["searchValue","label","hint"],load:function(m,n){b(m,this.settings).done(n).fail(n)},loadSelected:function(m,n){h(m,this.settings).done(n).fail(n)}}};var i=function(l){if(!l.documentReference||typeof l.documentReference==="string"){l.documentReference=XWiki.Model.resolve(l.documentReference,XWiki.EntityType.DOCUMENT,XWiki.currentDocument.documentReference)}l.searchScope=j(l.searchScope||"wiki:"+XWiki.currentWiki);return l};var j=function(m){if(typeof m==="string"){try{return XWiki.Model.resolve(m,null,XWiki.currentDocument.documentReference)}catch(l){return null}}return m};var b=function(m,l){return e.getJSON(d(l.searchScope),e.param({q:m,scope:["name","title"],number:10,localeAware:true,prettyNames:true},true)).then(e.proxy(c,null,l))};var h=function(o,m){var l=XWiki.Model.resolve(o,XWiki.EntityType.DOCUMENT,m.documentReference);var n=new XWiki.Document(l).getRestURL();return e.getJSON(n,e.param({prettyNames:true})).then(e.proxy(k,null,m)).then(function(p){return[p]})};var d=function(n){var m=n.getReversedReferenceChain().filter(function(o){return o.type===XWiki.EntityType.SPACE}).map(function(o){return o.name});var l=n.extractReferenceValue(XWiki.EntityType.WIKI);return XWiki.Document.getRestSearchURL("",m,l)};var c=function(m,l){if(e.isArray(l.searchResults)){return l.searchResults.map(e.proxy(k,null,m))}else{return[]}};var k=function(t,p){var n=XWiki.Model.resolve(p.id,XWiki.EntityType.DOCUMENT);var o=n.relativeTo(t.documentReference.getRoot());var s=XWiki.Model.serialize(o);var l=s;var q=p.hierarchy.items;var r=q.pop().label;if(n.name===a){r=q.pop().label;l=XWiki.Model.serialize(o.parent)}var m=q.filter(function(u){return u.type==="space"}).map(function(u){return u.label}).join(" / ");return{value:s,searchValue:l,label:r,hint:m,icon:g,url:new XWiki.Document(n).getURL()}};e.fn.suggestPages=function(l){return this.each(function(){var m=e.extend(f(e(this)),l);e(this).xwikiSelectize(i(m))})}});require(["jquery","xwiki-suggestPages","xwiki-events-bridge"],function(a){var b=function(d,e){var c=a((e&&e.elements)||document);c.find(".suggest-pages").suggestPages()};a(document).on("xwiki:dom:loaded xwiki:dom:updated",b);XWiki.domIsLoaded&&b()});