(function(){var a="sproutcore/standard_theme";if(!SC.BUNDLE_INFO){throw"SC.BUNDLE_INFO is not defined!"
}if(SC.BUNDLE_INFO[a]){return}SC.BUNDLE_INFO[a]={requires:["sproutcore/empty_theme"],styles:["/multivio/client/sproutcore/standard_theme/en/1.0.0/stylesheet-packed.css","/multivio/client/sproutcore/standard_theme/en/1.0.0/stylesheet.css"],scripts:["/multivio/client/sproutcore/standard_theme/en/1.0.0/javascript-packed.js"]}
})();SC.stringsFor("English",{_Metadata:"Show or hide the metadata",_Thumbnails:"Show or hide page thumbnails",_Tree:"Show or hide the document structure",_Search:"Search in the document",_Help:"Help",_ShowToolbar:"Show the toolbar permanently or only by hovering with the mouse pointer",_Download:"Download the current file",_Overview:"Show or hide the overview",_Pan:"Activate or deactivate the 'pan' mode",_RotateLeft:"Rotate left",_RotateRight:"Rotate right",_FirstPage:"Jump to the first page or to the previous file",_PreviousPage:"Go to the previous page (Shift+PgUp)",_NextPage:"Go to the next page (Shift+PgDown)",_LastPage:"Jump to the last page or to the next file","_Zoom+":"Zoom in (+)","_Zoom-":"Zoom out (-)",_FullSize:"Zoom to full size",_FullWidth:"Zoom to full width",_NativeSize:"Zoom to native size","_Change theme to white":"Change theme to white","_Change theme to dark gray":"Change theme to dark gray","_Change theme to blue":"Change theme to blue","_Click to go to Multivio website.":"Click to go to Multivio website.","_Current client version:":"Current client version:","_Current server version:":"Current server version:",_ThumbnailListMode:"Show thumbnails in a list",_ThumbnailGridMode:"Show thumbnails in a grid",_creator:"author",_mime:"file type",_language:"language",_nPages:"number of pages",_title:"title","_How to launch Multivio":"How to launch Multivio","_The calling syntax is":"The calling syntax is","_The {TARGET} URL can link to":"The {TARGET} URL can link to","_A Dublin Core record":"A record in Dublin Core format","_A MARC21 record":"A record in MARC21 format","_A MODS record":"A record in MODS format","_A METS record (supported profiles only)":"A METS record (supported profiles only)",_Examples:"Examples","_An error occurred":"An error occurred",_PermissionDenied:"You are not allowed to see this document.",_UnableToRetrieveRemoteDocument:"The requested document does not exist or is not accessible.",_UnsupportedFormat:"The format of the requested document is currently not supported.",_InvalidArgument:"Incorrect arguments.",_HttpMethodNotAllowed:"The HTTP method is not supported by this server.",_VersionIncompatibility:"The server and the client versions are not compatible.",_ServerNotFound:"The Multivio server is not accessible.",_Default:"An error occured. Please contact support at %@","_Go back":"Go back",_EmailErrorMessageSubject:"Multivio error",_EmailErrorMessageHeader:"[Insert your text here, or simply send this message as it is]",_EmailErrorMessageTechnicalInfo:"Technical information - DO NOT MODIFY","_Loading the requested resolution may take a long time":"Loading the requested resolution may take a long time","_Would you like to proceed?":"Would you like to proceed?","_File download":"File download","_unknown size":"unknown size",_File:"File",_Page:"Page",_Proceed:"Proceed",_Continue:"Continue","_Use lower resolution":"Use lower resolution","_Incorrect page number":"Incorrect page number","_Please enter a number between 1 and %@":"Please enter a number between 1 and %@",_Yes:"Yes",_Ok:"Ok",_No:"No",_Cancel:"Cancel","_Fetching remote data...":"Fetching remote data...",_doSearch:"Search",_goToNext:"Next occurence",_goToPrevious:"Previous occurence",_searchIn:"Select the file in which to search",_doClear:"Clear",_noSearchResultTitle:"No results found",_noSearchResultDesc:"No result was found for the given query",_typeQueryHere:"Type search query here",_tooManyResults:"Search result limit reached",_firstOccurrences:"Only the first %@ occurences are displayed.",_noResult:"No result was found",_searchInProgress:"Searching...",_listOfResults:"%@%@ results found",_resultsPages:"in %@%@ pages",_resultSelection:"Result %@/%@",_AllFiles:"All files",_More:"More...",_NoTextualContent:"No textual content",_NotSearchable:"The file is apparently not searchable",_helpTitle:"Help",_helpIntro:"Multivio is able to display digital documents such as      books, articles and images. In order to know more about Multivio go to      the website <a href='http://www.multivio.org'>www.multivio.org</a>      or contact the team by email at      <a href='mailto:info@multivio.org'>info@multivio.org</a>.<br/>      A tooltip associated with each button provides a description of its      function. It can be accessed by hovering the mouse over the      corresponding button. The application contains two different groups of      buttons: one in the vertical sidebar on the left and the other in the      navigation toolbar at the bottom.",_helpContentsTitle:"Help contents",_helpVerticalBar:"Side toolbar",_helpToc:"Displays the document structure and provides navigation capabilities.",_helpThum:"Displays page thumbnails of the document. They can be disposed      in either a list or a grid, using the two corresponding buttons at the      bottom: ",_helpSearch:'Allows searching inside the document. The results are shown      in their context and highlighted in the page.<br>      It is possible to perform a Boolean "AND" search by separating the      different search words by "AND", for instance:<br>      <tt>&nbsp;history AND europe</tt><br>      When performing a Boolean "AND" search, Multivio finds a combination      of the given words within the same page.      If the current document is composed of several files, it is possible to      select the file in which to perform the search, or to search in all      files at once.<br>      The search process is case-insensitive (searching for "europe" or "Europe"      produces the same result). Only the first 50 occurrences in each      file are shown. If this limit is exceeded, the reported number of results      is 50+, meaning "50 or more".<br>      NB: certain documents do not contain textual content, which is      usually the case with paper documents scanned in image mode only,      with no character recognition process done afterwards; the application      shows a warning if that is the case.',_helpDownload:"Downloads the current file.",_helpDisplayBar:"Makes the navigation toolbar remain visible.",_helpNavigationBar:"Navigation toolbar",_helpNavigationBarDesc:"This toolbar is shown when the mouse pointer      goes over the lower part of the displayed document.",_helpLoupe:"Shows or hides the overview miniature (bottom left) that      indicates which portion of the content is currently visible. It also      allows to move the visible portion around using the mouse. This tool      is available only when the content is too large to fit entirely in the      screen.",_helpRotation:"Rotates the current page by 90 degrees anticlockwise      or clockwise.",_helpNavigation:"Allows to navigate along the document: next and previous      page, beginning and end of document. It is also possible to access a      given page number by using the box located in the central part of the      toolbar.",_helpZoom:"Zooms the displayed content in or out.",_helpFullSize:"Adjusts the size of the document to the content window.",_helpFullWidth:"Displays the document using the full window width.",_helpNativeSize:"Displays the document using its native resolution.",_mouseActionsTitle:"Mouse actions",_mouseActions:'<table>      <thead>        <tr>          <th>ACTION</th>          <th>EFFECT</th>        </tr>      </thead>      <tbody>        <tr>          <td>Mouse wheel</td>          <td>Scrolls through the document.</td>        </tr>        <tr>          <td>Mouse pointer</td>          <td>            Clicking and dragging over the document creates an area of text            selection, which can be copied to the clipboard using the            browser\'s standard "Copy" command.<br>            NB: certain documents do not contain textual content (see note            about the search tool above).          </td>        </tr>      <tbody/>    </table>',_keyShortcutsTitle:"Keyboard shortcuts",_keyShortcuts:"<table>      <thead>        <tr>          <th>SHORTCUT</th>          <th>EFFECT</th>        </tr>      </thead>      <tbody>        <tr>          <td>+/-</td>          <td>Zooms in and out.</td>        </tr>        <tr>          <td>Up/down arrows</td>          <td>Produces the same effect as the mouse wheel.</td>        </tr>        <tr>          <td>Page Up/Down</td>          <td>Scrolls the displayed content up or down one screen at a time.</td>        </tr>        <tr>          <td>Shift + Page Up/Down</td>          <td>Jumps to the beginning of the previous/next page.</td>        </tr>      <tbody/>    </table>"});
SC.ExceptionHandler.handleException=function(a){console.error(a)};Multivio=SC.Application.create({NAMESPACE:"Multivio",VERSION:"1.0.0",store:SC.Store.create()});
Multivio.checkParams=function(d,c){var b="";for(var a in c){if(c.hasOwnProperty(a)){if(SC.typeOf(d[a])!==c[a]){b.push("parameter %@ of type %@ required; ".fmt(a,c[a]))
}}}return b};Multivio.configurator=SC.Object.create({support:"info@multivio.org",serverName:"/server",serverVersion:null,serverApiCompatibility:"1.0.0",allowedThemes:["mvo-white-theme","mvo-dark-gray-theme","mvo-blue-theme"],metadataKey:["title","creator","language"],initialTheme:"mvo-white-theme",initialFile:1,initialPosition:1,logParameters:{log:{browserConsole:"LOG_DEBUG",ajax:"LOG_ERROR"},logFile:"/log/post"},zoomParameters:{maxResolution:4000000,scaleForVectorGraphics:[0.1,0.15,0.2,0.3,0.4,0.5,0.75,1,1.5,2,3,4],scaleForBitmapGraphics:[0.1,0.15,0.2,0.3,0.4,0.5,0.75,1],initState:"Full"},baseUrlParameters:{version:"/version",metadata:"/metadata/get?url=",logicalStructure:"/structure/get_logical?url=",physicalStructure:"/structure/get_physical?url=",thumbnail:"/document/render?max_height=100&max_width=100",image:"/document/render?",imageSize:"/document/get_size?",search:"/document/search?query=%@&from=%@&to=%@&context_size=%@&max_results=%@&angle=%@&url=",getText:"/document/get_text?page_nr=%@&x1=%@&y1=%@&x2=%@&y2=%@&angle=%@&url=",getPageIndexing:"/document/get_indexing?page_nr=%@&from=%@&to=%@&url=",fixtures:{VAA:"/static/multivio/en/current/images/VAA"}},layouts:{"default":{layoutClass:"GridLayout3x3",layoutParams:{leftStripWidth:0,rightStripWidth:0,headerHeight:0,footerHeight:50,marginTop:10,marginRight:10,marginBottom:0,marginLeft:10}}},componentLayouts:{init:{baseLayout:"default",components:[{name:"views.footerView",coord:"A3:C3"},{name:"views.mainContentView",coord:"A1:C2",children:["views.leftButtons","views.bottomButtons","views.navigationInfo"]}]},usage:{baseLayout:"default",components:[{name:"views.usageView",coord:"A1:C3"}]},waiting:{baseLayout:"default",components:[{name:"views.waitingView",coord:"A1:C3"}]},error:{baseLayout:"default",components:[{name:"views.errorView",coord:"A1:C3"}]}},fixtureSets:{VAA:{componentLayout:"pageBasedWithDivider"}},layoutConfig:{xml:{components:[{name:"views.treeView",coord:"A1:C2"}]},pdf:{components:[{name:"views.mainContentView",coord:"A1:C2",children:["views.leftButtons","views.bottomButtons","views.navigationInfo"]}],zoomScale:"scaleForVectorGraphics"},image:{components:[{name:"views.mainContentView",coord:"A1:C2",children:["views.leftButtons","views.bottomButtons","views.navigationInfo"]}],zoomScale:"scaleForBitmapGraphics"}},getTypeForMimeType:function(a){var b=undefined;
if(a.match(".*?/xml.*?")){b="xml"}if(a.match(".*?/pdf.*?")){b="pdf"}if(a.match("image/.*?")){b="image"
}return b},getPath:function(b){if(SC.typeOf(b)!==SC.T_STRING){throw {message:'Configuration path type "%@" is invalid'.fmt(SC.typeOf(b))}
}var a=undefined;var d=b.split(".");if(!SC.none(d)&&d.length>0){a=this[d[0]];if(SC.none(a)){throw {message:'Configuration path "%@" is invalid'.fmt(b)}
}for(var c=1;c<d.length;c++){a=a[d[c]]}}return a},getImageUrl:function(d,b){var e=Multivio.initializer.get("inputParameters").scenario;
var a="";switch(e){case"get":a=this.getPath("baseUrlParameters.image");if(b!==0){a+="page_nr="+b;
a+="&url="+d}else{a+="url="+d}break;case"fixtures":var c=Multivio.initializer.get("inputParameters").name;
a=this.getPath("baseUrlParameters.fixtures.%@".fmt(c));a+=d.substring(d.lastIndexOf("/"));
break;default:a=undefined;break}return a},getThumbnailUrl:function(d,b){var e=Multivio.initializer.get("inputParameters").scenario;
var a;switch(e){case"get":a=this.get("baseUrlParameters").thumbnail;if(b!==0){a+="&page_nr="+b
}a+="&url="+d;break;case"fixtures":var c=Multivio.initializer.get("inputParameters").name;
a=this.getPath("baseUrlParameters.fixtures.%@".fmt(c));a+=d.substring(d.lastIndexOf("/"));
break;default:a=undefined;break}return a}});Multivio.calendarController=SC.ObjectController.create({listOfYears:null,selectedYear:null,monthsByYears:null,isNextYearEnabled:YES,isPreviousYearEnabled:YES,listOfMonths:null,selectedMonth:null,isNextMonthEnabled:YES,isPreviousMonthEnabled:YES,listOfDays:null,selectedDay:null,urlsByDay:null,physical:null,initialize:function(){if(SC.none(this.get("listOfYears"))){var c=Multivio.CDM.getReferer();
var f=Multivio.CDM.getLogicalStructure(c);var g=[];this.monthsByYears={};for(var e=0;
e<f.length;e++){var l={};l.year=f[e].label;l.index=e+"";g.push(l);var a=f[e].childs;
var b=[];for(var d=0;d<a.length;d++){var h={};h.date=a[d].label;h.url=a[d].file_position.url;
b.push(h)}this.monthsByYears[f[e].label]=b}this.set("listOfYears",g);this.set("selectedYear",g[0])
}},selectedYearDidChange:function(){var d=this.get("selectedYear");if(!SC.none(d)){var c=this.monthsByYears[d.year];
var e=[];for(var b=0;b<c.length;b++){var f={};f.month=c[b].date;f.name=this.getMonthName(parseInt(c[b].date,10));
f.url=c[b].url;f.index=b;e.push(f)}this.set("listOfMonths",e);this.set("selectedMonth",e[0]);
var a=parseInt(d.index,10);if(a===0){this.set("isPreviousYearEnabled",NO)}else{this.set("isPreviousYearEnabled",YES)
}if(a===this.get("listOfYears").length-1){this.set("isNextYearEnabled",NO)}else{this.set("isNextYearEnabled",YES)
}}}.observes("selectedYear"),previousYear:function(){var b=this.get("selectedYear");
if(!SC.none(b)){var a=parseInt(b.index,10);a=a-1;this.set("selectedYear",this.get("listOfYears")[a])
}},nextYear:function(c){var b=this.get("selectedYear");if(!SC.none(b)){var a=parseInt(b.index,10);
a=a+1;this.set("selectedYear",this.get("listOfYears")[a])}},selectedMonthDidChange:function(){var c=this.get("selectedMonth");
if(!SC.none(c)){this.selectedDay=null;var a=Multivio.CDM.getPhysicalstructure(c.url);
if(a!==-1){this.createListOfDays()}else{this.bind("physical",SC.Binding.oneWay("Multivio.CDM.physicalStructure"))
}var b=parseInt(c.index,10);if(b===0){this.set("isPreviousMonthEnabled",NO)}else{this.set("isPreviousMonthEnabled",YES)
}if(b===this.get("listOfMonths").length-1){this.set("isNextMonthEnabled",NO)}else{this.set("isNextMonthEnabled",YES)
}}}.observes("selectedMonth"),previousMonth:function(){var b=this.get("selectedMonth");
if(!SC.none(b)){var a=parseInt(b.index,10);a=a-1;this.set("selectedMonth",this.get("listOfMonths")[a])
}},nextMonth:function(){var b=this.get("selectedMonth");if(!SC.none(b)){var a=parseInt(b.index,10);
a=a+1;this.set("selectedMonth",this.get("listOfMonths")[a])}},getMonthName:function(d){var c="January February March April May June July August September October November December".w();
var b=null;if(SC.typeOf(d)===SC.T_NUMBER&&d>=1&&d<=12){b=c[d-1].loc()}else{var a='Invalid value %@ in input parameter "monthNumber". '.fmt(d)+"Value must be an integer in the range [0,12].";
throw new Error(a)}return b},physicalDidChange:function(){var a=this.get("physical");
if(!SC.none(a)){var b=a[this.get("selectedMonth").url];if(b!==-1){this.createListOfDays()
}}}.observes("physical"),createListOfDays:function(){console.info("create");this.urlsByDay={};
var f=Multivio.CDM.getPhysicalstructure(this.get("selectedMonth").url);if(f!==-1){var c=[];
for(var a=0;a<f.length;a++){var b=f[a].label;var e=b.split("-");var d=parseInt(e[2],10);
c.push(d);this.urlsByDay[d]=f[a].url}this.set("listOfDays",c);if(SC.none(this.get("selectedDay"))){this.set("selectedDay",c[0])
}}},selectedDayDidChange:function(){var b=this.get("selectedDay");var a=this.urlsByDay[b];
if(a!==Multivio.masterController.get("currentFile")){Multivio.makeFirstResponder(Multivio.INIT);
Multivio.sendAction("notAllowSelection");Multivio.masterController.zoomState=Multivio.zoomController.currentZoomState;
Multivio.masterController.set("currentFile",a)}}.observes("selectedDay")});Multivio.imageController=SC.ArrayController.create({isLoadingContent:null,isLoadingContentBinding:"Multivio.masterController.isLoadingContent",allowsMultipleSelection:NO,visiblePart:{height:null,width:null,x:0,y:0},scrollPosition:{verticalPos:0,horizontalPos:0},physicalStructure:null,position:null,isOneScrollVisible:NO,initialize:function(c){if(this.get("bindings").length!==0){this.reset()
}this.bind("position","Multivio.masterController.currentPosition");this.bind("isOneScrollVisible","Multivio.overviewController.isOverviewEnabled");
var d=Multivio.CDM.getFileMetadata(c);if(SC.none(d.nPages)){if(Multivio.masterController.isGrouped){var b=Multivio.CDM.getPhysicalstructure(Multivio.CDM.getReferer());
if(b!==-1){this._createImages(b)}else{this.bind("physicalStructure","Multivio.CDM.physicalStructure")
}}else{var a=Multivio.CDM.getPhysicalstructure(c);if(a!==-1){if(!SC.none(a)){this._createImages(a)
}else{Multivio.logger.warning("ImageController has no physical structure")}}else{this.bind("physicalStructure","Multivio.CDM.physicalStructure")
}}}else{if(Multivio.masterController.isGrouped){}else{this._createPDFImages(c,d.nPages)
}}Multivio.logger.info("imageController initialized")},reset:function(){var a=this.get("bindings");
for(var b=0;b<a.length;b++){var c=a[b];c.disconnect()}this.set("bindings",[]);this.position=null;
this.set("content",null);this.set("selection",null)},physicalStructureDidChange:function(){var a=this.get("physicalStructure");
if(!SC.none(a)){if(Multivio.masterController.isGrouped){var b=Multivio.CDM.getPhysicalstructure(Multivio.CDM.getReferer());
if(b!==-1){this._createImages(b)}}else{var c=Multivio.masterController.get("currentFile");
if(!SC.none(c)){var d=this.get("physicalStructure")[c];if(d!==-1){if(!SC.none(d)){this._createImages(d)
}}}}}}.observes("physicalStructure"),_createPDFImages:function(f,c){var b=[];for(var e=1;
e<c+1;e++){var d=Multivio.configurator.get("serverName")+Multivio.configurator.getImageUrl(f,e);
var a={url:d,pageNumber:e};b.push(a)}this.set("content",b);Multivio.sendAction("addComponent","imageController");
Multivio.logger.info("imageController#createPDFImages pdf images created and layout setted"+this.get("content").length)
},_createImages:function(c){var b=[];for(var f=0;f<c.length;f++){var g=c[f];var e=g.url;
var d=undefined;if(Multivio.initializer.get("inputParameters").scenario==="fixtures"){d=Multivio.configurator.getImageUrl(e,0)
}else{d=Multivio.configurator.get("serverName")+Multivio.configurator.getImageUrl(e,0)
}var a={url:d,pageNumber:f+1};b.push(a)}this.set("content",b);Multivio.sendAction("addComponent","imageController");
Multivio.logger.info("imageController#createImages images created and layout setted"+this.get("content").length)
},positionDidChange:function(){var b=this.get("position");if(!SC.none(b)&&!SC.none(this.get("content"))){b--;
var a=this.get("content");var c=a[b];this.set("selection",SC.SelectionSet.create().addObject(c));
SC.RunLoop.begin();this.set("isLoadingContent",YES);SC.RunLoop.end();Multivio.logger.info("imageController#positionDidChange: %@".fmt(this.get("selection").firstObject()))
}}.observes("position","content")});Multivio.metadataController=SC.ObjectController.create({initialize:function(a){var b=Multivio.CDM.getFileMetadata(a);
if(!SC.none(b)&&b!==-1){this.set("content",b)}Multivio.logger.info("metadataController initialized")
},getTranslatedMetadata:function(){var a=this.get("content");var g=[];var b=Multivio.configurator.get("metadataKey");
for(var e=0;e<b.length;e++){var d=b[e];if(!SC.none(a[d])){var c=[];var f=("_"+d).loc();
c.key=f;c.data=a[d];g.push(c)}}return g},descriptiveMetadataDictionary:function(){var e=this.get("content");
for(var c in e){if(e.hasOwnProperty(c)){if(SC.typeOf(e[c])===SC.T_ARRAY){var a=e[c];
var d="";for(var b in a){if(a.hasOwnProperty(b)){if(d.length>0){d=d+"; "}d=d+a[b]
}}e[c]=d}}}return e}.property("content"),title:function(){var b=null;try{b=this.get("content").title
}catch(a){}return b}.property("content").cacheable()});Multivio.navigationController=SC.ObjectController.create({currentPage:null,currentFile:null,_numberOfPages:null,isLoadingContent:null,isLoadingContentBinding:"Multivio.masterController.isLoadingContent",isNextEnabled:YES,isPreviousEnabled:YES,isFirstEnabled:YES,isLastEnabled:YES,isCurrentPageEnabled:YES,position:null,physicalStructure:null,initialize:function(b){this.position=null;
this.bind("position","Multivio.masterController.currentPosition");this.bind("currentFile","Multivio.masterController.currentFileIndex");
var c=Multivio.CDM.getFileMetadata(b);if(SC.none(c.nPages)){if(Multivio.masterController.isGrouped){var a=Multivio.CDM.getPhysicalstructure(Multivio.CDM.getReferer());
if(a!==-1){this.set("_numberOfPages",a.length);Multivio.sendAction("addComponent","navigationController")
}else{this.bind("physicalStructure","Multivio.CDM.physicalStructure")}}else{var d=Multivio.CDM.getPhysicalstructure(b);
if(d===-1){this.bind("physicalStructure","Multivio.CDM.physicalStructure")}else{if(!SC.none(d)){this.set("_numberOfPages",d.length);
Multivio.sendAction("addComponent","navigationController")}}}}else{if(Multivio.masterController.isGrouped){}else{this.set("_numberOfPages",c.nPages);
Multivio.sendAction("addComponent","navigationController")}}if(!SC.none(this.get("currentFile"))&&this.get("currentFile")>0){this.set("isFirstEnabled",YES)
}Multivio.logger.info("navigationController initialized")},physicalStructureDidChange:function(){var c=this.get("physicalStructure");
if(!SC.none(c)){if(Multivio.masterController.isGrouped){var a=Multivio.CDM.getPhysicalstructure(Multivio.CDM.getReferer());
if(a!==-1){this.set("_numberOfPages",a.length);Multivio.sendAction("addComponent","navigationController")
}}else{var b=Multivio.masterController.get("currentFile");if(!SC.none(b)){var d=this.get("physicalStructure")[b];
if(d!==-1&&!SC.none(d)){this.set("_numberOfPages",d.length);Multivio.sendAction("addComponent","navigationController")
}}}}}.observes("physicalStructure"),positionDidChange:function(){var b=this.get("position");
if(!SC.none(b)){var a=this.get("currentPage");if(a!==b){this.set("isLoadingContent",YES);
this.set("currentPage",b);Multivio.logger.info("navigationController#positionDidChange: %@".fmt(this.get("currentPage")))
}}}.observes("position"),_currentPageDidChange:function(){var a=this.get("currentPage");
var b=this.get("_numberOfPages");if(isFinite(a)){a=parseInt(a,10)}if(SC.typeOf(b)===SC.T_NUMBER){if(SC.typeOf(a)!==SC.T_NUMBER||a<1||a>b){Multivio.usco.showAlertPaneWarn("_Incorrect page number".loc(),"_Please enter a number between 1 and %@".loc()+b,"_Ok".loc(),"",this)
}else{this.set("position",a)}}}.observes("currentPage"),alertPaneDidDismiss:function(b,a){switch(a){case SC.BUTTON1_STATUS:this.set("currentPage",this.get("position"));
break}},isLoadingContentDidChange:function(){var a=this.get("isLoadingContent");if(a){this.set("isPreviousEnabled",NO);
this.set("isNextEnabled",NO);this.set("isFirstEnabled",NO);this.set("isLastEnabled",NO);
this.set("isCurrentPageEnabled",NO)}else{this.set("isCurrentPageEnabled",YES);var c=this.get("currentPage");
var b=this.get("currentFile");if(Multivio.masterController.isGrouped){if(c!==1){this.set("isPreviousEnabled",YES);
this.set("isFirstEnabled",YES)}if(c!==this.get("_numberOfPages")){this.set("isNextEnabled",YES);
this.set("isLastEnabled",YES)}}else{if(!SC.none(b)){if(c!==1){this.set("isPreviousEnabled",YES)
}else{if(b!==0){this.set("isPreviousEnabled",YES)}}if(b!==0){this.set("isFirstEnabled",YES)
}else{if(c!==1){this.set("isFirstEnabled",YES)}}if(c!==this.get("_numberOfPages")){this.set("isNextEnabled",YES)
}else{if(!SC.none(Multivio.masterController.listOfFiles)&&b<Multivio.masterController.listOfFiles.length-1){this.set("isNextEnabled",YES)
}}if(!SC.none(Multivio.masterController.listOfFiles)&&(b<Multivio.masterController.listOfFiles.length-1||(b===(Multivio.masterController.listOfFiles.length-1))&&c!==this.get("_numberOfPages"))){this.set("isLastEnabled",YES)
}}else{if(c!==1){this.set("isPreviousEnabled",YES);this.set("isFirstEnabled",YES)
}if(c!==this.get("_numberOfPages")){this.set("isNextEnabled",YES);this.set("isLastEnabled",YES)
}}}}}.observes("isLoadingContent"),goToNextPage:function(){this.set("isPreviousEnabled",YES);
var a=parseInt(this.get("currentPage"),10)+1;if(a<=this.get("_numberOfPages")){SC.RunLoop.begin();
this.set("isLoadingContent",YES);SC.RunLoop.end();this.set("currentPage",a)}},goToPreviousPage:function(){this.set("isNextEnabled",YES);
var a=this.get("currentPage")-1;if(a>0){SC.RunLoop.begin();this.set("isLoadingContent",YES);
SC.RunLoop.end();this.set("currentPage",a)}},goToFirstPage:function(){SC.RunLoop.begin();
this.set("isLoadingContent",YES);SC.RunLoop.end();if(SC.none(this.get("currentFile"))){this.set("currentPage",1)
}else{if(this.get("currentPage")!==1){this.set("currentPage",1)}else{var a=this.get("currentFile");
a--;this.currentPage=null;this.set("currentFile",a);Multivio.makeFirstResponder(Multivio.INIT);
Multivio.READY.showLastPosition=YES;Multivio.sendAction("notAllowSelection");Multivio.masterController.zoomState=Multivio.zoomController.currentZoomState
}}},goToLastPage:function(){SC.RunLoop.begin();this.set("isLoadingContent",YES);SC.RunLoop.end();
if(SC.none(this.get("currentFile"))){var a=this.get("_numberOfPages");this.set("currentPage",a)
}else{if(this.get("currentPage")!==this.get("_numberOfPages")){this.set("currentPage",this.get("_numberOfPages"))
}else{var b=this.get("currentFile");b++;Multivio.makeFirstResponder(Multivio.INIT);
Multivio.sendAction("notAllowSelection");Multivio.masterController.zoomState=Multivio.zoomController.currentZoomState;
this.set("currentFile",b)}}},goToNext:function(){if(SC.none(this.get("currentFile"))){if(this.get("currentPage")!==this.get("_numberOfPages")){this.goToNextPage()
}}else{if(this.get("currentPage")===this.get("_numberOfPages")){if(this.get("currentFile")!==Multivio.masterController.listOfFiles.length-1&&!Multivio.masterController.isGrouped){this.goToLastPage()
}}else{this.goToNextPage()}}},goToPrevious:function(){if(SC.none(this.get("currentFile"))){if(this.get("currentPage")!==1){this.goToPreviousPage()
}}else{if(this.get("currentPage")===1){if(this.get("currentFile")!==0){this.goToFirstPage()
}}else{this.goToPreviousPage()}}},keyEvent:function(a){switch(a.which){case 33:this.goToPrevious();
return YES;case 34:this.goToNext();return YES;default:return NO}}});Multivio.overviewController=SC.ObjectController.create({selection:null,rotate:0,visiblePart:null,isOverviewActive:NO,isOverviewEnabled:NO,thumbnailUrl:null,scrolls:{horizontal:0,vertical:0},showOverview:function(b){if(!this.get("isOverviewActive")){this.set("isOverviewActive",YES);
this.bind("selection",SC.Binding.oneWay("Multivio.imageController.selection"));this.bind("rotate",SC.Binding.oneWay("Multivio.rotateController.currentValue"));
this.bind("visiblePart",SC.Binding.oneWay("Multivio.imageController.visiblePart"));
var c=Multivio.getPath("views.mainContentView.content").get("frame");var d=[];d.width=150;
d.height=150;d.right=34;d.bottom=150;var a=Multivio.getPath("views.overviewPalette");
a.set("layout",d);a.append()}else{this.set("isOverviewActive",NO);this.reset();Multivio.getPath("views.overviewPalette").remove()
}},isOverviewEnabledDidChange:function(){if(!this.get("isOverviewEnabled")){this.set("isOverviewActive",NO);
this.reset();Multivio.getPath("views.overviewPalette").remove()}}.observes("isOverviewEnabled"),reset:function(){var a=this.get("bindings");
for(var b=0;b<a.length;b++){var c=a[b];c.disconnect()}this.set("bindings",[]);this.selection=null;
this.rotate=0;this.visiblePart=null},scrollsDidChange:function(){var a={};a.verticalPos=this.get("scrolls").vertical;
a.horizontalPos=this.get("scrolls").horizontal;Multivio.imageController.set("scrollPosition",a)
}.observes("scrolls"),selectionDidChange:function(){var c=this.get("selection");if(!SC.none(c)&&!SC.none(c.firstObject())){var b=c.firstObject().url;
var a=this.get("rotate");b=b.replace("?","?max_width=130&max_height=130&angle="+a+"&");
this.set("thumbnailUrl",b)}}.observes("selection"),rotateDidChange:function(){var c=this.get("selection");
if(!SC.none(c)&&!SC.none(c.firstObject())){var b=c.firstObject().url;var a=this.get("rotate");
b=b.replace("?","?max_width=130&max_height=130&angle="+a+"&");this.set("thumbnailUrl",b)
}}.observes("rotate")});Multivio.paletteController=SC.ObjectController.create({defaultWidth:320,activeButton:null,thumbnailSize:null,metadata:null,thumbnailMode:"list",isHorizontalToolbarActive:null,paletteLayout:function(c){var b=Multivio.getPath("views.mainContentView.content");
var a=b.get("frame").height;var d=[];d.bottom=150;d.top=b.get("parentView").get("frame").y+5;
d.left=b.get("frame").x+15;if(c){d.width=this.defaultWidth}else{d.width=150}return d
},showMetadata:function(b){var c=Multivio.getPath("views.metadataPalette");if(SC.none(this.activeButton)){b.set("isActive",YES);
this.activeButton=b;var a=c.get("contentView").get("childViews")[0];a.set("content",Multivio.metadataController.getTranslatedMetadata());
c.set("layout",this.paletteLayout(YES));c.append()}else{if(this.activeButton!==b){this.hidePalette(this.activeButton.name);
this.showOtherPalette(b)}else{this.activeButton=null;c.remove()}}},showThumbnails:function(a){var b=Multivio.getPath("views.thumbnailPalette");
if(SC.none(this.activeButton)){a.set("isActive",YES);this.activeButton=a;b.set("layout",this.paletteLayout(NO));
this.adjustThumbnailLayoutToMode();b.append()}else{if(this.activeButton!==a){this.hidePalette(this.activeButton.name);
this.showOtherPalette(a)}else{this.activeButton=null;b.remove()}}},adjustThumbnailLayoutToMode:function(){var a=Multivio.getPath("views.thumbnailPalette");
var b=Multivio.getPath("views.mainContentView.frame");var c=a.layout;if(this.get("thumbnailMode")==="list"){delete c.right;
c.width=150}else{delete c.width;c.right=parseInt(b.width*0.4,10)}a.adjust(c)}.observes("thumbnailMode","Multivio.views.mainContentView.frame"),showTree:function(b){var a=null;
if(Multivio.masterController.get("isTimeNavigationEnabled")){Multivio.calendarController.initialize();
a=Multivio.getPath("views.calendarPalette")}else{a=Multivio.getPath("views.treePalette")
}if(SC.none(this.activeButton)){b.set("isActive",YES);this.activeButton=b;a.set("layout",this.paletteLayout(YES));
a.append()}else{if(this.activeButton!==b){this.hidePalette(this.activeButton.name);
this.showOtherPalette(b)}else{this.activeButton=null;a.remove()}}},showSearch:function(b){var a=Multivio.getPath("views.searchPalette");
if(SC.none(this.activeButton)){b.set("isActive",YES);this.activeButton=b;a.set("layout",this.paletteLayout(YES));
a.append()}else{if(this.activeButton!==b){this.hidePalette(this.activeButton.name);
this.showOtherPalette(b)}else{this.activeButton=null;a.remove()}}},showHelpPalette:function(a){var b=Multivio.getPath("views.helpPalette");
if(SC.none(this.activeButton)){a.set("isActive",YES);this.activeButton=a;b.set("layout",this.paletteLayout(YES));
b.append()}else{if(this.activeButton!==a){this.hidePalette(this.activeButton.name);
this.showOtherPalette(a)}else{this.activeButton=null;b.remove()}}},showHorizontalToolbar:function(a){if(this.isHorizontalToolbarActive){a.set("isActive",NO);
this.set("isHorizontalToolbarActive",NO)}else{a.set("isActive",YES);this.set("isHorizontalToolbarActive",YES)
}},downloadFile:function(c){var e=Multivio.masterController.get("currentFile");if(Multivio.masterController.isGrouped){var a=Multivio.CDM.getPhysicalstructure(Multivio.CDM.getReferer());
var d=Multivio.masterController.get("currentPosition");e=a[d-1].url}var b=Multivio.CDM.getFileMetadata(e);
if(b!==-1){this.showPaneInfo()}else{this.bind("metadata",SC.Binding.from("Multivio.CDM.fileMetadata").oneWay())
}},showPaneInfo:function(){var e=Multivio.masterController.get("currentFile");if(Multivio.masterController.isGrouped){var b=Multivio.CDM.getPhysicalstructure(Multivio.CDM.getReferer());
var d=Multivio.masterController.get("currentPosition");e=b[d-1].url}var c=SC.none(this.get("metadata"))?Multivio.CDM.getFileMetadata(e):this.get("metadata")[e];
if(!SC.none(c)&&c!==-1){var a=SC.none(c.fileSize)?-1:c.fileSize;if(a===-1){a="_unknown size".loc()
}else{switch(true){case a<=1024:a=a+" Bytes";break;case a<=Math.pow(1024,2):a=(a/1024);
a=Math.round(a*100)/100;a=a+" KB";break;case a<=Math.pow(1024,3):a=(a/Math.pow(1024,2));
a=Math.round(a*100)/100;a=a+" MB";break;case a<=Math.pow(1024,4):a=(a/Math.pow(1024,3));
a=Math.round(a*100)/100;a=a+" GB";break;default:Multivio.logger.info("bigger than GB");
break}}Multivio.usco.showAlertPaneInfoWithController("_File download".loc(),e+" ("+a+")","_Continue".loc(),"_Cancel".loc(),this)
}}.observes("metadata"),alertPaneDidDismiss:function(c,a){switch(a){case SC.BUTTON1_STATUS:var b=c.description;
b=b.split("(");window.open(b[0]);break;case SC.BUTTON2_STATUS:break}},showOtherPalette:function(a){switch(a.name){case"thumbnails":this.showThumbnails(a);
break;case"tree":this.showTree(a);break;case"metadata":this.showMetadata(a);break;
case"search":this.showSearch(a);break;case"help":this.showHelpPalette(a);break;default:Multivio.logger.info("unable to show the selected palette");
break}},hidePalette:function(a){if(!SC.none(this.activeButton)){var b=!SC.none(a)?a:this.activeButton.name;
switch(b){case"thumbnails":Multivio.getPath("views.thumbnailPalette").remove();break;
case"tree":if(Multivio.masterController.get("isTimeNavigationEnabled")){Multivio.getPath("views.calendarPalette").remove()
}else{Multivio.getPath("views.treePalette").remove()}break;case"metadata":Multivio.getPath("views.metadataPalette").remove();
break;case"search":Multivio.getPath("views.searchPalette").remove();break;case"help":Multivio.getPath("views.helpPalette").remove();
break;default:Multivio.logger.info("unable to hide the selected palette");break}this.activeButton.set("isActive",NO);
this.activeButton=null}}});Multivio.rotateController=SC.ObjectController.create({currentValue:0,isLoadingContent:null,isLoadingContentBinding:"Multivio.masterController.isLoadingContent",isRigthAllow:YES,isLeftAllow:YES,resetRotateValue:function(){SC.RunLoop.begin();
this.set("currentValue",0);SC.RunLoop.end()},isLoadingContentDidChange:function(){var a=this.get("isLoadingContent");
if(a){this.set("isRigthAllow",NO);this.set("isLeftAllow",NO)}else{this.set("isRigthAllow",YES);
this.set("isLeftAllow",YES)}}.observes("isLoadingContent"),rotateLeft:function(){var b=this.get("currentValue");
var a=0;if(b!==270){a=b+90}SC.RunLoop.begin();this.set("isLoadingContent",YES);SC.RunLoop.end();
this.set("currentValue",a)},rotateRight:function(){var a=this.get("currentValue");
var b=0;if(a!==-270){b=a-90}SC.RunLoop.begin();this.set("isLoadingContent",YES);SC.RunLoop.end();
this.set("currentValue",b)}});Multivio.HighlightController=SC.ArrayController.extend({allowsMultipleSelection:NO,isEditable:YES,zoomFactor:null,minimalZoneDimension:2,rotateValue:undefined,currentFileList:undefined,physicalStructure:undefined,selectedText:undefined,selectedTextBinding:SC.Binding.oneWay("Multivio.CDM.selectedText").notNull().notEmpty(),userSelection:undefined,selectedTextString:undefined,userSelectionDidChange:function(){var g=this.get("userSelection"),f;
var e=this.get("rotateValue");var a=this.get("zoomFactor");f=this._getOriginalZone(g,a);
f=this.getUnrotatedCoords(f,e);var d=this.getSelectionsOnLinesBetweenPoints(f.left,f.top,f.left+f.width,f.top+f.height);
var b="";if(!SC.none(d)){b=d.join(" ")}Multivio.selectionController.set("selectedTextString",b);
Multivio.logger.debug("userSelectionDidChange: text: [%@]".fmt(b))}.observes("userSelection"),getSelectionLineAtPoint:function(a,g){var f=this._getPageIndexing();
if(SC.none(f)||f===-1){return -1}var e=Multivio.masterController.get("currentPosition");
if(SC.none(f.pages)||SC.none(f.pages[e])){return -1}var c=f.pages[e].lines;var b;
for(var d=0;d<c.length;d++){b=c[d];if(g>=b.t&&g<=(b.t+b.h)){Multivio.logger.debug('getSelectionLineAtPoint: "%@" at line %@ '+"(tlwh:%@,%@,%@,%@) for given point (%@,%@)".fmt(b.text,d,b.t,b.l,b.w,b.h,a,g));
return b}}},getSelectionsOnLinesBetweenPoints:function(F,d,E,c){Multivio.logger.debug("getSelectionsOnLinesBetweenPoints(%@,%@,%@,%@)".fmt(F,d,E,c));
if(Math.abs(E-F)<3||Math.abs(c-d)<3){return[]}var H=this._getPageIndexing();if(SC.none(H)||H===-1){return[]
}var p=[];var h=Multivio.masterController.get("currentPosition");if(SC.none(H.pages)||SC.none(H.pages[h])){return[]
}var b=H.pages[h].lines;var D=undefined,J=0;var t=0,I=0,r=0,G=0;var z,e=-1,y=-1,m=-1,g=-1,x=[],v=[],u=[],s=[],f=NO,q=-1;
for(var C=0;C<b.length;C++){z=b[C];if(e===-1&&d<=z.t&&c>=z.t&&F<=z.r){e=C;Multivio.logger.debug("selection start at line #"+C)
}f=(C===(b.length-1));q=(z.t+z.h*0.5);if((e!==-1&&y===-1)&&(f||(c<=q)||E<=z.l)){y=C;
Multivio.logger.debug("selection stop at line #"+C);if((p.length===0||(f&&c>q)&&E>=z.l)){p.push(z)
}D=(p.length===1);var n=undefined,o=undefined,a="";m=-1;g=-1;var A=0,B=0;n=p[A];a=n.text.split(" ");
for(B=0;B<n.x.length;B++){o=n.x[B];if(m===-1&&(F<=o.l||(o.l<=F&&F<=o.r))){m=B}if(m!==-1&&B>=m){v.push(a[B])
}}if(m===-1){Multivio.logger.debug("first line, word_start is -1, setting to 0...");
m=0}if(p.length!==1){t=n.x[m].l;I=n.t;r=n.x[n.x.length-1].r;G=I+n.h;this.addHighlightHelper(t,I,r,G,YES)
}n=p[p.length-1];a=n.text.split(" ");J=(D?m:0);for(B=J;B<n.x.length;B++){o=n.x[B];
if(g===-1){s.push(a[B])}if(E<=o.l){g=Math.max(B-1,0);s.pop();break}}if(g===-1){g=n.x.length-1
}if(p.length===1){t=n.x[m].l;I=n.t;r=n.x[g].r;G=I+n.h}else{t=n.l;I=n.t;r=n.x[g].r;
G=I+n.h}this.addHighlightHelper(t,I,r,G,YES);for(A=1;A<p.length-1;A++){n=p[A];a=n.text.split(" ");
for(B=0;B<n.x.length;B++){o=n.x[B];u.push(a[B])}t=n.l;I=n.t;r=n.x[n.x.length-1].r;
G=I+n.h;this.addHighlightHelper(t,I,r,G,YES)}if(p.length===1){x=s}else{x=v.concat(u).concat(s)
}break}if(e!==-1&&y===-1){p.push(z)}}return x},_currentPositionDidChange:function(){Multivio.logger.debug("_currentPositionDidChange");
this._getPageIndexing()}.observes("Multivio.masterController.currentPosition"),_currentFileDidChange:function(){Multivio.logger.debug("_currentFileDidChange");
this._getPageIndexing()}.observes("Multivio.masterController.currentFile"),_getPageIndexing:function(){if(Multivio.firstResponder!==Multivio.READY){return
}Multivio.logger.debug("_getPageIndexing from: "+this);var d=Multivio.masterController.get("currentFile");
var e=Multivio.masterController.get("currentPosition")||1;var c=this.get("currentFileList");
if(SC.none(c)){Multivio.logger.debug("_getPageIndexing: no file list, skipping: "+c);
return}var a=c.length;var b=this.get("url");Multivio.logger.debug("_getPageIndexing, url: "+d);
if(a>1&&d===b){Multivio.logger.debug("_getPageIndexing: ref_url, skipping");return
}if(!SC.none(d)&&!SC.none(e)){return Multivio.CDM.getPageIndexing(d,e,undefined,undefined)
}return undefined},_physicalStructureDidChange:function(){Multivio.logger.debug("_physicalStructureDidChange, first (%@)".fmt(this));
var a=this.get("physicalStructure");if(this.get("physicalStructureInitialised")){return
}var c=Multivio.CDM.getReferer();var e=null;Multivio.logger.debug("_physicalStructureDidChange,referer: "+c+" phys: "+a[c]);
Multivio.logger.debug("_physicalStructureDidChange, entering...");if(!SC.none(a)&&!SC.none(a[c])&&a[c].length>0){this.set("physicalStructureInitialised",YES);
if(a[c].length<2){Multivio.logger.debug("_physicalStructureDidChange, removing scope");
Multivio.logger.debug("_physicalStructureDidChange, url: "+a[c][0].url);Multivio.searchController.set("currentSearchFile",a[c][0].url);
Multivio.searchController.set("currentFileList",[a[c][0]]);Multivio.selectionController.set("currentFileList",[a[c][0]])
}else{var b=Multivio.CDM.clone(a[c]);if(a[c].length>1){b.insertAt(0,{label:"_AllFiles".loc(),url:c})
}Multivio.selectionController.set("currentFileList",b);Multivio.searchController.set("currentFileList",b)
}e={};for(var d=0;d<a[c].length;d++){e[a[c][d].url]=YES}Multivio.selectionController.set("displayResults",e);
Multivio.searchController.set("displayResults",e)}}.observes("physicalStructure"),addHighlight:function(l,o,d,i,b,h,e,c,a){if(d<=this.minimalZoneDimension||i<=this.minimalZoneDimension){return null
}var g;g=SC.Object.create({top:l,left:o,width:d,height:i});var n=undefined;var m=undefined;
if(c){n=this._getCurrentZone(g,e);m={page_number:b,type:h,current:n,original:g}}else{var j=this._getOriginalZone(g,e);
var f=this.get("rotateValue");j=this.getUnrotatedCoords(j,f);m={page_number:b,type:h,current:g,original:j}
}m.url=a;this.addObject(m);return m},addHighlightHelper:function(c,j,a,h,d){var i=j,n=c,e=Math.abs(a-c),f=Math.abs(h-j);
var g=this.get("zoomFactor");var l=Multivio.masterController.get("currentFile");var b=Multivio.masterController.get("currentPosition");
var m="selection";return this.addHighlight(i,n,e,f,b,m,g,d,l)},removeHighlight:function(b){var a=this.objectAt(b);
if(SC.none(a)){return NO}this.removeObject(a);a.original.destroy();a.current.destroy();
return YES},removeHighlightOnPage:function(a,b){if(this.objectAt(a).index===b){this.removeHighlight(a)
}},removeAllHighlightsOnPage:function(b){var a=this.get("length");while(--a>=0){this.removeHighlightOnPage(a,b)
}},removeAllHighlights:function(){this.set("content",[])},getZone:function(a){return this.objectAt(a)
},rotateValueDidChange:function(){this.updateCoordinates(NO,YES)}.observes("rotateValue"),zoomFactorDidChange:function(){this.updateCoordinates(YES,NO)
}.observes("zoomFactor"),_getOriginalZone:function(a,b){var c;c=SC.Object.create({top:a.top/b,left:a.left/b,width:a.width/b,height:a.height/b,page:a.page,type:a.type});
return c},_getCurrentZone:function(a,b){return this._getOriginalZone(a,1/b)},updateCoordinates:function(p,e){if(Multivio.firstResponder!==Multivio.READY){return
}var h=this.get("rotateValue");var i=this.get("zoomFactor");var f=Multivio.masterController.get("currentFile");
var n=Multivio.masterController.get("currentPosition");if(SC.none(f)||SC.none(n)){return
}var b="page_nr=%@&url=%@".fmt(n,f);var a=Multivio.CDM.getImageSize(b);var g=this.get("length"),m,d,j;
while(--g>=0){j=this.getZone(g);if(j.page_number!==n){continue}m=j.current;d=j.original;
m=this.getRotationCoords(d,h,a);m=this._getCurrentZone(m,i);j.current=m}},getRotationCoords:function(j,e,b){var i=b.width;
var h=b.height;var g,d=j.left;var a,m=j.top;var f,c=d+j.width;var n,l=m+j.height;
if(e===-90||e===270){g=Math.max(0,h-l);a=d;f=Math.max(0,h-m);n=c}else{if(e===90||e===-270){g=m;
a=Math.max(0,i-c);f=l;n=Math.max(0,i-d)}else{if(e===-180||e===180){g=Math.max(0,i-c);
a=Math.max(0,h-l);f=Math.max(0,i-d);n=Math.max(0,h-m)}else{g=d;a=m;f=c;n=l}}}return{left:g,top:a,width:Math.abs(f-g),height:Math.abs(n-a)}
},getUnrotatedCoords:function(b,h){var g=b;if(h===0){return g}var e=Multivio.masterController.get("currentFile");
var c=Multivio.masterController.get("currentPosition");if(SC.none(e)||SC.none(c)){return
}var d="page_nr=%@&url=%@".fmt(c,e);var a=Multivio.CDM.getImageSize(d);var f=a;if(Math.abs(h)===90||Math.abs(h)===270){f={width:a.height,height:a.width}
}g=this.getRotationCoords(g,-h,f);return g},initialize:function(a){Multivio.logger.info("selectionController:: initialize()");
this.set("content",[]);this.set("physicalStructureInitialised",NO);this.bind("physicalStructure","Multivio.CDM.physicalStructure");
Multivio.sendAction("addComponent","selectionController");Multivio.logger.info("selectionController initialized")
},reset:function(){var a=this.get("bindings");for(var b=0;b<a.length;b++){var c=a[b];
c.disconnect()}this.set("bindings",[]);this.position=null;this.set("content",null);
this.set("selection",null)}});Multivio.SearchController=Multivio.HighlightController.extend({allowsMultipleSelection:NO,isEditable:YES,currentSearchTerm:"",currentSearchFile:undefined,lastSearchQuery:undefined,url:undefined,isDocumentSearchable:function(){var c=NO;
var g=this.get("currentFileList"),b="",a="";if(SC.typeOf(g)===SC.T_ARRAY){for(var e=0;
e<g.length;e++){var b=g[e].url;var d=Multivio.CDM.getFileMetadata(b);if(SC.typeOf(d)===SC.T_HASH){typeOfFile=Multivio.configurator.getTypeForMimeType(d.mime);
if(typeOfFile==="pdf"){c=YES;break}}}}return(c)}.property("currentFileList","Multivio.CDM.fileMetadata"),displayResults:{},searchResults:undefined,searchResultsBinding:SC.Binding.oneWay("Multivio.CDM.searchResults"),searchStatus:"",textualContentHasBeenChecked:NO,_loadExistingSearchResultsForFile:function(a){this.set("content",[]);
var c=Multivio.CDM.get("searchResults");var b=Multivio.CDM.clone(c);this.set("_load_url",a);
this.set("searchResults",b)},_selectionDidChange:function(){if(!this.get("allowsSelection")){return
}var f=this.get("selection");var c=f.firstObject();var b=this.indexOf(c);Multivio.logger.debug("_selectionDidChange: index: "+b);
Multivio.logger.debug("_selectionDidChange: object: "+c);Multivio.logger.debug("### selectionDidChange: store url in master: "+this.get("currentSearchFile"));
Multivio.masterController.set("currentSearchFile",this.get("currentSearchFile"));
if(SC.none(c)){return NO}var d=this.get("currentSearchFile");var e=Multivio.masterController.get("currentFile");
var a=this.get("url");if(e!==c.url){SC.RunLoop.begin();Multivio.logger.debug("selectionDidChange: switching to file: "+c.url);
Multivio.makeFirstResponder(Multivio.INIT);Multivio.masterController.set("currentFile",c.url);
Multivio.masterController.set("initialPosition",c.page_number);Multivio.masterController.set("isLoadingContent",YES);
SC.RunLoop.end()}else{Multivio.logger.debug("selectionDidChange: switching to page: "+c.page_number);
Multivio.masterController.set("currentPosition",c.page_number)}return YES}.observes("selection"),setSelectionIndex:function(b){var a=SC.SelectionSet.create();
a.addObject(this.objectAt(b));this.set("selection",a)},getZone:function(a){return this.objectAt(a)
},doSearch:function(){var l=this.get("currentSearchTerm");if(SC.browser.msie){l=unescape(encodeURIComponent(l))
}this.set("lastSearchQuery",l);this.clearResults();this.set("textualContentHasBeenChecked",NO);
if(SC.none(l)||SC.empty(l.trim())){return NO}SC.RunLoop.begin();this.set("searchStatus","_searchInProgress".loc());
this.set("allowsSelection",NO);Multivio.searchTreeController.set("allowsSelection",NO);
SC.RunLoop.end();Multivio.logger.debug('SearchController.doSearch("%@"), file: %@'.fmt(l,this.get("currentSearchFile")));
var f=0;var b=this.get("currentSearchFile");var e=this.get("url");var j=undefined;
if(b===e){Multivio.logger.debug("doSearch ALL: referer url: "+b);var d=this.get("currentFileList");
Multivio.logger.debug("doSearch ALL: file_list: %@, length: %@".fmt(d,d.length));
for(var h=0;h<d.length;h++){if(d.length>1&&d[h].url===e){continue}Multivio.logger.debug("ALL: sending request for url: "+d[h].url);
j=Multivio.CDM.getSearchResults(d[h].url,l,"","",15,50,f)}}else{j=Multivio.CDM.getSearchResults(b,l,"","",15,50,f)
}var c=this.get("searchResults")||{};var a=Multivio.CDM.clone(c);a[b]=j;SC.RunLoop.begin();
var g=this.get("displayResults");g[b]=YES;this.set("displayResults",g);this.set("_load_url",b);
this.set("searchResults",a);SC.RunLoop.end();return YES},clearResults:function(){Multivio.logger.debug("SearchController.clearResults()");
var d=this.get("currentSearchFile");var b=this.get("url");var e=Multivio.CDM.get("searchResults");
var c={};if(YES){c=undefined;Multivio.logger.debug("clearing all...");SC.RunLoop.begin();
Multivio.CDM.set("searchResults",c);SC.RunLoop.end()}else{if(!SC.none(e)&&!SC.none(e[d])){Multivio.logger.debug("clearing...");
c=Multivio.CDM.clone(e);c[d]=undefined;SC.RunLoop.begin();Multivio.CDM.set("searchResults",c);
SC.RunLoop.end()}}this.set("content",[]);var a=this.get("currentSearchFile");var f=this.get("displayResults");
f[a]=NO;SC.RunLoop.begin();this.set("displayResults",f);SC.RunLoop.end()},doClear:function(){Multivio.logger.debug("SearchController.doClear()");
this.clearResults();SC.RunLoop.begin();this.set("currentSearchTerm","");this.set("searchStatus","");
SC.RunLoop.end()},_searchResultsDidChange:function(){var h=this.get("searchResults");
var a=this.get("_load_url");var l=(SC.none(a)?this.get("currentSearchFile"):a);var j=this.get("lastSearchQuery");
Multivio.logger.debug("_searchResultsDidChange: (1) res:"+h);Multivio.logger.debug("_searchResultsDidChange: (2) url:"+l);
var n=l;var f=this.get("url");if(n===f){Multivio.logger.debug("_searchResultsDidChange: (3) REF URL HERE")
}this.set("_load_url",undefined);if(!this.get("displayResults")[l]&&l!==f){Multivio.logger.debug("_searchResultsDidChange, do not display url: "+l);
return}if(!SC.none(h)&&(!SC.none(h[n])||n===f)){Multivio.logger.debug("_searchResultsDidChange, (4) stuff to do...");
SC.RunLoop.begin();if(n===f){var e=this.get("currentFileList");var m=[];Multivio.logger.debug("_searchResultsDidChange, (5) concat all results...");
this.set("content",[]);for(var g=0;g<e.length;g++){Multivio.logger.debug("_searchResultsDidChange, (6) url: "+e[g].url);
if(e.length>1&&e[g].url===f){continue}if(SC.none(h[e[g].url])){continue}this._setSearchResults(h[e[g].url],j);
m.pushObject(h[e[g].url])}SC.RunLoop.begin();Multivio.logger.debug("_searchResultsDidChange (7), setting all results");
h[f]=m;Multivio.CDM.set("searchResults",h);SC.RunLoop.end()}else{this._setSearchResults(h[n],j)
}var c=Multivio.masterController.get("currentSearchResultSelectionIndex");Multivio.logger.debug("_searchResultsDidChange, selected index: "+c);
if(!SC.none(c)&&c!==-1){var b=SC.SelectionSet.create();var d=this.objectAt(c);Multivio.logger.debug("_searchResultsDidChange restore previous selection: "+d);
b.addObject(d);if(!SC.none(d)){SC.RunLoop.begin();this.set("selection",b);SC.RunLoop.end()
}}SC.RunLoop.end()}}.observes("searchResults"),_setSearchResults:function(J,f){Multivio.logger.debug("_setSearchResults, res: "+J);
if(J!==-1&&!SC.none(J)){var d,w=J.file_position.results.length;var D=this.get("searchResults");
d=0;var l=0;var g=this.get("currentFileList");var e=g.length;var E=this.get("url");
var B=this.get("currentSearchFile");var v=YES,q,m="";if(B!==E){if(SC.none(D)||SC.none(D[B])){Multivio.logger.debug("---no result for specific file, skip: "+B);
v=NO}else{d=D[B].file_position.results.length;if(D[B].max_reached!==0){m="+"}}}else{for(var y=0;
y<e;y++){q=g[y].url;if(g[y].label==="_AllFiles".loc()){continue}if(SC.none(D)||SC.none(D[q])){v=NO;
continue}d+=D[q].file_position.results.length;if(D[q].max_reached!==0){m="+"}}}Multivio.logger.debug("---search done: "+v);
Multivio.logger.debug("---number of search results: "+d);if(v){this.set("allowsSelection",YES);
Multivio.searchTreeController.set("allowsSelection",YES);if(d===0){this.set("searchStatus","_noResult".loc());
this._checkTextualContent()}else{var I=0;for(var A in D){var o=D[A].file_position;
if(!SC.none(o)){var x=o.results;if(!SC.none(x)){var h={};for(var s=0;s<x.length;s++){var t=x[s].index.page.toString();
h[t]=YES}}}var n=0;for(k in h){if(h.hasOwnProperty(k)){n++}}I=I+n}this.set("searchStatus","_listOfResults".loc(d,m)+" "+"_resultsPages".loc(I,m))
}}var H=null,G=null,F=null,p=null;for(var C=0;C<w;C++){p=J.file_position;H=p.results[C];
G=H.index;F=G.bounding_box;this.addSearchResult(f,H.preview,F.y1,F.x1,Math.abs(F.x1-F.x2),Math.abs(F.y1-F.y2),p.url,G.page,this.get("zoomFactor"))
}}},_checkTextualContent:function(){if(this.get("textualContentHasBeenChecked")){return
}Multivio.logger.debug("_checkTextualContent");var b=this._getPageIndexing();if(b===-1){return
}var a=Multivio.masterController.get("currentPosition");if(SC.none(b)||SC.none(b.pages)||SC.none(b.pages[a])||SC.none(b.pages[a].lines)||b.pages[a].lines.length===0){Multivio.usco.showAlertPaneInfo("_NoTextualContent".loc(),"_NotSearchable".loc(),"OK")
}this.set("textualContentHasBeenChecked",YES)},goToFirstResult:function(){var b=this.get("selection");
var c=b.firstObject();var a=SC.SelectionSet.create();Multivio.logger.debug("goToFirstResult");
a.addObject(this.objectAt(0));SC.RunLoop.begin();this.set("selection",a);SC.RunLoop.end()
},goToNextResult:function(){var d=this.get("selection");var f=d.firstObject();var c=SC.SelectionSet.create();
var b=this.get("length");Multivio.logger.debug("goToNextResult");if(d.get("length")===0){this.goToFirstResult()
}else{var a=this.indexOf(f,0);var e=this.objectAt(++a%b);c.addObject(e);SC.RunLoop.begin();
this.set("selection",c);SC.RunLoop.end()}},goToPreviousResult:function(){var e=this.get("selection");
var f=e.firstObject();var c=SC.SelectionSet.create();var b=this.get("length");if(e.get("length")===0){c.addObject(this.objectAt(b-1));
SC.RunLoop.begin();this.set("selection",c);SC.RunLoop.end()}else{var a=this.indexOf(f,0);
var d=this.objectAt((--a+b)%b);c.addObject(d);SC.RunLoop.begin();this.set("selection",c);
SC.RunLoop.end()}},addSearchResult:function(i,b,h,j,c,f,e,a,d){SC.RunLoop.begin();
var g=this.addHighlight(h,j,c,f,a,"search",d,YES,e);if(!SC.none(g)){g.label=i;g.context=b
}SC.RunLoop.end()},initialize:function(e){Multivio.logger.info("searchController:: initialize()");
this.set("url",Multivio.CDM.getReferer());this.set("physicalStructureInitialised",NO);
var d=Multivio.masterController.get("currentSearchResultSelectionIndex");var h=Multivio.masterController.get("currentSearchFile");
Multivio.logger.debug("search init: master search file: "+h);this.set("content",[]);
this.set("searchStatus","");var g=this.get("initSearchTerm");if(!SC.none(g)&&g!==""){g=unescape(g);
this.set("currentSearchFile",this.get("url"));Multivio.logger.debug("search ctrl init, found input query: "+g);
this.set("currentSearchTerm",g);var c;if(this.get("physicalStructureInitialised")){c=this.get("physicalStructure")
}else{c=Multivio.CDM.getPhysicalstructure(this.get("url"));if(c===-1){this.set("initial_search",YES);
this.set("initial_term",g);this.set("initial_url",this.get("url"));return}}Multivio.logger.debug("search ctrl init, phys: "+c);
this.set("currentFileList",c);Multivio.logger.debug("search ctrl init, url: "+this.get("url"));
this.set("initSearchTerm",undefined);Multivio.logger.debug("search ctrl init, trying to display palette");
var f=Multivio.getPath("views.leftButtons").get("childViews")[0];Multivio.paletteController.showSearch(f);
Multivio.logger.debug("search ctrl init, running search with url: "+this.get("currentSearchFile"));
this.doSearch()}else{if(h===this.get("url")){e=h}this._loadExistingSearchResultsForFile(this.get("url"));
var b=SC.SelectionSet.create();b.addObject(this.objectAt(d));var a=this.get("content");
this.set("selection",b)}Multivio.sendAction("addComponent","searchController");Multivio.logger.info("searchController initialized with url:"+e)
},selectionIndexDidChange:function(){var a=Multivio.masterController.get("currentSearchResultSelectionIndex");
Multivio.logger.debug("search, selectionIndexDidChange: "+a);if(a>-1&&a<this.get("length")){var c=this.objectAt(a);
Multivio.logger.debug("search, selectionIndexDidChange, next object: "+c);var b=SC.SelectionSet.create();
b.addObject(c);this.set("selection",b)}}.observes("Multivio.masterController.currentSearchResultSelectionIndex"),currentFileListDidChange:function(){Multivio.logger.debug("currentFileListDidChange");
var d=this.get("currentFileList");if(SC.none(d)){return}this._getPageIndexing();var c=this.get("initial_search");
var b=this.get("initial_term");var a=this.get("initial_url");if(SC.none(c)||!c){return
}this.set("currentSearchTerm",b);this.set("initial_term",undefined);this.set("currentSearchFile",a);
this.set("initial_url",undefined);this.set("initial_search",NO);this.doSearch()}.observes("currentFileList"),currentSearchFileDidChange:function(){this.doClear()
}.observes("currentSearchFile"),reset:function(){var a=this.get("bindings");for(var b=0;
b<a.length;b++){var c=a[b];c.disconnect()}this.set("bindings",[]);this.position=null;
this.set("content",null);this.set("selection",null)}});Multivio.searchController=Multivio.SearchController.create();
Multivio.selectionController=Multivio.HighlightController.create();Multivio.searchTreeController=SC.TreeController.create({fileList:null,treeExist:NO,globalStructure:null,treeStructure:null,_treeLabelByPosition:undefined,_treeNodeById:undefined,_createRootNode:function(){this.treeStructure=[];
var a={file_position:{index:null,url:null},label:"Root Node",childs:null};this.treeStructure.push(a);
this.initializeTree()},_createRootAndFileNodes:function(){if(SC.none(this.treeStructure)||SC.none(this.treeStructure[0])){this._createRootNode()
}if(SC.none(this.fileList)){Multivio.logger.debug("searchTreeController, _createRootAndFileNodes, no fileList, exit");
return}Multivio.logger.debug("searchTreeController, _createRootAndFileNodes()");var c=Multivio.CDM.getReferer();
var f=this.get("fileList");var g=undefined,a=[],e=undefined;var b=f.length===1;for(var d=0;
d<f.length;d++){g=f[d];if(!b&&g.url===c){continue}e={file_position:{index:null,url:g.url},label:g.label,type:"file",childs:null};
a.push(e)}this._addSubtree(a);this.initializeTree()},fileListDidChange:function(){Multivio.logger.debug("searchTreeController, fileListDidChange()");
this._createRootAndFileNodes();this.searchResultsDidChange()}.observes("fileList"),selectionIndexDidChange:function(){var a=Multivio.masterController.get("currentSearchResultSelectionIndex");
Multivio.logger.debug("search tree, selectionIndexDidChange: "+a);if(a>-1){var c=this._treeNodeById[a];
Multivio.logger.debug("search tree, selectionIndexDidChange, next object: "+c);if(!SC.none(c)){var b=SC.SelectionSet.create();
b.addObject(c);this.set("selection",b)}}}.observes("Multivio.masterController.currentSearchResultSelectionIndex"),selectionDidChange:function(){if(!this.get("allowsSelection")){Multivio.logger.debug("tree selectionDidChange, selection not allowed, exit");
return}Multivio.logger.debug("searchTreeController, selectionDidChange()");var b=this.get("selection");
if(SC.none(b)){return}var c=b.firstObject();Multivio.logger.debug("searchTreeController, selectionDidChange(), so: "+c);
if(SC.none(c)){Multivio.logger.debug("searchTreeController, selectionDidChange(), try to get selection from index");
var a=Multivio.searchController.get("selection");Multivio.logger.debug("searchTreeController, selectionDidChange(), ssel: "+a);
this.selectionIndexDidChange();return}if(c.type==="result"){Multivio.logger.debug("searchTreeController, selectionDidChange(), send to search ctrl, id: "+c.id);
Multivio.masterController.set("currentSearchResultSelectionFile",c.file_position.url);
Multivio.masterController.set("currentSearchResultSelectionIndex",c.id)}else{if(c.type==="more"){}}}.observes("selection"),searchResultsDidChange:function(){Multivio.logger.debug("searchTreeController, searchResultsDidChange(), FIRST");
var l=Multivio.CDM.get("searchResults");Multivio.logger.debug("searchTreeController, searchResultsDidChange(), enter?: "+l);
if(SC.none(l)){Multivio.logger.debug("searchTreeController, searchResultsDidChange(), clearing tree...");
this.clear();this._createRootNode();return}Multivio.logger.debug("searchTreeController, searchResultsDidChange(), root:"+this.treeStructure[0]);
var a=this.fileList;var b=undefined,g=undefined,e=undefined,o=undefined;var f=[],c=[];
var p,n,i=undefined,j=0;var d=Multivio.CDM.getReferer();var m=a.length===1;Multivio.logger.debug("searchTreeController, searchResultsDidChange(), #files: "+a.length);
for(p=0;p<a.length;p++){b=a[p];if(!m&&b.url===d){continue}o={file_position:{index:null,url:b.url},label:b.label,type:"file",childs:null};
g=l[b.url];if(SC.none(g)||SC.none(g.file_position)){continue}i=g.file_position.results;
if(i.length>0){o.childs=[];var h=(g.max_reached===0?"":"+");o.label+=" (%@%@)".fmt(i.length,h);
f.push(o)}for(n=0;n<i.length;n++){e={file_position:{index:i[n].index.page,url:g.file_position.url},label:i[n].preview,type:"result",id:j++};
o.childs.push(e)}}this._addSubtree(f);this.initializeTree()}.observes("Multivio.searchController.searchResults"),initialize:function(a){Multivio.logger.info("searchTreeController, begin initialize(), url: "+a);
this.set("content",[]);if(YES){this.reset();this.clear()}if(Multivio.masterController.isGrouped){this.treeStructure=null;
a=Multivio.CDM.getReferer();this.treeExist=NO}if(SC.none(this.treeStructure)){this._createRootNode()
}else{this.treeStructure=null}Multivio.logger.info("searchTreeController initialized, adding bindings");
this.bind("fileList","Multivio.searchController.currentFileList");this.searchResultsDidChange();
this.selectionIndexDidChange()},_createRootAndRefererNodes:function(b,c){this.treeStructure=[];
var d=[{file_position:{index:null,url:c},label:b,childs:null}];var a={file_position:{index:null,url:null},label:"Root Node",childs:null};
this.treeStructure.push(a)},_addSubtree:function(c){var b=[];if(!SC.none(this.treeStructure)){var d=this.treeStructure[0];
d.childs=c;b.push(this.treeStructure[0])}for(var a=0;a<c.length;a++){b.push(c[a])
}this.treeStructure=b},initializeTree:function(){this.reset();this.bind("fileList","Multivio.searchController.currentFileList");
var a=this.treeStructure;if(this.get("treeExist")){this._updateTree(a)}else{this._createTree(a)
}var e=this.ascendingKeys(this._treeLabelByPosition);var b=[];for(var c=0;c<e.length;
c++){var d=e[c];b[d]=this._treeLabelByPosition[d]}this._treeLabelByPosition=b},_createTree:function(c){this.set("treeExist",YES);
var a=[];a.push(c[0]);for(var e=1;e<c.length;e++){var f=c[e];if(f.childs){var d=this.getListOfChilds(f);
a=a.concat(d)}else{a.push(f)}}this.set("globalStructure",a);this._treeLabelByPosition=[];
this._treeNodeById=[];var b=Multivio.SearchTreeContent.create(c[0]);this.set("content",b);
Multivio.sendAction("addComponent","searchTreeController");Multivio.logger.info("searchTreeController#_createTree")
},getListOfChilds:function(a){var d=[];var c=a.childs;for(var b=0;b<c.length;b++){if(c[b].childs){this.getListOfChilds(c[b])
}else{d.push(c[b])}}d.push(a);return d},_getListOfLabelsForIndex:function(b){var e=undefined;
if(!SC.none(this._treeLabelByPosition)&&!SC.none(b)){var a=this._treeLabelByPosition[b];
if(!SC.none(a)){e=a}else{var f=0;var d=0;for(var c in this._treeLabelByPosition){if(this._treeLabelByPosition.hasOwnProperty(c)){d=c;
if(d<b){f=d}else{e=this._treeLabelByPosition[f];break}}else{e=this._treeLabelByPosition[f];
break}}}}return e},ascendingKeys:function(c){var b=[];for(var a in c){if(c.hasOwnProperty(a)){b.push(parseInt(a,10))
}}b.sort(function(e,d){return(e>d)-(e<d)});return b},createNewStructure:function(b,a){for(var c=0;
c<b.length;c++){if(!SC.none(b[c].childs)){b[c].level=0;this.createNewStructure(b[c].childs,a)
}else{b[c].level=1;a.push(b[c])}}return a},lastAdded:[],_updateTree:function(l){Multivio.logger.info("searchTreeController, _updateTree(%@)".fmt(l));
var b=this.get("bindings");for(var f=0;f<b.length;f++){var d=b[f];d.disconnect()}this.bindings=[];
this.bind("fileList","Multivio.searchController.currentFileList");this.content=null;
var s=this.get("globalStructure");if(SC.none(s)){return}var e=Multivio.masterController.get("currentFile");
var h=[];if(l.length===1){l[0].file_position.index=1}if(this.lastAdded.length!==0){var o=this.lastAdded.reverse();
var r=[];for(var c=0;c<o.length;c++){if(!SC.none(o[c].childs)){var q=o[c].childs;
var n=YES;for(var u=0;u<q.length;u++){if(q[u].file_position.url===e){n=NO;break}}if(n){o[c].childs=undefined
}else{r.push(o[c])}}}this.lastAdded=r}for(var g=0;g<s.length;g++){var p=s[g];if(!SC.none(p)&&p.file_position.url===e){p.childs=l;
this.lastAdded.push(p);for(var m=0;m<l.length;m++){h.push(l[m]);this.lastAdded.push(l[m])
}}h.push(p)}this.globalStructure=h;this._treeLabelByPosition=[];this._treeNodeById=[];
var a=Multivio.SearchTreeContent.create(h[0]);this.set("content",a);Multivio.sendAction("addComponent","searchTreeController");
Multivio.logger.info("searchTreeController#_updateTree")},allowSelection:function(a){this.set("allowsSelection",a)
},reset:function(){var a=this.get("bindings");for(var b=0;b<a.length;b++){var c=a[b];
c.disconnect()}this.bindings=[]},clear:function(){this.treeExist=NO;this.globalStructure=null;
this.treeStructure=null;this._treeLabelByPosition=undefined;this._treeNodeById=undefined
},goToFirstResult:function(){var b=this.get("selection");var a=SC.SelectionSet.create();
Multivio.logger.debug("goToFirstResult");a.addObject(this._treeNodeById[0]);SC.RunLoop.begin();
this.set("selection",a);SC.RunLoop.end()},goToNextResult:function(){var d=this.get("selection");
Multivio.logger.debug("goToNextResult");if(SC.none(d)||d.get("length")===0){this.goToFirstResult()
}else{var f=d.firstObject();var c=SC.SelectionSet.create();var b=this._treeNodeById.length;
var a=f.id||Multivio.masterController.currentSearchResultSelectionIndex;var e=this._treeNodeById[++a%b];
c.addObject(e);SC.RunLoop.begin();this.set("selection",c);SC.RunLoop.end()}},goToPreviousResult:function(){var e=this.get("selection");
var c=SC.SelectionSet.create();var b=this._treeNodeById.length;if(SC.none(e)||e.get("length")===0){c.addObject(this._treeNodeById[b-1]);
SC.RunLoop.begin();this.set("selection",c);SC.RunLoop.end()}else{var f=e.firstObject();
var a=f.id||Multivio.masterController.currentSearchResultSelectionIndex;var d=this._treeNodeById[(--a+b)%b];
c.addObject(d);SC.RunLoop.begin();this.set("selection",c);SC.RunLoop.end()}}});Multivio.soundController=SC.ObjectController.create({showVolumeSlider:function(){}});
Multivio.thumbnailController=SC.ArrayController.create({allowsMultipleSelection:NO,physicalStructure:null,position:null,_positionToThumbnail:{},initialize:function(c){if(this.get("bindings").length!==0){this.reset()
}this.bind("position","Multivio.masterController.currentPosition");var d=Multivio.CDM.getFileMetadata(c);
if(SC.none(d.nPages)){if(Multivio.masterController.isGrouped){var b=Multivio.CDM.getPhysicalstructure(Multivio.CDM.getReferer());
if(b!==-1){this._createThumbnails(b)}else{this.bind("physicalStructure","Multivio.CDM.physicalStructure")
}}else{var a=Multivio.CDM.getPhysicalstructure(c);if(a!==-1){if(!SC.none(a)){this._createThumbnails(a)
}else{Multivio.logger.warning("ThumbnailController has no physical structure")}}else{this.bind("physicalStructure","Multivio.CDM.physicalStructure")
}}}else{if(Multivio.masterController.isGrouped){}else{this._createPDFThumbnails(c,d.nPages)
}}Multivio.logger.info("thumbnailController initialized ")},reset:function(){var a=this.get("bindings");
for(var b=0;b<a.length;b++){var c=a[b];c.disconnect()}this.set("bindings",[]);this._positionToThumbnail={};
this.position=null;this.set("content",null);this.set("selection",null)},physicalStructureDidChange:function(){var a=this.get("physicalStructure");
if(!SC.none(a)){if(Multivio.masterController.isGrouped){var b=Multivio.CDM.getPhysicalstructure(Multivio.CDM.getReferer());
if(b!==-1){this._createThumbnails(b)}}else{var c=Multivio.masterController.get("currentFile");
if(!SC.none(c)){var d=this.get("physicalStructure")[c];if(d!==-1){if(!SC.none(d)){this._createThumbnails(d)
}}}}}}.observes("physicalStructure"),_createThumbnails:function(b){var a=[];var f={};
var g=undefined;for(var d=0;d<b.length;d++){var c=b[d].url;var h=undefined;if(Multivio.initializer.get("inputParameters").scenario==="fixtures"){h=Multivio.configurator.getThumbnailUrl(c,0)
}else{h=Multivio.configurator.get("serverName")+Multivio.configurator.getThumbnailUrl(c,0)
}var e={url:h,pageNumber:d+1};f[d+1]=e;a.push(e)}this.set("content",a);this.set("_cdmNodeToThumbnail",f);
Multivio.sendAction("addComponent","thumbnailController");Multivio.logger.info("thumbnailController#_createThumbnails")
},_createPDFThumbnails:function(f,d){var a=[];var e={};for(var c=1;c<d+1;c++){var g=Multivio.configurator.get("serverName")+Multivio.configurator.getThumbnailUrl(f,c);
var b={url:g,pageNumber:c};e[c]=b;a.push(b)}this.set("content",a);this.set("_cdmNodeToThumbnail",e);
Multivio.sendAction("addComponent","thumbnailController");Multivio.logger.info("thumbnailController#_createPDFThumbnails")
},positionDidChange:function(){var c=this.get("position");if(!SC.none(c)&&!SC.none(this.get("content"))){var b=!SC.none(this.get("selection"))?this.get("selection").firstObject():undefined;
var a=!SC.none(b)?b.pageNumber:0;if(a!==c){var d=this.get("_cdmNodeToThumbnail")[c];
this.set("selection",SC.SelectionSet.create().addObject(d))}}}.observes("position","content"),selectionDidChange:function(){var a=this.get("selection");
if(!SC.none(a)&&!SC.none(a.firstObject())){var b=a.firstObject().pageNumber;var c=this.get("position");
if(c!==b){this.set("position",b);Multivio.logger.info("thumbnailController#selectionDidChange: %@".fmt(this.get("position")))
}}}.observes("selection")});Multivio.treeController=SC.TreeController.create({position:null,logicalStructure:null,physicalStructure:null,treeExist:NO,globalStructure:null,treeStructure:null,_treeLabelByPosition:undefined,initialize:function(a){if(this.get("bindings").length!==0){this.reset()
}if(Multivio.masterController.isGrouped){this.treeStructure=null;a=Multivio.CDM.getReferer();
this.treeExist=NO}if(SC.none(this.treeStructure)){var m=Multivio.CDM.getFileMetadata(a);
if(m!==-1){var b=Multivio.CDM.getReferer();this._createRootAndRefererNodes(m.title,b)
}}else{this.treeStructure=null}var e=Multivio.CDM.getLogicalStructure(a);if(e!==-1){if(SC.none(e)){var l=Multivio.CDM.getPhysicalstructure(a);
if(l===-1){this.bind("physicalStructure","Multivio.CDM.physicalStructure")}else{if(SC.none(l)){Multivio.logger.info("This document has no logical and no physical structure")
}else{var c=[];for(var g=0;g<l.length;g++){var o=l[g];var n={file_position:{index:Multivio.masterController.isGrouped?g+1:null,url:o.url},label:o.label};
c.push(n)}this._addSubtree(c);this.initializeTree()}}}else{var d=e[0];var j=[];if(d.file_position.index===null){var h=Multivio.CDM.getPhysicalstructure(a);
if(h!==-1){if(SC.none(h)){Multivio.logger.error("This document has no physical structure to create index")
}else{if(Multivio.masterController.isGrouped){var p={file_position:{index:0,url:""},label:"fake node",childs:e};
var f=this.setLogicalIndex(p,h);this._addSubtree(f.childs);this.initializeTree()}else{this._addSubtree(e);
this.initializeTree()}}}else{this.bind("physicalStructure","Multivio.CDM.physicalStructure")
}}else{this._addSubtree(e);this.initializeTree()}}}else{this.bind("logicalStructure","Multivio.CDM.logicalStructure")
}Multivio.logger.info("treeController initialized")},_createRootAndRefererNodes:function(b,c){this.treeStructure=[];
var d=[{file_position:{index:null,url:c},label:b,childs:null}];var a={file_position:{index:null,url:null},label:"Root Node",childs:d};
this.treeStructure.push(a);this.treeStructure.push(d)},_addSubtree:function(c){var b=[];
if(!SC.none(this.treeStructure)){var d=this.treeStructure[1];d[0].childs=c;b.push(this.treeStructure[0]);
b.push(d[0])}for(var a=0;a<c.length;a++){b.push(c[a])}this.treeStructure=b},reset:function(){var a=this.get("bindings");
for(var b=0;b<a.length;b++){var c=a[b];c.disconnect()}this.bindings=[]},clear:function(){this.position=null;
this.logicalStructure=null;this.physicalStructure=null;this.treeExist=NO;this.globalStructure=null;
this.treeStructure=null;this._treeLabelByPosition=undefined},setLogicalIndex:function(b,g){var e=b.file_position.url;
for(var d=0;d<g.length;d++){var h=g[d].url;if(h===e){b.file_position.index=d+1;break
}}var a=b.childs;if(!SC.none(a)){for(var f=0;f<a.length;f++){var c=b.childs[f];this.setLogicalIndex(c,g)
}}return b},logicalStructureDidChange:function(){if(!SC.none(this.get("logicalStructure"))){var a=Multivio.masterController.get("currentFile");
if(Multivio.masterController.isGrouped){a=Multivio.CDM.getReferer()}if(!SC.none(a)){var d=this.get("logicalStructure")[a];
if(d!==-1){if(SC.none(d)){var j=Multivio.CDM.getPhysicalstructure(a);if(j!==-1){if(SC.none(j)){Multivio.logger.error("This document has no logical and no physical structure ")
}else{var b=[];for(var f=0;f<j.length;f++){var m=j[f];var l={file_position:{index:Multivio.masterController.isGrouped?f+1:null,url:m.url},label:m.label};
b.push(l)}this._addSubtree(b);this.initializeTree()}}else{this.bind("physicalStructure","Multivio.CDM.physicalStructure")
}}else{var c=d[0];var h=[];if(c.file_position.index===null){var g=Multivio.CDM.getPhysicalstructure(a);
if(g!==-1){if(SC.none(g)){Multivio.logger.error("This document has no physical structure to create index")
}else{if(Multivio.masterController.isGrouped){var n={file_position:{index:0,url:""},label:"fake node",childs:d};
var e=this.setLogicalIndex(n,g);this._addSubtree(e.childs);this.initializeTree()}else{this._addSubtree(d);
this.initializeTree()}}}else{this.bind("physicalStructure","Multivio.CDM.physicalStructure")
}}else{this._addSubtree(d);this.initializeTree()}}}}}}.observes("logicalStructure"),physicalStructureDidChange:function(){if(!SC.none(this.get("physicalStructure"))){var a=Multivio.masterController.get("currentFile");
if(Multivio.masterController.isGrouped){a=Multivio.CDM.getReferer()}if(!SC.none(a)){var m=this.get("physicalStructure")[a];
var h=Multivio.CDM.getPhysicalstructure(a);if(m!==-1&&m===h){if(SC.none(m)){Multivio.logger.error("This document has no physicalStructure")
}else{var c=Multivio.CDM.getLogicalStructure(a);if(c!==-1){if(SC.none(c)){var b=[];
for(var e=0;e<m.length;e++){var l=m[e];var j={file_position:{index:Multivio.masterController.isGrouped?e+1:null,url:l.url},label:l.label};
b.push(j)}this._addSubtree(b);this.initializeTree()}else{var g=c[0];var f=[];if(g.file_position.index===null){if(Multivio.masterController.isGrouped){var n={file_position:{index:0,url:""},label:"fake node",childs:c};
var d=this.setLogicalIndex(n,m);this._addSubtree(d.childs);this.initializeTree()}else{this._addSubtree(c);
this.initializeTree()}}else{this._addSubtree(c);this.initializeTree()}}}}}}}}.observes("physicalStructure"),initializeTree:function(){this.reset();
this.bind("position","Multivio.masterController.currentPosition");var a=this.treeStructure;
if(this.get("treeExist")){this._updateTree(a)}else{this._createTree(a)}var e=this.ascendingKeys(this._treeLabelByPosition);
var b=[];for(var c=0;c<e.length;c++){var d=e[c];b[d]=this._treeLabelByPosition[d]
}this._treeLabelByPosition=b},_createTree:function(c){this.set("treeExist",YES);var a=[];
a.push(c[0]);a.push(c[1]);for(var e=2;e<c.length;e++){var f=c[e];if(f.childs){var d=this.getListOfChilds(f);
a=a.concat(d)}else{a.push(f)}}this.set("globalStructure",a);this._treeLabelByPosition=[];
var b=Multivio.TreeContent.create(c[0]);this.set("content",b);Multivio.sendAction("addComponent","treeController");
Multivio.logger.info("treeController#_createTree")},getListOfChilds:function(a){var d=[];
var c=a.childs;for(var b=0;b<c.length;b++){if(c[b].childs){this.getListOfChilds(c[b])
}else{d.push(c[b])}}d.push(a);return d},positionDidChange:function(){var b=this.get("position");
if(!SC.none(b)){var h=this._getListOfLabelsForIndex(b);if(!SC.none(h)){var d=!SC.none(this.get("selection"))?this.get("selection").firstObject():undefined;
if(h.length===1){var m=h[0];if(d!==m){this.set("selection",SC.SelectionSet.create().addObject(m));
Multivio.logger.info("treeController#positionDidChange case 1: %@".fmt(this.get("selection").firstObject()))
}}else{var l=NO;for(var g=0;g<h.length;g++){var n=h[g];if(d===n){l=YES;break}}if(!l){this.set("selection",SC.SelectionSet.create().addObject(h[0]));
Multivio.logger.info("treeController#positionDidChange case 2: %@".fmt(this.get("selection").firstObject()))
}}}else{var c=this.get("arrangedObjects");for(var e=0;e<c.length;e++){var a=c.objectAt(e);
if(a.file_position.url===Multivio.masterController.currentFile){var f=!SC.none(this.get("selection"))?this.get("selection").firstObject():undefined;
if(SC.none(f)||f.file_position.url!==a.file_position.url&&f.file_position.index!==a.file_position.index){this.set("selection",SC.SelectionSet.create().addObject(a));
break}}}}}}.observes("position"),_getListOfLabelsForIndex:function(b){var e=undefined;
if(!SC.none(this._treeLabelByPosition)&&!SC.none(b)){var a=this._treeLabelByPosition[b];
if(!SC.none(a)){e=a}else{var f=0;var d=0;for(var c in this._treeLabelByPosition){if(this._treeLabelByPosition.hasOwnProperty(c)){d=c;
if(d<b){f=d}else{e=this._treeLabelByPosition[f];break}}else{e=this._treeLabelByPosition[f];
break}}}}return e},ascendingKeys:function(c){var b=[];for(var a in c){if(c.hasOwnProperty(a)){b.push(parseInt(a,10))
}}b.sort(function(e,d){return(e>d)-(e<d)});return b},createNewStructure:function(b,a){for(var c=0;
c<b.length;c++){if(!SC.none(b[c].childs)){b[c].level=0;this.createNewStructure(b[c].childs,a)
}else{b[c].level=1;a.push(b[c])}}return a},lastAdded:[],_updateTree:function(l){var b=this.get("bindings");
for(var f=0;f<b.length;f++){var d=b[f];d.disconnect()}this.bindings=[];this.position=null;
this.bind("position","Multivio.masterController.currentPosition");this.selection=null;
this.content=null;var r=this.get("globalStructure");var e=Multivio.masterController.get("currentFile");
var h=[];if(l.length===1){l[0].file_position.index=1}if(this.lastAdded.length!==0){var n=this.lastAdded.reverse();
var q=[];for(var c=0;c<n.length;c++){if(!SC.none(n[c].childs)){var p=n[c].childs;
var m=YES;for(var s=0;s<p.length;s++){if(p[s].file_position.url===e){m=NO;break}}if(m){n[c].childs=undefined
}else{q.push(n[c])}}}this.lastAdded=q}for(var g=0;g<r.length;g++){var o=r[g];if(o.file_position.url===e){o.childs=l;
this.lastAdded.push(o);for(var f=0;f<l.length;f++){h.push(l[f]);this.lastAdded.push(l[f])
}}h.push(o)}this.globalStructure=h;this._treeLabelByPosition=[];var a=Multivio.TreeContent.create(h[0]);
this.set("content",a);Multivio.sendAction("addComponent","treeController");Multivio.logger.info("treeController#_updateTree")
},allowSelection:function(a){this.set("allowsSelection",a)},_selectionDidChange:function(){var d=this.get("selection");
if(!SC.none(d)&&!SC.none(d.firstObject())){var c=d.firstObject().file_position.index;
if(SC.none(c)){var e=d.firstObject().file_position.url;if(!SC.none(e)){if(e!==Multivio.masterController.currentFile&&e!==Multivio.CDM.getReferer()){Multivio.makeFirstResponder(Multivio.INIT);
Multivio.sendAction("notAllowSelection");Multivio.masterController.zoomState=Multivio.zoomController.currentZoomState;
Multivio.masterController.set("currentFile",e)}else{if(e===Multivio.masterController.currentFile){this.set("position",1)
}}}else{var h=this.get("arrangedObjects");var g=h.indexOf(d.firstObject());g++;Multivio.masterController.set("currentFile",h.objectAt(g).file_position.url)
}}else{var f=this.get("position");var b=this._getListOfLabelsForIndex(f);if(!SC.none(b)){b=b[0]
}var a=d.firstObject();if(c!==f&&a!==b){this.set("position",c);Multivio.logger.info("treeController#selectionDidChange: %@".fmt(this.get("position")))
}}}}.observes("selection")});Multivio.zoomController=SC.ObjectController.create({FULLPAGE:"Full",PAGEWIDTH:"Width",HUNDREDPERCENT:"Native",currentZoomState:null,zoomStep:-1,zoomRatio:0,zoomScale:undefined,maxStep:0,maxRatio:0,minRatio:0,isLoadingContent:null,isLoadingContentBinding:"Multivio.masterController.isLoadingContent",isZoomInAllowed:YES,isZoomOutAllowed:YES,isFullModeAllow:YES,isWidthModeAllow:YES,initialize:function(){var c=Multivio.configurator.getTypeForMimeType(Multivio.masterController.currentFileType);
var b=Multivio.configurator.get("layoutConfig")[c];var a=b.zoomScale;this.zoomScale=Multivio.configurator.get("zoomParameters")[a];
this.maxStep=this.zoomScale.length-1;this.minRatio=this.zoomScale[0];this.maxRatio=this.zoomScale[this.maxStep];
Multivio.sendAction("addComponent","zoomController")},setZoomState:function(a){this.set("currentZoomState",a)
},doZoomIn:function(){var a=this.get("zoomStep");if(a<this.maxStep){SC.RunLoop.begin();
this.set("isLoadingContent",YES);SC.RunLoop.end();if(a!==-1){if(a<this.maxStep){a++;
this.set("zoomStep",a)}}else{this.set("currentZoomState",null);var b=this.get("zoomRatio");
if(b<this.minRatio){this.set("zoomStep",0)}else{if(b<this.maxRatio){var c=this.getNextStep(b);
this.set("zoomStep",c)}}}}},doZoomOut:function(){var b=this.get("zoomRatio");if(b>this.minRatio){SC.RunLoop.begin();
this.set("isLoadingContent",YES);SC.RunLoop.end();var a=this.get("zoomStep");if(a!==-1){if(a>0){a--;
this.set("zoomStep",a)}}else{this.set("currentZoomState",null);if(b>this.maxRatio){this.set("zoomStep",this.maxStep)
}else{if(b>this.minRatio){var c=this.getPreviousStep(b);this.set("zoomStep",c)}}}}},getNextStep:function(b){var c=0;
while(c<this.zoomScale.length){var a=this.zoomScale[c];if(a<=b){c++}else{break}}return c
},getPreviousStep:function(b){var c=0;while(c<this.zoomScale.length){var a=this.zoomScale[c];
if(a>=b){c--;break}else{c++}}return c},setBestStep:function(d,a){var c=Multivio.configurator.get("zoomParameters").maxResolution;
var e=0;while(e<this.zoomScale.length){var b=this.zoomScale[e];var f=(d*b)*(a*b);
if(f<=c){e++}else{break}}e--;this.set("currentZoomState",null);this.set("zoomStep",e)
},calculateRatio:function(a,c,e,d){var b=0;if(a%180===0){b=c/d}else{b=e/d}this.set("zoomRatio",b)
},setRatio:function(){var b=this.get("zoomStep");var a=this.zoomScale[b];this.set("zoomRatio",a)
}.observes("zoomStep"),isLoadingContentDidChange:function(){var a=this.get("isLoadingContent");
if(a){this.set("isZoomInAllowed",NO);this.set("isZoomOutAllowed",NO)}else{var c=this.get("zoomStep");
if(c===-1){var b=this.get("zoomRatio");if(b>this.minRatio){this.set("isZoomOutAllowed",YES)
}if(b<this.maxRatio){this.set("isZoomInAllowed",YES)}}else{if(c>0){this.set("isZoomOutAllowed",YES)
}if(c<this.maxStep){this.set("isZoomInAllowed",YES)}}}}.observes("isLoadingContent"),setPredefinedZoom:function(a){var b=a.name;
if(this.get("currentZoomState")!==b){this.zoomStep=-1;SC.RunLoop.begin();this.set("isLoadingContent",YES);
SC.RunLoop.end();this.set("currentZoomState",b)}else{a.set("isActive",YES)}},currentZoomStateDidChange:function(){var c=this.get("currentZoomState");
var b=Multivio.getPath("views.bottomButtons.backgroundView.zoomFullSizeButton");var a=Multivio.getPath("views.bottomButtons.backgroundView.zoomFullWidthButton");
var d=Multivio.getPath("views.bottomButtons.backgroundView.zoomNativeSizeButton");
switch(c){case"Full":b.set("isActive",YES);a.set("isActive",NO);d.set("isActive",NO);
break;case"Width":b.set("isActive",NO);a.set("isActive",YES);d.set("isActive",NO);
break;case"Native":b.set("isActive",NO);a.set("isActive",NO);d.set("isActive",YES);
break;case null:b.set("isActive",NO);a.set("isActive",NO);d.set("isActive",NO);break;
default:break}}.observes("currentZoomState"),isNativeSize:function(a){if(a){if(this.get("currentZoomState")===this.FULLPAGE){this.set("isFullModeAllow",NO);
this.set("isWidthModeAllow",NO)}if(this.get("currentZoomState")===this.PAGEWIDTH){this.set("isWidthModeAllow",NO)
}}},isFullEnabled:function(){if(this.get("isLoadingContent")){return NO}else{return this.get("isFullModeAllow")
}}.property("isLoadingContent","isFullModeAllow"),isWidthEnabled:function(){if(this.get("isLoadingContent")){return NO
}else{return this.get("isWidthModeAllow")}}.property("isLoadingContent","isWidthModeAllow"),isNativeEnabled:function(){if(this.get("isLoadingContent")){return NO
}else{if((this.get("currentZoomState")===this.FULLPAGE&&!this.get("isFullModeAllow"))||(this.get("currentZoomState")===this.PAGEWIDTH&&!this.get("isWidthModeAllow"))){this.set("currentZoomState",this.HUNDREDPERCENT)
}else{return YES}}}.property("isLoadingContent"),currentImagedidChange:function(){this.set("isFullModeAllow",YES);
this.set("isWidthModeAllow",YES)}.observes("Multivio.imageController.selection"),keyEvent:function(a){switch(a.which){case 45:this.doZoomOut();
return YES;case 43:this.doZoomIn();return YES;default:return NO}}});Multivio.errorController=SC.ObjectController.create({initialize:function(a){this.set("content",a);
Multivio.logger.info("errorController initialized")},message:function(){var b=this.get("content"),d,f;
if(!SC.none(b)){d=b.err_name;f=b.err_description}else{d="Unknown Error";f="-"}var a=("_"+d).loc();
if(a[0]==="_"){var c=Multivio.configurator.get("support");if(SC.none(c)){c="info@multivio.org"
}var h="";for(var g in navigator){if(navigator.hasOwnProperty(g)){if(SC.typeOf(navigator[g])===SC.T_STRING){h+="%@: %@\n".fmt(g,navigator[g])
}}}var e="<a href='mailto:%@?subject=%@&body=%@'>%@</a>".fmt(c,"_EmailErrorMessageSubject".loc()+" - "+escape(f),"_EmailErrorMessageHeader".loc()+"%0A%0A%0A%0A%0A%0A-------------------------------------%0A"+"_EmailErrorMessageTechnicalInfo".loc()+"%0A%0A"+escape(f)+"%0A%0A"+Date()+"%0A"+escape(document.baseURI)+"%0A%0AappCodeName   : "+navigator.appCodeName+"%0AappName       : "+navigator.appName+"%0AappVersion    : "+navigator.appVersion+"%0AbuildID       : "+navigator.buildID+"%0AcookieEnabled : "+navigator.cookieEnabled+"%0Alanguage      : "+navigator.language+"%0Aoscpu         : "+navigator.oscpu+"%0Aplatform      : "+navigator.platform+"%0Aproduct       : "+navigator.product+"%0AproductSub    : "+navigator.productSub+"%0AsecurityPolicy: "+navigator.securityPolicy+"%0AuserAgent     : "+navigator.userAgent+"%0Avendor        : "+navigator.vendor+"%0AvendorSub     : "+navigator.vendorSub+"%0A-------------------------------------%0A",c);
a="_Default".loc(e)}if(!SC.none(f)){a=a+"<br><br>"+f.loc()}return this.get("errorText").fmt(a)
}.property("content"),errorText:""+'<img src="%@" class="sc-icon-error-48">'.fmt(SC.BLANK_IMAGE_URL)+'<div class="mvo_info_full_title"><h3>'+"_An error occurred".loc()+'</h3></div><div class="mvo_info_full_message">%@ <br/><br/><div id="sc-error-dialog-reload-button" onclick="window.location.reload();"style="text-align: center; border: 1px solid black; padding: 3px; clear: both; margin-top: 20px; width: 100px; cursor: pointer;background-color: #888;color: #fff;">'+"_Go back".loc()+"</div></div>",usageText:""+'<img src="%@" class="sc-icon-info-48">'.fmt(SC.BLANK_IMAGE_URL)+'<div class="mvo_info_full_title"><h3>'+"_How to launch Multivio".loc()+'</h3></div><div class="mvo_info_full_message">'+"_The calling syntax is".loc()+":<ul><li>http://demo.multivio.org/client/#get&url={TARGET}</li></ul>"+"_The {TARGET} URL can link to".loc()+":<ul>"+"  <li>%@</li>".fmt("_A Dublin Core record".loc())+"  <li>%@</li>".fmt("_A MARC21 record".loc())+"  <li>%@</li>".fmt("_A MODS record".loc())+"  <li>%@</li>".fmt("_A METS record (supported profiles only)".loc())+"</ul>"+"_Examples".loc()+":<ul>  <li>http://demo.multivio.org/client/#get&url=http://doc.rero.ch/record/9495/export/xd</li>  <li>http://demo.multivio.org/client/#get&url=http://era.ethz.ch/oai?verb=GetRecord&metadataPrefix=mets&identifier=oai:era.ethz.ch:34314</li></ul></div>"});
Multivio.layoutController=SC.Object.create({localType:undefined,nbOfComponentToAdd:0,viewByController:{},currentTheme:"mvo-dark-gray-theme",showThemeSelector:YES,getListOfControllers:function(l){this.localType=Multivio.configurator.getTypeForMimeType(l);
if(this.localType==="image"){Multivio.masterController.isGrouped=YES}var b=Multivio.configurator.get("layoutConfig")[this.localType];
var g=b.components;var h=[];for(var f=0;f<g.length;f++){var c=g[f].name;var m=Multivio.getPath(c);
var a=m.controllers;for(var d=0;d<a.length;d++){var e=a[d];this.viewByController[e]=g[f];
h.push(e)}}this.set("nbOfComponentToAdd",h.length);return h},nbOfComponentDidChange:function(){if(this.get("nbOfComponentToAdd")===0){Multivio.makeFirstResponder(Multivio.READY);
switch(this.get("localType")){case"pdf":case"image":Multivio.invokeLater(Multivio.sendAction,1,"firstPosition");
break;case"xml":Multivio.invokeLater(Multivio.sendAction,1,"firstFile");break;default:Multivio.logger.info(this.get("localType")+" is an undefined type ");
break}}}.observes("nbOfComponentToAdd"),configureWorkspace:function(e){SC.RunLoop.begin();
var a=Multivio.getPath("mainPage.mainPane");var l=Multivio.configurator.getPath("componentLayouts.%@.baseLayout".fmt(e));
var j=Multivio.configurator.getPath("layouts.%@".fmt(l));var f=Multivio.getPath(j.layoutClass);
if(SC.none(f)){var h="Unable to find layout mixin %@".fmt(l);throw {message:h}}SC.mixin(a,f);
a.layOutGrid(j.layoutParams);var d=Multivio.configurator.getPath("componentLayouts.%@.components".fmt(e));
for(var b=0;b<d.length;b++){var g=d[b];a.layOutComponent(g);if(SC.typeOf(g.children)===SC.T_ARRAY){this.addChildViewsToComponent(g.children,g.name)
}}SC.RunLoop.end();Multivio.logger.info("layoutController workspace initialized")
},addChildViewsToComponent:function(d,f){var b=Multivio.getPath(f);if(SC.typeOf(b)!==SC.T_OBJECT||SC.typeOf(b.appendChild)!==SC.T_FUNCTION){throw new Error("hostView must respond to the appendChild() method")
}if(SC.typeOf(d)!==SC.T_ARRAY){throw new Error("floatingViews must be an array")}var a=d.length;
for(var c=0;c<a;c++){if(SC.typeOf(d[c])!==SC.T_STRING){throw new Error("the elements of floatingViews must be strings")
}var e=Multivio.getPath(d[c]);if(SC.typeOf(e)!==SC.T_OBJECT){throw new Error("floatingView %@ must be an object".fmt(e))
}b.appendChild(e)}},removeComponent:function(a){var b=Multivio.getPath("mainPage.mainPane");
b.removeComponent(a)},addComponent:function(a){var b=this.viewByController[a];var c=Multivio.getPath("mainPage.mainPane");
c.layOutComponent(b);if(SC.typeOf(b.children)===SC.T_ARRAY){this.addChildViewsToComponent(b.children,b.name)
}this.set("nbOfComponentToAdd",this.get("nbOfComponentToAdd")-1)},changeTheme:function(a){var e=a.get("newTheme");
if(e!==this.currentTheme){var c=Multivio.configurator.get("allowedThemes");var d=NO;
for(var b=0;b<c.length;b++){if(e===c[b]){d=YES;break}}if(d===YES){SC.$("body").addClass(e).removeClass(this.currentTheme);
this.currentTheme=e}}},_showUsagePage:function(){SC.RunLoop.begin();try{this.configureWorkspace("usage")
}catch(a){Multivio.logger.logException(a,"Error showing usage page")}finally{SC.RunLoop.end()
}},_showErrorPage:function(){SC.RunLoop.begin();SC.RunLoop.begin();Multivio.newErrorPane.append();
SC.RunLoop.end()},_showWaitingPage:function(){SC.RunLoop.begin();if(!Multivio.waitingPane.get("isPaneAttached")){Multivio.waitingPane.append()
}SC.RunLoop.end()},_hideWaitingPage:function(){SC.RunLoop.begin();if(Multivio.waitingPane.get("isPaneAttached")){Multivio.waitingPane.remove()
}SC.RunLoop.end()}});Multivio.masterController=SC.ObjectController.create({currentFile:null,currentPosition:null,initialPosition:null,isGrouped:NO,currentFileType:null,isLoadingContent:NO,isNew:NO,zoomState:null,listOfFiles:null,currentFileIndex:null,metadata:null,metadataBinding:SC.Binding.oneWay("Multivio.CDM.fileMetadata"),physicalStructure:null,physicalStructureBinding:SC.Binding.oneWay("Multivio.CDM.physicalStructure"),currentSearchResultSelectionIndex:-1,currentSearchResultSelectionFile:null,currentSearchFile:null,isTimeNavigationEnabled:NO,initialize:function(){Multivio.makeFirstResponder(Multivio.WAITING);
this.listOfFiles=null;this.isGrouped=NO;var a=Multivio.CDM.getReferer();this.set("currentFile",a);
Multivio.CDM.getPhysicalstructure(a);this.zoomState=Multivio.configurator.get("zoomParameters").initState;
Multivio.logger.info("masterController initialized")},reset:function(){this.set("currentFile",null);
this.set("currentPosition",null);this.set("currentFileType",null)},metadataDidChange:function(){var c=this.get("metadata");
if(!SC.none(c)){var b=this.get("currentFile");var a=this.get("metadata")[b];if(a!==-1){Multivio.sendAction("fileMetadataDidChange",b);
this.set("currentFileType",a.mime)}}}.observes("metadata"),physicalStructureDidChange:function(){var c=this.get("physicalStructure");
if(!SC.none(c)){var b=this.get("physicalStructure")[Multivio.CDM.getReferer()];if(b!==-1&&SC.none(this.listOfFiles)){if(b.length!==1){this.listOfFiles=[];
for(var a=0;a<b.length;a++){this.listOfFiles[a]=b[a]}this.currentFileIndex=0}}}}.observes("physicalStructure"),currentFileIndexDidChange:function(){this.currentFileType=null;
var b=this.get("currentFileIndex");var a=this.listOfFiles[b];this.set("currentFile",a.url)
}.observes("currentFileIndex"),setCurrentFileIndex:function(a){if(!SC.none(this.listOfFiles)){for(var b=0;
b<this.listOfFiles.length;b++){if(this.listOfFiles[b].url===a){this.set("currentFileIndex",b);
break}}}},selectFirstPosition:function(){var b=Multivio.configurator.get("initialPosition");
if(this.get("isGrouped")){if(b<1||(!SC.none(this.listOfFiles)&&b>this.listOfFiles.length)){b=1
}this.set("currentPosition",b)}else{var a=this.get("metadata")[this.get("currentFile")];
if(isNaN(b)||b>a.nPages){b=1}this.set("currentPosition",b);if(b!==1){Multivio.configurator.set("initialPosition",1)
}}Multivio.logger.debug("MasterController set currentPosition 1")},selectAPosition:function(){var b=this.get("initialPosition");
if(this.get("isGrouped")){if(b<1||(!SC.none(this.listOfFiles)&&b>this.listOfFiles.length)){b=1
}}else{var a=this.get("metadata")[this.get("currentFile")];if(isNaN(b)||isNaN(a.nPages)||b>a.nPages){b=1
}}Multivio.logger.debug("MasterController selectAPosition: "+b);if(!SC.none(b)){this.set("initialPosition",null);
this.set("currentPosition",b)}},selectLastPosition:function(){var b=this.get("currentFile");
var a=this.get("metadata")[b];if(!SC.none(a.nPages)){this.set("currentPosition",a.nPages)
}else{this.set("currentPosition",this.get("physicalStructure")[b].length)}},selectFirstFile:function(){var a=Multivio.configurator.get("initialFile");
if(a===1){var b=Multivio.CDM.getLogicalStructure(this.get("currentFile"));if(!SC.none(b)){var f=b[0].file_position.url;
if(SC.none(f)){var g=b[0].childs;for(var d=0;d<g.length;d++){var j=g[d];if(!SC.none(j.file_position.url)){f=j.file_position.url;
break}}}this.set("currentFile",f)}else{var e=Multivio.CDM.getPhysicalstructure(this.get("currentFile"));
this.set("currentFile",e[0].url)}}else{var c=Multivio.CDM.getPhysicalstructure(Multivio.CDM.getReferer());
if(isNaN(a)||a<1||a>c.length){a=0}else{a--}var h=c[a].url;this.set("currentFile",h)
}},currentFileTypeDidChange:function(){var c=this.get("currentFileType");var d=this.get("currentFile");
var e=Multivio.layoutController.getListOfControllers(c);for(var b=0;b<e.length;b++){var a=e[b];
Multivio[a].initialize(d);if(a==="zoomController"){Multivio.zoomController.setZoomState(this.zoomState)
}}}.observes("currentFileType"),currentFileDidChange:function(){if(!SC.none(this.get("currentFile"))){var a=this.get("currentSearchResultSelectionFile");
if(!SC.none(a)&&a!==this.get("currentFile")){this.set("currentSearchResultSelectionFile",null);
this.set("currentSearchResultSelectionIndex",-1)}this.set("isNew",YES);this.currentFileType=null;
this.set("currentPosition",null);var b=this.get("currentFile");this.setCurrentFileIndex(b);
var c=Multivio.CDM.getFileMetadata(b);if(c!==-1){this.set("currentFileType",c.mime)
}}}.observes("currentFile"),isLoadingContentDidChange:function(){var g=this.get("isLoadingContent");
if(g){Multivio.getPath("views.navigationInfo").showWaiting()}else{if(this.get("isNew")){var f="-";
if(this.get("isGrouped")){var b=Multivio.CDM.getPhysicalstructure(Multivio.CDM.getReferer());
var e=this.get("currentPosition");if(!SC.none(e)){Multivio.getPath("views.navigationInfo").showView(b[e-1].label,e+"/"+b.length);
this.set("isNew",NO)}}else{if(SC.none(this.listOfFiles)||this.listOfFiles.length===0){f=undefined
}else{for(var c=0;c<this.listOfFiles.length;c++){if(this.listOfFiles[c].url===this.get("currentFile")){f=this.listOfFiles[c].label;
break}}}var a=Multivio.CDM.getFileMetadata(this.get("currentFile")).nPages;if(SC.none(a)){if(!SC.none(this.listOfFiles)){a=this.listOfFiles.length
}else{a=1}}if(!SC.none(this.get("currentPosition"))){var d=this.get("currentPosition")+"/"+a;
Multivio.getPath("views.navigationInfo").showView(f,d);this.set("isNew",NO)}}}else{Multivio.getPath("views.navigationInfo").hideView()
}}}.observes("isLoadingContent"),currentPositionDidChange:function(){if(!SC.none(this.get("currentPosition"))){this.set("isNew",YES)
}console.info("currentPosition did Change....");console.info("new Val = "+this.get("currentPosition"))
}.observes("currentPosition")});Multivio.initializer=SC.Object.create({inputParameters:{},isFirstTime:YES,readInputParameters:function(){Multivio.CDM.clear();
Multivio.configurator.set("initialFile",1);Multivio.configurator.set("initialPosition",1);
Multivio.configurator.set("serverName","/server");Multivio.layoutController.changeTheme(SC.Object.create({newTheme:"mvo-dark-gray-theme"}));
Multivio.layoutController.set("showThemeSelector",YES);Multivio.treeController.clear();
Multivio.masterController.set("currentFile",null);var q=(SC.typeOf(location.hash)===SC.T_STRING&&location.hash!=="")?location.hash:undefined;
if(q!==undefined){var c=q.split("&");var d={};for(var g=0;g<c.length;g++){var e=c[g].split("=");
if(e.length===1){d[""]=e[0].replace("#","")}if(e.length===2){d[e[0]]=e[1]}if(e.length>2){var h=e[1];
for(var f=2;f<e.length;f++){h+=e[f]}d[e[0]]=h}}var b={};for(var p in d){if(d.hasOwnProperty(p)){switch(p){case"":b.scenario=d[p];
break;case"url":var a=!SC.none(location.hash)?location.hash:undefined;if(a!==undefined){var n=/(.*?)url=(.*)/;
var m=a.match(n);a=m.pop();b.url=a;Multivio.CDM.setReferer(a)}break;case"file":Multivio.configurator.set("initialFile",d[p]);
break;case"position":var l=parseInt(d[p],10);if(SC.typeOf(l)===SC.T_NUMBER&&l>0){Multivio.configurator.set("initialPosition",d[p]);
Multivio.masterController.set("initialPosition",d[p])}break;case"server":Multivio.configurator.set("serverName",d[p]);
break;case"theme":Multivio.layoutController.changeTheme(SC.Object.create({newTheme:"mvo-%@-theme".fmt(d[p])}));
Multivio.layoutController.set("showThemeSelector",NO);break;case"search":var r=d[p];
Multivio.logger.debug("initializer, store search query: "+r);Multivio.searchController.set("initSearchTerm",r);
break;default:var o=d[p];b[p]=o;break}}}this.set("inputParameters",b)}if(this.get("isFirstTime")){Multivio.logger.initialize();
this.set("isFirstTime",NO)}Multivio.logger.debug("end of configurator.readInputParameters()")
},inputParametersDidChange:function(){var b=this.get("inputParameters");if(SC.none(b.scenario)||SC.none(b.url)){if(b.scenario==="fixtures"){this.setFixtures()
}else{Multivio.makeFirstResponder(Multivio.ERROR)}}else{var a=Multivio.configurator.getPath("baseUrlParameters.version");
Multivio.requestHandler.sendGetRequest(a,this,"verifyVersion")}}.observes("inputParameters"),verifyVersion:function(a){if(SC.ok(a)){Multivio.logger.debug("version received from the server: %@".fmt(a.get("body")));
var c=a.get("body");var b=c.api_version;Multivio.configurator.set("serverVersion",c.version);
if(!SC.none(b)&&b===Multivio.configurator.serverApiCompatibility){Multivio.logger.debug("Client and server are compatible");
Multivio.masterController.initialize()}else{Multivio.errorController.initialize({err_name:"VersionIncompatibility",err_description:"Versions:<ul>"+"  <li>server = %@</li>".fmt(b)+"  <li>client = %@</li>".fmt(Multivio.VERSION)+"</ul>"});
Multivio.makeFirstResponder(Multivio.ERROR);Multivio.logger.logException("Client and server are incompatible: "+Multivio.VERSION)
}}else{Multivio.errorController.initialize({err_name:"ServerNotFound"});Multivio.makeFirstResponder(Multivio.ERROR)
}},setFixtures:function(){var c=this.get("inputParameters").name;if(SC.none(c)){Multivio.layoutController._showUsagePage()
}else{Multivio.makeFirstResponder(Multivio.WAITING);Multivio.CDM.setReferer(c);var e={};
e[c]=Multivio.CDM.FIXTURES.metadata[c];var b=Multivio.CDM.FIXTURES.logical[c];e[b[0].file_position.url]=Multivio.CDM.FIXTURES.metadata[b[0].file_position.url];
Multivio.CDM.fileMetadata=e;Multivio.sendAction("fileMetadataDidChange",c);var a={};
a[c]=Multivio.CDM.FIXTURES.logical[c];Multivio.CDM.logicalStructure=a;var f={};f[c]=Multivio.CDM.FIXTURES.physical[c];
Multivio.CDM.physicalStructure=f;var d={};d=Multivio.CDM.FIXTURES.size[c];Multivio.CDM.imageSize=d;
Multivio.masterController.set("currentFile",c);Multivio.logger.debug('Fixtures "%@" setted'.fmt(c))
}}});sc_require("configurator");Multivio.LOG_ERROR=40000;Multivio.LOG_WARN=30000;
Multivio.LOG_INFO=20000;Multivio.LOG_DEBUG=10000;Multivio.logger=SC.Object.create({errorLogger:undefined,warningLogger:undefined,infoLogger:undefined,debugLogger:undefined,loggers:[],initialize:function(){if(SC.none(this.debugLogger)){var c=Log4js.getLogger("Log4js");
c.setLevel(Log4js.Level.OFF);this.errorLogger=Log4js.getLogger("error");this.errorLogger.setLevel(Log4js.Level.ERROR);
this.errorLogger.isUsed=NO;this.loggers.push(this.errorLogger);this.warningLogger=Log4js.getLogger("warning");
this.warningLogger.setLevel(Log4js.Level.WARN);this.warningLogger.isUsed=NO;this.loggers.push(this.warningLogger);
this.infoLogger=Log4js.getLogger("info");this.infoLogger.setLevel(Log4js.Level.INFO);
this.infoLogger.isUsed=NO;this.loggers.push(this.infoLogger);this.debugLogger=Log4js.getLogger("debug");
this.debugLogger.setLevel(Log4js.Level.DEBUG);this.debugLogger.isUsed=NO;this.loggers.push(this.debugLogger);
var a=Multivio.configurator.getPath("logParameters.log");for(var b in a){if(a.hasOwnProperty(b)){var e=Multivio.get(a[b]);
var d=undefined;switch(b){case"ajax":d=new Log4js.AjaxAppender(Multivio.configurator.get("serverName")+Multivio.configurator.getPath("logParameters.logFile"));
d.setLayout(new Log4js.BasicLayout());break;case"console":d=new Log4js.ConsoleAppender(false);
break;case"browserConsole":d=new Log4js.BrowserConsoleAppender(true);break}if(d){this._attachAppender(d,e)
}}}this.info("end of logger.init")}},_attachAppender:function(b,d){for(var c=0;c<this.loggers.length;
c++){var a=this.loggers[c];if(a.level.level>=d){a.addAppender(b);a.isUsed=YES}}},error:function(a){if(!SC.none(this.errorLogger)&&this.errorLogger.isUsed){this.errorLogger.error(a)
}},warning:function(a){if(!SC.none(this.warningLogger)&&this.warningLogger.isUsed){this.warningLogger.warn(a)
}},info:function(a){if(!SC.none(this.infoLogger)&&this.infoLogger.isUsed){this.infoLogger.info(a)
}},debug:function(a){if(!SC.none(this.debugLogger)&&this.debugLogger.isUsed){this.debugLogger.debug(a)
}},logException:function(c,b){var d="\n\t{";for(var a in c){if(c.hasOwnProperty(a)){d+="'%@': '%@',\n ".fmt(a,c[a])
}}if(d.length>4){d=d.substring(0,d.length-4)}d+="}\n";this.error('Exception Caught %@ "custom message": "%@"'.loc(d,b))
}});Multivio.ContentView=SC.ScrollView.extend({isLoadingContent:null,isLoadingContentBinding:"Multivio.masterController.isLoadingContent",zoomRatio:null,zoomRatioBinding:"Multivio.zoomController.zoomRatio",zoomState:null,zoomStateBinding:SC.Binding.oneWay("Multivio.zoomController.currentZoomState"),rotateValueBinding:SC.Binding.oneWay("Multivio.rotateController.currentValue"),selection:null,selectionBinding:"Multivio.imageController.selection",imageSize:null,imageSizeBinding:"Multivio.CDM.imageSize",imageController:null,nativeWidth:undefined,nativeHeight:undefined,_nextUrl:null,needToScrollUp:YES,isNewImage:NO,largeResolutionsAuthorized:NO,zoomRatioDidChange:function(){var a=this.get("zoomRatio");
if(SC.none(this.get("zoomState"))){this._loadNewImage()}}.observes("zoomRatio"),zoomStateDidChange:function(){var a=this.get("zoomState");
if(!SC.none(a)){this._loadNewImage()}}.observes("zoomState"),rotateValueDidChange:function(){var a=this.get("rotateValue");
if(!SC.none(a)){this._loadNewImage()}}.observes("rotateValue"),imageSizeDidChange:function(){var e=this.get("imageSize");
if(!SC.none(e)){var d=this.get("selection");if(!SC.none(d)&&!SC.none(d.firstObject())){var c=d.firstObject().url;
var b=c.indexOf("page_nr=");if(b===-1){b=c.indexOf("url=")}var a=c.substring(b,c.length);
var f=this.get("imageSize")[a];if(f!==-1&&!SC.none(f)){this.nativeWidth=f.width;this.nativeHeight=f.height;
this._loadNewImage()}}}}.observes("imageSize"),scrollStateDidChange:function(){if(!this.get("isLoadingContent")){if(!this.get("isHorizontalScrollerVisible")&&!this.get("isVerticalScrollerVisible")){this.get("imageController").set("isOneScrollVisible",NO)
}else{this.get("imageController").set("isOneScrollVisible",YES)}}}.observes("isLoadingContent"),_adjustSize:function(b,g){var e=(g.width===this.nativeWidth&&g.height===this.nativeHeight)?YES:NO;
Multivio.zoomController.isNativeSize(e);SC.RunLoop.begin();var d=this.get("contentView");
var c=this.get("isVerticalScrollerVisible");if(c){if(this.isNewImage){if(this.needToScrollUp){if(this.get("isHorizontalScrollerVisible")){this.set("horizontalScrollOffset",0);
this.set("verticalScrollOffset",0)}else{SC.RunLoop.begin();this.set("verticalScrollOffset",0);
SC.RunLoop.end()}}else{this.set("verticalScrollOffset",this.get("maximumVerticalScrollOffset"));
this.needToScrollUp=YES}}}d.get("innerContent").set("value",b);d.adjust("width",g.width);
d.adjust("height",g.height);d.adjust("left",0);SC.RunLoop.end();if(!this.get("isHorizontalScrollerVisible")){d.adjust("left",undefined)
}var f=this.get("zoomState");if(!SC.none(f)){var a=this.get("rotateValue");Multivio.zoomController.calculateRatio(a,g.width,g.height,this.nativeWidth)
}SC.RunLoop.begin();this.set("isLoadingContent",NO);SC.RunLoop.end();this.isNewImage=NO;
d.get("highlightpane").set("layerNeedsUpdate",YES);Multivio.logger.info("ContentView#_adjustSize")
},_loadNewImage:function(){var m=this.get("selection");if(!SC.none(m)&&!SC.none(m.firstObject())){var t=m.firstObject().url;
var f=t.indexOf("url");var d=this.get("zoomState");var g=this.get("rotateValue");
var e=Multivio.configurator.get("zoomParameters").maxResolution;var p=NO;var b="";
if(Multivio.initializer.get("inputParameters").scenario==="fixtures"){b=t}else{switch(d){case Multivio.zoomController.FULLPAGE:var s=this.get("frame").width;
var j=this.get("frame").height;if(g%180===0){b=t.substring(0,f).concat("max_width="+s+"&max_height="+j+"&angle="+g+"&").concat(t.substring(f,t.length))
}else{b=t.substring(0,f).concat("max_width="+j+"&max_height="+s+"&angle="+g+"&").concat(t.substring(f,t.length))
}var q=this.nativeWidth/s;var a=this.nativeHeight/j;var u=q>a?q:a;var h=(this.nativeWidth/u)*(this.nativeHeight/u);
if(h>e){p=YES}break;case Multivio.zoomController.PAGEWIDTH:var i=this.get("frame").width-this.get("childViews")[1].get("scrollbarThickness");
if(g%180===0){b=t.substring(0,f).concat("max_width="+i+"&angle="+g+"&").concat(t.substring(f,t.length))
}else{b=t.substring(0,f).concat("max_height="+i+"&angle="+g+"&").concat(t.substring(f,t.length))
}var n=this.nativeWidth/s;var c=(this.nativeWidth/n)*(this.nativeHeight/n);if(c>e){p=YES
}break;case Multivio.zoomController.HUNDREDPERCENT:b=t.substring(0,f).concat("angle="+g+"&").concat(t.substring(f,t.length));
if(this.nativeWidth*this.nativeHeight>e){p=YES}break;default:var r=this.get("zoomRatio");
Multivio.logger.info("currentpercent "+r);var l=this.nativeWidth*r;var o=this.nativeHeight*r;
b=t.substring(0,f).concat("max_width="+parseInt(l,10)+"&max_height="+parseInt(o,10)+"&angle="+g+"&").concat(t.substring(f,t.length));
if(parseInt(l,10)*parseInt(o,10)>e){p=YES}break}}if(p&&this.get("largeResolutionsAuthorized")===NO){this._nextUrl=b;
Multivio.usco.showAlertPaneWarn("_Loading the requested resolution may take a long time".loc(),"_Would you like to proceed?".loc(),"_Proceed".loc(),"_Use lower resolution".loc(),this)
}else{Multivio.logger.debug("load new image "+b);SC.imageCache.loadImage(b,this,this._adjustSize)
}}},render:function(a,b){this.set("frame",{});arguments.callee.base.apply(this,arguments)
},alertPaneDidDismiss:function(c,a){switch(a){case SC.BUTTON1_STATUS:SC.imageCache.loadImage(this._nextUrl,this,this._adjustSize);
this.set("largeResolutionsAuthorized",YES);break;case SC.BUTTON2_STATUS:var b=this.get("selection");
Multivio.zoomController.setBestStep(this.nativeWidth,this.nativeHeight);break}},viewDidResize:function(){this.set("frame",{});
for(var b=0;b<this.get("childViews").length;b++){var c=this.get("childViews")[b];
c.layoutDidChange()}this.updateLayer();var a=this.get("zoomState");if(a===Multivio.zoomController.PAGEWIDTH||a===Multivio.zoomController.FULLPAGE&&this.get("frame").width!==0){SC.RunLoop.begin();
this.set("isLoadingContent",YES);SC.RunLoop.end();this._loadNewImage()}else{if(!this.get("isHorizontalScrollerVisible")){this.get("contentView").adjust("left",undefined)
}}},_selectionDidChange:function(){var d=this.get("selection");if(!SC.none(d)&&!SC.none(d.firstObject())){this.nativeWidth=0;
this.nativeHeight=0;Multivio.rotateController.resetRotateValue();this.isNewImage=YES;
var c=d.firstObject().url;var b=c.indexOf("page_nr=");if(b===-1){b=c.indexOf("url=")
}var a=c.substring(b,c.length);var e=Multivio.CDM.getImageSize(a);if(e!==-1){this.nativeWidth=e.width;
this.nativeHeight=e.height;this._loadNewImage()}}}.observes("selection"),scrollValueScreen:function(){var d=this.get("contentView").get("frame").height;
var a=this.get("frame").height;var c=d/a;var b=this.get("maximumVerticalScrollOffset")/c;
b+=this.get("verticalScrollerView").thumbLength();return b},scrollsDidChange:function(){var a=this.get("imageController").get("scrollPosition");
var c=Math.round(this.get("contentView").get("frame").width*a.horizontalPos);var b=Math.round(this.get("contentView").get("frame").height*a.verticalPos);
this.scrollTo(c,b)}.observes(".imageController.scrollPosition"),keyDown:function(c){if(!this.isLoadingContent){var b=YES;
switch(c.which){case 33:if(c.shiftKey){return NO}else{if(this.get("verticalScrollOffset")===0){this.needToScrollUp=NO;
Multivio.navigationController.goToPrevious()}else{this.scrollBy(null,-this.scrollValueScreen())
}return YES}break;case 34:if(c.shiftKey){return NO}else{var d=this.get("verticalScrollOffset");
if(d>=this.get("maximumVerticalScrollOffset")){Multivio.navigationController.goToNext()
}else{this.scrollBy(null,+this.scrollValueScreen())}return YES}break;case 37:b=this.get("isHorizontalScrollerVisible");
if(b){if(this.get("horizontalScrollOffset")!==0){this.scrollBy(-40,null)}}return YES;
case 38:b=this.get("isVerticalScrollerVisible");if(b){if(this.get("verticalScrollOffset")!==0){this.scrollBy(null,-40)
}else{if(Multivio.masterController.get("currentPosition")!==1){this.needToScrollUp=NO;
Multivio.navigationController.goToPrevious()}}}else{this.needToScrollUp=YES;Multivio.navigationController.goToPrevious()
}return YES;case 39:b=this.get("isHorizontalScrollerVisible");if(b){var a=this.get("maximumHorizontalScrollOffset");
if(this.get("horizontalScrollOffset")<a){this.scrollBy(40,null)}}return YES;case 40:b=this.get("isVerticalScrollerVisible");
if(b){var e=this.get("maximumVerticalScrollOffset");if(this.get("verticalScrollOffset")<e){this.scrollBy(null,40)
}else{Multivio.navigationController.goToNext()}}else{Multivio.navigationController.goToNext()
}return YES;default:return NO}}},mouseWheel:function(a){if(!this.isLoadingContent){if(a.wheelDeltaY>0){if(this.get("maximumVerticalScrollOffset")===this.get("verticalScrollOffset")){Multivio.navigationController.goToNext()
}}if(a.wheelDeltaY<0){if(this.get("verticalScrollOffset")===0){this.needToScrollUp=NO;
Multivio.navigationController.goToPrevious()}}arguments.callee.base.apply(this,arguments)
}}});Multivio.ImageContentView=SC.ImageView.extend({imageController:null,mouseDown:function(a){this.get("parentView").get("childViews")[1].mouseDown(a)
},mouseDragged:function(a){this.get("parentView").get("childViews")[1].mouseDragged(a)
},mouseUp:function(a){this.get("parentView").get("childViews")[1].mouseUp(a)},clippingFrameDidChange:function(){if(this.get("frame").height>0&&this.get("frame").width>0){var a={};
a.height=Math.round((this.get("clippingFrame").height/this.get("frame").height)*100)/100;
a.width=Math.round((this.get("clippingFrame").width/this.get("frame").width)*100)/100;
a.x=Math.round((this.get("clippingFrame").x/this.get("frame").width)*100)/100;a.y=Math.round((this.get("clippingFrame").y/this.get("frame").height)*100)/100;
this.get("imageController").set("visiblePart",a)}}.observes("clippingFrame"),parentViewDidResize:function(){var b=this.get("parentView");
if(SC.none(b)){return}var a=b.get("layout").width;var c=b.get("layout").height;this.adjust("width",a);
this.adjust("height",c)}});Multivio.HighlightContentView=SC.View.extend({masterController:null,selectionController:null,searchController:null,searchTreeController:null,paletteController:null,zoomController:null,rotateController:null,selectedTextDiv:null,highlightNeedsUpdate:NO,coordinatesNeedUpdate:NO,selections:[],searchResults:[],userSelection:null,_mouseDownInfo:null,persistentSelection:YES,_selectionIndex:null,isLoadingContent:NO,isLoadingContentBinding:SC.Binding.oneWay(".masterController.isLoadingContent"),init:function(){this.userSelection=this.createChildView(SC.View.design({layout:{top:0,left:0,width:0,height:0},classNames:"selection-transparent".w()}));
this.appendChild(this.userSelection);this.userSelection.set("isVisible",NO);this.selectedTextDiv=this.createChildView(SC.TextFieldView.design({layout:{top:-10,left:-10,width:1,height:1},layerId:"selected_text",keyDown:function(a){this.set("saved_value",this.$input()[0].value);
return NO},keyUp:function(a){this.$input()[0].value=this.get("saved_value");this.$input()[0].focus();
this.$input()[0].select();return NO}}));this.appendChild(this.selectedTextDiv);this.selectedTextDiv.set("isVisible",YES);
this.selectedTextDiv.set("isEnabled",YES);arguments.callee.base.apply(this,arguments)
},selectedTextStringDidChange:function(){var a=this.get("selectionController").get("selectedTextString");
SC.RunLoop.begin();this.selectedTextDiv.set("value",a);this.selectedTextDiv.$input()[0].focus();
this.selectedTextDiv.$input()[0].select();SC.RunLoop.end()}.observes(".selectionController.selectedTextString"),coordinatesNeedUpdateDidChange:function(){SC.RunLoop.begin();
if(this.get("coordinatesNeedUpdate")){this.get("searchController").updateCoordinates();
this.get("selectionController").updateCoordinates();this.set("coordinatesNeedUpdate",NO)
}SC.RunLoop.end()}.observes("coordinatesNeedUpdate"),isLoadingContentDidChange:function(){this.set("layerNeedsUpdate",YES)
}.observes("isLoadingContent"),highlightNeedsUpdateDidChange:function(){if(this.get("highlightNeedsUpdate")){this.set("layerNeedsUpdate",YES)
}}.observes("highlightNeedsUpdate"),searchResultSelectionIndexDidChange:function(){if(this.get("isLoadingContent")){return
}SC.RunLoop.begin();this.get("searchController").updateCoordinates();this.updateSearchResultScroll();
this.set("highlightNeedsUpdate",YES);SC.RunLoop.end()}.observes(".masterController.currentSearchResultSelectionIndex"),treeResultSelectionDidChange:function(){this.updateSearchResultScroll()
}.observes(".searchTreeController.selection"),updateSearchResultScroll:function(){var a=this.get("masterController").get("currentSearchResultSelectionIndex");
SC.RunLoop.begin();this.set("_selectionIndex",a);SC.RunLoop.end();if(a!==-1){var b=this.get("childViews");
var d=undefined;for(var c=0;c<b.get("length");c++){d=b[c];if(d.type==="search"&&d.id===a){Multivio.logger.debug("update search result scroll"+a);
d.scrollToVisible();break}}this.set("coordinatesNeedUpdate",YES)}},currentPageDidChange:function(){this.set("coordinatesNeedUpdate",YES);
this.set("highlightNeedsUpdate",YES)}.observes(".masterController.currentPosition"),rotateValueDidChange:function(){var a=this.get("rotateController").get("currentValue");
this.get("searchController").set("rotateValue",a);this.get("selectionController").set("rotateValue",a);
this.set("highlightNeedsUpdate",YES)}.observes(".rotateController.currentValue"),zoomFactorDidChange:function(){var a=this.get("zoomController").get("zoomRatio");
this.get("selectionController").set("zoomFactor",a);this.get("searchController").set("zoomFactor",a);
this.set("highlightNeedsUpdate",YES)}.observes(".zoomController.zoomRatio"),mouseDown:function(a){this.get("selectionController").removeAllHighlights();
var c=this.get("layout");var b=this.convertFrameFromView({x:a.pageX,y:a.pageY});this._mouseDownInfo={pageX:a.pageX,pageY:a.pageY,x:b.x,y:b.y,viewLayout:c};
this.userSelection.adjust("left",b.x);this.userSelection.adjust("top",b.y);this.userSelection.adjust("width",0);
this.userSelection.adjust("height",0);this.userSelection.set("isVisible",YES);this.selectedTextDiv.adjust("top",b.y);
this._propagateEventTo(a,this.get("nextResponder").get("layer"));return YES},_propagateEventTo:function(b,d){var c={which:b.which,clientX:b.clientX,clientY:b.clientY,pageX:b.pageX,pageY:b.pageY,screenX:b.screenX,screenY:b.screenY,charCode:b.charCode,keyCode:b.keyCode,altKey:b.altKey,metaKey:b.metaKey,ctrlKey:b.ctrlKey,shiftKey:b.shiftKey};
var a=SC.Event.simulateEvent(d,b.type,c);return SC.Event.trigger(d,b.type,a)},mouseDragged:function(a){var c=this._mouseDownInfo,b;
b=(a.pageX-c.pageX);if(b>=0){this.userSelection.adjust("left",c.x);this.userSelection.adjust("right",null)
}else{b*=(-1);this.userSelection.adjust("right",c.viewLayout.width-c.x);this.userSelection.adjust("left",null)
}this.userSelection.adjust("width",b);b=(a.pageY-c.pageY);if(b>=0){this.userSelection.adjust("top",c.y);
this.userSelection.adjust("bottom",null)}else{b*=(-1);this.userSelection.adjust("bottom",c.viewLayout.height-c.y);
this.userSelection.adjust("top",null)}this.userSelection.adjust("height",b);return NO
},mouseUp:function(b){var a=this.userSelection.get("layout"),e,d;e=a.top?a.top:(this._mouseDownInfo.viewLayout.height-a.bottom-a.height);
d=a.left?a.left:(this._mouseDownInfo.viewLayout.width-a.right-a.width);if(this.persistentSelection){}this.userSelection.set("isVisible",NO);
var c=this.get("masterController").get("currentPosition");this.get("selectionController").set("userSelection",{top:e,left:d,width:a.width,height:a.height,page:c,type:"selection"});
this.selectedTextDiv.adjust("top",e);this._mouseDownInfo=null;return NO},selectionsDidChange:function(){this.set("coordinatesNeedUpdate",YES);
this.set("layerNeedsUpdate",YES)}.observes(".selectionController.[]"),searchResultsDidChange:function(){this.set("coordinatesNeedUpdate",YES);
this.set("layerNeedsUpdate",YES)}.observes(".searchController.[]"),parentViewDidResize:function(){var b=this.get("parentView");
if(SC.none(b)){return}var a=b.get("layout").width;var c=b.get("layout").height;this.adjust("width",a);
this.adjust("height",c);this.set("layerNeedsUpdate",YES)},render:function(c,a){if(a){arguments.callee.base.apply(this,arguments)
}else{this.removeAllChildren();this.appendChild(this.userSelection);this.appendChild(this.selectedTextDiv);
if(this.get("isLoadingContent")){return}var d=this.get("selectionController").get("content")||[];
var h=d.get("length");var f;for(f=0;f<h;f++){this._drawHighlightZone(d.objectAt(f),"highlight selection-highlight",f,"selection")
}var m=this.get("masterController").get("currentFile");var e=this.get("searchController").get("url");
var b=this.get("searchController").get("currentSearchFile")||e;if(b!==m&&b!==e){return
}d=this.get("searchController").get("content")||[];h=d.get("length");var l="highlight search-highlight";
var j="";var g=this.get("_selectionIndex");for(f=0;f<h;f++){j=(f===g?l+" search-selected-highlight":l);
this._drawHighlightZone(d.objectAt(f),j,f,"search")}this.set("highlightNeedsUpdate",NO)
}},_drawHighlightZone:function(a,b,c,d){if(this.get("masterController").get("currentFile")!==a.url){return
}if(this.get("masterController").get("currentPosition")!==a.page_number){return}var e=a.current;
this.appendChild(this.createChildView(SC.View.design({layout:{top:e.top,left:e.left,width:e.width,height:e.height},classNames:b.w(),id:c,type:d})))
}});Multivio.ThumbnailView=SC.ScrollView.extend({thumbnailController:null,childViewsDidChange:function(){if(this.get("childViewsNeedLayout")){this.scrollToSelection()
}}.observes("childViewsNeedLayout"),viewDidResize:function(){arguments.callee.base.apply(this,arguments);
Multivio.logger.debug("Multivio.ThumbnailView.viewDidResize");var a=this;SC.run(function(){a.scrollToSelection()
});this.tile()},scrollToSelection:function(){var c=this.get("thumbnailController").get("selection").firstObject();
if(!SC.none(c)){var a=this.get("thumbnailController").indexOf(c),b=this.get("contentView");
if(!SC.none(a)&&!SC.none(b.get("content"))){b.scrollToContentIndex(a)}Multivio.logger.debug("Multivio.ThumbnailView.scrollToSelection "+"thumbnail selection index (%@) should now be visible".fmt(a))
}},_thumbnailSelectionDidChange:function(){this.scrollToSelection()}.observes(".thumbnailController.selection")});
Multivio.TreeView=SC.ScrollView.extend({treeController:null,childViewsDidChange:function(){if(this.get("childViewsNeedLayout")&&this.get("contentView").get("childViews").get("length")!==0){this.treeSelectionDidChange()
}}.observes("childViewsNeedLayout"),treeSelectionDidChange:function(){var b=this.get("treeController").get("selection");
if(!SC.none(b)){var c=this.get("horizontalScrollOffset");var a=this.get("treeController").get("arrangedObjects").indexOf(b.firstObject());
if(!this.get("isHorizontalScrollerVisible")){a++}this.get("contentView").scrollToContentIndex(a);
Multivio.logger.debug("update tree scroll");if(c===this.get("maximumHorizontalScrollOffset")){c=0
}this.set("horizontalScrollOffset",c)}}.observes(".treeController.selection")});Multivio.TreeLabelView=SC.ListItemView.extend({hasContentIcon:YES,render:function(b,i){arguments.callee.base.apply(this,arguments);
var a=this.get("content").label;var g=b._classNames;var f=SC.metricsForString(a,g.toString());
var d=f.width+parseInt(b._STYLE_PAIR_ARRAY[1],10)+24;if(this.get("parentView").get("frame").width<d){this.get("parentView").adjust("width",d)
}var c=null;try{c=this.get("parentView").get("parentView").get("frame").width}catch(h){}if(!(SC.typeOf(c)===SC.T_NUMBER)){Multivio.logger.error("Tree list item view could not determine the size of its grandparent scroll view")
}else{if(c<d){b.attr("title",a)}}},renderIcon:function(a,b){if(SC.none(this.content.get("file_position").index)){a.begin("img").addClass("icon").addClass("").attr("src","/multivio/client/multivio/en/1.0.0/images/icons/file.png").end()
}},renderLabel:function(c,b){var a=this.content.get("nb_results");if(!SC.none(a)&&a!==0){b=b+" ("+a+")"
}if(SC.none(this.content.get("file_position").index)){c.push('<label class="document-label-view">',b||"","</label>")
}else{c.push("<label>",b||"","</label>")}}});Multivio.CalendarView=SC.View.extend({classNames:"calendar-view",calendarController:null,year:null,month:null,day:null,createChildViews:function(){var a=[];
this.year=this.createChildView(SC.View.design({layout:{top:5,left:10,right:10,height:30},childViews:"prevYear currentYear nextYear".w(),prevYear:SC.ButtonView.design({layout:{top:5,left:5,width:20,height:20},titleMinWidth:0,needsEllipsis:NO,toolTip:"_goToPrevious".loc(),icon:"go_backwards_new_16",theme:"mvo-button",renderStyle:"renderImage",isEnabledBinding:".parentView.parentView.calendarController.isPreviousYearEnabled",target:this.get("calendarController"),action:"previousYear"}),currentYear:SC.SelectButtonView.design({layout:{top:5,left:35,right:35,height:25},objectsBinding:".parentView.parentView.calendarController.listOfYears",valueBinding:".parentView.parentView.calendarController.selectedYear",nameKey:"year",theme:"square",disableSort:YES,checkboxEnabled:YES,needsEllipsis:NO,supportFocusRing:NO}),nextYear:SC.ButtonView.design({layout:{top:5,right:5,width:20,height:20},titleMinWidth:0,needsEllipsis:NO,toolTip:"_goToNext".loc(),icon:"go_forward_new_16",theme:"mvo-button",renderStyle:"renderImage",isEnabledBinding:".parentView.parentView.calendarController.isNextYearEnabled",target:this.get("calendarController"),action:"nextYear"})}));
a.push(this.year);this.month=this.createChildView(SC.View.design({layout:{top:35,left:10,right:10,height:30},childViews:"prevMonth currentMonth nextMonth".w(),prevMonth:SC.ButtonView.design({layout:{top:5,left:5,width:20,height:20},titleMinWidth:0,needsEllipsis:NO,toolTip:"_goToPrevious".loc(),icon:"go_backwards_new_16",theme:"mvo-button",renderStyle:"renderImage",isEnabledBinding:".parentView.parentView.calendarController.isPreviousMonthEnabled",target:this.get("calendarController"),action:"previousMonth"}),currentMonth:SC.SelectButtonView.design({layout:{top:5,left:35,right:35,height:25},objectsBinding:".parentView.parentView.calendarController.listOfMonths",valueBinding:".parentView.parentView.calendarController.selectedMonth",theme:"square",nameKey:"name",disableSort:YES,checkboxEnabled:YES,needsEllipsis:NO,supportFocusRing:NO}),nextMonth:SC.ButtonView.design({layout:{top:5,right:5,width:20,height:20},titleMinWidth:0,needsEllipsis:NO,toolTip:"_goToNext".loc(),icon:"go_forward_new_16",theme:"mvo-button",renderStyle:"renderImage",isEnabledBinding:".parentView.parentView.calendarController.isNextMonthEnabled",target:this.get("calendarController"),action:"nextMonth"})}));
a.push(this.month);this.day=this.createChildView(SC.View.design({layout:{top:90,width:210,height:180,centerX:0},childViews:"weekDays monthDays".w(),weekDays:Multivio.WeekdaysView.design({layout:{top:0,left:0,height:24}}),monthDays:Multivio.DaysView.design({layout:{top:30,left:0,height:150},calendarController:this.get("calendarController")})}));
a.push(this.day);this.set("childViews",a)}});Multivio.WeekdaysView=SC.View.extend({classNames:"calendar-weekdays-view",render:function(c,d){var a=SC.DateTime.create().get("lastMonday");
for(var b=0;b<7;++b){c=c.begin("div").addClass("calendar-weekday").addStyle({position:"absolute",width:"30px",left:29*b+"px",top:"0px",bottom:"0px",textAlign:"center"});
c.push(a.toFormattedString("%a"));c=c.end();a=a.advance({day:1})}}});Multivio.DaysView=SC.View.extend({classNames:"calendar-days-view",calendarController:null,render:function(b,f){var g=this.get("calendarController");
var r=g.get("selectedMonth");var l=g.get("selectedYear");var a=g.get("listOfDays");
var e=g.get("selectedDay");var s=SC.DateTime.create();var u=s.get("year");var n=s.get("month");
var d=u-l.year;var h=n-r.month;var c=s.advance({month:-h}).advance({year:-d});var t=c.adjust({day:1});
if(t.get("dayOfWeek")!==1){t=t.get("lastMonday")}var p=t.copy();for(var q=0;q<42;
++q){b=b.begin("div").addClass("calendar-day").addStyle({position:"absolute",width:"30px",height:"24px",left:(30*q%210)+"px",top:(parseInt(q/7,10)*25)+"px",textAlign:"center"}).push(p.get("day"));
if(p.get("month")===c.get("month")){b.removeClass("not-current-month");var m=NO;for(var o=0;
o<a.length;o++){if(a[o]===p.get("day")){m=YES;break}}if(m){b.addClass("sel");if(p.get("day")===e){b.addClass("selected")
}else{b.removeClass("selected")}}else{b.removeClass("sel")}}else{b.addClass("not-current-month")
}b=b.end();p=p.advance({day:1})}},mouseDown:function(a){var c=SC.$(a.target);var b=c[0].innerHTML;
if(c[0].classList.contains("sel")){this.get("calendarController").set("selectedDay",parseInt(b,10))
}return YES},listOfDaysDidChange:function(){this.updateLayer()}.observes(".calendarController.listOfDays",".calendarController.selectedDay")});
Multivio.FileButtonView=SC.View.extend({hideTimer:undefined,isHorizontalToolbarActiveBinding:SC.Binding.oneWay("Multivio.paletteController.isHorizontalToolbarActive"),render:function(a,b){if(b){this.hideTimer=SC.Timer.schedule({target:this,action:"hideView",interval:3000})
}arguments.callee.base.apply(this,arguments)},mouseEntered:function(a){if(!this.get("isHorizontalToolbarActive")){if(!SC.none(this.hideTimer)){this.hideTimer.invalidate()
}else{this.showView()}}return YES},mouseExited:function(a){if(!this.get("isHorizontalToolbarActive")){this.hideTimer=SC.Timer.schedule({target:this,action:"hideView",interval:800})
}return YES},isHorizontalToolbarActivedidChange:function(){var a=this.get("isHorizontalToolbarActive");
if(!SC.none(a)){if(a){if(!SC.none(this.hideTimer)){this.hideTimer.invalidate()}this.showView()
}else{this.hideView()}}}.observes("isHorizontalToolbarActive"),hideView:function(){this.hideTimer=undefined;
this.set("classNames",["sc-view","mvo-front-view-invisible"]);this.updateLayer();
Multivio.getPath("views.mainContentView.content.innerMainContent").becomeFirstResponder()
},showView:function(){this.set("classNames",["sc-view","mvo-front-view"]);this.updateLayer()
}});Multivio.Metadata=SC.View.extend(SC.ContentDisplay,{contentDisplayProperties:"key data".w(),isTextSelectable:YES,customHeight:0,render:function(c,g){var d=this.get("content");
var b=d.key.capitalize();var f=SC.heightForString(b,110,"font-weight: bold",["mvo-metadata-label"]);
var e=d.data;var a=SC.heightForString(e,220,["mvo-metadata-data"]);if(a!==0){if(f<a){f=a
}c.addStyle("height",f);this.set("customHeight",f);c=c.begin("span").addClass("mvo-metadata-label").push(b).end();
c=c.begin("p").addClass("mvo-metadata-data").push(e).end();arguments.callee.base.apply(this,arguments)
}}});Multivio.innerGradient={render:function(a,b){if(a.needsContent){this.renderChildViews(a,b);
a.push("<div class='top-edge'></div>","<div class='right-edge'></div>","<div class='bottom-edge'></div>","<div class='left-edge'></div>")
}}};Multivio.innerGradientThinTopBottom={render:function(a,b){if(a.needsContent){this.renderChildViews(a,b);
a.push("<div class='top-edge-thin'></div>","<div class='right-edge-thin'></div>","<div class='bottom-edge-thin'></div>","<div class='left-edge-thin'></div>")
}}};Multivio.outerGradient={render:function(a,b){if(a.needsContent){this.renderChildViews(a,b);
a.push("<div class='outer-top-left-edge'></div>","<div class='outer-top-edge'></div>","<div class='outer-top-right-edge'></div>","<div class='outer-right-edge'></div>","<div class='outer-bottom-right-edge'></div>","<div class='outer-bottom-edge'></div>","<div class='outer-bottom-left-edge'></div>","<div class='outer-left-edge'></div>")
}}};Multivio.SearchTreeView=SC.ScrollView.extend({searchTreeController:Multivio.searchTreeController,treeSelectionDidChange:function(){var c=this.get("searchTreeController").get("selection");
if(!SC.none(c)){var d=this.get("horizontalScrollOffset");var b=this.get("searchTreeController").get("arrangedObjects");
if(SC.none(b)){return}var a=b.indexOf(c.firstObject());if(!this.get("isHorizontalScrollerVisible")){a++
}this.get("contentView").scrollToContentIndex(a);Multivio.logger.debug("update search tree scroll");
if(d===this.get("maximumHorizontalScrollOffset")){d=0}this.set("horizontalScrollOffset",d)
}}.observes(".searchTreeController.selection")});Multivio.SearchTreeLabelView=SC.ListItemView.extend({searchController:Multivio.searchController,hasContentIcon:YES,isEnabledBinding:"Multivio.searchTreeController.allowsSelection",render:function(c,e){arguments.callee.base.apply(this,arguments);
var b=this.get("content").label;var a=SC.metricsForString(b,'"Helvetica Neue", Arial, Helvetica, Geneva, sans-serif;');
var d=a.width+((this.get("outlineLevel")+1)*32);if(this.get("parentView").get("frame").width<d){this.get("parentView").adjust("width",d)
}},renderIcon:function(a,b){if(this.content.get("type")==="more"){return}if(SC.none(this.content.get("file_position").index)){a.begin("img").addClass("icon").addClass("").attr("src","/multivio/client/multivio/en/1.0.0/images/icons/file.png").end()
}},renderLabel:function(a,f){var g=(this.get("isEnabled")?"":"disabled");if(SC.none(this.content.get("file_position").index)){a.push('<label class="document-label-view %@">'.fmt(g),f||"","</label>")
}else{var h=f||"";var e=this.searchController.get("currentSearchTerm");var d=e.toLowerCase().split("and");
var c=function(p,o,m,n,l){return'<span class="mvo-search-result-term">'+p+"</span>"
};for(var j=0;j<d.length;j++){var b=d[j].trim();var i=new RegExp(b,"gi");h=h.replace(i,c)
}a.push('<label class="%@">'.fmt(g));a.push(h);a.push("</label>")}}});sc_require("mixins/interface");
sc_require("views/search_tree");Multivio.SearchView=SC.View.extend({searchController:null,searchTreeController:null,childViews:["messageLabelView","searchQueryView","clearButtonView","searchButtonView","previousResultButtonView","nextResultButtonView","resultsScrollView","searchScopeView"],render:function(a,b){if(b){arguments.callee.base.apply(this,arguments);
this._hideSearchScopeViewIfNeeded()}},currentFileListDidChange:function(){Multivio.logger.debug("==search view, currentFileListDidChange");
this._hideSearchScopeViewIfNeeded()}.observes(".searchController.currentFileList"),_hideSearchScopeViewIfNeeded:function(){var a=this.get("searchController").get("currentFileList");
Multivio.logger.debug("==search view, _hideSearchScopeViewIfNeeded: "+a);if(SC.none(a)){return
}if(a.length<=1){Multivio.logger.debug("==search view, hiding scope: "+this.searchScopeView);
this.searchScopeView.set("isVisible",NO)}else{this.searchScopeView.set("isVisible",YES)
}},searchQueryView:SC.TextFieldView.design({layout:{top:0,left:0,right:54,height:24},isEnabledBinding:"Multivio.searchTreeController.allowsSelection",classNames:"search",hint:"_typeQueryHere".loc(),valueBinding:"Multivio.searchController.currentSearchTerm",keyUp:function(a){if(a.which===13){this.get("parentView").get("searchController").set("currentSearchTerm",this.$input()[0].value);
this.get("parentView").get("searchController").doSearch();a.stop();return YES}else{this.fieldValueDidChange(NO);
return NO}}}),searchButtonView:SC.ButtonView.design({layout:{top:2,right:24,width:20,height:20},isEnabledBinding:"Multivio.searchTreeController.allowsSelection",icon:"search_new_16",renderStyle:"renderImage",titleMinWidth:0,theme:"mvo-button",toolTip:"_doSearch".loc(),target:"Multivio.searchController",action:"doSearch"}),clearButtonView:SC.ButtonView.design({layout:{top:2,right:0,width:20,height:20},isEnabledBinding:"Multivio.searchTreeController.allowsSelection",icon:"cancel_new_16",renderStyle:"renderImage",toolTip:"_doClear".loc(),theme:"mvo-button",titleMinWidth:0,target:"Multivio.searchController",action:"doClear"}),resultsScrollView:Multivio.SearchTreeView.design(Multivio.innerGradientThinTopBottom,{layout:{top:100,left:0,right:0,bottom:0},borderStyle:SC.BORDER_NONE,hasHorizontalScroller:YES,hasVerticalScroller:YES,contentView:SC.ListView.design({layout:{top:0,left:0,right:0,bottom:0},isEnabledBinding:"Multivio.searchTreeController.allowsSelection",insertionOrientation:SC.VERTICAL_ORIENTATION,rowHeight:15,contentBinding:"Multivio.searchTreeController.arrangedObjects",selectionBinding:"Multivio.searchTreeController.selection",contentValueKey:"label",exampleView:Multivio.SearchTreeLabelView})}),nextResultButtonView:SC.ButtonView.design({layout:{top:70,height:20,width:20,right:0},isEnabledBinding:"Multivio.searchTreeController.allowsSelection",needsEllipsis:NO,toolTip:"_goToNext".loc(),icon:"down_new_16",theme:"mvo-button",renderStyle:"renderImage",titleMinWidth:0,target:"Multivio.searchTreeController",action:"goToNextResult"}),previousResultButtonView:SC.ButtonView.design({layout:{top:70,height:20,width:20,right:24},isEnabledBinding:"Multivio.searchTreeController.allowsSelection",needsEllipsis:NO,toolTip:"_goToPrevious".loc(),icon:"up_new_16",theme:"mvo-button",renderStyle:"renderImage",titleMinWidth:0,target:"Multivio.searchTreeController",action:"goToPreviousResult"}),searchScopeView:SC.SelectButtonView.design({layout:{top:36,left:0,right:0,height:25},isEnabledBinding:"Multivio.searchTreeController.allowsSelection",toolTip:"_searchIn".loc(),valueBinding:"Multivio.searchController.currentSearchFile",objectsBinding:"Multivio.searchController.currentFileList",nameKey:"label",theme:"square",valueKey:"url",disableSort:YES,checkboxEnabled:YES,needsEllipsis:NO,supportFocusRing:NO}),messageLabelView:SC.LabelView.design({layout:{top:72,left:0,right:0,height:22},textAlign:SC.ALIGN_LEFT,classNames:"message",valueBinding:"Multivio.searchController.searchStatus"})});
Multivio.NavigationView=SC.View.extend({hideView:function(){this.removeAllChildren();
Multivio.getPath("views.mainContentView.content.innerMainContent").becomeFirstResponder()
},showWaiting:function(){var b=Multivio.getPath("views.navigationInfo.transparentView");
var a=Multivio.getPath("views.waitingImg");this.appendChild(b);this.appendChild(a)
},showView:function(c,e){this.removeAllChildren();var b=Multivio.getPath("views.navigationInfo.transparentView");
this.appendChild(b);var a=Multivio.getPath("views.navigationInfo.transparentView.currentPage");
a.set("value","_Page".loc()+" : "+e);if(!SC.none(c)){var d=Multivio.getPath("views.navigationInfo.transparentView.currentFile");
d.set("value","_File".loc()+" : "+c);this.appendChild(d)}else{a.set("layout",{width:220,height:20,centerY:0});
a.set("textAlign",SC.ALIGN_CENTER)}this.appendChild(a);SC.Timer.schedule({target:this,action:"hideView",interval:2000})
}});Multivio.OverviewView=SC.View.extend({overviewController:null,imageOverview:null,visiblePartIndicator:null,createChildViews:function(){var a=[];
this.imageOverview=this.createChildView(SC.ImageView.design({useImageCache:NO,borderStyle:SC.BORDER_NONE}));
a.push(this.imageOverview);this.visiblePartIndicator=this.createChildView(SC.View.design({classNames:"mvo-glass-zone highlight-pane-pan"}));
a.push(this.visiblePartIndicator);this.set("childViews",a)},displayImage:function(a,b){this.imageOverview.set("layout",{centerX:0,centerY:0,width:b.width,height:b.height});
this.imageOverview.set("value",a);this.drawZone()},drawZone:function(){var d=this.get("overviewController").get("visiblePart"),f=this.imageOverview.get("frame");
if(!SC.none(d)){var e=d.height;var a=d.width;var c=Math.round(f.width*d.x);var b=Math.round(f.height*d.y);
if(!SC.none(e)){this.visiblePartIndicator.set("layout",{top:f.y-3+b,left:f.x-3+c,width:f.width*a,height:f.height*e})
}}},zonePositionOrSizeDidChange:function(){this.drawZone()}.observes(".overviewController.visiblePart"),thumbnailUrlDidChange:function(){var a=this.get("overviewController").get("thumbnailUrl");
SC.imageCache.loadImage(a,this,this.displayImage)}.observes(".overviewController.thumbnailUrl"),mouseDown:function(a){this._mouseDownInfo={pageX:a.pageX,pageY:a.pageY,left:this.visiblePartIndicator.get("layout").left,top:this.visiblePartIndicator.get("layout").top};
return YES},mouseUp:function(a){this.mouseDragged(a);return YES},mouseDragged:function(b){var f=this._mouseDownInfo;
var e=f.left+(b.pageX-f.pageX);var c=f.top+(b.pageY-f.pageY);var a={};var g=this.imageOverview.get("frame");
var d=this.imageOverview.get("layout");a.horizontal=(e-g.x+3)/d.width;a.vertical=(c-g.y+3)/d.height;
this.get("overviewController").set("scrolls",a);return YES}});sc_require("views/main_content");
sc_require("views/image_content");sc_require("views/highlight_content");sc_require("views/thumbnail");
sc_require("views/tree");sc_require("views/calendar");sc_require("views/file_button");
sc_require("views/metadata");sc_require("views/search");sc_require("views/navigation");
sc_require("views/overview");sc_require("mixins/interface");Multivio.views=SC.Page.design({mainContentView:SC.View.design(Multivio.innerGradient,{layout:{top:0,bottom:0,left:0,right:0},acceptsFirstResponder:YES,isKeyResponder:YES,mouseDown:function(a){Multivio.paletteController.hidePalette(null);
return YES},controllers:["zoomController","navigationController","searchController","selectionController","imageController","treeController","thumbnailController","searchTreeController"],childViews:"content".w(),content:SC.View.design({layout:{top:0,bottom:0,left:48,right:0},classNames:"outer_content_view",childViews:"innerMainContent".w(),innerMainContent:Multivio.ContentView.design({layout:{top:5,bottom:5,left:5,right:5},imageController:Multivio.imageController,isFirstResponder:YES,acceptsFirstResponder:YES,isKeyResponder:YES,borderStyle:SC.BORDER_NONE,classNames:"inner_content_view",contentView:SC.View.design({layout:{top:0,bottom:0,centerX:0,minWidth:1},useImageCache:NO,childViews:"innerContent highlightpane".w(),innerContent:Multivio.ImageContentView.design({imageController:Multivio.imageController,layout:{top:0,left:0,minWidth:1},useImageCache:NO}),highlightpane:Multivio.HighlightContentView.design({layout:{top:0,left:0,right:0,minWidth:1},masterController:Multivio.masterController,selectionController:Multivio.selectionController,searchController:Multivio.searchController,searchTreeController:Multivio.searchTreeController,paletteController:Multivio.paletteController,zoomController:Multivio.zoomController,rotateController:Multivio.rotateController}).classNames("highlight-pane".w())}).classNames("image-and-highlight-container".w())})})}),navigationInfo:Multivio.NavigationView.design({layout:{width:220,height:50,centerX:24,top:16},classNames:"mvo-front-view",childViews:"transparentView ".w(),transparentView:SC.View.design({layout:{left:0,right:0,top:0,bottom:0},classNames:"mvo-front-view-transparent",childViews:"currentFile currentPage".w(),currentFile:SC.LabelView.design({layout:{width:220,height:20,left:5,top:5},classNames:"mvo-metadata-label",escapeHTML:YES,value:null}),currentPage:SC.LabelView.design({layout:{width:220,height:20,left:5,top:25},classNames:"mvo-metadata-label",escapeHTML:NO,value:null})})}),bottomButtons:Multivio.FileButtonView.design({layout:{bottom:20,centerX:24,width:728,height:48},classNames:"mvo-front-view",childViews:"backgroundView ".w(),backgroundView:SC.View.design({layout:{left:0,right:0,top:0,bottom:0},classNames:"mvo-front-view-transparent",childViews:["overviewButton","rotateLeftButton","rotateRightButton","firstPageButton","previousPageButton","textPageView","nextPageButton","lastPageButton","zoomOutButton","zoomInButton","zoomFullSizeButton","zoomFullWidthButton","zoomNativeSizeButton"],overviewButton:SC.ButtonView.design({layout:{centerX:-240,centerY:0,width:32,height:32},titleMinWidth:0,needsEllipsis:NO,name:"overview",toolTip:"_Overview".loc(),renderStyle:"renderImage",icon:"overview_new",theme:"mvo-button",isEnabledBinding:"Multivio.overviewController.isOverviewEnabled",isActiveBinding:"Multivio.overviewController.isOverviewActive",target:"Multivio.overviewController",action:"showOverview"}),rotateLeftButton:SC.ButtonView.design({layout:{centerX:-176,centerY:0,width:32,height:32},layerId:"rotateLeftPageId",titleMinWidth:0,needsEllipsis:NO,toolTip:"_RotateLeft".loc(),renderStyle:"renderImage",icon:"rotate_left_new",theme:"mvo-button",target:"Multivio.rotateController",isEnabledBinding:"Multivio.rotateController.isLeftAllow",action:"rotateLeft"}),rotateRightButton:SC.ButtonView.design({layout:{centerX:-144,centerY:0,width:32,height:32},layerId:"rotateRightPageId",titleMinWidth:0,needsEllipsis:NO,toolTip:"_RotateRight".loc(),renderStyle:"renderImage",icon:"rotate_right_new",theme:"mvo-button",target:"Multivio.rotateController",isEnabledBinding:"Multivio.rotateController.isRigthAllow",action:"rotateRight"}),firstPageButton:SC.ButtonView.design({layout:{centerX:-80,centerY:0,width:32,height:32},titleMinWidth:0,needsEllipsis:NO,toolTip:"_FirstPage".loc(),renderStyle:"renderImage",icon:"jump_backwards_new",theme:"mvo-button",isEnabledBinding:"Multivio.navigationController.isFirstEnabled",target:"Multivio.navigationController",action:"goToFirstPage"}),previousPageButton:SC.ButtonView.design({layout:{centerX:-48,centerY:0,width:32,height:32},titleMinWidth:0,needsEllipsis:NO,toolTip:"_PreviousPage".loc(),renderStyle:"renderImage",icon:"go_backwards_new",theme:"mvo-button",isEnabledBinding:"Multivio.navigationController.isPreviousEnabled",target:"Multivio.navigationController",action:"goToPrevious"}),textPageView:SC.TextFieldView.design({layout:{centerX:0,centerY:-1,width:50,height:24},textAlign:SC.ALIGN_CENTER,valueBinding:"Multivio.navigationController.currentPage",isEnabledBinding:"Multivio.navigationController.isCurrentPageEnabled",mouseDown:function(a){this.becomeFirstResponder();
a.stopPropagation();return YES},keyDown:function(a){if(a.which===43||a.which===45){a.preventDefault();
return YES}return NO}}),nextPageButton:SC.ButtonView.design({layout:{centerX:48,centerY:0,width:32,height:32},titleMinWidth:0,needsEllipsis:NO,toolTip:"_NextPage".loc(),acceptsFirstResponder:YES,renderStyle:"renderImage",icon:"go_forward_new",theme:"mvo-button",isEnabledBinding:"Multivio.navigationController.isNextEnabled",target:"Multivio.navigationController",action:"goToNext"}),lastPageButton:SC.ButtonView.design({layout:{centerX:80,centerY:0,width:32,height:32},titleMinWidth:0,needsEllipsis:NO,toolTip:"_LastPage".loc(),renderStyle:"renderImage",icon:"jump_forward_new",theme:"mvo-button",isEnabledBinding:"Multivio.navigationController.isLastEnabled",target:"Multivio.navigationController",action:"goToLastPage"}),zoomOutButton:SC.ButtonView.design({layout:{centerX:144,centerY:0,width:32,height:32},titleMinWidth:0,needsEllipsis:NO,toolTip:"_Zoom-".loc(),renderStyle:"renderImage",icon:"zoom_minus_new",theme:"mvo-button",isEnabledBinding:"Multivio.zoomController.isZoomOutAllowed",target:"Multivio.zoomController",action:"doZoomOut"}),zoomInButton:SC.ButtonView.design({layout:{centerX:176,centerY:0,width:32,height:32},titleMinWidth:0,needsEllipsis:NO,toolTip:"_Zoom+".loc(),renderStyle:"renderImage",icon:"zoom_plus_new",theme:"mvo-button",isEnabledBinding:"Multivio.zoomController.isZoomInAllowed",target:"Multivio.zoomController",action:"doZoomIn"}),zoomFullSizeButton:SC.ButtonView.design({layout:{centerX:240,centerY:0,width:32,height:32},titleMinWidth:0,needsEllipsis:NO,name:"Full",toolTip:"_FullSize".loc(),renderStyle:"renderImage",icon:"full_size_new",theme:"mvo-button",isEnabledBinding:"Multivio.zoomController.isFullEnabled",target:"Multivio.zoomController",action:"setPredefinedZoom"}),zoomFullWidthButton:SC.ButtonView.design({layout:{centerX:272,centerY:0,width:32,height:32},titleMinWidth:0,needsEllipsis:NO,name:"Width",toolTip:"_FullWidth".loc(),renderStyle:"renderImage",icon:"full_width_new",theme:"mvo-button",isEnabledBinding:"Multivio.zoomController.isWidthEnabled",target:"Multivio.zoomController",action:"setPredefinedZoom"}),zoomNativeSizeButton:SC.ButtonView.design({layout:{centerX:304,centerY:0,width:32,height:32},titleMinWidth:0,needsEllipsis:NO,name:"Native",toolTip:"_NativeSize".loc(),renderStyle:"renderImage",icon:"native_size_new",theme:"mvo-button",isEnabledBinding:"Multivio.zoomController.isNativeEnabled",target:"Multivio.zoomController",action:"setPredefinedZoom"})})}),leftButtons:SC.View.design({layout:{top:0,left:4,bottom:0,width:40},classNames:"workspace_black",childViews:[SC.ButtonView.design({layout:{top:10,centerX:0,width:32,height:32},titleMinWidth:0,needsEllipsis:NO,name:"search",toolTip:"_Search".loc(),renderStyle:"renderImage",icon:"search_new",theme:"mvo-button",isEnabledBinding:"Multivio.searchController.isDocumentSearchable",target:"Multivio.paletteController",action:"showSearch"}),SC.ButtonView.design({layout:{top:50,centerX:0,width:32,height:32},titleMinWidth:0,needsEllipsis:NO,name:"tree",toolTip:"_Tree".loc(),renderStyle:"renderImage",icon:"tree_new",theme:"mvo-button",target:"Multivio.paletteController",action:"showTree"}),SC.ButtonView.design({layout:{top:90,centerX:0,width:32,height:32},titleMinWidth:0,needsEllipsis:NO,name:"thumbnails",toolTip:"_Thumbnails".loc(),renderStyle:"renderImage",icon:"thumbnails_new",theme:"mvo-button",target:"Multivio.paletteController",action:"showThumbnails"}),SC.ButtonView.design({layout:{top:130,centerX:0,width:32,height:32},titleMinWidth:0,needsEllipsis:NO,name:"download",toolTip:"_Download".loc(),renderStyle:"renderImage",icon:"download_new",theme:"mvo-button",target:"Multivio.paletteController",action:"downloadFile"}),SC.ButtonView.design({layout:{top:170,centerX:0,width:32,height:32},titleMinWidth:0,needsEllipsis:NO,name:"show_toolbar",toolTip:"_ShowToolbar".loc(),renderStyle:"renderImage",icon:"show_toolbar_new",theme:"mvo-button",target:"Multivio.paletteController",action:"showHorizontalToolbar"}),SC.ButtonView.design({layout:{top:210,centerX:0,width:32,height:32},titleMinWidth:0,needsEllipsis:NO,name:"help",toolTip:"_Help".loc(),renderStyle:"renderImage",icon:"help_new",theme:"mvo-button",target:"Multivio.paletteController",action:"showHelpPalette"})]}),thumbnailPalette:SC.PalettePane.design({isAnchored:YES,classNames:"mvo-transparent",contentView:SC.View.design({layout:{top:0,bottom:0,left:0,right:0},childViews:"innerThumbnail thumbnailListModeButtom thumbnailGridModeButtom".w(),innerThumbnail:Multivio.ThumbnailView.design(Multivio.innerGradientThinTopBottom,{layout:{top:2,bottom:42,left:2,right:2},hasHorizontalScroller:NO,borderStyle:SC.BORDER_NONE,thumbnailController:Multivio.thumbnailController,contentView:SC.GridView.design({layout:{top:0,bottom:0,left:0,right:0},insertionOrientation:SC.VERTICAL_ORIENTATION,rowHeight:130,columnWidth:130,contentBinding:"Multivio.thumbnailController.arrangedObjects",selectionBinding:"Multivio.thumbnailController.selection",exampleView:SC.View.design({childViews:"thumbImage thumbLabel".w(),isSelectedDidChange:function(){this.get("thumbLabel").updateLayer()
}.observes("isSelected"),thumbImage:SC.View.design({layout:{top:4,height:100,centerX:0,width:100},childViews:[SC.ImageView.design({useImageCache:NO,classNames:"centered-image",contentBinding:".parentView.parentView.content",contentValueKey:"url"})]}),thumbLabel:SC.LabelView.design({layout:{bottom:4,height:18,centerX:0,width:46},textAlign:SC.ALIGN_CENTER,contentBinding:".parentView.content",contentValueKey:"pageNumber",render:function(c,d){var a=this.get("parentView").get("isSelected");
var b={standard:!a,selected:a};c.setClass(b);arguments.callee.base.apply(this,arguments)
}})}).classNames("custom-thumbnail-item-view".w())})}),thumbnailListModeButtom:SC.ButtonView.design({layout:{height:32,bottom:4,width:32,left:2},titleMinWidth:0,needsEllipsis:NO,name:"thumbnailListMode",toolTip:"_ThumbnailListMode".loc(),renderStyle:"renderImage",icon:"thumbnail_list_mode_new",theme:"mvo-button",valueBinding:"Multivio.paletteController.thumbnailMode",buttonBehavior:SC.TOGGLE_ON_BEHAVIOR,toggleOnValue:"list"}),thumbnailGridModeButtom:SC.ButtonView.design({layout:{height:32,bottom:4,width:32,left:32},titleMinWidth:0,needsEllipsis:NO,name:"thumbnailGridMode",toolTip:"_ThumbnailGridMode".loc(),renderStyle:"renderImage",icon:"thumbnail_grid_mode_new",theme:"mvo-button",valueBinding:"Multivio.paletteController.thumbnailMode",buttonBehavior:SC.TOGGLE_ON_BEHAVIOR,toggleOnValue:"grid"})})}),searchPalette:SC.PalettePane.design({isAnchored:YES,classNames:"mvo-transparent",contentView:SC.View.design({layout:{top:0,bottom:0,left:0,right:0},controllers:["imageController"],childViews:"innerSearch".w(),innerSearch:Multivio.SearchView.design({layout:{top:2,bottom:2,left:2,right:2},borderStyle:SC.BORDER_NONE,searchController:Multivio.searchController,searchTreeController:Multivio.searchTreeController})})}),treePalette:SC.PalettePane.design({isAnchored:YES,classNames:"mvo-transparent",contentView:SC.View.design({layout:{top:0,bottom:0,left:0,right:0},childViews:"innerTree ".w(),innerTree:Multivio.TreeView.design(Multivio.innerGradientThinTopBottom,{layout:{top:2,bottom:2,left:2,right:2},borderStyle:SC.BORDER_NONE,treeController:Multivio.treeController,contentView:SC.ListView.design({layout:{top:0,bottom:0,left:0,right:0},classNames:"mvo-test",rowHeight:18,borderStyle:SC.BORDER_NONE,exampleView:Multivio.TreeLabelView,contentValueKey:"label",contentBinding:"Multivio.treeController.arrangedObjects",selectionBinding:"Multivio.treeController.selection"})})})}),calendarPalette:SC.PalettePane.design({isAnchored:YES,classNames:"mvo-transparent",contentView:SC.View.design({layout:{top:0,bottom:0,left:0,right:0},childViews:[Multivio.CalendarView.design(Multivio.innerGradientThinTopBottom,{layout:{top:2,bottom:2,left:2,right:2},borderStyle:SC.BORDER_NONE,calendarController:Multivio.calendarController})]})}),treeView:SC.View.design({layout:{top:0,bottom:0,left:0,right:0},controllers:["treeController"]}),metadataPalette:SC.PalettePane.design({isAnchored:YES,classNames:"mvo-transparent",contentView:SC.View.design({layout:{top:0,left:0,bottom:0,right:0},childViews:[SC.ListView.design({layout:{top:2,bottom:2,left:2,right:2},exampleView:Multivio.Metadata,didCreateLayer:function(){var c=this.get("childViews");
var b=13;for(var a=0;a<c.length;a++){c[a].set("layout",{top:b});b+=c[a].get("customHeight")
}}})]})}),overviewPalette:SC.PalettePane.design({isAnchored:YES,classNames:"mvo-transparent",contentView:Multivio.OverviewView.design({layout:{top:0,bottom:0,left:0,right:0},overviewController:Multivio.overviewController}),acceptsKeyPane:NO}),waitingImg:SC.ImageView.design({layout:{centerX:0,centerY:0,width:36,height:36},value:"/multivio/client/multivio/en/1.0.0/images/progress_wheel_medium.gif"}),helpPalette:SC.PalettePane.design({isAnchored:YES,classNames:"mvo-transparent",contentView:SC.View.design({layout:{top:0,bottom:0,left:0,right:0},childViews:"innerHelp".w(),innerHelp:SC.ScrollView.design(Multivio.innerGradientThinTopBottom,{layout:{top:2,bottom:2,left:2,right:2},borderStyle:SC.BORDER_NONE,hasHorizontalScroller:NO,contentView:SC.LabelView.design({layout:{top:2,right:2,width:280},classNames:"help-panel",escapeHTML:NO,isTextSelectable:YES,useStaticLayout:YES,value:"<h1>"+"_helpTitle".loc()+"</h1>"+"_helpIntro".loc()+"<h3>"+"_helpContentsTitle".loc()+"</h3><ul><li>"+"_helpVerticalBar".loc()+"</li><li>"+"_helpNavigationBar".loc()+"</li><li>"+"_mouseActionsTitle".loc()+"</li><li>"+"_keyShortcutsTitle".loc()+'</li></ul><h3 id="helpVerticalBar">1. '+"_helpVerticalBar".loc()+'</h3><img class="help-image" style= "" src="/multivio/client/multivio/en/1.0.0/images/icons/24x24/search_dark_24x24.png"/><div class="help-text">'+"_helpSearch".loc()+'</div><img class="help-image" style= "" src="/multivio/client/multivio/en/1.0.0/images/icons/24x24/tree_dark_24x24.png"/><div class="help-text">'+"_helpToc".loc()+'</div><img class="help-image" style= "" src="/multivio/client/multivio/en/1.0.0/images/icons/24x24/thumbnails_dark_24x24.png"/><div class="help-text">'+"_helpThum".loc()+'<div><img class="help-image-inline" style= "" src="/multivio/client/multivio/en/1.0.0/images/icons/24x24/thumbnail_list_dark_24x24.png"/>, <img class="help-image-inline" style= "" src="/multivio/client/multivio/en/1.0.0/images/icons/24x24/thumbnail_grid_dark_24x24.png"/></div></div><img class="help-image" style= "" src="/multivio/client/multivio/en/1.0.0/images/icons/24x24/download_dark_24x24.png"/><div class="help-text">'+"_helpDownload".loc()+'</div><img class="help-image" style= "" src="/multivio/client/multivio/en/1.0.0/images/icons/24x24/show_toolbar_dark_24x24.png"/><div class="help-text">'+"_helpDisplayBar".loc()+'</div><h3 id="helpNavigationBar">2. '+"_helpNavigationBar".loc()+"</h3><p>"+"_helpNavigationBarDesc".loc()+'<p/><img class="help-image" style= "" src="/multivio/client/multivio/en/1.0.0/images/icons/24x24/loupe_dark_24x24.png"/><div class="help-text">'+"_helpLoupe".loc()+'</div><img class="help-image" style= "" src="/multivio/client/multivio/en/1.0.0/images/icons/24x24/rotate_left_dark_24x24.png"/><img class="help-image" style= "" src="/multivio/client/multivio/en/1.0.0/images/icons/24x24/rotate_right_dark_24x24.png"/><div class="help-text">'+"_helpRotation".loc()+'</div><img class="help-image" style= "" src="/multivio/client/multivio/en/1.0.0/images/icons/24x24/jump_backwards_dark_24x24.png"/><img class="help-image" style= "" src="/multivio/client/multivio/en/1.0.0/images/icons/24x24/go_backwards_dark_24x24.png"/><img class="help-image" style= "" src="/multivio/client/multivio/en/1.0.0/images/icons/24x24/go_forward_dark_24x24.png"/><img class="help-image" style= "" src="/multivio/client/multivio/en/1.0.0/images/icons/24x24/jump_forward_dark_24x24.png"/><div class="help-text">'+"_helpNavigation".loc()+'</div><img class="help-image" style= "" src="/multivio/client/multivio/en/1.0.0/images/icons/24x24/zoom_minus_dark_24x24.png"/><img class="help-image" style= "" src="/multivio/client/multivio/en/1.0.0/images/icons/24x24/zoom_plus_dark_24x24.png"/><div class="help-text">'+"_helpZoom".loc()+'</div><img class="help-image" style= "" src="/multivio/client/multivio/en/1.0.0/images/icons/24x24/full_size_dark_24x24.png"/><div class="help-text">'+"_helpFullSize".loc()+'</div><img class="help-image" style= "" src="/multivio/client/multivio/en/1.0.0/images/icons/24x24/full_width_dark_24x24.png"/><div class="help-text">'+"_helpFullWidth".loc()+'</div><img class="help-image" style= "" src="/multivio/client/multivio/en/1.0.0/images/icons/24x24/100_percent_dark_24x24.png"/><div class="help-text">'+"_helpNativeSize".loc()+'</div><h3 id="mouseActions">3. '+"_mouseActionsTitle".loc()+"</h3><p>"+"_mouseActions".loc('<img class="" style= "" src="/multivio/client/multivio/en/1.0.0/images/icons/24x24/pan_dark_24x24.png"/>')+'</p><h3 id="keyShortcuts">4. '+"_keyShortcutsTitle".loc()+"</h3><p>"+"_keyShortcuts".loc()+"</p>",isVisibleInWindowDidChange:function(){if(this.get("isVisibleInWindow")){this.viewDidResize()
}}.observes("isVisibleInWindow")})})})}),footerView:SC.View.design({layout:{top:10,bottom:0,left:0,right:0},childViews:"metadataView themeSelectionView logoMvoView".w(),metadataView:SC.View.design({layout:{top:0,bottom:0,left:0,right:230},childViews:[SC.LabelView.design({layout:{top:5,height:20,left:0},isTextSelectable:YES,tagName:"span",classNames:"metadata_primary",valueBinding:"Multivio.metadataController.title",render:function(a,b){a.attr("title",Multivio.metadataController.title());
arguments.callee.base.apply(this,arguments)}})]}).classNames("".w()),themeSelectionView:SC.View.design({layout:{top:0,bottom:0,width:72,right:150},isVisibleBinding:"Multivio.layoutController.showThemeSelector",childViews:[SC.ButtonView.design({layout:{top:0,bottom:0,right:48,width:24},toolTip:"_Change theme to white".loc(),renderStyle:"renderImage",icon:"theme-button-white",theme:"mvo-button",target:"Multivio.layoutController",action:"changeTheme",newTheme:"mvo-white-theme"}),SC.ButtonView.design({layout:{top:0,bottom:0,right:24,width:24},toolTip:"_Change theme to dark gray".loc(),renderStyle:"renderImage",icon:"theme-button-dark-gray",theme:"mvo-button",target:"Multivio.layoutController",action:"changeTheme",newTheme:"mvo-dark-gray-theme"}),SC.ButtonView.design({layout:{top:0,bottom:0,right:0,width:24},toolTip:"_Change theme to blue".loc(),renderStyle:"renderImage",icon:"theme-button-blue",theme:"mvo-button",target:"Multivio.layoutController",action:"changeTheme",newTheme:"mvo-blue-theme"})]}),logoMvoView:SC.View.design({layout:{top:0,height:21,right:0,width:100},isTextSelectable:YES,childViews:[SC.View.design({layout:{top:0,height:21,right:0,left:0},childViews:[SC.ImageView.design({layout:{top:0,height:21,right:0,width:100},classNames:"multivio_logo",toolTip:"_Click to go to Multivio website.".loc()+" "+"_Current client version:".loc()+" "+Multivio.VERSION})],render:function(c,e){c.push("<a href='https://www.multivio.org/' target='_blank'>");
var d=this.get("childViews")[0];var b=d.get("toolTip");var a=Multivio.configurator.get("serverVersion");
b+=" "+"_Current server version:".loc()+" "+a;d.set("toolTip",b);this.renderChildViews(c,e);
c.push("</a>")}})]})}),usageView:SC.View.design({layout:{top:0,bottom:0,left:0,right:0},childViews:[SC.View.design({layout:{centerX:0,centerY:0,width:700,height:500},childViews:[SC.LabelView.design({layout:{top:50,bottom:50,right:50,left:50},classNames:"mvo_info_full",contentBinding:"Multivio.errorController",contentValueKey:"usageText",escapeHTML:NO})]}).classNames("mvo_info_full_background".w())]}).classNames("mvo_info_full shadow".w()),errorView:SC.View.design({layout:{top:0,bottom:0,left:0,right:0},childViews:[SC.View.design({layout:{centerX:0,centerY:0,width:700,height:400},childViews:[SC.LabelView.design({layout:{top:50,bottom:50,right:50,left:50},classNames:"mvo_info_full",contentBinding:"Multivio.errorController",contentValueKey:"message",escapeHTML:NO})]}).classNames("mvo_info_full_background".w())]}).classNames("mvo_info_full shadow".w()),waitingView:SC.View.design({childViews:[SC.View.design({layout:{centerX:0,centerY:0,width:500,height:300},classNames:"mvo-pane loading".w(),childViews:[SC.LabelView.design({layout:{centerX:0,centerY:-33,width:230,height:33},classNames:"mvo-pane loading".w(),tagName:"div",value:"<h3>"+"_Fetching remote data...".loc()+"</h3>",escapeHTML:NO}),SC.ImageView.design({layout:{centerX:0,centerY:50,width:36,height:36},value:"/multivio/client/multivio/en/1.0.0/images/progress_wheel_medium.gif",classNames:["mvo_info_full_progress"]})]})]}),blankPane:SC.View.design({layout:{top:0,bottom:0,left:0,right:0},classNames:"blank-bg".w()})});
Multivio.waitingPane=SC.PanelPane.create({layout:{width:500,height:250,centerX:0,centerY:0},contentView:SC.View.extend({childViews:[SC.LabelView.design({layout:{centerX:0,centerY:-33,width:230,height:33},classNames:"mvo-pane sc-large-size".w(),value:"_Fetching remote data...".loc()}),SC.ImageView.design({layout:{centerX:0,centerY:50,width:36,height:36},value:"/multivio/client/multivio/en/1.0.0/images/progress_wheel_medium.gif",classNames:"mvo_info_full_progress".w()})]}).classNames("mvo-pane".w())});
Multivio.newErrorPane=SC.PanelPane.create({layout:{centerX:0,centerY:0,width:700,height:400},contentView:SC.View.design({layout:{top:0,bottom:0,right:0,left:0},classNames:"mvo_info_full",childViews:[SC.LabelView.extend({layout:{top:50,bottom:50,right:50,left:50},contentBinding:"Multivio.errorController",contentValueKey:"message",escapeHTML:NO}).classNames("mvo_info_full_background".w())]})});
Multivio.GridLayout3x3={_gridCells:[],_componentsOnGrid:{},_leftStripWidth:0,_rightStripWidth:0,_headerHeight:0,_footerHeight:0,_margin:0,layOutGrid:function(b){var a=Multivio.checkParams(b,{leftStripWidth:SC.T_NUMBER,rightStripWidth:SC.T_NUMBER,headerHeight:SC.T_NUMBER,footerHeight:SC.T_NUMBER,marginTop:SC.T_NUMBER,marginRight:SC.T_NUMBER,marginBottom:SC.T_NUMBER,marginLeft:SC.T_NUMBER});
if(a.length>0){throw {message:"Invalid parameters while laying out a GridLayout3x3: "+a}
}this._leftStripWidth=b.leftStripWidth;this._rightStripWidth=b.rightStripWidth;this._headerHeight=b.headerHeight;
this._footerHeight=b.footerHeight;this._marginTop=b.marginTop;this._marginRight=b.marginRight;
this._marginBottom=b.marginBottom;this._marginLeft=b.marginLeft;this._resetLayout()
},layOutComponent:function(e){var a=!SC.none(e.x)?YES:NO;var p=Multivio.checkParams(e,{name:SC.T_STRING});
if(p.length>0){var c="Invalid parameters while laying out a component  on a GridLayout3x3:"+p;
throw {message:c}}if(a){p=Multivio.checkParams(e,{x:SC.T_NUMBER,y:SC.T_NUMBER,xlen:SC.T_NUMBER,ylen:SC.T_NUMBER});
if(p.length>0){c="Invalid parameters while laying out a component  on a GridLayout3x3:"+p;
throw {message:c}}}else{p=Multivio.checkParams(e,{coord:SC.T_STRING});if(p.length>0){c="Invalid parameters while laying out a component  on a GridLayout3x3:"+p;
throw {message:c}}if(e.coord&&e.coord.length!==5){c="Coordinates are invalid:"+e.coord;
throw {message:c}}}var l=e.name;var d=Multivio.getPath(l);var q,o,b,s;if(SC.none(d)){c="Component object with name %@ not found for laying out on a "+"GridLayout3x3".fmt(l);
throw {message:c}}if(a){q=e.x;o=e.y;b=e.xlen;s=e.ylen}else{var n=e.coord.charAt(0);
q=(n==="A")?0:(n==="B")?1:(n==="C")?2:-1;n=parseInt(e.coord.charAt(1),10);o=n-1;n=e.coord.charAt(3);
b=(n==="A")?0:(n==="B")?1:(n==="C")?2:-1;b=b-q+1;n=parseInt(e.coord.charAt(4),10);
s=n-o}p="";if(q<0||q>2||b<=0||q+b>3||o<0||o>2||s<=0||o+s>3){if(a){p="Coordinates are invalid: (%@, %@, %@, %@)".fmt(q,o,b,s)
}else{p="Coordinates are invalid: %@".fmt(e.coord)}throw {message:p}}var h={};switch(q){case 0:h.left=this._marginLeft;
break;case 1:h.left=this._leftStripWidth+this._marginLeft+1;break;case 2:h.width=this._rightStripWidth-this._marginLeft-this._marginRight;
break}switch(q+b){case 1:h.width=this._leftStripWidth-this._marginLeft-this._marginRight;
break;case 2:h.right=this._rightStripWidth+this._marginRight+1;break;case 3:h.right=this._marginRight;
break}switch(o){case 0:h.top=this._marginTop;break;case 1:h.top=this._headerHeight+this._marginTop+1;
break;case 2:h.height=this._footerHeight-this._marginTop-this._marginBottom;break
}switch(o+s){case 1:h.height=this._headerHeight-this._marginTop-this._marginBottom;
break;case 2:h.bottom=this._footerHeight+this._marginBottom+1;break;case 3:h.bottom=this._marginBottom;
break}for(var g=q;g<q+b;g++){for(var f=o;f<o+s;f++){var r=this._gridCells[g][f];if(!SC.none(r)&&r!==l){this.removeComponent(r)
}this._gridCells[g][f]=l;if(SC.none(this._componentsOnGrid[l])){this._componentsOnGrid[l]={coordinates:[q,o,b,s],coveredCells:[]}
}this._componentsOnGrid[l].coveredCells.push([g,f])}}d.set("layout",h);this.appendChild(d);
d.set("isVisibleInWindow",YES)},removeComponent:function(e){var f=this._componentsOnGrid[e]||{};
var b=f.coveredCells||[];for(var h=0;h<b.length;h++){if(SC.typeOf(b[h])===SC.T_ARRAY&&b[h].length===2){var a=b[h][0],g=b[h][1];
if(this._gridCells[a][g]===e){this._gridCells[a][g]=null}}}if(!SC.empty(f)){delete this._componentsOnGrid[e];
var d=Multivio.getPath(e);if(d.get("isVisibleInWindow")){d.set("isVisibleInWindow",NO)
}this.removeChild(d)}},_resetLayout:function(){for(var b in this._componentsOnGrid){if(this._componentsOnGrid.hasOwnProperty(b)){var a=Multivio.getPath(b);
if(a.get("isVisibleInWindow")){a.set("isVisibleInWindow",NO)}this.removeChild(a)}}this._gridCells=[[null,null,null],[null,null,null],[null,null,null]]
}};Multivio.GridLayout4x4={_gridCells:[],_componentsOnGrid:{},_leftStripWidth:0,_rightStripWidth:0,_headerHeight:0,_footerHeight:0,_xCenter:0,_yCenter:0,layOutGrid:function(d,b,a,c,e,f){this._leftStripWidth=d;
this._rightStripWidth=b;this._headerHeight=a;this._footerHeight=c;this._xCenter=e;
this._yCenter=f;this._gridCells=[[null,null,null,null],[null,null,null,null],[null,null,null,null],[null,null,null,null]]
},layOutComponent:function(g,b,c,d,a){var h="";if(b<0||b>3||c<=0||b+c>4||d<0||d>3||a<=0||d+a>4){h="Coordinates are invalid: (%@, %@, %@, %@)".fmt(b,c,d,a);
Multivio.logger.error(h);throw {message:h}}if(this._componentsOnGrid[g]){h="Cannot lay out an already laid out component: %@".fmt(g);
Multivio.logger.error(h);throw {message:h}}var e={};switch(b){case 0:e.left=0;break;
case 1:e.left=this._leftStripWidth+1;break;case 2:e.left=this._xCenter;break;case 3:e.right=this._rightStripWidth;
break}switch(b+c){case 1:e.width=100;break;case 2:e.right="50%";break;case 3:e.right=100;
break;case 4:e.right=0;break}switch(d){case 0:e.top=0;break;case 1:e.top=this._headerHeight+1;
break;case 2:e.top=this._yCenter;break;case 3:e.bottom=this._footerHeight;break}switch(d+a){case 1:e.height=100;
break;case 2:e.bottom="50%";break;case 3:e.bottom=100;break;case 4:e.bottom=0;break
}for(var i=b;i<b+c;i++){for(var f=d;f<d+a;f++){var j=this._gridCells[i][f];if(j!==null){this.removeComponent(j)
}this._gridCells[i][f]=g;if(SC.none(this._componentsOnGrid[g])){this._componentsOnGrid[g]=[]
}this._componentsOnGrid[g].push([i,f])}}g.set("layout",e);this.appendChild(g);g.set("isVisibleInWindow",YES)
},removeComponent:function(d){var b=this._componentsOnGrid[d]||[];for(var f=0;f<b.length;
f++){if(SC.typeOf(b[f])===SC.T_ARRAY&&b[f].length===2){var a=b[f][0],e=b[f][1];if(this._gridCells[a][e]===d){this._gridCells[a][e]=null
}}}delete this._componentsOnGrid[d];if(d.get("isVisibleInWindow")){d.set("isVisibleInWindow",NO)
}this.removeChild(d)}};Multivio.CDM=SC.Object.create({referer:undefined,fileMetadata:undefined,logicalStructure:undefined,physicalStructure:undefined,imageSize:undefined,searchResults:undefined,pageIndexing:undefined,selectedText:undefined,clear:function(){this.referer=undefined;
this.fileMetadata=undefined;this.logicalStructure=undefined;this.physicalStructure=undefined;
this.imageSize=undefined;this.searchResults=undefined;this.pageIndexing=undefined;
this.selectedText=undefined},setFileMetadata:function(a,b){if(SC.ok(a)){Multivio.logger.debug("metadata received from the server: %@".fmt(a.get("body")));
var d=a.get("body");var c={};if(!SC.none(this.get("fileMetadata"))){if(this.get("fileMetadata")[b]===undefined){var e=this.get("fileMetadata");
c=this.clone(e);c[b]=d;this.set("fileMetadata",c);Multivio.logger.info("New metadata added for "+b)
}}else{c[b]=d;this.set("fileMetadata",c);Multivio.logger.info("New metadata added for "+b)
}}else{Multivio.errorController.initialize(a.get("body"));Multivio.sendAction("errorOccured")
}},clone:function(a){if(typeof(a)!=="object"||a===null){return a}var c=a.constructor();
for(var b in a){if(a.hasOwnProperty(b)){c[b]=this.clone(a[b])}}return c},getFileMetadata:function(a){if(SC.none(a)){a=this.referer
}if(SC.none(this.get("fileMetadata"))||this.get("fileMetadata")[a]===undefined){var c=Multivio.configurator.getPath("baseUrlParameters.metadata");
c+=a;Multivio.requestHandler.sendGetRequest(c,this,"setFileMetadata",a);return -1
}else{var b=this.get("fileMetadata")[a];Multivio.logger.debug("metadata returned by cdm "+b);
return b}},setReferer:function(a){this.set("referer",a)},getReferer:function(){var a=this.get("referer");
return a},setLogicalStructure:function(a,b){if(SC.ok(a)){Multivio.logger.debug("logicalStructure received from the server: %@".fmt(a.get("body")));
var d=a.get("body");var c={};if(!SC.none(this.get("logicalStructure"))){if(this.get("logicalStructure")[b]===undefined){var e=this.get("logicalStructure");
c=this.clone(e);c[b]=d;this.set("logicalStructure",c);Multivio.logger.info("New logicalStructure added for "+b)
}}else{c[b]=d;this.set("logicalStructure",c);Multivio.logger.info("New logicalStructure added for "+b)
}}else{Multivio.errorController.initialize(a.get("body"));Multivio.sendAction("errorOccured")
}},getLogicalStructure:function(b){if(SC.none(this.get("logicalStructure"))||this.get("logicalStructure")[b]===undefined){var c=Multivio.configurator.getPath("baseUrlParameters.logicalStructure");
c+=b;Multivio.requestHandler.sendGetRequest(c,this,"setLogicalStructure",b);return -1
}else{var a=this.get("logicalStructure")[b];Multivio.logger.info("logicalStructure returned by cdm "+a);
return a}},setPhysicalStructure:function(a,b){if(SC.ok(a)){Multivio.logger.debug("physicalStructure received from the server: %@".fmt(a.get("body")));
var d=a.get("body");var c={};if(!SC.none(this.get("physicalStructure"))){if(this.get("physicalStructure")[b]===undefined){var e=this.get("physicalStructure");
c=this.clone(e);c[b]=d;this.set("physicalStructure",c);Multivio.logger.debug("New physicalStructure added for "+b)
}}else{c[b]=d;this.set("physicalStructure",c);Multivio.logger.debug("create and add physicalStructure for "+b)
}}else{Multivio.errorController.initialize(a.get("body"));Multivio.sendAction("errorOccured")
}},getPhysicalstructure:function(a){if(SC.none(this.get("physicalStructure"))||this.get("physicalStructure")[a]===undefined){var c=Multivio.configurator.getPath("baseUrlParameters.physicalStructure");
c+=a;Multivio.requestHandler.sendGetRequest(c,this,"setPhysicalStructure",a);return -1
}else{var b=this.get("physicalStructure")[a];Multivio.logger.debug("physicalStructure returned by cdm "+b);
return b}},getImageSize:function(a){if(SC.none(this.get("imageSize"))||this.get("imageSize")[a]===undefined){var c=Multivio.configurator.getPath("baseUrlParameters.imageSize");
c+=a;Multivio.requestHandler.sendGetRequest(c,this,"setImageSize",a);return -1}else{var b=this.get("imageSize")[a];
Multivio.logger.debug("imageSize returned by cdm "+b);return b}},setImageSize:function(a,b){if(SC.ok(a)){Multivio.logger.debug("imageSize received from the server: %@".fmt(a.get("body")));
var e=a.get("body");var c={};if(!SC.none(this.get("imageSize"))){if(this.get("imageSize")[b]===undefined){var d=this.get("imageSize");
c=this.clone(d);c[b]=e;this.set("imageSize",c);Multivio.logger.debug("New imageSize added for "+b)
}}else{c[b]=e;this.set("imageSize",c);Multivio.logger.debug("New imageSize added for "+b)
}}else{Multivio.errorController.initialize(a.get("body"));Multivio.makeFirstResponder(Multivio.ERROR)
}},getSearchResults:function(a,g,h,i,b,e,c){if(SC.none(this.get("searchResults"))||this.get("searchResults")[a]===undefined){var d=Multivio.configurator.getPath("baseUrlParameters.search");
d=d.fmt(g,h,i,b,e,c)+a;Multivio.requestHandler.sendGetRequest(d,this,"setSearchResults",a);
Multivio.logger.debug("request sent to server: "+d);return -1}else{var f=this.get("searchResults")[a];
Multivio.logger.debug("search results returned by cdm "+f);return f}},setSearchResults:function(a,b){if(SC.ok(a)){Multivio.logger.debug("search results received from the server: %@".fmt(a.get("body")));
var d=a.get("body");var c={};if(!SC.none(this.get("searchResults"))){var e=this.get("searchResults");
c=this.clone(e)}c[b]=d;this.set("searchResults",c);Multivio.logger.debug("New search results added for "+b)
}else{Multivio.errorController.initialize(a.get("body"));Multivio.makeFirstResponder(Multivio.ERROR)
}},getPageIndexing:function(b,d,f,e){var a=Multivio.configurator.getPath("baseUrlParameters.getPageIndexing");
a=a.fmt(d,f,e)+b;if(SC.none(this.get("pageIndexing"))||this.get("pageIndexing")[a]===undefined){Multivio.requestHandler.sendGetRequest(a,this,"setPageIndexing",a);
Multivio.logger.debug("page indexing: request sent to server: "+a);return -1}else{var c=this.get("pageIndexing")[a];
Multivio.logger.debug("page indexing returned by cdm "+c);return c}},setPageIndexing:function(a,b){if(SC.ok(a)){Multivio.logger.debug("page indexing received from the server: %@".fmt(a.get("body")));
var d=a.get("body");var c={};if(!SC.none(this.get("pageIndexing"))){var e=this.get("pageIndexing");
c=this.clone(e)}c[b]=d;this.set("pageIndexing",c);Multivio.logger.debug("New page indexing added for "+b)
}else{Multivio.errorController.initialize(a.get("body"));Multivio.makeFirstResponder(Multivio.ERROR)
}},getSelectedText:function(a,f,c,h,b,g,d){if(SC.none(this.get("selectedText"))||this.get("selectedText")[a]===undefined){var e=Multivio.configurator.getPath("baseUrlParameters.getText");
e=e.fmt(f,c,h,b,g,d)+a;Multivio.requestHandler.sendGetRequest(e,this,"setSelectedText",a,NO);
return -1}else{var i=this.get("selectedText")[a];Multivio.logger.debug("selectedText returned by cdm "+i);
return i}},setSelectedText:function(a,b){if(SC.ok(a)){Multivio.logger.debug("selected text received from the server: %@".fmt(a.get("body")));
var d=a.get("body");var c={};if(!SC.none(this.get("selectedText"))){var e=this.get("selectedText");
c=this.clone(e)}c[b]=d;this.set("selectedText",c);Multivio.logger.debug("New selected text added for "+b)
}else{Multivio.errorController.initialize(a.get("body"));Multivio.makeFirstResponder(Multivio.ERROR)
}}});Multivio.SearchTreeContent=SC.Object.extend({treeItemIsExpanded:undefined,labelWidth:undefined,position:undefined,treeItemChildren:function(){var e=[];
var g=this.childs;var d=this.label;var c=this.file_position;this.position=c.index;
if(!SC.none(this.position)){var h=Multivio.searchTreeController._treeLabelByPosition[this.position];
if(SC.none(h)){Multivio.searchTreeController._treeLabelByPosition[this.position]=[this]
}else{Multivio.searchTreeController._treeLabelByPosition[this.position]=h.concat(this)
}}if(!SC.none(this.id)){Multivio.searchTreeController._treeNodeById[this.id]=this
}this.labelWidth=d.length;if(SC.none(g)){this.treeItemIsExpanded=NO}else{this.treeItemIsExpanded=YES;
for(var f=0;f<g.length;f++){var b=this.childs[f];var a=Multivio.SearchTreeContent.create(b);
e.push(a)}}if(e.length===0){e=null}return e}.property().cacheable()});Multivio.TreeContent=SC.Object.extend({treeItemIsExpanded:undefined,labelWidth:undefined,position:undefined,nb_results:undefined,setSearchResultsNumber:function(a){this.set("nb_results",a)
},treeItemChildren:function(){var e=[];var g=this.childs;var d=this.label;var c=this.file_position;
this.position=c.index;if(!SC.none(this.position)){var h=Multivio.treeController._treeLabelByPosition[this.position];
if(SC.none(h)){Multivio.treeController._treeLabelByPosition[this.position]=[this]
}else{Multivio.treeController._treeLabelByPosition[this.position]=h.concat(this)}}this.labelWidth=d.length;
if(SC.none(g)){this.treeItemIsExpanded=NO}else{this.treeItemIsExpanded=YES;for(var f=0;
f<g.length;f++){var b=this.childs[f];var a=Multivio.TreeContent.create(b);e.push(a)
}}if(e.length===0){e=null}return e}.property().cacheable()});Multivio.requestHandler=SC.Object.create({listOfRequest:undefined,notAsked:function(a){if(SC.none(this.listOfRequest)){this.listOfRequest=SC.Set.create();
return YES}if(!this.listOfRequest.contains(a)){this.listOfRequest.add(a);return YES
}else{return NO}},sendGetRequest:function(f,b,c,g,d){var a=SC.none(d)?YES:d;if(!d||this.notAsked(f)){var h=Multivio.configurator.get("serverName");
var e=SC.Request.getUrl(h+f).json().notify(b,c,g);e.set("isJSON",YES);e.send()}}});
Multivio.ERROR=SC.Responder.create({didBecomeFirstResponder:function(){if(Multivio.waitingPane.get("isPaneAttached")){Multivio.layoutController._hideWaitingPage()
}if(Multivio.errorController.get("hasContent")){Multivio.layoutController._showErrorPage()
}else{Multivio.layoutController._showUsagePage()}}});Multivio.INIT=SC.Responder.create({didBecomeFirstResponder:function(){Multivio.logger.debug("Multivio entering state INIT");
Multivio.getPath("views.navigationInfo").showWaiting()},willLoseFirstResponder:function(){Multivio.logger.debug("Multivio leaving state INIT");
Multivio.getPath("views.navigationInfo").hideView()},notAllowSelection:function(){Multivio.treeController.allowSelection(NO)
},errorOccured:function(){var b=Multivio.errorController.get("content");var d=b.err_name;
var a=("_"+d).loc();if(a[0]==="_"){var c=Multivio.configurator.get("support");if(SC.none(c)){c="info@multivio.org"
}a="_Default".loc(c,c)}Multivio.usco.showAlertPaneError("_An error occurred".loc(),a);
Multivio.treeController.allowSelection(YES)},addComponent:function(a){Multivio.layoutController.addComponent(a)
}});Multivio.READY=SC.Responder.create({showLastPosition:NO,didBecomeFirstResponder:function(){Multivio.logger.debug("Multivio state is READY");
Multivio.treeController.allowSelection(YES);Multivio.getPath("views.mainContentView.content.innerMainContent").becomeFirstResponder()
},firstPosition:function(){if(!SC.none(Multivio.masterController.get("initialPosition"))){Multivio.masterController.selectAPosition()
}else{if(this.showLastPosition){Multivio.masterController.selectLastPosition();this.showLastPosition=NO
}else{Multivio.masterController.selectFirstPosition()}}},firstFile:function(){Multivio.makeFirstResponder(Multivio.INIT);
Multivio.sendAction("notAllowSelection");Multivio.masterController.selectFirstFile()
}});Multivio.WAITING=SC.Responder.create({didBecomeFirstResponder:function(){Multivio.logger.debug("Multivio entering state WAITING");
Multivio.layoutController._showWaitingPage()},willLoseFirstResponder:function(){Multivio.logger.debug("Multivio leaving state WAITING");
Multivio.layoutController._hideWaitingPage()},errorOccured:function(){Multivio.makeFirstResponder(Multivio.ERROR)
},fileMetadataDidChange:function(a){Multivio.layoutController._hideWaitingPage();
Multivio.layoutController.configureWorkspace("init");Multivio.metadataController.initialize(a);
Multivio.makeFirstResponder(Multivio.INIT)}});Multivio.usco=SC.Object.create({showAlertPaneError:function(c,b,a){var d=SC.AlertPane.error("%@".loc(c),"%@".loc(b),"","%@".loc(a),"","",this);
d.append()},showAlertPaneInfo:function(c,b,a){var d=SC.AlertPane.info("%@".loc(c),"%@".loc(b),"","%@".loc(a),"","",this);
d.append()},showAlertPaneInfoWithController:function(e,d,c,b,a){var f=SC.AlertPane.info("%@".loc(e),"%@".loc(d),"","%@".loc(c),"%@".loc(b),"",a);
f.append()},showAlertPaneWarn:function(e,d,c,b,a){var f=SC.AlertPane.warn("%@".loc(e),"%@".loc(d),"","%@".loc(c),"%@".loc(b),"",a);
f.append()},showAlertPanePlain:function(e,d,c,b,a){var f=SC.AlertPane.plain("%@".loc(e),"%@".loc(d),"","%@".loc(c),"%@".loc(b),"",a);
f.append()}});Multivio.mainPage=SC.Page.design({mainPane:SC.MainPane.design({defaultResponder:"Multivio",acceptsFirstResponder:YES,isKeyResponder:YES,keyDown:function(a){switch(a.which){case 33:case 34:this.sendEvent("keyEvent",a,Multivio.navigationController);
return YES;case 43:case 45:this.sendEvent("keyEvent",a,Multivio.zoomController);return YES;
default:return NO}}}).classNames("workspace_black")});Multivio.main=function main(){SC.ExceptionHandler.handleException=function(a){Multivio.errorController.initialize({err_name:"General Error",err_description:JSON.stringify(a)});
Multivio.makeFirstResponder(Multivio.ERROR)};Multivio.getPath("mainPage.mainPane").append();
SC.routes.add("*",Multivio.initializer,"readInputParameters")};function main(){Multivio.main()
};
