bundle.debug.js 980 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242
  1. /**
  2. * Licensed Materials - Property of IBM
  3. *
  4. * IBM Cognos Products: BI Glass
  5. *
  6. * Copyright IBM Corp. 2016, 2017
  7. *
  8. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  9. */
  10. define('baglass/api/ActionInterface',[], function () {
  11. 'use strict';
  12. /**
  13. * This class provides a means to declare a custom action controller for a button/menu item
  14. * It plays the role of an interface, consumer can implement it.
  15. *
  16. * @interface
  17. */
  18. var ActionInterface = function ActionInterface() {
  19. /**
  20. * Called when the custom button/menu item is Clicked/Tapped
  21. *
  22. * @public
  23. * @param {Context}
  24. */
  25. this.execute = function
  26. /* context */
  27. () {};
  28. /**
  29. * Optional:-
  30. * Implement this method if the widget being added is a menu item.
  31. * Determines based on the return value if the menu item should be visible or hidden.
  32. *
  33. * @public
  34. * @param {Context}
  35. * @return {Boolean} True - will show the menu item, False - will hide the menu item.
  36. */
  37. this.isVisible = function
  38. /* context */
  39. () {};
  40. };
  41. return ActionInterface;
  42. });
  43. //# sourceMappingURL=ActionInterface.js.map
  44. ;
  45. /**
  46. * Licensed Materials - Property of IBM
  47. * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2013, 2016
  48. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  49. */
  50. define('baglass/core-client/js/core-client/ui/core/Class',['underscore'], function (_) {
  51. 'use strict';
  52. /**
  53. * The Class implements the root of class hierarchy implementing the mechanism for
  54. * creating new derived classes and calling inherited methods.
  55. */
  56. // @class
  57. // @abstract
  58. var Class = function Class() {};
  59. function createConstructor() {
  60. return function () {
  61. if (typeof this.init === 'function') {
  62. this.init.apply(this, arguments);
  63. }
  64. };
  65. }
  66. // Create new widget class derived from the Class
  67. // @static
  68. // @param mixins [optional] An array of the mixin classes.
  69. // @param def The definition of the derived class, methods, member variables. The
  70. // special method 'init' is called at construction of the class instance.
  71. //
  72. Class.extend = function (mixins, def) {
  73. if (arguments.length === 1) {
  74. def = mixins;
  75. mixins = null;
  76. }
  77. var baseProto = this.prototype,
  78. parentProto = baseProto,
  79. proto = Object.create(parentProto);
  80. // create the constructor
  81. var ctor = createConstructor();
  82. // add the mixins
  83. if (mixins) {
  84. for (var i = 0, len = mixins.length; i < len; ++i) {
  85. proto = _.extend(proto, mixins[i].prototype);
  86. }
  87. parentProto = proto;
  88. proto = Object.create(proto);
  89. if (typeof def.init !== 'function') {
  90. // generate default init method for multi-class inheritance
  91. def.init = function () {
  92. ctor.inherited('init', this, arguments);
  93. };
  94. }
  95. }
  96. _.extend(proto, def);
  97. ctor.prototype = proto;
  98. // static method to allow for further extension
  99. ctor.extend = this.extend;
  100. // calling the inherited methods
  101. ctor.inherited = function (name, that, args) {
  102. if (name === 'init') {
  103. // the 'init' method has a special case of calling inherited implementation
  104. // it should call all the 'init' methods from the base class and mixins
  105. if (typeof baseProto[name] === 'function') {
  106. baseProto[name].apply(that, args);
  107. }
  108. _.each(mixins, function (m) {
  109. if (typeof m.prototype[name] === 'function') {
  110. m.prototype[name].apply(that, args);
  111. }
  112. });
  113. } else if (typeof parentProto[name] === 'function') {
  114. return parentProto[name].apply(that, args);
  115. }
  116. };
  117. return ctor;
  118. };
  119. return Class;
  120. });
  121. //# sourceMappingURL=Class.js.map
  122. ;
  123. /**
  124. * Licensed Materials - Property of IBM
  125. * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2013, 2016
  126. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  127. *
  128. * @module /dashboard/data/Events
  129. * @see Events
  130. */
  131. define('baglass/core-client/js/core-client/ui/core/Events',['./Class'], function (Class) {
  132. 'use strict';
  133. /**
  134. * Events implements the Backbone-style eventing model objects
  135. *
  136. * @class Events
  137. */
  138. var Events = Class.extend({
  139. init: function init() {
  140. this._events = {};
  141. },
  142. /**
  143. * The 'on' method registers the handler and return DOJO-style event registration object with 'remove' method, which unregisters the handler.
  144. *
  145. * This implementation supports composite event names, such as 'eventBaseName:eventSecondaryName', for example: 'change:name'. Triggering 'change:name' event would invoke handlers registered to
  146. * listen 'change' event as well as the handlers registered to listen the 'change:name' event. The special event name 'all' can be used to listen to all event types.
  147. */
  148. on: function on(eventName, handler, context) {
  149. if (typeof handler !== 'function') {
  150. console.log('ERROR in Events.on: Invalid event handler');
  151. }
  152. if (!this._events[eventName]) {
  153. this._events[eventName] = [];
  154. }
  155. this._events[eventName].push({
  156. handler: handler,
  157. context: context
  158. });
  159. var that = this;
  160. return {
  161. remove: function remove() {
  162. that.off(eventName, handler, context);
  163. }
  164. };
  165. },
  166. /**
  167. * Removes the specified handler from the listening to the events on this object. If eventName is not specified then unregister handler and context for all event types. If handler is not specified
  168. * then unregister all event handlers for the specified context and event name. If context is not specified then unregister all event handlers for the specified handler and event name.
  169. *
  170. * Examples: obj.off('change:name', handler, context); // unregister handler in context from listening 'change:name' event obj.off(null, null, context); // unregister all event handlers for the
  171. * specified context obj.off(); // unregister all event handlers
  172. */
  173. off: function off(eventName, handler, context) {
  174. var getEvents = function getEvents(evName, self) {
  175. var events = self._events;
  176. if (!evName) {
  177. return events;
  178. }
  179. var parts = evName.split(':');
  180. events = {};
  181. events[parts[0]] = self._events[parts[0]];
  182. if (parts.length > 1 && parts[1] !== '*') {
  183. events[evName] = self._events[evName];
  184. } else if (parts.length > 1 && parts[1] === '*') {
  185. for (var name in self._events) {
  186. if (name.indexOf(parts[0] + ':') === 0) {
  187. events[name] = self._events[name];
  188. }
  189. }
  190. }
  191. return events;
  192. };
  193. var events = getEvents(eventName, this);
  194. for (var name in events) {
  195. var i = 0,
  196. handlers = events[name];
  197. if (!handlers) {
  198. continue;
  199. }
  200. while (i < handlers.length) {
  201. if ((handlers[i].handler === handler || !handler) && (handlers[i].context === context || !context)) {
  202. handlers.splice(i, 1);
  203. } else {
  204. i++;
  205. }
  206. }
  207. }
  208. },
  209. /**
  210. * Triggers an event
  211. */
  212. trigger: function trigger(eventName, event) {
  213. var parts = eventName.split(':');
  214. var handlers = [].concat(this._events['all'] || []).concat(this._events[parts[0]] || []);
  215. if (parts.length > 1) {
  216. handlers = handlers.concat(this._events[eventName] || []);
  217. }
  218. for (var i = 0; i < handlers.length; i++) {
  219. if (typeof handlers[i].handler === 'function') {
  220. handlers[i].handler.call(handlers[i].context, event, eventName);
  221. }
  222. }
  223. }
  224. });
  225. // alias
  226. Events.prototype.emit = Events.prototype.trigger;
  227. //
  228. return Events;
  229. });
  230. //# sourceMappingURL=Events.js.map
  231. ;
  232. /**
  233. * Licensed Materials - Property of IBM
  234. * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2012, 2019
  235. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  236. *
  237. * borrowed from cclcore.
  238. * Common bidi javascript library - BidiUtils.
  239. * Singleton containing useable bidi methods.
  240. */
  241. /**
  242. * This module contains a subset of BidiUtils from cclcore with some
  243. * modifications to meet gemini's requirements for BiDi text. Elements passed
  244. * in to the methods of this module is expected to contain only a single text
  245. * node such as <div contenteditable> or <input> elements
  246. */
  247. define('baglass/core-client/js/core-client/utils/BidiUtil',[], function () {
  248. 'use strict';
  249. var AUTO = 'auto',
  250. arabicLocales = {
  251. 'General Info': {
  252. 'Generated from': 'CLDR Version: 30.0.3',
  253. 'Generated by': 'BDL CLDR Reader Tool',
  254. 'Date': '16-03-17 12:40:12'
  255. },
  256. 'Arabic Default Numbering Systems': {
  257. 'ar': 'arab',
  258. 'ar_AE': 'arab',
  259. 'ar_BH': 'arab',
  260. 'ar_DJ': 'arab',
  261. 'ar_DZ': 'latn',
  262. 'ar_EG': 'arab',
  263. 'ar_EH': 'latn',
  264. 'ar_ER': 'arab',
  265. 'ar_IL': 'arab',
  266. 'ar_IQ': 'arab',
  267. 'ar_JO': 'arab',
  268. 'ar_KM': 'arab',
  269. 'ar_KW': 'arab',
  270. 'ar_LB': 'arab',
  271. 'ar_LY': 'latn',
  272. 'ar_MA': 'latn',
  273. 'ar_MR': 'arab',
  274. 'ar_OM': 'arab',
  275. 'ar_PS': 'arab',
  276. 'ar_QA': 'arab',
  277. 'ar_SA': 'arab',
  278. 'ar_SD': 'arab',
  279. 'ar_SO': 'arab',
  280. 'ar_SS': 'arab',
  281. 'ar_SY': 'arab',
  282. 'ar_TD': 'arab',
  283. 'ar_TN': 'latn',
  284. 'ar_YE': 'arab'
  285. }
  286. },
  287. cldrData = arabicLocales['Arabic Default Numbering Systems'];
  288. var BidiUtil = function BidiUtil() {
  289. this._isIE = this._detectIE(navigator.userAgent);
  290. this.userPreferredTextDir = this._getUserPreferredTextDir() || AUTO;
  291. this.LRE = '\u202A';
  292. this.RLE = '\u202B';
  293. this.PDF = '\u202C';
  294. this.LRM = '\u200E';
  295. };
  296. BidiUtil.prototype._detectIE = function (useragent) {
  297. return (/\b(MSIE|Trident|Edge)\b/.test(useragent)
  298. );
  299. };
  300. // Private Methods
  301. // Should not need to call these methods outside this module. Although real
  302. // encapsulation is possible, defining as part of BidiUtil's prototype allows
  303. // unit testing and faster scope chain access from public methods
  304. /**
  305. * Gets the user's preferred text direction from <html> attribute passed in
  306. * from server-side and stores it as member of this singleton as userPreferredTextDir
  307. * @return {string} User's preferred text direction (i.e. ltr, rtl, auto)
  308. */
  309. BidiUtil.prototype._getUserPreferredTextDir = function () {
  310. if (!this.userPreferredTextDir) {
  311. this.userPreferredTextDir = document.documentElement.getAttribute('data-pref-text-dir');
  312. }
  313. return this.userPreferredTextDir;
  314. };
  315. /**
  316. * Normalizes the process of retrieving the value from <input> or <div contenteditable>
  317. * HTML elements
  318. * @param {Element|HTMLInputElement} element - DOM element receiving text input
  319. * @return {string} String value of the DOM element
  320. */
  321. BidiUtil.prototype._getNodeValue = function (element) {
  322. return element.value || element.tagName === 'INPUT' ? element.value : element.textContent;
  323. };
  324. /**
  325. * Normalizes the process of setting the value to <input> or <div contenteditable>
  326. * HTML elements
  327. * @param {Element|HTMLInputElement} element - DOM element receiving text input
  328. * @param {string} value - String value to be set to element
  329. */
  330. BidiUtil.prototype._setNodeValue = function (element, value) {
  331. if (element.value || element.tagName === 'INPUT') {
  332. element.value = value;
  333. } else {
  334. // setting the textContent removes any text of its child nodes
  335. element.textContent = value;
  336. }
  337. };
  338. /**
  339. * Checks if the character passed in is an Arabic character.
  340. * @param {string} charCode - Character code
  341. * @return {boolean} True, if character is an Arabic character
  342. */
  343. BidiUtil.prototype._isArabicChar = function (charCode) {
  344. if (charCode >= 0x0600 && charCode <= 0x0669 || charCode >= 0x06fa && charCode <= 0x07ff || charCode >= 0xfb50 && charCode <= 0xfdff || charCode >= 0xfe70 && charCode <= 0xfefc) {
  345. return true;
  346. }
  347. return false;
  348. };
  349. /**
  350. * Checks if the character passed in is a Hebrew character.
  351. * @param {string} charCode - Character code
  352. * @return {boolean} True, if character is a Hebrew character
  353. */
  354. BidiUtil.prototype._isHebrewChar = function (charCode) {
  355. if (charCode >= 0x05d0 && charCode <= 0x05ff) {
  356. return true;
  357. }
  358. return false;
  359. };
  360. /**
  361. * Checks if the character passed in is a BiDi character.
  362. * @param {number} charCode - Chracter code
  363. * @return {boolean} True, if the character is a BiDi (Arabic or Hebrew) character
  364. */
  365. BidiUtil.prototype._isBidiChar = function (charCode) {
  366. return this._isArabicChar(charCode) || this._isHebrewChar(charCode);
  367. };
  368. /**
  369. * Checks if the character passed in is a Latin character (Only treats
  370. * capital and lower case alphabets as latin characters)
  371. * @param {number} charCode - Character code
  372. * @return {boolean} True, if the character is a Latin character
  373. */
  374. BidiUtil.prototype._isLatinChar = function (charCode) {
  375. if (charCode > 64 && charCode < 91 || charCode > 96 && charCode < 123) {
  376. return true;
  377. }
  378. return false;
  379. };
  380. /**
  381. * Event handler for 'input' event (events causing the value of the target
  382. * element to change)
  383. * Resolves the base text direction and sets the dir attribute
  384. * @param {Event} event - DOM Event object
  385. */
  386. BidiUtil.prototype._handleInputEvent = function (event) {
  387. // NOTE: 'this' has been binded to be BidiUtil in _addBidiEventListeners function
  388. this._resolveDirAttr(event.target);
  389. };
  390. /**
  391. * Adds event listeners for events changing the value of the element being passed in
  392. * @param {Element|HTMLInputElement} element - DOM element receiving text input
  393. */
  394. BidiUtil.prototype._addBidiEventListeners = function (element) {
  395. if (!element._hasBidiEventListeners) {
  396. element._hasBidiEventListeners = true;
  397. var eventTypes = ['keyup', 'cut', 'paste'];
  398. for (var i = 0; i < eventTypes.length; ++i) {
  399. element.addEventListener(eventTypes[i], this._handleInputEvent.bind(this), false);
  400. }
  401. }
  402. };
  403. /**
  404. * Sets dir attribute of the DOM element passed in as parameter according to
  405. * the direction of the first strong character in the text content of the element
  406. * @param {Element|HTMLInputElement} element - DOM element receiving text input
  407. */
  408. BidiUtil.prototype._resolveDirAttr = function (element) {
  409. if (this._isIE && (this.userPreferredTextDir === AUTO || !this.userPreferredTextDir)) {
  410. // IE doesn't support dir="auto" HTML attribute
  411. var text = this._getNodeValue(element);
  412. element.dir = this.resolveBaseTextDir(text);
  413. } else {
  414. // Chrome, Safari, and Firefox supports dir="auto" HTML attribute
  415. // IE will only receive "ltr" or "rtl" in this block
  416. element.dir = this.userPreferredTextDir || AUTO;
  417. }
  418. };
  419. /**
  420. * This function determines the positions where we should insert the LRM marker for correct display
  421. * of Structured Text Value
  422. * @param str
  423. * @param isLocation
  424. * @returns array
  425. */
  426. BidiUtil.prototype._parseSTT = function (str, isLocation) {
  427. var delimiter = isLocation ? '>' : ':/@=[]\'<>';
  428. var segmentsPointers = [];
  429. var sp_len = 0,
  430. i;
  431. for (i = 0; i < str.length; i++) {
  432. if (delimiter.indexOf(str.charAt(i)) >= 0) {
  433. segmentsPointers[sp_len] = i;
  434. sp_len++;
  435. }
  436. }
  437. return segmentsPointers;
  438. };
  439. // Public Methods
  440. /**
  441. * Simply resolves the dir attribute of the HTML element and adds BiDi specific
  442. * event handlers if necessary
  443. * @param {Element|HTMLInputElement} element - DOM element receiving text input
  444. */
  445. BidiUtil.prototype.initElementForBidi = function (element) {
  446. if (element) {
  447. this._resolveDirAttr(element); // resolve dir attribute of the element
  448. if (this._isIE) {
  449. this._addBidiEventListeners(element);
  450. }
  451. }
  452. };
  453. /**
  454. * Enforces text direction by adding UCC (Unicode Control Characters)
  455. * @param {String} text - The text for which we should enforce text direction.
  456. * @returns string
  457. */
  458. BidiUtil.prototype.enforceTextDirection = function (text) {
  459. if (text) {
  460. var finalDir = this.resolveBaseTextDir(text);
  461. var finalValue = text;
  462. if (finalDir === 'ltr') {
  463. finalValue = this.LRE + finalValue + this.PDF;
  464. } else if (finalDir === 'rtl') {
  465. finalValue = this.RLE + finalValue + this.PDF;
  466. }
  467. return finalValue;
  468. }
  469. return text;
  470. };
  471. /**
  472. * Traverses the string passed in as parameter from the beginning and
  473. * determines the direction of the text based on the first strong character
  474. * @param {string} text - A bi-directional text
  475. * @param {bool} isTextArea - Does the text belong to a textarea
  476. * @return {string} Direction of the text
  477. */
  478. BidiUtil.prototype.resolveBaseTextDir = function (text, isTextArea) {
  479. var textDir = this.userPreferredTextDir;
  480. if (!textDir) {
  481. textDir = AUTO;
  482. }
  483. if (textDir === AUTO && (!isTextArea || this._isIE)) {
  484. for (var i = 0; text && i < text.length; i++) {
  485. var character = text.charCodeAt(i);
  486. if (this._isBidiChar(character)) {
  487. textDir = 'rtl';
  488. break;
  489. } else if (this._isLatinChar(character)) {
  490. textDir = 'ltr';
  491. break;
  492. }
  493. }
  494. if (this._isIE && textDir === AUTO) {
  495. textDir = '';
  496. }
  497. }
  498. return textDir;
  499. };
  500. /**
  501. * Enforces text direction for Structured Text value by adding UCC (Unicode Control Characters)
  502. * We should add an LRM before each segment and also we should enforce text direction of each segment
  503. * @param {String} text - The text for which we should enforce text direction.
  504. * @returns string
  505. */
  506. BidiUtil.prototype.enforceTextDirectionForSTT = function (text) {
  507. if (text) {
  508. text = this.removeMarkers(text);
  509. var isLocation = (text.match(/ > /g) || []).length > 0;
  510. var segmentsPointers = this._parseSTT(text, isLocation);
  511. var result = '';
  512. var n;
  513. var marker = this.LRM;
  514. var offset = isLocation ? 1 : 0;
  515. if (segmentsPointers.length === 0) {
  516. result = this.enforceTextDirection(text);
  517. } else {
  518. result = this.enforceTextDirection(text.substring(0, segmentsPointers[0] - offset));
  519. }
  520. for (var i = 0; i < segmentsPointers.length; i++) {
  521. n = segmentsPointers[i];
  522. if (n) {
  523. var endIndex = i < segmentsPointers.length - 1 ? segmentsPointers[i + 1] - offset : text.length;
  524. var segment = text.substring(n + 1 + offset, endIndex);
  525. result = result + marker + text.substring(n - offset, n + offset + 1) + this.enforceTextDirection(segment);
  526. }
  527. }
  528. return result;
  529. }
  530. return text;
  531. };
  532. /**
  533. * Enforces text direction for Structured Text value by adding UCC (Unicode Control Characters)
  534. * We should add an LRM before each segment and also we should enforce text direction of each segment
  535. * @param {String} text - The text for which we should enforce text direction.
  536. * @returns string
  537. */
  538. BidiUtil.prototype.enforceTextDirectionForLocation = function (text) {
  539. return this.enforceTextDirectionForSTT(text);
  540. };
  541. /**
  542. * Removes all the markers from the text
  543. * @param {String} text - The text
  544. * @returns string
  545. */
  546. BidiUtil.prototype.removeMarkers = function (text) {
  547. return text.replace(/[\u202A\u202B\u202C\u200E]/g, '');
  548. };
  549. BidiUtil.prototype._isArabicLocale = function (locale) {
  550. return locale.match(/^ar[-_].*$/i);
  551. };
  552. BidiUtil.prototype._useLatinNums = function (locale) {
  553. if (!this._isArabicLocale(locale)) {
  554. return true;
  555. }
  556. return cldrData[locale] && cldrData[locale] === 'latn';
  557. };
  558. /**
  559. * Enforces numeric shaping for the given string
  560. * @param {Object} text to be wrapped. Can be number or string object.
  561. * @param {bool} isContextual. Should enforce contextual numeric shaping.
  562. * @returns {string}
  563. */
  564. BidiUtil.prototype.enforceNumericShaping = function (text, isContextual) {
  565. if (this.bidiSupport && this.userPreferredContentLocale.startsWith('ar') && (typeof text === 'number' || typeof text === 'string')) {
  566. var segmentDir = this.userPreferredTextDir;
  567. if (this.userPreferredTextDir === AUTO) {
  568. segmentDir = this.resolveBaseTextDir(text);
  569. }
  570. var locale = typeof navigator === 'undefined' ? '' : navigator.language || navigator.userLanguage || '';
  571. locale = locale.replace('-', '_');
  572. var finalText = text;
  573. if (typeof text === 'number') {
  574. finalText = text.toString();
  575. }
  576. var pattern = /([0-9])|([\u0660-\u0669])|([\u0590-\u05FF\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5-\u06E6\u06EE-\u06EF\u06FA-\u06FF\u0750-\u077F\u08A0-\u08E3\u200F\u202B\u202E\u2067\uFB50-\uFD3D\uFD40-\uFDCF\uFDF0-\uFDFC\uFDFE-\uFDFF\uFE70-\uFEFE]+)|([^0-9\u0590-\u05FF\u0660-\u0669\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5-\u06E6\u06EE-\u06EF\u06FA-\u06FF\u0750-\u077F\u08A0-\u08E3\u200F\u202B\u202E\u2067\uFB50-\uFD3D\uFD40-\uFDCF\uFDF0-\uFDFC\uFDFE-\uFDFF\uFE70-\uFEFE\u0600-\u0607\u0609-\u060A\u060C\u060E-\u061A\u064B-\u066C\u0670\u06D6-\u06E4\u06E7-\u06ED\u06F0-\u06F9\u08E4-\u08FF\uFD3E-\uFD3F\uFDD0-\uFDEF\uFDFD\uFEFF\u0000-\u0040\u005B-\u0060\u007B-\u007F\u0080-\u00A9\u00AB-\u00B4\u00B6-\u00B9\u00BB-\u00BF\u00D7\u00F7\u02B9-\u02BA\u02C2-\u02CF\u02D2-\u02DF\u02E5-\u02ED\u02EF-\u02FF\u2070\u2074-\u207E\u2080-\u208E\u2100-\u2101\u2103-\u2106\u2108-\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A-\u213B\u2140-\u2144\u214A-\u214D\u2150-\u215F\u2189\uA720-\uA721\uA788\uFF01-\uFF20\uFF3B-\uFF40\uFF5B-\uFF65\uFFE0-\uFFE6\uFFE8-\uFFEE]+)/g; // eslint-disable-line no-control-regex
  577. var self = this;
  578. return finalText.replace(pattern, function (curChs, latNum, araNum, rtlChs, ltrChs) {
  579. if (araNum) {
  580. if (isContextual && segmentDir === 'ltr' || !isContextual && self._useLatinNums(locale)) {
  581. return araNum.charCodeAt(0) - 1632;
  582. } else {
  583. return araNum;
  584. }
  585. } else if (latNum) {
  586. if (isContextual && segmentDir === 'rtl' || !isContextual && !self._useLatinNums(locale)) {
  587. return String.fromCharCode(parseInt(latNum) + 1632);
  588. } else {
  589. return latNum;
  590. }
  591. } else if (rtlChs) {
  592. segmentDir = 'rtl';
  593. } else if (ltrChs) {
  594. segmentDir = 'ltr';
  595. }
  596. return curChs;
  597. });
  598. }
  599. return text;
  600. };
  601. /**
  602. * Sets the text dir user preference
  603. * @param {String} textDir - The text direction user preference.
  604. * @param {String} bidiSupport - Is Bidi support enabled ?
  605. */
  606. BidiUtil.prototype.setUserPreferredTextDir = function (textDir, bidiSupport) {
  607. this.userPreferredTextDir = '';
  608. this.bidiSupport = false;
  609. if (bidiSupport === 'true') {
  610. this.userPreferredTextDir = textDir.toLowerCase();
  611. this.bidiSupport = true;
  612. }
  613. };
  614. /**
  615. * Sets the content locale user preference
  616. * @param {String} contentLocale - The content locale user preference.
  617. */
  618. BidiUtil.prototype.setUserPreferredContentLocale = function (contentLocale) {
  619. this.userPreferredContentLocale = contentLocale;
  620. };
  621. return new BidiUtil();
  622. });
  623. //# sourceMappingURL=BidiUtil.js.map
  624. //# sourceMappingURL=BidiUtil.js.map
  625. ;
  626. /**
  627. * Licensed Materials - Property of IBM
  628. * IBM Cognos Products: BI
  629. * (C) Copyright IBM Corp. 2014, 2017
  630. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule
  631. * Contract with IBM Corp.
  632. */
  633. define('baglass/core-client/js/core-client/utils/dom-utils',[], function () {
  634. 'use strict';
  635. return {
  636. getAncestorOfClass: function getAncestorOfClass(node, className) {
  637. var doc = document;
  638. while (node && node !== doc) {
  639. if (node.className.split(' ').indexOf(className) >= 0) {
  640. return node;
  641. }
  642. node = node.parentNode;
  643. }
  644. return null;
  645. },
  646. isTouchEvent: function isTouchEvent(ev) {
  647. return ev.type.indexOf('touch') === 0;
  648. },
  649. isPointerTouch: function isPointerTouch(ev) {
  650. return ev.gesture && ev.gesture.pointerType === 'touch';
  651. },
  652. isMultiTouchEvent: function isMultiTouchEvent(ev) {
  653. var oev = ev.originalEvent || ev;
  654. if (oev && oev.touches && oev.touches.length > 1) {
  655. return true;
  656. }
  657. return false;
  658. },
  659. isGesture: function isGesture(ev) {
  660. if (ev.gesture && ev.gesture.touches && ev.gesture.touches.length > 0) {
  661. return true;
  662. }
  663. return false;
  664. },
  665. getEventPos: function getEventPos(ev) {
  666. var pageValuesValid = function pageValuesValid(event) {
  667. return event && (event.pageX || event.pageX === 0) && (event.pageY || event.pageY === 0);
  668. };
  669. var pos;
  670. if (this.isGesture(ev)) {
  671. var touches = ev.gesture.touches[0];
  672. if (pageValuesValid(touches)) {
  673. pos = {
  674. pageX: touches.pageX,
  675. pageY: touches.pageY
  676. };
  677. }
  678. }
  679. if (!pos && this.isTouchEvent(ev)) {
  680. var oev = ev.originalEvent || ev;
  681. if (oev && oev.touches.length > 0 && pageValuesValid(oev.touches[0])) {
  682. pos = { pageX: oev.touches[0].pageX, pageY: oev.touches[0].pageY };
  683. }
  684. }
  685. if (!pos && pageValuesValid(ev)) {
  686. pos = { pageX: ev.pageX, pageY: ev.pageY };
  687. }
  688. if (!pos && pageValuesValid(ev.originalEvent)) {
  689. pos = { pageX: ev.originalEvent.pageX, pageY: ev.originalEvent.pageY };
  690. }
  691. if (!pos) {
  692. // could not find any valid numbers so return zero. Returning undefined values breaks some other code.
  693. pos = { pageX: 0, pageY: 0 };
  694. }
  695. return pos;
  696. },
  697. getEventTarget: function getEventTarget(ev) {
  698. if (this.isTouchEvent(ev)) {
  699. var oev = ev.originalEvent || ev;
  700. if (oev && oev.touches.length > 0) {
  701. return oev.touches[0].target;
  702. }
  703. }
  704. return ev.target;
  705. },
  706. withinElementBoundaries: function withinElementBoundaries(event, node) {
  707. var pos = this.getEventPos(event);
  708. var boundingRect = node.getBoundingClientRect();
  709. var inXRange = pos.pageX >= boundingRect.left && pos.pageX <= boundingRect.right;
  710. var inYRange = pos.pageY >= boundingRect.top && pos.pageY <= boundingRect.bottom;
  711. return inXRange && inYRange;
  712. }
  713. };
  714. });
  715. //# sourceMappingURL=dom-utils.js.map
  716. ;
  717. /**
  718. * Licensed Materials - Property of IBM
  719. * IBM Cognos Products: BI
  720. * (C) Copyright IBM Corp. 2014, 2016
  721. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  722. *
  723. * Drag-and-Drop Manager
  724. */
  725. define('baglass/core-client/js/core-client/utils/dnd/DnDManager',['jquery', 'underscore', '../../ui/core/Class', '../dom-utils'], function ($, _, Class, utils) {
  726. 'use strict';
  727. var DnDManager = null;
  728. DnDManager = Class.extend({
  729. dropTargets: null,
  730. currentDropTarget: null,
  731. init: function init() {
  732. this.dropTargets = [];
  733. this.currentDropTarget = {};
  734. // Add the dialog blocker as a default drop zone to swallow and ignore any drop that happens on the backdrop
  735. this.addDropTarget($('body')[0], '.dialogBlocker', {
  736. accepts: function accepts() {
  737. return true;
  738. }
  739. });
  740. },
  741. // Utility method that subscribes to the specified jQuery event
  742. // and returns removable object, that can be inserted into the 'owned' collections
  743. // of subscriptions
  744. //
  745. on: function on($el, types, selector, data, fn) {
  746. $el.on(types, selector, data, fn);
  747. return {
  748. remove: function remove() {
  749. $el.off(types, selector, fn);
  750. }
  751. };
  752. },
  753. /**
  754. * Register a drop Zone with the drag and drop manage
  755. *
  756. *
  757. * @param el - The drop zone element.
  758. * @param selector - Selector to identify the drop zone sub regions. If not specified, there will only be one region which is the drop zone element.
  759. * @param callbacks
  760. * callbacks.accepts(dragObject) - Called to check if the dropzone accepts the payload.
  761. * callbacks.onDragStart() - Called when a drag starts
  762. * callbacks.onDragEnd() - Called when a drag ends
  763. * callbacks.onDragEnter(dragObject, dropNode) - Called when we enter a drop zone
  764. * callbacks.onDragMove(dragObject, dropNode) - Called when we move inside a drop zone
  765. * callbacks.onDragLeave(dragObject, dropNode) - Called when we leave a drop zone
  766. * callbacks.onDrop(dragObject, dropNode) - Called when a drop occurs.
  767. * @returns {___anonymous1282_1365}
  768. */
  769. addDropTarget: function addDropTarget(el, selector, callbacks) {
  770. if (typeof selector !== 'string') {
  771. callbacks = selector;
  772. selector = null;
  773. }
  774. this.removeDropTarget(el);
  775. this.dropTargets.push({
  776. el: el,
  777. selector: selector,
  778. callbacks: callbacks
  779. });
  780. return {
  781. remove: function () {
  782. this.removeDropTarget(el);
  783. }.bind(this)
  784. };
  785. },
  786. /**
  787. * Remove a registered drop target
  788. * @param el
  789. */
  790. removeDropTarget: function removeDropTarget(el) {
  791. var target = _.find(this.dropTargets, function (t) {
  792. return t.el === el;
  793. });
  794. if (target) {
  795. this.dropTargets.splice(_.indexOf(this.dropTargets, target), 1);
  796. }
  797. },
  798. _isScrollDropSupported: function _isScrollDropSupported() {
  799. return this.currentDropTarget.target && this.currentDropTarget.target.callbacks.isScrollDropSupported ? true : false;
  800. },
  801. /**
  802. *
  803. * Check if the intention is scrolling and return the proper scrolling enabled drop zone.
  804. * If we are dragging outside of the view port, the intention is to auto scroll. In this case we do the following:
  805. * - if we have a drop zone, find the closest scrollable drop zone in the ancestors.
  806. * - if there is no drop zone, select the last scrollable drop zone that was used.
  807. *
  808. * If we are dragging within the view and we have no drop zone, find the closest scrolling drop zone using the last drop target that was used.
  809. * @param target
  810. * @param isScrollDropSupported
  811. * @param pos - current mouse position
  812. *
  813. * @returns the target or empty object.
  814. */
  815. _validateDropTarget: function _validateDropTarget(target, isScrollDropSupported, pos) {
  816. var foundTarget = target;
  817. if (isScrollDropSupported) {
  818. if (pos.x + 1 >= $(window).innerWidth() || pos.y + 1 >= $(window).height() || pos.x <= 1 || pos.y <= 1) {
  819. // dragging outside of the viewport.. most likely the intent is to auto scroll a drop zone
  820. if (foundTarget) {
  821. foundTarget = this._getClosestTargetWithScrollSupport(foundTarget.node);
  822. } else {
  823. foundTarget = this.lastActiveScrollableTarget;
  824. }
  825. }
  826. if (!foundTarget && this.currentDropTarget) {
  827. foundTarget = this._getClosestTargetWithScrollSupport(this.currentDropTarget.node);
  828. }
  829. }
  830. return foundTarget || {};
  831. },
  832. /**
  833. * Scan the list containing the ancestors + self and return the first drop zone that suppports scrolling.
  834. *
  835. * @param dropTargetNode - the node of the drop target where to start the search
  836. *
  837. */
  838. _getClosestTargetWithScrollSupport: function _getClosestTargetWithScrollSupport(dropTargetNode) {
  839. var parentsAndSelf = $(dropTargetNode).parents();
  840. parentsAndSelf.splice(0, 0, dropTargetNode);
  841. var target = null;
  842. for (var i = 0; i < parentsAndSelf.length; i++) {
  843. target = this._getDropTargetWithScrollSupport(parentsAndSelf[i]);
  844. if (target) {
  845. this.lastActiveScrollableTarget = target;
  846. break;
  847. }
  848. }
  849. return target;
  850. },
  851. /**
  852. * Find the drop zone that support scrolling where the node match the given node parameter
  853. *
  854. * @param targetNode - node to match with the drop zone node.
  855. *
  856. */
  857. _getDropTargetWithScrollSupport: function _getDropTargetWithScrollSupport(targetNode) {
  858. var foundTarget = null;
  859. var dropTarget = _.find(this.dropTargets, function (target) {
  860. var $elements = $(target.el);
  861. if (target.selector) {
  862. $elements = $elements.find(target.selector);
  863. }
  864. return _.find($elements, function (node) {
  865. return node === targetNode && target.callbacks.isScrollDropSupported && (!target.callbacks.accepts || target.callbacks.accepts(this.dragObject));
  866. }.bind(this));
  867. }.bind(this));
  868. if (dropTarget) {
  869. foundTarget = {
  870. target: dropTarget,
  871. node: targetNode
  872. };
  873. }
  874. return foundTarget;
  875. },
  876. /**
  877. * Helper method that gets the current drop target from a position
  878. * @param pos
  879. * @param options -- options passed by the called when the startDrag method is called
  880. * @returns {Object} - drop target
  881. */
  882. getDropTargetFromPos: function getDropTargetFromPos(pos, options) {
  883. var isScrollDropSupported = options && !options.disableScrollableDropZoneSupport;
  884. var foundTarget = null;
  885. var foundTargetArea = 0;
  886. var foundTargetPriority = 0;
  887. var nonActiveDropZones = [];
  888. _.each(this.dropTargets, function (target) {
  889. var $elements = $(target.el);
  890. if (target.selector) {
  891. $elements = $elements.find(target.selector);
  892. }
  893. _.each($elements, function (node) {
  894. var info = this.getTargetMatchInformation(pos, node, target, foundTarget, foundTargetArea, foundTargetPriority);
  895. if (info.isMatch) {
  896. if (!target.callbacks.accepts || target.callbacks.accepts(this.dragObject)) {
  897. foundTarget = {
  898. target: target,
  899. node: node
  900. };
  901. foundTargetArea = info.area;
  902. foundTargetPriority = info.priority;
  903. } else if (target.callbacks.receiveEventsWhenNotAccepting) {
  904. nonActiveDropZones.push({
  905. target: target,
  906. node: node
  907. });
  908. }
  909. }
  910. }.bind(this));
  911. }.bind(this));
  912. foundTarget = this._validateDropTarget(foundTarget, isScrollDropSupported, pos);
  913. if (foundTarget) {
  914. foundTarget.nonActiveDropZones = nonActiveDropZones;
  915. }
  916. return foundTarget || {};
  917. },
  918. /**
  919. * Return true if val is between lowerBound and (lowerBound + rangeSize).
  920. */
  921. _isInRange: function _isInRange(val, lowerBound, rangeSize) {
  922. return val >= lowerBound && val < lowerBound + rangeSize;
  923. },
  924. /**
  925. * return the priority set for target or 0.
  926. */
  927. _getPriority: function _getPriority(target) {
  928. var priority = target.callbacks.priority;
  929. if (typeof priority === 'function') {
  930. priority = priority();
  931. }
  932. return priority || 0;
  933. },
  934. /**
  935. * Helper function used by getDropTargetFromPos to decide if a drop target is found or not using the current mouse position
  936. */
  937. getTargetMatchInformation: function getTargetMatchInformation(pos, node, target, foundTarget, foundTargetArea, foundTargetPriority) {
  938. var matchInformation = {};
  939. var $el = $(node);
  940. var bounds = node.getBoundingClientRect();
  941. var isVisible = $el.is(':visible');
  942. if (isVisible) {
  943. var xInRange = this._isInRange(pos.x, bounds.left, bounds.width);
  944. var yInRange = this._isInRange(pos.y, bounds.top, bounds.height);
  945. if (xInRange && yInRange) {
  946. matchInformation = {
  947. area: bounds.width * bounds.height,
  948. priority: this._getPriority(target)
  949. };
  950. matchInformation.isMatch = !foundTarget || matchInformation.priority > foundTargetPriority || foundTargetArea > matchInformation.area && matchInformation.priority >= foundTargetPriority;
  951. }
  952. }
  953. return matchInformation;
  954. },
  955. /**
  956. * Helper method that gets the current drop target from a node
  957. * @param pos
  958. * @returns {Object} - drop target
  959. */
  960. getDropTargetFromNode: function getDropTargetFromNode(node) {
  961. var target = null;
  962. for (var i = 0; i < this.dropTargets.length; i++) {
  963. if (node === this.dropTargets[i].el) {
  964. target = this.dropTargets[i];
  965. break;
  966. }
  967. }
  968. return target;
  969. },
  970. dragObject: null,
  971. /**
  972. * Called to start dragging
  973. * @param options
  974. * options.event ev - the event used to start the drag. e.g. mousedown, touchstart
  975. * options.type - The type of the data being dropped.
  976. * options.data - The data being dropped.
  977. * options.avatar - the avatar node associated with the drag and drop operation
  978. * options.avatarXOffset - the number of pixel added to the avatar left position
  979. * options.avatarYOffset - the number of pixel added to the avatar top position
  980. * options.restrictToXAxis - restrict moving on the x axis
  981. * options.restrictToYAxis - restrict moving on the y axis
  982. *
  983. * options.callerCallbacks
  984. * callerCallback.onDragStart(event, {dragObject}) - Called when the drag is started.
  985. * callerCallback.onMove(event, {dragObject, dropNode}) - Called on every move event.
  986. * callerCallback.onDragDone(event, {dragObject, dropNode, isDropped}) - Called when the drag is complete, whether we droppped or not.
  987. *
  988. * options.moveXThreshold - the number of pixel to move on the X axis before we allow the drag to start. A good example to use this is
  989. * when want to enable a drag horizontally and still allow vertical scrolling/panning. In this case, we would set the moveXThreshold to something like 30.
  990. * This will allow vertical scroll as long as we don't drag horizontally more that 30 pixels.
  991. *
  992. * options.moveYThreshold - the number of pixel to move on the Y axis before we allow the drag to start.
  993. *
  994. * @param moveThreshold - distance in pixel that will activate the move and the avatar
  995. */
  996. startDrag: function startDrag(options) {
  997. if (this.dragObject) {
  998. // cannot start another drag operation until the previous one is finished
  999. return;
  1000. }
  1001. $('body').addClass('preventSelection');
  1002. this.isDragStartCalled = false;
  1003. this.targetMap = {};
  1004. var isTouch = utils.isTouchEvent(options.event);
  1005. this.dragObject = {
  1006. type: options.type,
  1007. data: options.data,
  1008. avatar: options.avatar,
  1009. isTouch: isTouch || options.event.gesture !== undefined
  1010. };
  1011. var eventPos = utils.getEventPos(options.event);
  1012. this.dragObject.startPosition = {
  1013. x: eventPos.pageX,
  1014. y: eventPos.pageY
  1015. };
  1016. this.setAvatar(options.avatar, options);
  1017. this.callerCallbacks = options.callerCallbacks ? options.callerCallbacks : {};
  1018. var $target = $(window);
  1019. if (isTouch) {
  1020. $target = $(utils.getEventTarget(options.event));
  1021. }
  1022. this.attachedMoveHandler = this.on($target, 'mousemove touchmove', this.moveHandler.bind(this, options));
  1023. this.attachedUpHandler = this.on($target, 'mouseup touchend touchcancel', this.upHandler.bind(this));
  1024. if (options.event.type === 'mousedown') {
  1025. this.attachedScrollHandler = this.on($(options.event.target), 'scroll', this.scrollHandler.bind(this));
  1026. }
  1027. if (options.currentDropZoneNode) {
  1028. var target = this.getDropTargetFromNode(options.currentDropZoneNode);
  1029. if (target) {
  1030. this.currentDropTarget = {
  1031. target: target,
  1032. node: options.currentDropZoneNode
  1033. };
  1034. }
  1035. }
  1036. },
  1037. scrollHandler: function scrollHandler() /* event */{
  1038. // we are scrolling, do not track movement
  1039. // cancel drag
  1040. // IE does not fire mouseUp on scrollbar so drag move continues after releasing the mouse when it should not
  1041. this.resetDragging();
  1042. },
  1043. _setAvatarPosition: function _setAvatarPosition(options) {
  1044. if (this.avatar && this.dragObject.position) {
  1045. if (!this.avatar.parentNode) {
  1046. $('body').append(this.avatar);
  1047. }
  1048. var xOffset = options && options.avatarXOffset ? options.avatarXOffset : 1;
  1049. var yOffset = options && options.avatarYOffset ? options.avatarYOffset : 1;
  1050. $(this.avatar).css({
  1051. left: this.dragObject.position.x + xOffset + 'px',
  1052. top: this.dragObject.position.y + yOffset + 'px'
  1053. });
  1054. }
  1055. },
  1056. setAvatar: function setAvatar(avatar, options) {
  1057. this.avatar = avatar;
  1058. this._setAvatarPosition(options);
  1059. },
  1060. /**
  1061. * Move event main handler
  1062. * @param options - drag options
  1063. * @param ev
  1064. */
  1065. moveHandler: function moveHandler(options, ev) {
  1066. //Always prevent the default behavior on drag move to prevent chrome auto scrolling
  1067. ev.preventDefault();
  1068. var eventPos = utils.getEventPos(ev);
  1069. var dx = eventPos.pageX;
  1070. var dy = eventPos.pageY;
  1071. this.dragObject.position = {
  1072. x: dx,
  1073. y: dy
  1074. };
  1075. if (options.restrictToXAxis) {
  1076. this.dragObject.position.y = this.dragObject.startPosition.y;
  1077. }
  1078. if (options.restrictToYAxis) {
  1079. this.dragObject.position.x = this.dragObject.startPosition.x;
  1080. }
  1081. if (!this.isDragStartCalled && this._isThresholdNotMet(options)) {
  1082. return;
  1083. }
  1084. this._setAvatarPosition(options);
  1085. var dropTarget = this.getDropTargetFromPos(this.dragObject.position, options);
  1086. this._callStartDrag(ev);
  1087. this._callMove(dropTarget, ev);
  1088. this._processCallbacks(dropTarget);
  1089. // Don't stop the propagation. This will interfere with hammer gestures like tap and hold.
  1090. // If there is an active tap/hold handlers, hammer needs to know when there is a move.
  1091. },
  1092. _processCallbacks: function _processCallbacks(dropTarget) {
  1093. var currentNonActiveDropZones = this.currentDropTarget.nonActiveDropZones;
  1094. // Process the callback for the active drop zone that accepted the drop
  1095. if (dropTarget.target !== this.currentDropTarget.target || dropTarget.node !== this.currentDropTarget.node) {
  1096. this._dropTargetCallback(this.currentDropTarget, 'onDragLeave');
  1097. this.currentDropTarget = dropTarget;
  1098. this._dropTargetCallback(this.currentDropTarget, 'onDragEnter');
  1099. } else {
  1100. this._dropTargetCallback(this.currentDropTarget, 'onDragMove');
  1101. }
  1102. // Process callback for drop zone that didn't accept but chose to receive the event anyway
  1103. this._processCallbacksForNonActiveDropzones(dropTarget.nonActiveDropZones, currentNonActiveDropZones);
  1104. },
  1105. _processCallbacksForNonActiveDropzones: function _processCallbacksForNonActiveDropzones(newDropZones, oldDropZones) {
  1106. _.each(newDropZones, function (dropZone) {
  1107. if (this._isDropZoneInArray(dropZone, oldDropZones)) {
  1108. this._dropTargetCallback(dropZone, 'onDragMove');
  1109. } else {
  1110. this._dropTargetCallback(dropZone, 'onDragEnter');
  1111. }
  1112. }.bind(this));
  1113. if (oldDropZones) {
  1114. _.each(oldDropZones, function (dropZone) {
  1115. if (!this._isDropZoneInArray(dropZone, newDropZones)) {
  1116. this._dropTargetCallback(dropZone, 'onDragLeave');
  1117. }
  1118. }.bind(this));
  1119. }
  1120. this.currentDropTarget.nonActiveDropZones = newDropZones;
  1121. },
  1122. _dropTargetCallback: function _dropTargetCallback(dropTarget, callbackName) {
  1123. if (dropTarget.target && dropTarget.target.callbacks[callbackName]) {
  1124. dropTarget.target.callbacks[callbackName](this.dragObject, dropTarget.node);
  1125. return true;
  1126. }
  1127. return false;
  1128. },
  1129. _isDropZoneInArray: function _isDropZoneInArray(dropZone, dropZoneArray) {
  1130. var found = false;
  1131. if (dropZoneArray) {
  1132. for (var i = 0; i < dropZoneArray.length; i++) {
  1133. if (dropZone.target === dropZoneArray[i].target) {
  1134. found = true;
  1135. break;
  1136. }
  1137. }
  1138. }
  1139. return found;
  1140. },
  1141. _isThresholdNotMet: function _isThresholdNotMet(options) {
  1142. var hasThreshold = options.moveXThreshold || options.moveYThreshold;
  1143. var isXThresholdNotMet = !options.moveXThreshold || options.moveXThreshold > Math.abs(this.dragObject.position.x - this.dragObject.startPosition.x);
  1144. var isYThresholdNotMet = !options.moveYThreshold || options.moveYThreshold > Math.abs(this.dragObject.position.y - this.dragObject.startPosition.y);
  1145. return hasThreshold && isXThresholdNotMet && isYThresholdNotMet;
  1146. },
  1147. _callMove: function _callMove(dropTarget, ev) {
  1148. if (this.callerCallbacks.onMove) {
  1149. this.callerCallbacks.onMove(ev, {
  1150. dragObject: this.dragObject,
  1151. dropTargetNode: dropTarget.node
  1152. });
  1153. }
  1154. },
  1155. _callStartDrag: function _callStartDrag(ev) {
  1156. if (this.callerCallbacks.onDragStart && !this.isDragStartCalled) {
  1157. this.callerCallbacks.onDragStart(ev, { dragObject: this.dragObject });
  1158. _.each(this.dropTargets, function (target) {
  1159. if (target.callbacks.onDragStart) {
  1160. target.callbacks.onDragStart(this.dragObject);
  1161. }
  1162. }.bind(this));
  1163. }
  1164. $('body').addClass('dragging');
  1165. this.isDragStartCalled = true;
  1166. },
  1167. /**
  1168. * mouseup/touchend main handler
  1169. *
  1170. * @param ev
  1171. */
  1172. upHandler: function upHandler(ev) {
  1173. if (this.isDragStartCalled) {
  1174. var isDropped = false;
  1175. $('body').removeClass('dragging');
  1176. var dropTarget = this.currentDropTarget;
  1177. if (this._dropTargetCallback(dropTarget, 'onDrop')) {
  1178. isDropped = true;
  1179. }
  1180. if (this.callerCallbacks.onDragDone) {
  1181. this.callerCallbacks.onDragDone(ev, {
  1182. dragObject: this.dragObject,
  1183. dropTargetNode: isDropped ? dropTarget.node : null,
  1184. isDropped: isDropped
  1185. });
  1186. }
  1187. if (dropTarget.nonActiveDropZones) {
  1188. _.each(dropTarget.nonActiveDropZones, function (dropZone) {
  1189. this._dropTargetCallback(dropZone, 'onDrop');
  1190. }.bind(this));
  1191. }
  1192. _.each(this.dropTargets, function (target) {
  1193. if (target.callbacks.onDragEnd) {
  1194. target.callbacks.onDragEnd(this.dragObject);
  1195. }
  1196. }.bind(this));
  1197. }
  1198. this.resetDragging();
  1199. // Don't stop the propagation. This will interfere with hammer gestures like tap and hold.
  1200. // If there is an active tap/hold handlers, hammer needs to know when the touch ends.
  1201. },
  1202. resetDragging: function resetDragging() {
  1203. // Release the capture that we set in the mouse down.
  1204. // This is used to allow IE to keep firing the mouse event when the mouse leaves the window or iframe
  1205. if (document.releaseCapture) {
  1206. document.releaseCapture();
  1207. }
  1208. if (this.attachedMoveHandler) {
  1209. this.attachedMoveHandler.remove();
  1210. }
  1211. if (this.attachedUpHandler) {
  1212. this.attachedUpHandler.remove();
  1213. }
  1214. if (this.attachedScrollHandler) {
  1215. this.attachedScrollHandler.remove();
  1216. }
  1217. $('body').removeClass('preventSelection');
  1218. this.currentDropTarget = {};
  1219. this.dragObject = null;
  1220. this.isDragStartCalled = false;
  1221. this.targetMap = null;
  1222. this.lastActiveScrollableTarget = null;
  1223. $(this.avatar).remove();
  1224. }
  1225. });
  1226. return new DnDManager();
  1227. });
  1228. //# sourceMappingURL=DnDManager.js.map
  1229. ;
  1230. /**
  1231. * Licensed Materials - Property of IBM
  1232. * IBM Cognos Products: BI
  1233. * (C) Copyright IBM Corp. 2014, 2016
  1234. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule
  1235. * Contract with IBM Corp.
  1236. */
  1237. define('baglass/core-client/js/core-client/utils/EventHelper',['jquery', './BidiUtil', './dnd/DnDManager', 'underscore', 'hammerjs', 'jquery.hammer'], function ($, BidiUtil, DnDManager, _, hammer) {
  1238. // Setup jquery to create a hammer instance when we use hammer events.
  1239. var hammerGestures = [];
  1240. for (var name in hammer.gestures) {
  1241. if (hammer.gestures.hasOwnProperty(name)) {
  1242. hammerGestures.push(hammer.gestures[name].name);
  1243. }
  1244. }
  1245. var hammerDefaultOptions = {
  1246. 'prevent_mouseevents': true,
  1247. 'stop_browser_behavior': false
  1248. };
  1249. $.each(hammerGestures, function (index, name) {
  1250. $.event.special[name] = {
  1251. setup: function setup() {
  1252. var $el = $(this);
  1253. var inst = $el.data('hammer');
  1254. if (!inst) {
  1255. // create hammer instance with default values
  1256. $el.hammer(hammerDefaultOptions);
  1257. }
  1258. }
  1259. };
  1260. });
  1261. /**
  1262. * A jQuery function that can be used to attach the onClick event handler. This function will also attach the touch events required for touch devices to avoid the delay caused by simulated mouse
  1263. * events
  1264. */
  1265. $.fn.onClick = function (handler) {
  1266. this.on('click', function (e) {
  1267. handler(e);
  1268. }).on('tap', function (e) {
  1269. handler(e);
  1270. // prevent the simulated clicks on touch devices
  1271. e.gesture.preventDefault();
  1272. });
  1273. return this;
  1274. };
  1275. // Get the box style to be applied to the inline editor
  1276. var getInlineEditBoxStyles = function getInlineEditBoxStyles($text, options) {
  1277. var cssProps = ['padding-top', 'padding-right', 'padding-bottom', 'padding-left', 'margin-top', 'margin-right', 'margin-bottom', 'margin-left', 'border-bottom-color', 'border-bottom-style', 'border-bottom-width', 'border-top-color', 'border-top-style', 'border-top-width', 'border-right-color', 'border-right-style', 'border-right-width', 'border-left-color', 'border-left-style', 'border-left-width', 'position', 'top', 'right', 'left', 'bottom', 'height', 'width', 'min-height', 'min-width', 'max-height', 'max-width'];
  1278. var cssValues = $text.css(cssProps);
  1279. // We don't want to set a zero height and width
  1280. if (cssValues.height === '0px') {
  1281. delete cssValues.height;
  1282. }
  1283. if (cssValues.width === '0px') {
  1284. delete cssValues.width;
  1285. }
  1286. // Set the maximum width to strech with the parent
  1287. if (options && options.maxSizeNode) {
  1288. var $node = $(options.maxSizeNode);
  1289. var width = options.maxSizeNode.style.width;
  1290. if (width) {
  1291. cssValues['max-width'] = '100%';
  1292. delete cssValues.width;
  1293. } else {
  1294. cssValues['max-width'] = $node.width() + 'px';
  1295. }
  1296. }
  1297. return cssValues;
  1298. };
  1299. // Get the css styles to be applied to the inline editor input element
  1300. var getInlineEditStyles = function getInlineEditStyles($text) {
  1301. var textCss = {
  1302. width: '0px',
  1303. 'min-width': $text.css('fontSize')
  1304. };
  1305. // Get the text alignment and apply it to the text input
  1306. var textAlignment = $text.css('text-align');
  1307. if (textAlignment === 'center') {
  1308. textCss['margin'] = '0px auto';
  1309. } else if (textAlignment === 'right') {
  1310. textCss['margin'] = '0px 0px 0px auto';
  1311. }
  1312. return textCss;
  1313. };
  1314. // Get the text css style to be applied to the inline editor
  1315. var getInlineEditTextStyles = function getInlineEditTextStyles($text) {
  1316. return $text.css(['fontSize', 'fontFamily', 'fontWeight', 'letterSpacing', 'color']);
  1317. };
  1318. var _addInlineEditHandlers = function _addInlineEditHandlers($text, fCallback, options) {
  1319. var $inlineEdit = $text._$inlineEdit;
  1320. $text._updateWidth = function () {
  1321. if ($inlineEdit) {
  1322. var value = $inlineEdit.val() || '';
  1323. if (value !== $inlineEdit._hidden.text()) {
  1324. $inlineEdit._hidden.text(value);
  1325. $inlineEdit.width($inlineEdit._hidden.width() + 2);
  1326. }
  1327. }
  1328. };
  1329. $text._inlineEditChangedFn = function () {
  1330. var sText = $inlineEdit.val().trim();
  1331. if (sText.length === 0 && options.noEmptyText) {
  1332. sText = $text._previousInlineText;
  1333. }
  1334. $inlineEdit.removeClass('inlineText').off('keypress').off('keydown').off('blur');
  1335. var invokeCallback = false;
  1336. if ($text._previousInlineText !== sText) {
  1337. invokeCallback = true;
  1338. }
  1339. $text._previousInlineText = null;
  1340. $inlineEdit._hidden.remove();
  1341. $inlineEdit._hidden = null;
  1342. $inlineEdit.off();
  1343. $inlineEdit.hide();
  1344. $inlineEdit.parent().remove();
  1345. $inlineEdit = null;
  1346. $text._$inlineEdit = null;
  1347. $text.text(sText);
  1348. $text.removeClass('inEditMode');
  1349. $text.show().focus();
  1350. if (invokeCallback) {
  1351. fCallback(sText);
  1352. }
  1353. var onEditEnd = options && options.onEditEnd;
  1354. if (onEditEnd) {
  1355. onEditEnd();
  1356. }
  1357. }.bind($text);
  1358. var sText = $text.text();
  1359. $text._previousInlineText = sText; // keep a back up of the current string
  1360. if (!$inlineEdit) {
  1361. $text.addClass('inEditMode');
  1362. // Create a container node that will inherit the text container properties
  1363. // like margin, padding, border and position
  1364. var $inlineEditContainer = $('<div>', {
  1365. 'class': 'inlineEditContainer'
  1366. });
  1367. $inlineEditContainer.css(getInlineEditBoxStyles($text, options));
  1368. $text.after($inlineEditContainer);
  1369. $inlineEdit = $('<input>', {
  1370. 'class': 'inlineText'
  1371. });
  1372. $inlineEdit.css('max-width', '100%');
  1373. $inlineEdit.css(getInlineEditStyles($text));
  1374. var cssValues = getInlineEditTextStyles($text);
  1375. $inlineEdit.css(cssValues);
  1376. $inlineEditContainer.append($inlineEdit);
  1377. $text._$inlineEdit = $inlineEdit;
  1378. $inlineEdit.val(sText);
  1379. $inlineEdit._hidden = $('<div style="white-space:pre; top:-999px; left:-999px; position:absolute;"></div>');
  1380. $inlineEdit._hidden.css(cssValues);
  1381. $text.hide();
  1382. $text.after($inlineEdit._hidden);
  1383. $inlineEdit.on('keyup keydown input propertychange change', function () {
  1384. $text._updateWidth();
  1385. });
  1386. if (options && options.style) {
  1387. $inlineEdit.css(options.style);
  1388. }
  1389. $text._updateWidth();
  1390. $inlineEdit.on('blur', $text._inlineEditChangedFn).on('keypress', function (e) {
  1391. if (e.keyCode === 13) {
  1392. $text._inlineEditChangedFn();
  1393. }
  1394. }).on('keyup', function (e) {
  1395. //stop propagation for delete key
  1396. if (e.keyCode === 46 || e.keyCode === 8) {
  1397. e.stopPropagation();
  1398. }
  1399. }).on('keydown', function (e) {
  1400. // stop the arrow keys from bubbling when in edit mode. Fix for when editing the name of a tab.
  1401. if (e.keyCode === 37 || e.keyCode === 39) {
  1402. e.stopPropagation();
  1403. }
  1404. }).on('mousedown mouseup dblclick', function (e) {
  1405. // cancel the mouse down, up and double click to allow the user to interact with the text
  1406. e.stopPropagation();
  1407. });
  1408. BidiUtil.initElementForBidi($inlineEdit[0]);
  1409. $inlineEdit.show();
  1410. } else {
  1411. $inlineEdit.val(sText);
  1412. }
  1413. $inlineEdit.focus();
  1414. $inlineEdit[0].setSelectionRange(0, 9999); //needed for selecting on ios
  1415. return false;
  1416. };
  1417. /**
  1418. * Turns an div element into an inline edit control
  1419. */
  1420. $.fn.inlineEditor = function (action, options) {
  1421. if (action === 'remove') {
  1422. if (this._$inlineEdit) {
  1423. this._inlineEditChangedFn();
  1424. }
  1425. this.off('dblclick', this._inlineEditFn);
  1426. this.off('hold', this._inlineEditFn);
  1427. delete this._inlineEditFn;
  1428. delete this._previousInlineText;
  1429. delete this._inlineEditChangedFn;
  1430. delete this._updateWidth;
  1431. } else if (action === 'blur') {
  1432. if (this._$inlineEdit) {
  1433. this._inlineEditChangedFn();
  1434. }
  1435. } else if (action === 'isEditing') {
  1436. return this._$inlineEdit ? true : false;
  1437. } else if (action === 'edit') {
  1438. if (this._inlineEditFn) {
  1439. this._inlineEditFn();
  1440. }
  1441. } else {
  1442. var onEditStart = options && options.onEditStart;
  1443. this._inlineEditFn = function (e) {
  1444. DnDManager.resetDragging();
  1445. if (onEditStart) {
  1446. onEditStart();
  1447. }
  1448. _addInlineEditHandlers(this, action, options);
  1449. if (e) {
  1450. e.stopPropagation();
  1451. }
  1452. }.bind(this);
  1453. this.hammer({
  1454. stop_browser_behavior: false,
  1455. prevent_mouseevents: true
  1456. });
  1457. this.on('dblclick', this._inlineEditFn);
  1458. this.on('hold', this._inlineEditFn);
  1459. this.on('keypress', function (e) {
  1460. var keyCode = e.keyCode || e.charCode;
  1461. if (keyCode === 13 || keyCode === 32) {
  1462. this._inlineEditFn(e);
  1463. }
  1464. }.bind(this));
  1465. }
  1466. };
  1467. });
  1468. //# sourceMappingURL=EventHelper.js.map
  1469. ;
  1470. /**
  1471. * Licensed Materials - Property of IBM
  1472. * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2014, 2016
  1473. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  1474. */
  1475. define('baglass/core-client/js/core-client/ui/core/View',['jquery', 'underscore', 'doT', './Events', '../../utils/EventHelper'], function ($, _, dot, Events) {
  1476. 'use strict';
  1477. var View = null;
  1478. var eventsRegex = /^(\S+)\s*(.*)$/;
  1479. // View related attributes that are supported
  1480. var viewAttributes = ['el', 'id', 'className', 'tagName', 'events'];
  1481. /**
  1482. * A Backbone style base View Class. UI Views should extend this class.
  1483. *
  1484. */
  1485. View = Events.extend({
  1486. templateString: null,
  1487. id: null,
  1488. init: function init(attributes) {
  1489. View.inherited('init', this, arguments);
  1490. this.viewId = _.uniqueId('view');
  1491. this.dotTemplate = dot.template(this.templateString || '');
  1492. _.extend(this, _.pick(attributes || {}, viewAttributes));
  1493. this._initDomElement();
  1494. this._attachEvents();
  1495. },
  1496. /**
  1497. * The tag name given to the view's DOM element. By default it's a DIV.
  1498. */
  1499. tagName: 'div',
  1500. /**
  1501. * Initialize the DOM element for this view
  1502. */
  1503. _initDomElement: function _initDomElement() {
  1504. if (!this.el) {
  1505. var attrs = {};
  1506. if (this.id) {
  1507. attrs.id = _.result(this, 'id');
  1508. }
  1509. if (this.className) {
  1510. attrs['class'] = _.result(this, 'className');
  1511. }
  1512. this.setElement(document.createElement(this.tagName));
  1513. this.$el.attr(attrs);
  1514. } else {
  1515. this.setElement(_.result(this, 'el'));
  1516. }
  1517. },
  1518. /**
  1519. * Convenience function to use jQuery to find a DOM element within this view. This is
  1520. * faster then doing a global lockup.
  1521. */
  1522. $: function $(selector) {
  1523. return this.$el.find(selector);
  1524. },
  1525. /**
  1526. * Hide the view
  1527. */
  1528. hide: function hide() {
  1529. this.$el.hide();
  1530. },
  1531. /**
  1532. * Show the view if hidden
  1533. */
  1534. show: function show() {
  1535. this.$el.show();
  1536. },
  1537. /**
  1538. * Make sure the target is the intended dom node, using CSS class to validate.
  1539. * If not the right node, check out the parents.
  1540. */
  1541. getTarget: function getTarget(target, sClass) {
  1542. var $t = $(target);
  1543. if (!$t.hasClass(sClass)) {
  1544. var parents = $t.parents('.' + sClass);
  1545. if (parents.length > 0) {
  1546. target = parents[0];
  1547. }
  1548. }
  1549. return target;
  1550. },
  1551. /**
  1552. * Render is the main function of the View. Views should implement (override) the render
  1553. * method to populate this.el with the appropriate HTML. Render should always return this
  1554. * to allow chaining of calls.
  1555. */
  1556. render: function render() {
  1557. return this;
  1558. },
  1559. /**
  1560. * Remove this view:
  1561. * -Remove the element from the DOM
  1562. * -Remove the event listeners
  1563. */
  1564. remove: function remove() {
  1565. if (this.$el) {
  1566. this.$el.remove();
  1567. }
  1568. if (this.off) {
  1569. this.off();
  1570. }
  1571. return this;
  1572. },
  1573. /**
  1574. * Set the view element to a new DOM element
  1575. */
  1576. setElement: function setElement(el) {
  1577. this._detachEvents();
  1578. this.$el = el instanceof $ ? el : $(el);
  1579. this.el = this.$el[0];
  1580. this._attachEvents();
  1581. return this;
  1582. },
  1583. /**
  1584. * Attaches the events in this.events to this.el for this view
  1585. */
  1586. _attachEvents: function _attachEvents() {
  1587. var events = this.events;
  1588. this._detachEvents();
  1589. for (var key in events) {
  1590. var callback = events[key];
  1591. if (!_.isFunction(callback)) {
  1592. callback = this[events[key]];
  1593. }
  1594. if (!callback) {
  1595. continue;
  1596. }
  1597. var match = key.match(eventsRegex);
  1598. var eventName = match[1];
  1599. var selector = match[2];
  1600. // add the event to the element, with a namespace 'privateViewEvents'
  1601. this.$el.on(eventName + '.privateViewEvents' + this.viewId, selector, callback.bind(this));
  1602. }
  1603. return this;
  1604. },
  1605. /**
  1606. * Detaches all the events from the element
  1607. */
  1608. _detachEvents: function _detachEvents() {
  1609. if (this.$el) {
  1610. this.$el.off('.privateViewEvents' + this.viewId);
  1611. }
  1612. return this;
  1613. }
  1614. });
  1615. return View;
  1616. });
  1617. //# sourceMappingURL=View.js.map
  1618. ;
  1619. /**
  1620. * Licensed Materials - Property of IBM
  1621. *
  1622. * IBM Cognos Products: BI
  1623. *
  1624. * Copyright IBM Corp. 2015, 2017
  1625. *
  1626. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  1627. */
  1628. define('baglass/core-client/js/core-client/ui/View',['./core/View'], function (BaseView) {
  1629. /**
  1630. * A Backbone style base View Class. Glass UI Views should extend this class.
  1631. */
  1632. var View = BaseView.extend({
  1633. /**
  1634. * @param {options} set of initial properties
  1635. */
  1636. init: function init(options) {
  1637. if (options && options.glassContext && options.glassContext.getCoreSvc) {
  1638. this.logger = options.glassContext.getCoreSvc('.Logger');
  1639. }
  1640. View.inherited('init', this, arguments);
  1641. },
  1642. /**
  1643. * Hide the view
  1644. */
  1645. hide: function hide() {
  1646. this.$el.addClass('hidden');
  1647. this.$el.attr('aria-hidden', 'true');
  1648. },
  1649. /**
  1650. * Show the view if hidden
  1651. */
  1652. show: function show() {
  1653. this.$el.removeClass('hidden');
  1654. this.$el.removeAttr('aria-hidden');
  1655. }
  1656. });
  1657. return View;
  1658. });
  1659. //# sourceMappingURL=View.js.map
  1660. ;
  1661. /**
  1662. * Licensed Materials - Property of IBM
  1663. * IBM Business Analytics (C) Copyright IBM Corp. 2017
  1664. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  1665. */
  1666. define('baglass/core-client/js/core-client/utils/ClassFactory',['require'], function (require) {
  1667. /**
  1668. *This class provides utility to create an instance from a module id
  1669. */
  1670. var ClassFactory = function ClassFactory() {};
  1671. /**
  1672. * @constant
  1673. * @default
  1674. */
  1675. ClassFactory.prototype.FAIL_CREATE_INSTANCE = 'Failed to create the instance';
  1676. /**
  1677. * @constant
  1678. * @default
  1679. */
  1680. ClassFactory.prototype.FAIL_LOAD_MODULE = 'Failed to load the module';
  1681. /**
  1682. * Instantiate an object based on the passed module id
  1683. * @param {moduleId} module id
  1684. * @param potential additional parameters
  1685. * @return promise
  1686. */
  1687. ClassFactory.prototype.instantiate = function (moduleId) {
  1688. var args = arguments;
  1689. return this.loadModule(moduleId).then(function (Module) {
  1690. try {
  1691. var factoryFunction = Module.bind.apply(Module, args);
  1692. var object = new factoryFunction();
  1693. object.moduleID = args[0];
  1694. return object;
  1695. } catch (error) {
  1696. throw { msg: this.FAIL_CREATE_INSTANCE, causedBy: error };
  1697. }
  1698. }.bind(this));
  1699. };
  1700. ClassFactory.prototype.loadModule = function (moduleId) {
  1701. return new Promise(function (resolve, reject) {
  1702. if (typeof moduleId === 'function') {
  1703. resolve(moduleId);
  1704. } else {
  1705. return require([moduleId], function (Module) {
  1706. if (Module) {
  1707. resolve(Module);
  1708. } else {
  1709. reject({ msg: this.FAIL_LOAD_MODULE, causedBy: 'Module is not set', moduleId: moduleId });
  1710. }
  1711. }.bind(this), function (error) {
  1712. reject({ msg: this.FAIL_LOAD_MODULE, causedBy: error, moduleId: moduleId });
  1713. }.bind(this));
  1714. }
  1715. }.bind(this));
  1716. };
  1717. return new ClassFactory();
  1718. });
  1719. //# sourceMappingURL=ClassFactory.js.map
  1720. ;
  1721. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  1722. /**
  1723. * Licensed Materials - Property of IBM
  1724. * IBM Cognos Products: BI
  1725. * (C) Copyright IBM Corp. 2016, 2020
  1726. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  1727. */
  1728. define('baglass/utils/Utils',['jquery', 'underscore', '../core-client/js/core-client/utils/ClassFactory', 'jquery-bbq'], function ($, _, ClassFactory) {
  1729. $.browser = {};
  1730. var Utils = {
  1731. _ClassFactory: ClassFactory,
  1732. /**
  1733. * Builds and returns a URL for you given a returnURL and additional URL parameters.
  1734. * @param {String} url - The URL you want to redirect to.
  1735. * @param {String} [returnURL=undefined] - The m_return parameter that you want to be added to the returned url.
  1736. * @param {Object} [params=undefined] - Key/Value pairs of additional parameters that you might want to add to the url.
  1737. */
  1738. buildRedirectURL: function buildRedirectURL(url, returnURL, params) {
  1739. var redirectURL = url;
  1740. var combinedParams = {};
  1741. if (returnURL !== undefined && returnURL !== null) {
  1742. combinedParams.m_redirect = returnURL;
  1743. }
  1744. if (params) {
  1745. _.extend(combinedParams, params);
  1746. }
  1747. if (redirectURL) {
  1748. $.each(combinedParams, function (key, value) {
  1749. redirectURL = redirectURL + (redirectURL.indexOf('?') > -1 ? '&' : '?') + encodeURIComponent(key) + '=' + encodeURIComponent(value);
  1750. });
  1751. }
  1752. return redirectURL;
  1753. },
  1754. /**
  1755. * Returns the value of the requested cookie
  1756. * @param {String} The key of the cookie
  1757. * @return {String|undefined} the value of the cookie
  1758. */
  1759. getCookieValue: function getCookieValue(key) {
  1760. var retVal;
  1761. var aCookies = document.cookie.split(';');
  1762. for (var i = 0; i < aCookies.length; i++) {
  1763. var aSet = aCookies[i].split('=');
  1764. var sKey = decodeURIComponent(aSet[0].trim());
  1765. if (sKey === key && aSet.length > 1) {
  1766. retVal = decodeURIComponent(aSet[1]);
  1767. break;
  1768. }
  1769. }
  1770. return retVal;
  1771. },
  1772. /**
  1773. * Returns true if the passed in has been protected for errors
  1774. * @private
  1775. * @param {Object} anObj - a function you want to test if it has been protected.
  1776. */
  1777. _needsProtection: function _needsProtection(aFunction) {
  1778. return $.isFunction(aFunction) && (_.isUndefined(aFunction.needsProtection) || aFunction.needsProtection === false);
  1779. },
  1780. /**
  1781. * update the passed in function to mark it as protected
  1782. * @private
  1783. * @param {Object} anObj - a function you want to test if it has been protected.
  1784. */
  1785. _markAsProtected: function _markAsProtected(aFunction) {
  1786. aFunction.needsProtection = false;
  1787. },
  1788. /**
  1789. * Returns true if the passed in object is a promise object (implemented the promise interface)
  1790. * @private
  1791. * @param {Object} anObj - an instance of an object that you want to check if it is a promise.
  1792. */
  1793. _isPromise: function _isPromise(anObj) {
  1794. return !_.isUndefined(anObj) && anObj.then && $.isFunction(anObj.then);
  1795. },
  1796. /**
  1797. * Returns a JQuery deferred object that is resolved only when all the promises in the arrayOfPromises are
  1798. * either resolved or rejected
  1799. * @public
  1800. * @param {Promise[]} arrayOfPromises - an array of all the promises that you want to wait for
  1801. */
  1802. waitForAllOrSomePromises: function waitForAllOrSomePromises(arrayOfPromises) {
  1803. var deferred = $.Deferred();
  1804. if (_.isUndefined(arrayOfPromises) || arrayOfPromises === null || arrayOfPromises.length === 0) {
  1805. deferred.resolve();
  1806. return deferred;
  1807. }
  1808. var unresolvedCount = arrayOfPromises.length;
  1809. var rejectedCount = 0;
  1810. var responses = [];
  1811. for (var index = 0; index < arrayOfPromises.length; index += 1) {
  1812. var currentPromise = arrayOfPromises[index];
  1813. if (!Utils._isPromise(currentPromise)) {
  1814. //if this is not a promise then skip it
  1815. console.warn('waitForAllOrSomePromises found an invalid promise: ' + currentPromise);
  1816. continue;
  1817. }
  1818. (function (aPromise) {
  1819. aPromise.then(function (resp) {
  1820. if (_.isUndefined(resp)) {
  1821. resp = {};
  1822. }
  1823. aPromise.responseModule = resp;
  1824. unresolvedCount -= 1;
  1825. resp.isSuccess = true;
  1826. responses.push(resp);
  1827. if (unresolvedCount <= 0) {
  1828. deferred.resolve.apply(deferred, responses);
  1829. }
  1830. }, function (resp) {
  1831. if (_.isUndefined(resp)) {
  1832. resp = {};
  1833. }
  1834. unresolvedCount -= 1;
  1835. rejectedCount += 1;
  1836. resp.isSuccess = false;
  1837. responses.push(resp);
  1838. console.info(resp);
  1839. if (unresolvedCount <= 0) {
  1840. if (rejectedCount === arrayOfPromises.length) {
  1841. //in this case every promise was rejected so we do need to reject this bad boy
  1842. deferred.reject.apply(deferred, responses);
  1843. } else {
  1844. deferred.resolve.apply(deferred, responses);
  1845. }
  1846. }
  1847. });
  1848. })(currentPromise);
  1849. }
  1850. return deferred;
  1851. },
  1852. /**
  1853. * Utility function to wrap functions introspectively with try catch'es respecting promises in error conditions if there are any
  1854. * be aware that in the case of catching a javascript script error, the return value is assumed to be a promise
  1855. * @public
  1856. * @param {Object} obj - an instance of an object that you want to protect errors with.
  1857. * @param {String[]} applyList - list of functions that are to wrapped. If the method name is not a valid function for the supplied object then it skeps it
  1858. * @param {function} errCallback -optional error callback to call if an error occurrs when the function is executed. The default is to log the error and reject any promises
  1859. */
  1860. errorProtect: function errorProtect(obj, applyList, errCallback) {
  1861. if (_.isUndefined(applyList)) {
  1862. return;
  1863. }
  1864. for (var ind = 0; ind < applyList.length; ind += 1) {
  1865. var methodName = applyList[ind]; //need a closure here as we want the value of methodName not the variable
  1866. (function (methodName) {
  1867. var currentMethod = obj[methodName];
  1868. if (Utils._needsProtection(currentMethod)) {
  1869. obj[methodName] = function () {
  1870. var answer = null;
  1871. try {
  1872. answer = currentMethod.apply(obj, arguments);
  1873. return answer;
  1874. } catch (ex) {
  1875. console.error(ex);
  1876. if (!_.isUndefined(errCallback)) {
  1877. errCallback(ex);
  1878. }
  1879. if (_.isUndefined(answer) || answer === null) {
  1880. //in this case we got nothing back for the response
  1881. //this very possibly could mean that a js error occurred and the return of the promise could not happen
  1882. //so create a dummy promise that you can return and reject
  1883. var dummyDef = $.Deferred();
  1884. dummyDef.reject(ex);
  1885. return dummyDef.promise();
  1886. }
  1887. if (Utils._isPromise(answer)) {
  1888. //in this case the response was a promise so lets reject it with impunity
  1889. answer.reject(ex);
  1890. }
  1891. }
  1892. };
  1893. Utils._markAsProtected(obj[methodName]);
  1894. }
  1895. }).bind(obj)(methodName);
  1896. }
  1897. },
  1898. /**
  1899. * Determines whether the user requested a factory mode by passing an extra "factoryMode" parameter in URL query string.
  1900. * If "factoryMode" parameter is equal to "true" then a global "isFactoryMode" variable (defined in index.jsp of bi-service project) is set to true,
  1901. * otherwise is set to false.
  1902. *
  1903. * For more information, please see index.jsp of bi-service.
  1904. *
  1905. * @public
  1906. * @return {Boolean} Returns true if factory mode was requested, otherwise false
  1907. */
  1908. isFactoryMode: function (_isFactoryMode) {
  1909. function isFactoryMode() {
  1910. return _isFactoryMode.apply(this, arguments);
  1911. }
  1912. isFactoryMode.toString = function () {
  1913. return _isFactoryMode.toString();
  1914. };
  1915. return isFactoryMode;
  1916. }(function () {
  1917. return typeof isFactoryMode !== 'undefined' && isFactoryMode === true;
  1918. }),
  1919. /**
  1920. * Determines whether glass is displayed in preview mode.
  1921. *
  1922. * @public
  1923. * @return {Boolean} Returns true if glass is in ui-preview mode, otherwise false
  1924. */
  1925. isUiPreview: function (_isUiPreview) {
  1926. function isUiPreview() {
  1927. return _isUiPreview.apply(this, arguments);
  1928. }
  1929. isUiPreview.toString = function () {
  1930. return _isUiPreview.toString();
  1931. };
  1932. return isUiPreview;
  1933. }(function () {
  1934. return typeof isUiPreview !== 'undefined' && isUiPreview === true;
  1935. }),
  1936. /**
  1937. * Gets the shared resource action controller for the type.
  1938. * @public
  1939. * @param {object} [glassContext] The glassContext
  1940. * @param {String} [type] The type of the object.
  1941. * @return {Object} Promise. Resolved with the action controller or undefined if the collection item is not found.
  1942. * Rejects if there are any errors.
  1943. */
  1944. getSharedResourceActionController: function getSharedResourceActionController(glassContext, type, context) {
  1945. var _this = this;
  1946. return glassContext.findCollection(Utils.SHARE_CONTAINER).then(function (collectionItems) {
  1947. if (!collectionItems) {
  1948. return;
  1949. }
  1950. var promises = []; // Sort the contributions based on the weight.
  1951. collectionItems.sort(function (a, b) {
  1952. return (b.weight || 0) - (a.weight || 0);
  1953. }); // Instantiate the controllers.
  1954. collectionItems.forEach(function (item) {
  1955. if (item.types && item.types.indexOf(type) !== -1) {
  1956. var promise = _this._ClassFactory.instantiate(item.actionController).catch(function (error) {
  1957. glassContext.getCoreSvc('.Logger').error(Utils.COLLECTION_MODULE_NOT_FOUND + type);
  1958. throw error;
  1959. });
  1960. promises.push(promise);
  1961. }
  1962. });
  1963. return Promise.all(promises).then(function (items) {
  1964. var options = {
  1965. glassContext: glassContext,
  1966. context: context
  1967. };
  1968. return _.find(items, function (item) {
  1969. return item && (!item.isEnabled || typeof item.isEnabled === 'function' && item.isEnabled(options));
  1970. });
  1971. });
  1972. });
  1973. },
  1974. /**
  1975. * Add a coachmark dynamically to the UI.
  1976. * @param options - The options parameter takes the following values to add the coachmark:
  1977. * id: the identifier for the element to attach the coachmark to,
  1978. * $el: the element to attach the coachmark to,
  1979. * title: the title string for the coachmark,
  1980. * content: the content string for the coachmark,
  1981. * glassContext: the relevant glass context
  1982. */
  1983. addCoachmark: function addCoachmark(options) {
  1984. return Promise.try(function () {
  1985. if (options.glassContext.getCoreSvc('.UserProfile').preferences.showHints === 'showAll') {
  1986. var coachmarkOptions = {
  1987. title: options.title,
  1988. contents: options.contents,
  1989. glassContext: options.glassContext,
  1990. placement: options.placement
  1991. };
  1992. if (options.$el.find('.coachMark').length === 0) {
  1993. var persistence = options.glassContext.getCoreSvc('.CoachMarkService').getPersistence();
  1994. return persistence.isRead(options.id).then(function (isRead) {
  1995. options.$el.attr('id', options.id);
  1996. var CoachMark = options.glassContext.getCoreSvc('.CoachMarkService').getRenderer();
  1997. var coachmark = new CoachMark(coachmarkOptions);
  1998. coachmark.render(options.$el, !isRead);
  1999. if (options.showPopover && !isRead) {
  2000. coachmark.$popover.trigger('primaryaction');
  2001. }
  2002. });
  2003. }
  2004. }
  2005. });
  2006. },
  2007. /**
  2008. * Gets the application content from browser's queryString and fragment.
  2009. * @public
  2010. * @param {String} queryString] The browser url queryString
  2011. * @param {String} [fragment] The browser url fragment
  2012. * @return {Object} Content. Returns an object representing the key values pairs found in the supplied queryString and fragment.
  2013. */
  2014. getAppContent: function getAppContent(queryString, fragment, glassContext) {
  2015. try {
  2016. var coerce = Utils._checkCoerceFeatureFlag(glassContext);
  2017. return Utils._getAppContent(queryString, fragment, coerce);
  2018. } catch (err) {
  2019. if (glassContext) {
  2020. glassContext.getCoreSvc('.Logger').error(err);
  2021. } else {
  2022. console.error(err);
  2023. }
  2024. return {};
  2025. }
  2026. },
  2027. _checkCoerceFeatureFlag: function _checkCoerceFeatureFlag(glassContext) {
  2028. var featureChecker = glassContext && glassContext.getCoreSvc('.FeatureChecker');
  2029. var coerce = featureChecker && featureChecker.checkValue('ba-glass', 'stringOnlyQS', 'disabled');
  2030. return coerce;
  2031. },
  2032. _getAppContent: function _getAppContent(queryString, fragment, coerce) {
  2033. var qsObj = queryString && this.deparam(queryString, coerce) || {};
  2034. var fragObj = fragment && $.deparam(fragment, coerce) || {};
  2035. var content = $.extend(true, fragObj, qsObj);
  2036. if (coerce) {
  2037. var nonCoercedContent;
  2038. for (var key in content) {
  2039. if (key.indexOf('p_') === 0) {
  2040. nonCoercedContent = nonCoercedContent || Utils._getAppContent(queryString, fragment, false);
  2041. content[key] = nonCoercedContent[key];
  2042. }
  2043. }
  2044. }
  2045. return content;
  2046. },
  2047. deparam: function deparam(queryString, coerce) {
  2048. var pair, value, name;
  2049. var qsObj = {};
  2050. var coerce_types = {
  2051. 'true': true,
  2052. 'false': false,
  2053. 'null': null
  2054. };
  2055. queryString = queryString.replace(/\+/g, ' ');
  2056. var params = queryString ? queryString.split('&') : [];
  2057. _.map(params, function (param) {
  2058. pair = param.split('=');
  2059. name = decodeURIComponent(pair[0]);
  2060. value = pair.length > 2 ? pair.slice(1).join('=') : pair[1];
  2061. value = decodeURIComponent(value);
  2062. if (coerce) {
  2063. value = value && !isNaN(value) ? +value : value === 'undefined' ? undefined : coerce_types[value] !== undefined ? coerce_types[value] : value;
  2064. }
  2065. if (qsObj[name] !== undefined) {
  2066. qsObj[name] = Array.isArray(qsObj[name]) ? qsObj[name].concat(value) : [].concat(qsObj[name], value);
  2067. } else {
  2068. qsObj[name] = value;
  2069. }
  2070. });
  2071. return qsObj;
  2072. },
  2073. /**
  2074. * Parses the #queryString_data element text populated by the entry-page.
  2075. * @returns {Object} - Map of parameter:value
  2076. */
  2077. getQueryDataParameterMap: function getQueryDataParameterMap(glassContext) {
  2078. var queryString = _.unescape($('#queryString_data').text());
  2079. return Utils.getAppContent(queryString, $.param.fragment(), glassContext);
  2080. },
  2081. getFilteredLoginParameters: function getFilteredLoginParameters(glassContext, queryString, loginPromptParameters) {
  2082. var parameters = glassContext.getAllowedUrlLoginParameters();
  2083. var allowedParameters = ['CAMNamespace'];
  2084. var filteredMap = {};
  2085. var filteredParameters = [];
  2086. if (_.isString(parameters)) {
  2087. _.each(parameters.split(','), function (value) {
  2088. allowedParameters.push(value.trim());
  2089. });
  2090. }
  2091. if (queryString) {
  2092. _.each(queryString, function (value, key) {
  2093. if (_.isString(value) && allowedParameters.indexOf(key) !== -1 && filteredMap[key] == undefined) {
  2094. filteredMap[key] = value;
  2095. }
  2096. });
  2097. }
  2098. if (loginPromptParameters) {
  2099. _.each(loginPromptParameters, function (value, key) {
  2100. if (_.isString(loginPromptParameters[key].value) && filteredMap[loginPromptParameters[key].name] == undefined) {
  2101. filteredMap[loginPromptParameters[key].name] = loginPromptParameters[key].value;
  2102. }
  2103. });
  2104. }
  2105. _.each(filteredMap, function (value, key) {
  2106. filteredParameters.push({
  2107. name: key,
  2108. value: value
  2109. });
  2110. });
  2111. return filteredParameters;
  2112. },
  2113. /**
  2114. * Will iterate through object using propertyMap to safely find nested property value
  2115. *
  2116. * @public
  2117. * @param {Array} propertyMap map of tested property
  2118. * @param {Object} object object to search for nested property
  2119. * @return Returns object property or null if property not found
  2120. */
  2121. getObjectProperty: function getObjectProperty(propertyMap, object) {
  2122. if (propertyMap) {
  2123. var reducerCallbackFunc = function reducerCallbackFunc(reducedObject, currentProperty) {
  2124. return reducedObject && reducedObject[currentProperty] ? reducedObject[currentProperty] : null;
  2125. };
  2126. return propertyMap.reduce(reducerCallbackFunc, object);
  2127. } else {
  2128. return null;
  2129. }
  2130. },
  2131. /**
  2132. * Passed as the replacer argment for JSON.stringify, this will remove cyclical references from the object and allow it to be serializable
  2133. *
  2134. * @public
  2135. * @return Returns the value of a key if it is not a duplicate
  2136. */
  2137. getCircularReplacer: function getCircularReplacer() {
  2138. var seen = new WeakSet();
  2139. return function (key, value) {
  2140. if (_typeof(value) === 'object' && value !== null) {
  2141. if (seen.has(value)) {
  2142. return;
  2143. }
  2144. seen.add(value);
  2145. }
  2146. return value;
  2147. };
  2148. },
  2149. /**
  2150. * Simple XOR encryption of a string
  2151. *
  2152. * @public
  2153. * @param {String} simple string to be encrypted
  2154. * @param {Number} encryption key
  2155. * @return a simple XOR encryption
  2156. */
  2157. encryptString: function encryptString(strToEncrypt, encryptionKey) {
  2158. encryptionKey = Number(String(Number(encryptionKey))) === encryptionKey ? Number(encryptionKey) : 13;
  2159. var encryptedString = strToEncrypt.split('').map(function (c) {
  2160. return c.charCodeAt(0);
  2161. }).map(function (i) {
  2162. return i ^ encryptionKey;
  2163. });
  2164. return String.fromCharCode.apply(undefined, encryptedString);
  2165. }
  2166. };
  2167. Utils.SSO_PARAMS = {
  2168. 'm': 'portal/main.xts',
  2169. 'h_CAM_action': 'logon'
  2170. };
  2171. Utils.SHARE_CONTAINER = 'com.ibm.bi.glass.common.sharedResources';
  2172. Utils.COLLECTION_MODULE_NOT_FOUND = 'Unable to load collection item for shareable type: ';
  2173. return Utils;
  2174. });
  2175. //# sourceMappingURL=Utils.js.map
  2176. ;
  2177. /**
  2178. * Licensed Materials - Property of IBM
  2179. *
  2180. * "Restricted Materials of IBM"
  2181. *
  2182. * 5746-SM2
  2183. *
  2184. * (C) Copyright IBM Corp. 2015, 2016
  2185. *
  2186. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  2187. */
  2188. define('baglass/app/ContentView',['../core-client/js/core-client/ui/View', 'jquery', '../utils/Utils'], function (BaseView, $, Utils) {
  2189. /**
  2190. * @public
  2191. */
  2192. var ContentView = BaseView.extend(
  2193. /**
  2194. * @lends ContentView.prototype
  2195. */
  2196. {
  2197. /**
  2198. * @classdesc A base class for different Perspective Content Views in the application. A Content view should implement all of the functions required by View.
  2199. * @constructs
  2200. * @public
  2201. *
  2202. * @param {options} set of initial properties
  2203. */
  2204. init: function init(options) {
  2205. $.extend(this, options);
  2206. ContentView.inherited('init', this, [options]);
  2207. this.$el.addClass('pageView');
  2208. Utils.errorProtect(this, ['render', 'getTitle', 'getContent']);
  2209. },
  2210. /**
  2211. * Return a boolean to the caller indicating whether this view is dirty (ie edited)
  2212. * Glass uses this value to display a * in the switcher and confirm closing
  2213. * Content views should override this and provide an appropriate boolean when called
  2214. * @returns {Boolean} is dirty flag.
  2215. */
  2216. isDirty: function isDirty() {
  2217. return false;
  2218. },
  2219. /**
  2220. * Render is the main function of the Content View. Content Views should implement (override) the render
  2221. * method to populate this.el with the appropriate HTML. Render should always return this as a promise
  2222. * to allow chaining of calls.
  2223. *
  2224. * Errors occurring within the contentView should be handled by rejecting the promise with an error object as follows:
  2225. * {
  2226. * "status": "notFound" or "noCapability" or "noPermission"
  2227. * "message": Localized error message. Note: Optional if an applicable status is supplied since glass will supply one accordingly
  2228. *
  2229. * }
  2230. * @returns (Promise)
  2231. */
  2232. render: function render() {
  2233. return Promise.resolve(this);
  2234. },
  2235. /**
  2236. * Content views should override this and provide a meaningful title
  2237. * which will be used to display in the browser's title area
  2238. * @returns {String} The title of this content view.
  2239. */
  2240. getTitle: function getTitle() {
  2241. if (this.module) {
  2242. var moduleTokens = this.module.split('/');
  2243. return moduleTokens[moduleTokens.length - 1];
  2244. } else {
  2245. return this.glassContext.currentAppView.perspective;
  2246. }
  2247. },
  2248. /**
  2249. * Content views can override this and provide a snapshot of it's state
  2250. * @returns {Object} A cloneable object containing state for this contentView.
  2251. */
  2252. getContent: function getContent() {
  2253. return {};
  2254. },
  2255. /**
  2256. * Set the focus to an element within the view.
  2257. * Sub classes should override this method as required
  2258. * @Default sets focus to first tabbable element in this view if one exists
  2259. * @public
  2260. */
  2261. setFocus: function setFocus() {
  2262. var $tabs = this.$el.find(':tabbable:first');
  2263. if ($tabs.length > 0) {
  2264. $tabs.focus();
  2265. }
  2266. }
  2267. });
  2268. return ContentView;
  2269. });
  2270. //# sourceMappingURL=ContentView.js.map
  2271. ;
  2272. /**
  2273. * Licensed Materials - Property of IBM
  2274. *
  2275. * IBM Cognos Products: BI Glass
  2276. *
  2277. * Copyright IBM Corp. 2016, 2018
  2278. *
  2279. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  2280. */
  2281. define('baglass/api/Context',[], function () {
  2282. 'use strict'; //NOSONAR: Meant to be strict
  2283. /**
  2284. * This class represents the Context passed by Cognos Analytics to third party providers.
  2285. *
  2286. */
  2287. var NO_LOGGER_DEFINED = 'There is no logged part of this context. Logs generated in the console log.';
  2288. /**
  2289. * Constructor that is used make a shallow copy of the GlassContext to only include the
  2290. * logger and a public means to open a perspective.
  2291. * @private
  2292. */
  2293. var Context = function Context(options) {
  2294. if (options.getCoreSvc) {
  2295. this.logger = options.getCoreSvc('.Logger');
  2296. } else {
  2297. console.info(NO_LOGGER_DEFINED);
  2298. }
  2299. try {
  2300. this._openPerspective = options.appController.openAppView.bind(options.appController);
  2301. } catch (err) {
  2302. if (this.logger) {
  2303. this.logger.error(err);
  2304. } else {
  2305. console.error(err);
  2306. }
  2307. }
  2308. };
  2309. /**
  2310. *Opens a factory or custom perspective with given options.
  2311. *@public
  2312. *@param {String} [name] - Name of the perspective to open.
  2313. *@param {Object} [options] - Options with which to open the perspective.
  2314. *@returns {Object} The supplied or new object injected with the glassContext.
  2315. */
  2316. Context.prototype.openPerspective = function (name, options) {
  2317. return new Promise(function (resolve, reject) {
  2318. this._openPerspective(name, options).then(resolve, reject);
  2319. }.bind(this));
  2320. };
  2321. return Context;
  2322. });
  2323. //# sourceMappingURL=Context.js.map
  2324. ;
  2325. /**
  2326. * Licensed Materials - Property of IBM
  2327. *
  2328. * IBM Cognos Products: BI Glass
  2329. *
  2330. * Copyright IBM Corp. 2016, 2018
  2331. *
  2332. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  2333. */
  2334. define('baglass/api/ExtensionViewAdaptor',['../app/ContentView', 'jquery', 'underscore', '../core-client/js/core-client/utils/ClassFactory', './Context'], function (BaseContentView, $, _, classFactory, Context) {
  2335. /**
  2336. * 2.0 ExtensionView adaptor
  2337. *
  2338. */
  2339. var ContentView = BaseContentView.extend({
  2340. init: function init(options) {
  2341. this.content = options;
  2342. this.glassContext = options.glassContext;
  2343. this.displayInfo = {};
  2344. this.shallowContext = new Context(this.glassContext);
  2345. ContentView.inherited('init', this, arguments);
  2346. },
  2347. createView: function createView() {
  2348. var _this = this;
  2349. return new Promise(function (resolve, reject) {
  2350. classFactory.instantiate(_this.type, {}).done(function (view) {
  2351. Object.assign(view, _this.content);
  2352. delete _this.content;
  2353. _this.view = view;
  2354. _this.bindToView(view);
  2355. resolve(view);
  2356. }).fail(function (error) {
  2357. return reject({
  2358. msg: 'Internal error: unable to create content View ' + _this.type,
  2359. causedBy: error
  2360. });
  2361. });
  2362. });
  2363. },
  2364. bindToView: function bindToView(view) {
  2365. view.login = this.login.bind(this);
  2366. view.signin = this.signin.bind(this);
  2367. },
  2368. callViewOpen: function callViewOpen(view) {
  2369. var _this2 = this;
  2370. if (this.view && _.isFunction(this.view.open)) {
  2371. return view.open(this.shallowContext, this.options).then(function (eRoot) {
  2372. _this2.$el.empty().append($(eRoot));
  2373. _this2.displayInfo = _this2._proxyMethod('getDisplayInfo') || {};
  2374. _this2.show();
  2375. return _this2;
  2376. });
  2377. } else {
  2378. return Promise.reject({
  2379. msg: 'Internal error: content view open method not implemented for ' + this.type
  2380. });
  2381. }
  2382. },
  2383. doRender: function doRender() {
  2384. var _this3 = this;
  2385. return this.createView().then(function (view) {
  2386. return _this3.callViewOpen(view);
  2387. });
  2388. },
  2389. render: function render() {
  2390. return this.doRender();
  2391. },
  2392. /**
  2393. * performs a login; returns a jquery promise for backward
  2394. *
  2395. * @public
  2396. * @deprecated since R6
  2397. * @param {Object[]} loginPrompts - object containing the login prompts
  2398. * @param {string} loginPrompts[].name - name of the login prompt
  2399. * @param {string} loginPrompts[].value - value of the login prompt
  2400. * @return {Promise} promise resolved when the login is successful, rejected when it fails,
  2401. *
  2402. */
  2403. login: function login(loginPrompts) {
  2404. var dfd = $.Deferred();
  2405. this.signin(loginPrompts).then(function () {
  2406. dfd.resolve();
  2407. }).catch(function (error) {
  2408. dfd.reject(dfd, error.jqXHR);
  2409. });
  2410. return dfd.promise();
  2411. },
  2412. /**
  2413. * @typedef {Object} LoginError
  2414. * @property {string} message - error message
  2415. */
  2416. /**
  2417. * stub for signin - required to overriden by inherited class
  2418. *
  2419. * @public
  2420. * @param {Object[]} loginPrompts - object containing the login prompts
  2421. * @param {string} loginPrompts[].name - name of the login prompt
  2422. * @param {string} loginPrompts[].value - value of the login prompt
  2423. * @return {Promise<undefined|LoginError>} - promise resolved with no object when the login is successful, rejected with an error when it fails,
  2424. *
  2425. */
  2426. signin: function
  2427. /* loginPrompts */
  2428. signin() {},
  2429. show: function show() {
  2430. this._proxyMethod('onShow');
  2431. },
  2432. deactivate: function deactivate() {
  2433. this._proxyMethod('onHide');
  2434. },
  2435. getTitle: function getTitle() {
  2436. return this.displayInfo.title || '';
  2437. },
  2438. getIcon: function getIcon() {
  2439. return this.displayInfo.icon || '';
  2440. },
  2441. getContent: function getContent() {
  2442. return this._proxyMethod('getContent') || {};
  2443. },
  2444. remove: function remove() {
  2445. this._proxyMethod('close');
  2446. },
  2447. _proxyMethod: function _proxyMethod(method, args) {
  2448. if (this.view && _.isFunction(this.view[method])) {
  2449. return this.view[method](args);
  2450. } else {
  2451. this.glassContext.getCoreSvc('.Logger').warn('method not implemented', method);
  2452. }
  2453. }
  2454. });
  2455. return ContentView;
  2456. });
  2457. //# sourceMappingURL=ExtensionViewAdaptor.js.map
  2458. ;
  2459. /*
  2460. *+------------------------------------------------------------------------+
  2461. *| Licensed Materials - Property of IBM
  2462. *| IBM Cognos Products: Content Explorer
  2463. *| (C) Copyright IBM Corp. 2016, 2018
  2464. *|
  2465. *| US Government Users Restricted Rights - Use, duplication or disclosure
  2466. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  2467. *+------------------------------------------------------------------------+
  2468. */
  2469. define('baglass/api/IFrameOpener',['../core-client/js/core-client/ui/core/Class', 'jquery', 'underscore'], function (BaseClass, $, _) {
  2470. 'use strict'; //NOSONAR: Meant to be strict
  2471. var IFrameOpener = BaseClass.extend({
  2472. /**
  2473. * @classdesc class to open an IFrame
  2474. * @constructs IFrameOpener
  2475. * @public
  2476. * @param {options}
  2477. * options.id - unique id
  2478. * options.content.url - url to be loaded in IFrame
  2479. * options.content.title - label to be used in perspective switcher
  2480. */
  2481. init: function init(options) {
  2482. IFrameOpener.inherited('init', this, arguments);
  2483. $.extend(this, options);
  2484. },
  2485. onSelectItem: function onSelectItem(context) {
  2486. this.onPress(context);
  2487. },
  2488. /**
  2489. * Keyboard press handler to open IFrame.
  2490. *
  2491. * @public
  2492. * @param {object} context-glass context
  2493. */
  2494. onPress: function onPress(context) {
  2495. return new Promise(function (resolve, reject) {
  2496. try {
  2497. context.glassContext.openAppView('generic_iframe', this._buildPayload(context)).then(resolve, reject);
  2498. } catch (error) {
  2499. context.glassContext.getCoreSvc('.Logger').error(error);
  2500. reject(error);
  2501. }
  2502. }.bind(this));
  2503. },
  2504. _buildPayload: function _buildPayload(context) {
  2505. var options = this._getOptions(context);
  2506. return {
  2507. content: {
  2508. id: options.id,
  2509. url: options.url,
  2510. title: options.title
  2511. }
  2512. };
  2513. },
  2514. _getOptions: function _getOptions(context) {
  2515. var options = {};
  2516. if (this._isValidContext(context)) {
  2517. var _itemSpec = context.target.plugin.itemSpec;
  2518. if (this._isItMenuItem(context) === true) {
  2519. var selectedItemIndex = context.target.specItemIndex;
  2520. var item = _itemSpec.items[selectedItemIndex];
  2521. options = _.pick(item.options, 'url', 'title');
  2522. options.id = this._getID(item);
  2523. } else if (this._isItButton(context) === true) {
  2524. options = _.pick(_itemSpec.options, 'url', 'title');
  2525. options.id = this._getID(_itemSpec);
  2526. }
  2527. if (_.isUndefined(options.url)) {
  2528. $.extend(options, this.getOptionsFromid(context, options.id));
  2529. }
  2530. return options;
  2531. }
  2532. },
  2533. _isValidContext: function _isValidContext(context) {
  2534. return context && context.target && context.target.plugin && context.target.plugin.itemSpec;
  2535. },
  2536. _getID: function _getID(itemSpec) {
  2537. return itemSpec.id ? btoa(itemSpec.id + itemSpec.options.url) : btoa(itemSpec.options.url);
  2538. },
  2539. getOptionsFromid: function getOptionsFromid(context, id) {
  2540. try {
  2541. var plugin = context.glassContext.findElement(id);
  2542. return plugin.options;
  2543. } catch (e) {
  2544. return {};
  2545. }
  2546. },
  2547. _isItMenuItem: function _isItMenuItem(context) {
  2548. return context.target.specItemIndex !== undefined && context.target.plugin.itemSpec.items.length > 0 && context.target.plugin.itemSpec.items[context.target.specItemIndex].options !== undefined;
  2549. },
  2550. _isItButton: function _isItButton(context) {
  2551. return context.target.plugin.itemSpec.options !== undefined;
  2552. }
  2553. });
  2554. return IFrameOpener;
  2555. });
  2556. //# sourceMappingURL=IFrameOpener.js.map
  2557. ;
  2558. /**
  2559. * Licensed Materials - Property of IBM
  2560. *
  2561. * IBM Cognos Products: BI Glass
  2562. *
  2563. * Copyright IBM Corp. 2019
  2564. *
  2565. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  2566. */
  2567. define('baglass/api/View',[], function () {
  2568. 'use strict'; //NOSONAR: Meant to be strict
  2569. /**
  2570. * This class provides a means to declare a content View for a perspective
  2571. * It plays the role of an interface, consumer can implement it.
  2572. *
  2573. * @interface
  2574. */
  2575. var ContentView = function ContentView() {
  2576. /**
  2577. * Called when this view is created
  2578. *
  2579. * @public
  2580. * @param {context} context.logger - logger utility
  2581. * @param {options} custom options for this particular instance
  2582. * @returns {Promise} promise resolved to the root DOM element for this view.
  2583. */
  2584. this.open = function () {};
  2585. /**
  2586. * Called when this view is destroyed
  2587. *
  2588. * @public
  2589. */
  2590. this.close = function () {};
  2591. /**
  2592. * Called whenever this view is shown
  2593. *
  2594. * @public
  2595. */
  2596. this.onShow = function () {};
  2597. /**
  2598. * Called whenever this view is hidden
  2599. *
  2600. * @public
  2601. */
  2602. this.onHide = function () {};
  2603. /**
  2604. * Called whenever display Info is required for this view
  2605. *
  2606. * @public
  2607. * @returns {Object} displayInfo - The displayInfo for this view.
  2608. * @returns {string} displayInfo.title - The title.
  2609. * @returns {string} displayInfo.icon - The icon.
  2610. */
  2611. this.getDisplayInfo = function () {};
  2612. };
  2613. return ContentView;
  2614. });
  2615. //# sourceMappingURL=View.js.map
  2616. ;
  2617. /**
  2618. * Licensed Materials - Property of IBM
  2619. * IBM Cognos Products: BI Glass
  2620. * (C) Copyright IBM Corp. 2015, 2017
  2621. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  2622. */
  2623. define('baglass/api/all',['./ActionInterface', './ExtensionViewAdaptor', './IFrameOpener', './View'], function () {});
  2624. //# sourceMappingURL=all.js.map
  2625. ;
  2626. /**
  2627. * Licensed Materials - Property of IBM
  2628. *
  2629. * IBM Cognos Products: BI Glass
  2630. *
  2631. * Copyright IBM Corp. 2015, 2017
  2632. *
  2633. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  2634. */
  2635. define('baglass/nls/BAGlassResources',{
  2636. "root": true,
  2637. "cs": true,
  2638. "da": true,
  2639. "de": true,
  2640. "es": true,
  2641. "fi": true,
  2642. "fr": true,
  2643. "hr": true,
  2644. "hu": true,
  2645. "it": true,
  2646. "ja": true,
  2647. "kk": true,
  2648. "ko": true,
  2649. "no": true,
  2650. "nb": true,
  2651. "nl": true,
  2652. "pl": true,
  2653. "pt": true,
  2654. "pt-br": true,
  2655. "ro": true,
  2656. "ru": true,
  2657. "sl": true,
  2658. "sv": true,
  2659. "th": true,
  2660. "tr": true,
  2661. "zh": true,
  2662. "zh-cn": true,
  2663. "zh-tw": true
  2664. });
  2665. //# sourceMappingURL=BAGlassResources.js.map
  2666. ;
  2667. /**
  2668. * Licensed Materials - Property of IBM
  2669. *
  2670. * IBM Cognos Products: BI Glass
  2671. *
  2672. * Copyright IBM Corp. 2018, 2019
  2673. *
  2674. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  2675. */
  2676. define('baglass/nls/root/BAGlassResources',{
  2677. "signInButtonText": "Sign in",
  2678. "userPlaceholder": "Username",
  2679. "passPlaceholder": "Password",
  2680. "nsPlaceholder": "Namespace",
  2681. "anonymousLoginFail": "Failed to open session as Anonymous",
  2682. "retrieveInstallInfoErrorTitle": "Installation Information Error",
  2683. "retrieveInstallInfoErrorMsg": "A failure occurred while retrieving the installation environment. Some features may not be available. The root cause is the following: %{reason}",
  2684. "selectNamespace": "Select Namespace",
  2685. "connectAnonymously": "Connect anonymously",
  2686. "CAInitTitle": "CA Initialization Information",
  2687. "CALoginAuthError": "CA Login Authentication Error",
  2688. "unableSetSSOURL": "unable to set up SSO URL",
  2689. "unableGetInstallInfo": "Unable to get CA install information",
  2690. "loginInfoTitle": "CA Login Information",
  2691. "loginInProgress": "Logging in",
  2692. "loginSuccess": "Login Successful",
  2693. "unableLogin": "Cannot login",
  2694. "invalidLogin": "The provided credentials are invalid. Please type your credentials for authentication.",
  2695. "unableGetAccountInfo": "Cannot get user's account information!",
  2696. "accountInfoTitle": "Account Information Error",
  2697. "credentialSubmitError": "Error submitting login credentials",
  2698. "invalidLoginResponse": "Invalid login response",
  2699. "CAMPromptInfoMissing": "Error retrieving CAM PromptInfo Response",
  2700. "CAMMessagesMissing": "Error retrieving CAM Messages Response",
  2701. "changePassword": "Change Password",
  2702. "newPasswordsDoNotMatch": "The new passwords you entered do not match. Please retype the new password in both text boxes.",
  2703. "loginLegalText": "Licensed Materials - Property of IBM Corp. © Copyright IBM Corporation and other(s) 2005, %{fullYear}. IBM, the IBM logo, ibm.com and Cognos are trademarks or registered trademarks of International Business Machines Corp., registered in many jurisdictions worldwide.",
  2704. "legalText": "Licensed Materials - Property of IBM Corp. © Copyright IBM Corporation and other(s) 2005, %{fullYear}. IBM, the IBM logo, ibm.com and Cognos are trademarks or registered trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. A current list of IBM trademarks is available on the Web at www.ibm.com/legal/copytrade.shtml. This Program is licensed under the terms of the license agreement accompanying the Program. This license agreement may be either located in a Program directory folder or library identified as \"License\" or \"Non_IBM_License\", if applicable, or provided as a printed license agreement. Please read the agreement carefully before using the Program. By using the Program you agree to these terms.",
  2705. "CAMNamespaceDisplayName": "Sign in with your %{promptValue} ID",
  2706. "customLoginPerspectiveNotFound": "The custom sign-in view could not be found",
  2707. "defaultToIBMLoginPage": "The custom sign-in view is not available. The default sign-in view is displayed instead.",
  2708. "errorRetrievePerspectiveURL": "Error retrieving perspective: %{url}",
  2709. "CAMUserNameForDisplay": "User ID: %{promptValue}",
  2710. "genericPrompt": "%{promptName} %{promptValue}",
  2711. "errLoadingView": "Unable to load requested view.",
  2712. "errLoadingViewShowHome": "Unable to load requested view. Displaying home view instead.",
  2713. "productName": "IBM Cognos Analytics %{version}",
  2714. "version": "Version",
  2715. "myPreferences": "My preferences",
  2716. "skin": "Style",
  2717. "showHiddenObjects": "Show hidden entries",
  2718. "format": "Report format",
  2719. "accessibilityFeatures": "Turn on accessibility features",
  2720. "displayMode": "Default view",
  2721. "productLocale": "Product language",
  2722. "contentLocale": "Content language",
  2723. "biDirectionalFeaturesEnabled": "Bidirectional language support",
  2724. "baseTextDirection": "Base direction for text",
  2725. "portal": "Portal",
  2726. "regionalOptions": "Options for your region",
  2727. "timeZoneID": "Time zone",
  2728. "email": "Email",
  2729. "homePage": "Home page",
  2730. "defaultHome": "Default",
  2731. "resetHome": "Reset to default",
  2732. "homeSet": "Your home was set successfully",
  2733. "homeSetError": "An error occurred setting the default home page, try closing and reopening this view.",
  2734. "resetHomeSuccess": "You have successfully reset your home to default.",
  2735. "shareSetError": "This action cannot be performed before closing and reopening this view.",
  2736. "general": "General",
  2737. "personal": "Personal",
  2738. "nameSpace": "Namespace",
  2739. "userName": "User name",
  2740. "password": "Password",
  2741. "confirmPassword": "Confirm password",
  2742. "passwordChange": "Change your password",
  2743. "changePasswordTitle": "Change my password",
  2744. "showPassword": "Show password",
  2745. "oldPassword": "Old password",
  2746. "newPassword": "New password",
  2747. "confirmNewPassword": "Confirm new password",
  2748. "passwordMatch": "Password match",
  2749. "passwordNotMatch": "Oops, password does not match",
  2750. "wrongPassword": "Unable to authenticate",
  2751. "updatePWUnknownError": "Unable to update password",
  2752. "passWordChangeSuccess": "You have successfully changed your password",
  2753. "advanced": "Advanced",
  2754. "credentials": "Credentials",
  2755. "credentialCreate": "Create",
  2756. "credentialCreateSuccess": "You have successfully created your credentials",
  2757. "credentialChange": "Renew",
  2758. "credentialRenewed": "Your credentials were renewed with your current user ID and password.",
  2759. "myCredentials": "My credentials",
  2760. "myCapabilities": "My capabilities",
  2761. "viewDetails": "View details",
  2762. "manage": "Manage",
  2763. "dataSourceCredentials": "Data server credentials",
  2764. "groupsAndRoles": "Groups and roles",
  2765. "welcome": "Welcome",
  2766. "welcomeMsg": "Welcome to %{brandName}",
  2767. "samples": "Sample content to explore",
  2768. "sampleName1": "Call Activity and Win Plans",
  2769. "sampleName2": "Product Line Dashboard",
  2770. "welcomeGetStarted": "Get started with a tour of the new interface and see what is new and exciting",
  2771. "submit": "Submit",
  2772. "companionApps": "Companion applications",
  2773. "analysisStudio": "Analysis Studio",
  2774. "dashboardConsole": "Workspace",
  2775. "drillThrough": "Drill-Through definitions",
  2776. "eventStudio": "Event Studio",
  2777. "queryStudio": "Query Studio",
  2778. "metricsManager": "Metrics Manager",
  2779. "powerplayStudio": "PowerPlay Studio",
  2780. "controller": "Controller",
  2781. "contributor": "Contributor",
  2782. "metricStudio": "Studio",
  2783. "metricsFileImportTask": "New Import from Files",
  2784. "metricsMaintenanceTask": "New Maintenance",
  2785. "metricsExportTask": "New Export",
  2786. "metricsPackage": "New Package",
  2787. "ok": "OK",
  2788. "html": "HTML",
  2789. "pdf": "PDF",
  2790. "spreadsheetML": "Excel",
  2791. "xlsxData": "Excel Data",
  2792. "csv": "CSV",
  2793. "cancel": "Cancel",
  2794. "rtl": "Right-to-left",
  2795. "ltr": "Left-to-right",
  2796. "contextual": "Contextual",
  2797. "showAll": "Show all",
  2798. "showUnread": "Show unread",
  2799. "hideAll": "Hide all",
  2800. "showHints": "Show hints",
  2801. "defaultCompleteMessage": "Operation completed.",
  2802. "defaultProgressMessage": "Operation in progress...",
  2803. "defaultFailMessage": "Operation failed.",
  2804. "defaultIndefiniteMessage": "Operation in progress...",
  2805. "defaultPauseMessage": "Operation paused.",
  2806. "progressHideBtn": "Hide",
  2807. "coachMarkLabel": "Learn more about - %{title}",
  2808. "coachMarkTurnOffHints": "Turn off hints",
  2809. "coachMarkClose": "Close",
  2810. "secondaryWelcomeMsg": "Get started by opening a report, dashboard, or story!",
  2811. "invalidHomePageTitle": "The home page cannot be retrieved. Click OK to reset the home page to the Welcome page.",
  2812. "unsavedViewsMsg": "You have work that has not been saved:",
  2813. "unsavedViewMsg1": "Close the view?",
  2814. "unsavedViewMsg2": "You have unsaved changes that will be lost if you don’t save them first.",
  2815. "unsavedViewMsg3": "Close without saving",
  2816. "errorLabel": "Error",
  2817. "unknownError": "An unknown error occurred trying to view the requested resource.",
  2818. "notFound": "The requested resource cannot be retrieved. It might have been deleted or renamed.",
  2819. "noCapability": "You do not have the capability to view the requested resource.",
  2820. "noPermission": "You do not have sufficient privileges to view the requested resource.",
  2821. "knowledgeCenterErrorTitle": "The link to Knowledge Center didn't work",
  2822. "knowledgeCenterErrorMessage": "Try again. If the problem persists, contact your administrator.",
  2823. "communityErrorTitle": "The link to the community didn't work",
  2824. "communityErrorMessage": "Try again. If the problem persists, contact your administrator.",
  2825. "close": "Close",
  2826. "info": "Info",
  2827. "warning": "Warning",
  2828. "error": "Error",
  2829. "success": "Success",
  2830. "defaultSlideoutLabel": "Slideout",
  2831. "legacyAppsSlideoutLabel": "Available Legacy Applications",
  2832. "myPreferencesSlideoutLabel": "My Preferences",
  2833. "pinSlideout": "Pin Slideout",
  2834. "unpinSlideout": "Unpin Slideout",
  2835. "paginationControl": "Open Collapsed Slideout(s)",
  2836. "openPerspectiveFailed": "Failed to open %{name}",
  2837. "untitled": "Untitled",
  2838. "invalidPerspectiveErrorTitle": "Invalid perspective name",
  2839. "invalidPerspectiveErrorMessage": "Perspective name cannot contain '/' or '.'",
  2840. "perspective404ErrorTitle": "Perspective not available",
  2841. "perspective404ErrorMessage": "The perspective name at the end of the URL is not available. Please try again, using a valid perspective name.",
  2842. "perspective404HomeErrorMessage": "The home perspective name at the end of the URL is not available. Please check if a valid extension exists and try again.",
  2843. "log_level_Error": "Error",
  2844. "log_level_Warn": "Warning",
  2845. "log_level_Info": "Information",
  2846. "log_level_Debug": "Debug",
  2847. "logging_level": "Logging level:",
  2848. "logging_active": "Logging is on:",
  2849. "logging_config_description": "Logging is used for troubleshooting. Consult your administrator for guidance on settings.",
  2850. "logging_congfig_title": "Logging",
  2851. "manageLogging": "Logging",
  2852. "loggingConfigurationSlideoutA11yLabel": "Logging Configuration",
  2853. "validationControl": "Show validation information",
  2854. "previewDialogTitle": "Preview",
  2855. "error404NotFound": "The asset that you want to open is not available. You might not have the required permissions to access it, or it might be deleted or disabled.",
  2856. "website": "Website",
  2857. "unavailable": "Unavailable",
  2858. "offlineErrorTitle": "Trying to reconnect",
  2859. "offlineErrorMessage": "There seems to be a network problem. Please wait while we try to reconnect or check your network connection and try again",
  2860. "refreshButton": "Refresh",
  2861. "shareDialogTitle": "Share",
  2862. "shareDialogCodeLabel": "Share URL",
  2863. "shareDialogText": "Copy this link to share this content with other users.",
  2864. "embedDialogTitle": "Embed",
  2865. "embedDialogCodeLabel": "Embed code",
  2866. "embedDialogText": "Copy this code to embed.",
  2867. "embedURLWidthLabel": "Width:",
  2868. "embedURLHeightLabel": "Height:",
  2869. "embedURLWidth": "Width",
  2870. "embedURLHeight": "Height",
  2871. "copyText": "Copy",
  2872. "bypassBlockButtonTitle": "Skip to content",
  2873. "cannotOpenLocation": "Invalid URL detected",
  2874. "invalidUrl": "A request to navigate the browser to a new location has been denied. Reload Application?"
  2875. });
  2876. /**
  2877. * Licensed Materials - Property of IBM
  2878. * IBM Business Analytics (C) Copyright IBM Corp. 2017
  2879. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  2880. */
  2881. define('baglass/core-client/js/core-client/utils/Lexicon',['../ui/core/Class', 'jquery', 'polyglot'], function (Class, $, Polyglot) {
  2882. var Lexicon = Class.extend({
  2883. /**
  2884. *constructor
  2885. *@param {options} with data and verbose = {true|false}
  2886. */
  2887. init: function init(options) {
  2888. $.extend(true, this, options);
  2889. this._polyglot = new Polyglot({ phrases: this.data });
  2890. },
  2891. /**
  2892. * Translates a key in the current locale
  2893. * @param key message key
  2894. * @param interpolation key-value pairs for interpolation
  2895. */
  2896. translate: function translate(key, interpolation) {
  2897. var translated = this._polyglot.t(key, interpolation);
  2898. if (this.verbose) {
  2899. if (translated === key) {
  2900. translated = Lexicon.NOT_TRANSLATED + '(' + key + ')';
  2901. }
  2902. }
  2903. return translated;
  2904. }
  2905. });
  2906. Lexicon.NOT_TRANSLATED = '__NOT_TRANSLATED__';
  2907. return Lexicon;
  2908. });
  2909. //# sourceMappingURL=Lexicon.js.map
  2910. ;
  2911. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  2912. /**
  2913. * Licensed Materials - Property of IBM
  2914. *
  2915. * IBM Cognos Products: BI Glass
  2916. *
  2917. * Copyright IBM Corp. 2015, 2018
  2918. *
  2919. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  2920. */
  2921. (function (root, factory) {
  2922. if (typeof define === 'function' && define.amd) {
  2923. define('baglass/nls/StringResources',['i18n!./BAGlassResources', '../core-client/js/core-client/utils/Lexicon'], factory);
  2924. } else if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) === 'object') {
  2925. module.exports = factory(require('i18n!./BAGlassResources'), require('../core-client/js/core-client/utils/Lexicon'));
  2926. } else {
  2927. root.Requester = factory(root.BAGlassResources, root.Lexicon);
  2928. }
  2929. })(void 0, function (BAGlassResources, Lexicon) {
  2930. var lexicon = new Lexicon({
  2931. data: BAGlassResources,
  2932. allowMissing: true,
  2933. verbose: false
  2934. });
  2935. return {
  2936. /**
  2937. * Get the string resource for the given key and interpolation options
  2938. *
  2939. * @param key The key of the string to return
  2940. * @param interpolationOptions Optional interpolation options (see poly.t documentation for details)
  2941. * @returns The string to display
  2942. */
  2943. get: function get(key, interpolationOptions) {
  2944. var translated = lexicon.translate(key, interpolationOptions);
  2945. if (translated !== key) {
  2946. return translated;
  2947. }
  2948. return "".concat(Lexicon.NOT_TRANSLATED, "(").concat(key, ")");
  2949. }
  2950. };
  2951. });
  2952. //# sourceMappingURL=StringResources.js.map
  2953. ;
  2954. /**
  2955. * Licensed Materials - Property of IBM
  2956. * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2017
  2957. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  2958. */
  2959. /**
  2960. * This class provides the base error class. It must have a message, the caused
  2961. * by and error code are optional.
  2962. */
  2963. define('baglass/core-client/js/core-client/errors/BaseError',['../ui/core/Class', 'underscore'], function (Class, _) {
  2964. var BaseError = Class.extend(
  2965. /**
  2966. * @lends BaseError.prototype
  2967. */
  2968. {
  2969. /**
  2970. * @classdesc Class defining a base error; it extends the JavaScript Error
  2971. * @constructs
  2972. * @public
  2973. * @param {String} message - message of the error
  2974. * @param {Error|String|Object} [causedBy] - cause of the error; can be an error, a string or a object with a message property; if the object does not contain
  2975. * a message property it is considered as additionalInfo
  2976. * @param {Object} [additionalInfo] - JSON objects with additional info; title or code for example
  2977. * @example
  2978. * Error with message only:
  2979. * new BaseError('some error');
  2980. *
  2981. * Error with message and cause as a string:
  2982. * new BaseError('some error', 'some cause');
  2983. *
  2984. * Error with message and additional info
  2985. * new BaseError('some error', {title: 'Network Error'});
  2986. *
  2987. */
  2988. init: function init(message, causedBy, additionalInfo) {
  2989. var error = Error.apply(this, arguments);
  2990. this.name = 'BaseError';
  2991. this.message = message || 'Error';
  2992. if (this._isValidCause(causedBy)) {
  2993. this.causedBy = causedBy;
  2994. this._setAdditionalInfo(additionalInfo);
  2995. } else {
  2996. this._setAdditionalInfo(causedBy);
  2997. }
  2998. if (error.stack) {
  2999. this.stack = error.stack;
  3000. }
  3001. },
  3002. /**
  3003. * Serializes the error as a string
  3004. * @public
  3005. */
  3006. toString: function toString() {
  3007. var str = this.name + ': ' + this.message;
  3008. _.each(_.keys(this).sort(), function (key) {
  3009. if (key !== 'name' && key !== 'causedBy' && key !== 'message' && key !== 'stack') {
  3010. str += '\n' + key + ': ' + this[key];
  3011. }
  3012. }.bind(this));
  3013. if (this.causedBy) {
  3014. str += '\nCaused by: ' + this.causedBy;
  3015. }
  3016. return str;
  3017. },
  3018. _isValidCause: function _isValidCause(causedBy) {
  3019. return causedBy instanceof Error || _.isString(causedBy) || _.isObject(causedBy) && causedBy.message;
  3020. },
  3021. _setAdditionalInfo: function _setAdditionalInfo(additionalInfo) {
  3022. if (_.isObject(additionalInfo)) {
  3023. _.extend(this, additionalInfo);
  3024. }
  3025. }
  3026. });
  3027. return BaseError;
  3028. });
  3029. //# sourceMappingURL=BaseError.js.map
  3030. ;
  3031. /**
  3032. * Licensed Materials - Property of IBM
  3033. * IBM Cognos Products: BI
  3034. * (C) Copyright IBM Corp. 2015, 2019
  3035. * US Government Users Restricted Rights - Use, duplication or disclosure
  3036. * restricted by GSA ADP Schedule Contract with IBM Corp.
  3037. */
  3038. define('baglass/api/Url',['jquery', 'underscore', '../utils/Utils', 'jquery-bbq'], function ($, _, GlassUtils) {
  3039. var urlApi = function urlApi() {};
  3040. $.extend(urlApi.prototype, {
  3041. URL_EMBED_API: [{
  3042. key: 'closeWindowOnLastView',
  3043. values: [true],
  3044. getValue: function getValue(key, value, isEmbed) {
  3045. return isEmbed === true ? true : value;
  3046. },
  3047. preserveInUrl: true
  3048. }, {
  3049. key: 'ui_appbar',
  3050. values: [false],
  3051. getValue: function getValue(key, value, isEmbed) {
  3052. return isEmbed === true ? false : value;
  3053. },
  3054. preserveInUrl: true
  3055. }, {
  3056. key: 'ui_navbar',
  3057. values: [false],
  3058. getValue: function getValue(key, value, isEmbed) {
  3059. return isEmbed === true ? false : value;
  3060. },
  3061. preserveInUrl: true
  3062. }, {
  3063. key: 'shareMode',
  3064. values: ['embedded'],
  3065. getValue: function getValue(key, value, isEmbed) {
  3066. return isEmbed === true ? 'embedded' : undefined;
  3067. }
  3068. }, {
  3069. key: 'productLocale',
  3070. preserveInUrl: true
  3071. }],
  3072. URL_API: [{
  3073. key: 'perspective'
  3074. }, {
  3075. key: 'pathRef'
  3076. }, {
  3077. key: 'factoryMode',
  3078. values: [true],
  3079. getValue: function getValue(key, value
  3080. /*, isEmbed */
  3081. ) {
  3082. if (value === undefined) {
  3083. return GlassUtils.isFactoryMode();
  3084. } else {
  3085. return value;
  3086. }
  3087. }
  3088. }, {
  3089. //Currently used for cacheID
  3090. key: 'id'
  3091. }, {
  3092. key: 'nextgen3p'
  3093. }, {
  3094. key: 'prefetchsvc'
  3095. }, {
  3096. key: 'appcue'
  3097. }],
  3098. ENDPOINT_PATHS: {
  3099. objRef: 'v1/objects',
  3100. pathRef: 'v1/path',
  3101. searchPathRef: 'v1/search_path'
  3102. },
  3103. _getUrlPath: function _getUrlPath() {
  3104. return location.origin + location.pathname.split(/[?#]/)[0];
  3105. },
  3106. /**
  3107. * encodes the characters that are not encoded by bbq according to rfc-3986
  3108. * also encodes extra characters
  3109. * @private
  3110. * @param {String} queryParam - query string
  3111. * @return {String} completed encoded query string
  3112. */
  3113. _completeURIEncoding: function _completeURIEncoding(queryParams) {
  3114. var fullyEncoded = queryParams.replace(/[!'()*~]/g, function (char) {
  3115. var encoded = '';
  3116. switch (char) {
  3117. case '!':
  3118. encoded = '%21';
  3119. break;
  3120. case '\'':
  3121. encoded = '%27';
  3122. break;
  3123. case '(':
  3124. encoded = '%28';
  3125. break;
  3126. case ')':
  3127. encoded = '%29';
  3128. break;
  3129. case '*':
  3130. encoded = '%2A';
  3131. break;
  3132. case '~':
  3133. encoded = '%7E';
  3134. break;
  3135. default:
  3136. encoded = char;
  3137. break;
  3138. }
  3139. return encoded;
  3140. });
  3141. return fullyEncoded;
  3142. },
  3143. /**
  3144. * build a url for a given resource context
  3145. * @public
  3146. * @param {Object} context - The resource context.
  3147. * @param {Object} context.urlMap - A map of key/value pairs to be converted into a queryString.
  3148. * @param {String} context.urlMap.perspective - Value representing the perspective for this resource. (Required)
  3149. * @param {String} context.urlMap.pathRef - Unique immutable key used to find the resource (Required when resource is persisted)
  3150. * @param {Boolean} context.isEmbed - Indicates whether this a Share or Embed Context. Defaults to false (ie Share).
  3151. * @param {Object} glassContext - context for the glass application
  3152. * @returns a url String representing the applicable resource
  3153. * @throws Will throw an error if context.urlMap is missing any required attributes (eg context.urlMap.perspective).
  3154. */
  3155. getUrl: function getUrl(context, glassContext) {
  3156. if (_.isUndefined(glassContext)) {
  3157. console.warn('The Glass Context is not being passed to the getUrl method. In the current usage of getUrl, the Glass Context should be passed as an argument --> getUrl(context, glassContext)');
  3158. }
  3159. var urlParms = this.getMap(context);
  3160. var urlEncoderService = glassContext && glassContext.getCoreSvc('.URLEncoder');
  3161. if (urlEncoderService) {
  3162. for (var item in urlParms) {
  3163. urlParms[item] = urlEncoderService.encodeQSValue(urlParms[item]);
  3164. }
  3165. }
  3166. var urlPath = this._getUrlPath();
  3167. var url = $.param.querystring(urlPath, urlParms); // eslint-disable-next-line
  3168. var queryParams = url.replace(/^([^\?]+)(\?.+)$/, '$2');
  3169. if (queryParams.indexOf('?') === 0) {
  3170. url = urlPath + this._completeURIEncoding(queryParams);
  3171. }
  3172. return url;
  3173. },
  3174. /**
  3175. * return only the public map for a given urlMap
  3176. * @public
  3177. * @param {Object} context - The resource context.
  3178. * @param {Object} context.urlMap - A map of key/value pairs to be inspected
  3179. * @param {String} context.urlMap.perspective - Value representing the perspective for this resource. (Required)
  3180. * @param {Boolean} context.isEmbed - Indicates whether this a Share or Embed context. Defaults to false (ie Share).
  3181. * @returns a clone of the supplied urlMap filtered by public keys
  3182. * @throws Will throw an error if context.urlMap is missing any required attributes (eg context.urlMap.perspective).
  3183. */
  3184. getPublicMap: function getPublicMap(context) {
  3185. //NOSONAR: necessary complexity
  3186. context = context || {};
  3187. var publicMap = {};
  3188. var urlParms = context.urlMap || {}; //Validate URL API Parms
  3189. $.each(this.URL_API, function (i, ruleObj) {
  3190. //NOSONAR: necessary complexity
  3191. var value = urlParms[ruleObj.key];
  3192. if (_.isFunction(value)) {
  3193. throw new Error('Value cannot be a function: ' + ruleObj.key);
  3194. }
  3195. if (ruleObj.required && !value) {
  3196. throw new Error('Missing required attribute: ' + ruleObj.key);
  3197. }
  3198. var _value = _.isFunction(ruleObj.getValue) ? ruleObj.getValue(ruleObj.key, value, context.isEmbed) : undefined;
  3199. value = !_.isUndefined(_value) ? _value : value;
  3200. if (!_.isUndefined(value) && (ruleObj.preserveInUrl || !ruleObj.values || ruleObj.values.indexOf(value) >= 0)) {
  3201. publicMap[ruleObj.key] = value;
  3202. }
  3203. }.bind(this));
  3204. return publicMap;
  3205. },
  3206. /**
  3207. * return the map for a given urlMap omitting unsupported public key values
  3208. * @public
  3209. * @param {Object} context - The resource context.
  3210. * @param {Object} context.urlMap - A map of key/value pairs to be inspected
  3211. * @param {String} context.urlMap.perspective - Value representing the perspective for this resource. (Required)
  3212. * @param {Boolean} context.isEmbed - Indicates whether this a Share or Embed context. Defaults to false (ie Share).
  3213. * @returns a clone of the supplied urlMap omitting unsupported keys
  3214. * @throws Will throw an error if context.urlMap is missing any required attributes (eg context.urlMap.perspective).
  3215. */
  3216. getMap: function getMap(context) {
  3217. context = context || {};
  3218. var publicParms = this.getPublicMap(context);
  3219. var publicKeys = _.pluck(urlApi.prototype.URL_API, 'key');
  3220. var privateParms = _.omit(context.urlMap, publicKeys);
  3221. $.each(privateParms, function (key, value) {
  3222. if (_.isFunction(value)) {
  3223. throw new Error('Value cannot be a function: ' + key);
  3224. }
  3225. });
  3226. return $.extend(publicParms, privateParms);
  3227. },
  3228. isAppBarVisible: function isAppBarVisible(urlMap) {
  3229. return !urlMap || urlMap.ui_appbar !== false;
  3230. },
  3231. /**
  3232. * get objInfo for pathRef
  3233. * @public
  3234. * @param {Object} glassContext - The glassContext.
  3235. * @param {String} pathRef - the path reference, unencoded
  3236. * @param {Array} fields - array of fields to be picked and returned
  3237. * @param {String} searchPath - the object search path reference, unencoded
  3238. * @returns the promise with the objInfo applicable to the given pathRef
  3239. */
  3240. getPathRefInfo: function getPathRefInfo(glassContext, pathRef, fields, searchPath) {
  3241. return this._getObjInfo(glassContext, this.ENDPOINT_PATHS['pathRef'] + '?path=' + encodeURIComponent(pathRef) + '&', fields, searchPath);
  3242. },
  3243. /**
  3244. * get objInfo for objRef
  3245. * @public
  3246. * @param {Object} glassContext - The glassContext.
  3247. * @param {String} objRef - the id reference, unencoded
  3248. * @param {Array} fields - array of fields to be picked and returned
  3249. * @returns the promise with the objInfo applicable to the given pathRef
  3250. */
  3251. getObjRefInfo: function getObjRefInfo(glassContext, objRef, fields) {
  3252. return this._getObjInfo(glassContext, this.ENDPOINT_PATHS['objRef'] + '/' + encodeURIComponent(objRef) + '?', fields);
  3253. },
  3254. _getObjInfo: function _getObjInfo(glassContext, url, fields, searchPath) {
  3255. var _this = this;
  3256. if (!fields) {
  3257. fields = ['type'];
  3258. }
  3259. var requestURL = url + 'fields=' + fields.concat(['id', 'path']).join(',');
  3260. return this._getAjaxSvc(glassContext).ajax({
  3261. url: requestURL,
  3262. type: 'GET',
  3263. dataType: 'json'
  3264. }).then(function (response) {
  3265. return _this._getFormattedObjInfo(response, fields);
  3266. }).catch(function (error) {
  3267. if (searchPath) {
  3268. return _this._getObjInfoBySearchPath(glassContext, searchPath, fields);
  3269. }
  3270. throw error;
  3271. });
  3272. },
  3273. _getObjInfoBySearchPath: function _getObjInfoBySearchPath(glassContext, searchPath, fields) {
  3274. var _this2 = this;
  3275. var searchUrl = this.ENDPOINT_PATHS['searchPathRef'] + '?searchPath=' + encodeURIComponent(searchPath) + '&fields=' + fields.concat(['id', 'path']).join(',');
  3276. return this._getAjaxSvc(glassContext).ajax({
  3277. url: searchUrl,
  3278. type: 'GET',
  3279. dataType: 'json'
  3280. }).then(function (response) {
  3281. return _this2._getFormattedObjInfo(response, fields);
  3282. }).catch(function (error) {
  3283. throw error;
  3284. });
  3285. },
  3286. _getFormattedObjInfo: function _getFormattedObjInfo(objData, fields) {
  3287. var obj = GlassUtils.getObjectProperty(['data', 'data', 0], objData);
  3288. var pathRef = null;
  3289. var url = GlassUtils.getObjectProperty(['_meta', 'links', 'path', 'url'], obj);
  3290. if (url) {
  3291. var index = url.indexOf('=');
  3292. pathRef = decodeURIComponent(url.substring(index + 1));
  3293. }
  3294. var objId = obj.id ? obj.id : null;
  3295. var objInfo = {
  3296. pathRef: pathRef,
  3297. objRef: objId
  3298. };
  3299. _.extend(objInfo, _.pick(obj, fields));
  3300. return objInfo;
  3301. },
  3302. _getAjaxSvc: function _getAjaxSvc(glassContext) {
  3303. if (glassContext && glassContext.getCoreSvc) {
  3304. return glassContext.getCoreSvc('.Ajax');
  3305. } else {
  3306. console.warn('API Change: ba-glass-client/api/Url now expects "glassContext" instead of "services.ajax" in public API calls. Please update your code!'); // Terrible hack...
  3307. return window.__glassAppController.glassContext.getCoreSvc('.Ajax');
  3308. }
  3309. },
  3310. _isValueAcceptableAPIValue: function _isValueAcceptableAPIValue(API, value) {
  3311. var isBooleanAsString = value === 'true' || value === 'false';
  3312. if (isBooleanAsString) {
  3313. value = JSON.parse(value);
  3314. }
  3315. return API.values.includes(value);
  3316. },
  3317. /**
  3318. * get objInfo for pathRef or objRef
  3319. * @public
  3320. * @param {Object} glassContext - The glass context
  3321. * @param {Object} content - the content containing either a pathRef or an objRef
  3322. * @param {Array} fields - array of fields to be picked and returned
  3323. * @returns the promise with the objInfo applicable to the given pathRef
  3324. */
  3325. getObjInfoFromContent: function getObjInfoFromContent(glassContext, content, fields) {
  3326. return Promise.try(function () {
  3327. if (content && content.pathRef) {
  3328. return this.getPathRefInfo(glassContext, content.pathRef, fields);
  3329. } else if (content && content.objRef) {
  3330. return this.getObjRefInfo(glassContext, content.objRef, fields);
  3331. } else {
  3332. throw new Error('Missing pathRef and objRef');
  3333. }
  3334. }.bind(this));
  3335. },
  3336. getContextFromUrlMap: function getContextFromUrlMap(urlMap) {
  3337. if (urlMap) {
  3338. return {
  3339. perspective: urlMap.perspective,
  3340. content: urlMap
  3341. };
  3342. }
  3343. },
  3344. /**
  3345. * get objInfo for pathRef
  3346. * @public
  3347. * @param {Object} module - The module
  3348. * @param {Object} glassContext - The glass context
  3349. * @param {Object} context - The resource context.
  3350. * @returns Promise resolved by urlMap
  3351. */
  3352. getUrlMap: function getUrlMap(module, glassContext, context) {
  3353. return Promise.resolve().then(function () {
  3354. if (module && _.isFunction(module.execute)) {
  3355. var appView = context && context.glassContext && context.glassContext.currentAppView;
  3356. if (appView && appView.context && appView.context.isDefaultAction) {
  3357. context.isDefaultAction = appView.context.isDefaultAction;
  3358. }
  3359. return Promise.resolve(module.execute(context)).then(function (urlMap) {
  3360. if (context && context.urlMap && context.urlMap.pathRef) {
  3361. return urlMap;
  3362. } else {
  3363. return this.getPathRef(glassContext, urlMap.objRef).then(function (pathRef) {
  3364. if (context && context.mode !== 'defaultAction') {
  3365. delete urlMap.objRef;
  3366. }
  3367. urlMap.pathRef = pathRef;
  3368. return urlMap;
  3369. }.bind(this));
  3370. }
  3371. }.bind(this));
  3372. }
  3373. }.bind(this));
  3374. },
  3375. /**
  3376. * convert an objRef into a pathRef
  3377. * @public
  3378. * @param {Object} glassContext - The glassContext
  3379. * @param {String} objRef - the object reference
  3380. * @param {String} searchPath - the object search path, default undefined
  3381. * @returns the pathRef applicable to the given objRef
  3382. */
  3383. getPathRef: function getPathRef(glassContext, objRef, searchPath) {
  3384. if (objRef) {
  3385. return this.getPathRefInfo(glassContext, objRef, null, searchPath).then(function (obj) {
  3386. return obj.pathRef;
  3387. });
  3388. } else {
  3389. return Promise.resolve();
  3390. }
  3391. },
  3392. updateContextWithCurrentUIFilters: function updateContextWithCurrentUIFilters(currentUIFilters, newContext) {
  3393. var _this3 = this;
  3394. if (currentUIFilters) {
  3395. this.URL_EMBED_API.forEach(function (API) {
  3396. if (API.preserveInUrl && API.preserveInUrl === true) {
  3397. if (currentUIFilters.hasOwnProperty(API.key) && _this3._isValueAcceptableAPIValue(API, currentUIFilters[API.key])) {
  3398. newContext.content[API.key] = currentUIFilters[API.key];
  3399. }
  3400. }
  3401. });
  3402. }
  3403. return newContext;
  3404. }
  3405. });
  3406. urlApi.prototype.URL_UI_API = urlApi.prototype.URL_EMBED_API;
  3407. urlApi.prototype.URL_API = _.union(urlApi.prototype.URL_API, urlApi.prototype.URL_UI_API);
  3408. urlApi.MODES = {
  3409. DYNAMIC: 'dynamic',
  3410. CURRENT: 'current',
  3411. DEFAULT_ACTION: 'defaultAction'
  3412. };
  3413. return urlApi;
  3414. });
  3415. //# sourceMappingURL=Url.js.map
  3416. ;
  3417. /**
  3418. * Licensed Materials - Property of IBM
  3419. * IBM Cognos Products: BI
  3420. * (C) Copyright IBM Corp. 2015, 2016
  3421. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  3422. */
  3423. define('baglass/core-client/js/core-client/ui/KeyCodes',[], function () {
  3424. return {
  3425. NUM0: 48,
  3426. NUM1: 49,
  3427. NUM2: 50,
  3428. NUM3: 51,
  3429. NUM4: 52,
  3430. NUM5: 53,
  3431. NUM6: 54,
  3432. NUM7: 55,
  3433. NUM8: 56,
  3434. NUM9: 57,
  3435. // Letters: Upper and Lower Case share the same code, i.e. the code for "a" is 65, too.
  3436. A: 65,
  3437. B: 66,
  3438. C: 67,
  3439. D: 68,
  3440. E: 69,
  3441. F: 70,
  3442. G: 71,
  3443. H: 72,
  3444. I: 73,
  3445. J: 74,
  3446. K: 75,
  3447. L: 76,
  3448. M: 77,
  3449. N: 78,
  3450. O: 79,
  3451. P: 80,
  3452. Q: 81,
  3453. R: 82,
  3454. S: 83,
  3455. T: 84,
  3456. U: 85,
  3457. V: 86,
  3458. W: 87,
  3459. X: 88,
  3460. Y: 89,
  3461. Z: 90,
  3462. NUMPAD0: 96,
  3463. NUMPAD1: 97,
  3464. NUMPAD2: 98,
  3465. NUMPAD3: 99,
  3466. NUMPAD4: 100,
  3467. NUMPAD5: 101,
  3468. NUMPAD6: 102,
  3469. NUMPAD7: 103,
  3470. NUMPAD8: 104,
  3471. NUMPAD9: 105,
  3472. F1: 112,
  3473. F2: 113,
  3474. F3: 114,
  3475. F4: 115,
  3476. F5: 116,
  3477. F6: 117,
  3478. F7: 118,
  3479. F8: 119,
  3480. F9: 120,
  3481. F10: 121,
  3482. F11: 122,
  3483. F12: 123,
  3484. // Note: some keys have the same shape but different number, like DIVIDE and FORWARDSLASH.
  3485. // Make sure you're using the right key.
  3486. BACKSPACE: 8,
  3487. TAB: 9,
  3488. ENTER: 13,
  3489. SHIFT: 16,
  3490. CTRL: 17,
  3491. ALT: 18,
  3492. PAUSEBREAK: 19,
  3493. CAPSLOCK: 20,
  3494. ESCAPE: 27,
  3495. SPACE: 32,
  3496. PAGEUP: 33,
  3497. PAGEDOWN: 34,
  3498. END: 35,
  3499. HOME: 36,
  3500. LEFT_ARROW: 37,
  3501. UP_ARROW: 38,
  3502. RIGHT_ARROW: 39,
  3503. DOWN_ARROW: 40,
  3504. INSERT: 45,
  3505. DELETE: 46,
  3506. SECOND: 50, // the same with NUM2. Keep it for history reason.
  3507. LEFT_WINDOW_KEY: 91, // Left Command on Mac
  3508. RIGHT_WINDOW_KEY: 92, // Right Command on Mac
  3509. SELECT_KEY: 93,
  3510. MULTIPLY: 106,
  3511. ADD: 107,
  3512. SUBTRACT: 109,
  3513. DECIMAL_POINT: 110,
  3514. DIVIDE: 111,
  3515. NUM_LOCK: 144,
  3516. SCROLL_LOCK: 145,
  3517. SEMI_COLON: 186,
  3518. EQUAL: 187,
  3519. COMMA: 188,
  3520. DASH: 189,
  3521. PERIOD: 190,
  3522. FORWARDSLASH: 191,
  3523. GRAVE_ACCENT: 192,
  3524. OPEN_BRACKET: 219,
  3525. BACKSLASH: 220,
  3526. CLOSE_BRACKET: 221,
  3527. SINGLE_QUOTE: 222
  3528. };
  3529. });
  3530. //# sourceMappingURL=KeyCodes.js.map
  3531. ;
  3532. define('text!baglass/core-client/js/core-client/ui/template/LoadingWaitAnimation1.html',[],function () { return '<div class="wait_loading_animation" role="presentation">\n\t<div id="wait_loader_div1" role="presentation"></div>\n\t<div id="wait_loader_div2" role="presentation"></div>\n\t<div id="wait_loader_div3" role="presentation"></div>\n\t<div id="wait_loader_div4" role="presentation"></div>\n\t<div id="wait_loader_div5" role="presentation"></div>\n\t<div id="wait_loader_div6" role="presentation"></div>\n\t<div id="wait_loader_div7" role="presentation"></div>\n\t<div id="wait_loader_div8" role="presentation"></div>\n</div>\n';});
  3533. define('text!baglass/core-client/js/core-client/ui/template/LoadingWaitAnimation2.html',[],function () { return '<div class="wait_loading_bar" role="presentation">\n</div>';});
  3534. define('text!baglass/core-client/js/core-client/ui/template/MediumSpinner.html',[],function () { return '<div class="mediumSpinner" role="presentation">\n</div>\n';});
  3535. define('text!baglass/core-client/js/core-client/utils/templates/webfont.html',[],function () { return '<span role="img" class="webfont {{!it.icon}}" {{? it.tooltip}}title="{{!it.tooltip}}"{{?}} {{? it.label}}aria-label="{{!it.label}}"{{?}} {{? it.color}}style="color:{{!it.color}}"{{?}}></span>';});
  3536. define('text!baglass/core-client/js/core-client/utils/templates/image.html',[],function () { return '<img src="{{!it.icon}}" {{? it.tooltip}}title="{{!it.tooltip}}"{{?}} {{? it.label}}alt="{{!it.label}}"{{?}}></img>';});
  3537. define('text!baglass/core-client/js/core-client/utils/templates/svg.html',[],function () { return '<svg class="svgIcon" role="img" {{? it.label}}aria-label="{{!it.label}}"{{?}} focusable=false>\n\t{{? it.tooltip}}\n\t\t<title>\n\t\t\t{{!it.tooltip}}\n\t\t</title>\n\t{{?}}\n\t<use style="pointer-events: none; {{? it.fill}}fill:{{!it.fill}} {{?}}" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#{{!it.icon}}">\n\t</use>\n</svg>\n';});
  3538. /**
  3539. * Licensed Materials - Property of IBM
  3540. * IBM Cognos Products: BI
  3541. * (C) Copyright IBM Corp. 2015, 2019
  3542. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  3543. */
  3544. define('baglass/core-client/js/core-client/utils/BrowserUtils',[], function () {
  3545. return {
  3546. isBrowser: {
  3547. ie: function ie() {
  3548. return this.isIE();
  3549. },
  3550. ieEdge: function ieEdge() {
  3551. return this.isIEEdge();
  3552. },
  3553. ie11: function ie11() {
  3554. return this.isIE11();
  3555. },
  3556. ff: function ff() {
  3557. return this.isFirefox();
  3558. },
  3559. chrome: function chrome() {
  3560. return this.isChrome();
  3561. },
  3562. safari: function safari() {
  3563. return this.isSafari();
  3564. },
  3565. iPad: function iPad() {
  3566. return this.isIPad();
  3567. }
  3568. },
  3569. isIE: function isIE() {
  3570. return (/\b(MSIE|Trident|Edge)\b/.test(this._getUserAgent())
  3571. );
  3572. },
  3573. isIE11: function isIE11() {
  3574. return (/Trident\/7\./.test(this._getUserAgent())
  3575. );
  3576. },
  3577. isIEEdge: function isIEEdge() {
  3578. return (/Edge/.test(this._getUserAgent())
  3579. );
  3580. },
  3581. isFirefox: function isFirefox() {
  3582. return (/.*Firefox.*/i.test(this._getUserAgent())
  3583. );
  3584. },
  3585. isChrome: function isChrome() {
  3586. return (/chrome/i.test(this._getUserAgent()) && !this.isIE()
  3587. );
  3588. },
  3589. isSafari: function isSafari() {
  3590. return (/^((?!chrome|android|crios|fxios).)*safari/i.test(this._getUserAgent()) && !this.isChrome() && !this.isIE() && !this.isIPad()
  3591. );
  3592. },
  3593. isIPad: function isIPad() {
  3594. return (/iPad/i.test(this._getUserAgent())
  3595. );
  3596. },
  3597. _getUserAgent: function _getUserAgent() {
  3598. return navigator.userAgent;
  3599. }
  3600. };
  3601. });
  3602. //# sourceMappingURL=BrowserUtils.js.map
  3603. ;
  3604. /**
  3605. * Licensed Materials - Property of IBM
  3606. * IBM Cognos Products: BI
  3607. * (C) Copyright IBM Corp. 2015, 2021
  3608. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  3609. */
  3610. define('baglass/core-client/js/core-client/utils/LegacyUtils',['jquery', 'underscore', './BrowserUtils'], function ($, _, BrowserUtils) {
  3611. return {
  3612. /**
  3613. * Launch a legacy Cognos application in a separate tab
  3614. */
  3615. legacyLaunch: function legacyLaunch(glassContext, tool, object) {
  3616. this._openLegacyWindow(this._getLaunchParms(glassContext, tool, object));
  3617. },
  3618. /**
  3619. * Get the URL to launch a legacy Cognos application
  3620. */
  3621. getLegacyLaunchUrl: function getLegacyLaunchUrl(glassContext, tool, object, action) {
  3622. return this._getUrl(this._getLaunchParms(glassContext, tool, object, action));
  3623. },
  3624. _getLaunchParms: function _getLaunchParms(glassContext, tool, object, action) {
  3625. var app = this.legacyApps[tool] || tool;
  3626. if (!_.isUndefined(app) && !_.isUndefined(app.launchParams)) {
  3627. return app.launchParams;
  3628. } else {
  3629. return {
  3630. 'b_action': 'xts.run',
  3631. 'm': 'portal/launch.xts',
  3632. 'ui.gateway': glassContext.gateway + '/v1/disp',
  3633. 'ui.tool': tool,
  3634. 'ui.object': object,
  3635. 'ui.action': action || 'new',
  3636. 'launch.launchinWindow': 'true',
  3637. 'backURL': 'disp?b_action=xts.run&m=portal/close.xts'
  3638. };
  3639. }
  3640. },
  3641. /*
  3642. * Based on the user's capabilities and browser vendor,
  3643. * determines whether the supplied tool can be used.
  3644. * @See LegacyUtils.legacyApps for supported tool types.
  3645. * @returns A boolean indicating whether the supplied tool can be used.
  3646. */
  3647. canUseLegacyTool: function canUseLegacyTool(glassContext, tool) {
  3648. var toolInfo = this.legacyApps[tool] || tool;
  3649. if (!_.isUndefined(toolInfo)) {
  3650. var hasCapability = glassContext.hasCapability(toolInfo.capability);
  3651. if (hasCapability) {
  3652. var browsers = toolInfo.browsers;
  3653. if (!_.isUndefined(browsers)) {
  3654. for (var i = 0; i < browsers.length; i++) {
  3655. var isBrowserFunc = BrowserUtils.isBrowser[browsers[i]];
  3656. if (isBrowserFunc.call(BrowserUtils)) {
  3657. return true;
  3658. }
  3659. }
  3660. } else {
  3661. return true;
  3662. }
  3663. }
  3664. }
  3665. return false;
  3666. },
  3667. legacyApps: {
  3668. DashboardConsole: {
  3669. icon: 'common-workspace',
  3670. capability: 'canUseDashboardViewer',
  3671. browsers: ['ie', 'ff', 'chrome', 'safari']
  3672. },
  3673. QueryStudio: {
  3674. icon: 'common-query',
  3675. capability: 'canUseQueryStudio',
  3676. browsers: ['ie', 'ff']
  3677. },
  3678. AnalysisStudio: {
  3679. icon: 'common-analysis_studio',
  3680. capability: 'canUseAnalysisStudio',
  3681. browsers: ['ie', 'ff']
  3682. },
  3683. DrillThrough: {
  3684. icon: 'common-drill_through_definition',
  3685. capability: 'canUseDrillThroughAssistant',
  3686. launchParams: {
  3687. 'b_action': 'xts.run',
  3688. 'm': 'portal/cc_drillthrough.xts'
  3689. }
  3690. },
  3691. EventStudio: {
  3692. icon: 'common-agent',
  3693. capability: 'canUseEventStudio',
  3694. browsers: ['ie', 'ff', 'chrome']
  3695. },
  3696. Subscriptions: {
  3697. capability: 'DO_NOT_SHOW_IN_COMPANION_APPS',
  3698. launchParams: {
  3699. 'b_action': 'xts.run',
  3700. 'm': 'portal/subscriptions/subscriptions.xts'
  3701. }
  3702. },
  3703. MetricsManager: {
  3704. icon: 'common-metrics',
  3705. capability: 'canUseMetricStudio',
  3706. apps: {
  3707. MetricStudio: {
  3708. icon: 'common-metrics',
  3709. capability: 'canUseMetricStudio',
  3710. handler: function handler(evt) {
  3711. this._launchLegacyWindow(evt);
  3712. },
  3713. browsers: ['ie', 'ff']
  3714. },
  3715. metricsFileImportTask: {
  3716. icon: 'common-metricsImport',
  3717. capability: 'canUseMetricsManagerAdministration'
  3718. },
  3719. metricsMaintenanceTask: {
  3720. icon: 'common-metricsMaintenance',
  3721. capability: 'canUseMetricsManagerAdministration'
  3722. },
  3723. metricsExportTask: {
  3724. icon: 'common-metricsExport',
  3725. capability: 'canUseMetricsManagerAdministration'
  3726. },
  3727. metricsPackage: {
  3728. icon: 'common-metricsNewPackage',
  3729. capability: 'canUseMetricsManagerAdministration',
  3730. handler: function handler() {
  3731. var queryParams = {
  3732. 'b_action': 'mms.run',
  3733. 'pid': 'new_mpwizard_start'
  3734. };
  3735. this._openLegacyWindow(queryParams);
  3736. }
  3737. }
  3738. },
  3739. handler: function handler(evt) {
  3740. var queryParams = {
  3741. 'b_action': 'xts.run',
  3742. 'm': 'portal/newMetricsTasks/processNewTasks.xts',
  3743. 'so.select': 'newmetricstaskspackage',
  3744. 'so.return.m': 'portal/new_general.xts',
  3745. 'm_new_class': evt.type
  3746. };
  3747. this._openLegacyWindow(queryParams);
  3748. }
  3749. },
  3750. PowerplayStudio: {
  3751. icon: 'common-powerPlayCube',
  3752. capability: 'canUsePowerPlay',
  3753. browsers: ['ie', 'ff', 'chrome', 'safari']
  3754. },
  3755. Controller: {
  3756. icon: 'common-controller',
  3757. capability: 'canUseControllerStudio',
  3758. browsers: ['ie']
  3759. },
  3760. Contributor: {
  3761. icon: 'common-planning',
  3762. capability: 'canUsePlanningContributor'
  3763. }
  3764. },
  3765. _openLegacyWindow: function _openLegacyWindow(queryParms) {
  3766. this._openWindow(this._getUrl(queryParms));
  3767. },
  3768. _openWindow: function _openWindow(url) {
  3769. window.open(url);
  3770. },
  3771. _launchLegacyWindow: function _launchLegacyWindow(evt) {
  3772. this.legacyLaunch(evt.glassContext, evt.type);
  3773. },
  3774. _getUrl: function _getUrl(queryParms) {
  3775. return 'v1/disp?' + $.param(queryParms, true);
  3776. }
  3777. };
  3778. });
  3779. //# sourceMappingURL=LegacyUtils.js.map
  3780. ;
  3781. /**
  3782. * Licensed Materials - Property of IBM
  3783. *
  3784. * IBM Cognos Products: BI
  3785. *
  3786. * Copyright IBM Corp. 2015
  3787. *
  3788. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  3789. */
  3790. define('baglass/core-client/js/core-client/nls/CommonsResources',{
  3791. "root": true,
  3792. "cs": true,
  3793. "da": true,
  3794. "de": true,
  3795. "es": true,
  3796. "fi": true,
  3797. "fr": true,
  3798. "hr": true,
  3799. "hu": true,
  3800. "it": true,
  3801. "ja": true,
  3802. "kk": true,
  3803. "ko": true,
  3804. "no": true,
  3805. "nb": true,
  3806. "nl": true,
  3807. "pl": true,
  3808. "pt": true,
  3809. "pt-br": true,
  3810. "ro": true,
  3811. "ru": true,
  3812. "sl": true,
  3813. "sv": true,
  3814. "th": true,
  3815. "tr": true,
  3816. "zh": true,
  3817. "zh-cn": true,
  3818. "zh-tw": true
  3819. });
  3820. //# sourceMappingURL=CommonsResources.js.map
  3821. ;
  3822. /**
  3823. * Licensed Materials - Property of IBM
  3824. *
  3825. * IBM Cognos Products: BI Glass
  3826. *
  3827. * Copyright IBM Corp. 2018
  3828. *
  3829. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  3830. */
  3831. define('baglass/core-client/js/core-client/nls/root/CommonsResources',{
  3832. "save": "Save",
  3833. "saveAs": "Save as",
  3834. "saveAsLabel": "Save as:",
  3835. "teamFolders": "Team Folders",
  3836. "open": "Open",
  3837. "openDialogTitle": "Open file",
  3838. "openDialogFooter": "Open and cancel button",
  3839. "saveDialogTitle": "Save as",
  3840. "saveDialogFooter": "Save and cancel button",
  3841. "shareDialogTitle": "Share",
  3842. "shareDialogCodeLabel": "Share URL",
  3843. "shareDialogText": "Copy this link to share this content with other users.",
  3844. "embedDialogTitle": "Embed",
  3845. "embedDialogCodeLabel": "Embed code",
  3846. "embedDialogText": "Copy this code to embed.",
  3847. "embedURLWidthLabel": "Width:",
  3848. "embedURLHeightLabel": "Height:",
  3849. "embedURLWidth": "Width",
  3850. "embedURLHeight": "Height",
  3851. "filesToOpen": "Files to open:",
  3852. "remove": "Remove",
  3853. "loading": "Loading",
  3854. "ok": "OK",
  3855. "cancel": "Cancel",
  3856. "close": "Close",
  3857. "datasetLoading": "Your data set %{name} is loading...",
  3858. "datasetFinishedLoading": "Your data set %{name} loaded successfully.",
  3859. "datasetLoadingFailed": "Your data set %{name} did not load.",
  3860. "datasetLoadingCancelled": "The loading of your data set %{name} was cancelled.",
  3861. "datasetRefreshing": "Your data set %{name} is refreshing...",
  3862. "datasetFinishedRefreshing": "Your data set %{name} refreshed successfully.",
  3863. "datasetRefreshFailed": "Your data set %{name} did not refresh.",
  3864. "datasetRefreshCancelled": "The refreshing of your data set %{name} was cancelled.",
  3865. "userID": "User ID",
  3866. "password": "Password",
  3867. "signOnMessage": "Please provide your credentials to use this data",
  3868. "rememberCre": "Remember my credentials",
  3869. "signOnDialogFooter": "Submit and cancel button",
  3870. "signOnTitle": "Credentials required: %{dataSource}",
  3871. "errMessage": "The credentials are missing or invalid.\n Please type your credentials for authentication.",
  3872. "submit": "Submit",
  3873. "datepicker_input_describedby": "Type a date in the format YYYY dash MM dash DD.",
  3874. "schedule_datepicker_label": "Date",
  3875. "schedule_datepicker_description": "Date Picker",
  3876. "time_picker_label": "Time",
  3877. "bs_timepicker_container": "Time picker widget",
  3878. "bs_timepicker_input_description": "Time picker",
  3879. "bs_timepicker_input_describedby": "Type a time in the format HH colon MM AM or PM.",
  3880. "bs_timepicker_hour_text": "Hour",
  3881. "bs_timepicker_minute_text": "Minute",
  3882. "bs_timepicker_meridian_text": "Meridian",
  3883. "bs_timepicker_increment_hour": "Increment hour",
  3884. "bs_timepicker_decrement_hour": "Decrement hour",
  3885. "bs_timepicker_increment_minute": "Increment minute",
  3886. "bs_timepicker_decrememt_minute": "Decrement minute",
  3887. "bs_timepicker_toggle_meridian": "Toggle meridian",
  3888. "unknown": "Unknown",
  3889. "EllapsedTimeDays": "%{days}d %{hours}h %{minutes}m %{seconds}s",
  3890. "EllapsedTimeHours": "%{hours}h %{minutes}m %{seconds}s",
  3891. "EllapsedTimeMinutes": "%{minutes}m %{seconds}s",
  3892. "EllapsedTimeSeconds": "%{seconds}s",
  3893. "confirmRefreshUpload": "Confirm replacement of existing data",
  3894. "msgConfirmRefreshUpload": "The file '%{fileName}' already exists. Do you want to replace its data with the data contained in the selected file?",
  3895. "promptDialogTitle": "Prompt",
  3896. "promptControlTitle": "Specify the prompt values for %{paramLabel}",
  3897. "copyText": "Copy",
  3898. "copySuccess": "Copied to Clipboard successfully",
  3899. "copyFail": "Copy to Clipboard failed",
  3900. "clear": "Clear",
  3901. "invert": "Invert",
  3902. "numSelected": "%{number} of %{total} selected",
  3903. "search_box_default_text": "Find",
  3904. "title": "Title",
  3905. "back": "Back",
  3906. "edit": "Edit",
  3907. "invalidInput": "Invalid input",
  3908. "owner": "Owner",
  3909. "createdWithColon": "Created:",
  3910. "modifiedWithColon": "Modified:",
  3911. "typeWithColon": "Type:",
  3912. "dataRefWithColon": "Data refreshed:",
  3913. "defaultSlideoutLabel": "Slideout",
  3914. "invalidNumber": "The value entered is not a number. Type a number.",
  3915. "exceedMaxLength": "The text is too long. Shorten to %{maxLength} characters.",
  3916. "invalidEmailMessage": "Email address is not valid.",
  3917. "numberOutOfRange": "The value entered must be a number between %{min} and %{max}",
  3918. "numberTooSmall": "The value entered must be a number greater than %{min}",
  3919. "numberTooBig": "The value entered must be a number less than %{max}",
  3920. "defaultCompleteMessage": "Operation completed.",
  3921. "defaultProgressMessage": "Operation in progress...",
  3922. "defaultFailMessage": "Operation failed.",
  3923. "defaultIndefiniteMessage": "Operation in progress...",
  3924. "defaultPauseMessage": "Operation paused.",
  3925. "progressHideBtn": "Hide",
  3926. "paginationControl": "Open Collapsed Slideout(s)",
  3927. "confirmCancelMessage": "Do you want to discard your changes?",
  3928. "confirmCancel": "Confirm cancel",
  3929. "pinSlideout": "pin",
  3930. "unpinSlideout": "Unpin",
  3931. "details": "Details",
  3932. "edit_palette": "Edit",
  3933. "duplicate_palette": "Duplicate",
  3934. "reverse_palette": "Reverse",
  3935. "delete_palette": "Delete ",
  3936. "palette_copy": "%{paletteName} copy",
  3937. "showMoreColors": "More",
  3938. "showLessColors": "Less",
  3939. "addCustomColor": "Select custom color",
  3940. "createPalette": "Create a custom palette",
  3941. "moreActionsForPalette": "More actions for %{paletteName}",
  3942. "showMoreColorPalette": "More"
  3943. });
  3944. /**
  3945. * Licensed Materials - Property of IBM
  3946. *
  3947. * IBM Cognos Products: BI
  3948. *
  3949. * Copyright IBM Corp. 2015, 2016
  3950. *
  3951. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  3952. */
  3953. define('baglass/core-client/js/core-client/nls/StringResources',['i18n!./CommonsResources', '../utils/Lexicon'], function (CommonsResources, Lexicon) {
  3954. var lexicon = new Lexicon({
  3955. data: CommonsResources,
  3956. allowMissing: true,
  3957. verbose: false
  3958. });
  3959. return {
  3960. /**
  3961. * Get the string resource for the given key and interpolation options
  3962. *
  3963. * @param key The key of the string to return
  3964. * @param interpolationOptions Optional interpolation options (see poly.t documentation for details)
  3965. * @returns The string to display
  3966. */
  3967. get: function get(key, interpolationOptions) {
  3968. var translated = lexicon.translate(key, interpolationOptions);
  3969. if (translated !== key) {
  3970. return translated;
  3971. }
  3972. return Lexicon.NOT_TRANSLATED + '(' + key + ')';
  3973. }
  3974. };
  3975. });
  3976. //# sourceMappingURL=StringResources.js.map
  3977. ;
  3978. /**
  3979. * Licensed Materials - Property of IBM
  3980. * IBM Cognos Products: BI UI_Commons
  3981. * (C) Copyright IBM Corp. 2015, 2018
  3982. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  3983. */
  3984. define('baglass/core-client/js/core-client/utils/Utils',['jquery', 'underscore', 'doT', 'text!../ui/template/LoadingWaitAnimation1.html', 'text!../ui/template/LoadingWaitAnimation2.html', 'text!../ui/template/MediumSpinner.html', 'text!./templates/webfont.html', 'text!./templates/image.html', 'text!./templates/svg.html', './LegacyUtils', '../nls/StringResources', './BrowserUtils'], function ($, _, doT, animation1, animation2, MediumSpinner, webfontTemplate, imageTemplate, svgTemplate, LegacyUtils, StringResources, BrowserUtils) {
  3985. /**
  3986. * The patterns we will use to match the icon field beign passed in.
  3987. */
  3988. var matchPatterns = {
  3989. WFG: 'wfg',
  3990. WFT: 'wft',
  3991. WFBI: 'wfbi'
  3992. };
  3993. var imageIcons = {
  3994. PNG: '.png',
  3995. JPEG: '.jpeg',
  3996. JPG: '.jpg',
  3997. GIF: '.gif',
  3998. SVG: '.svg'
  3999. };
  4000. return {
  4001. ALERT_ID: 'com-ibm-ca-alert',
  4002. /** Sets the attribute only if value is defined.
  4003. */
  4004. setAttr: function setAttr($plugin, sAttr, sValue) {
  4005. if (sValue) {
  4006. $plugin.attr(sAttr, sValue);
  4007. }
  4008. },
  4009. /** Adds the sClassname if it's defined to the element.
  4010. *
  4011. */
  4012. addClass: function addClass($plugin, className) {
  4013. if (className) {
  4014. $plugin.addClass(className);
  4015. }
  4016. },
  4017. _embed: function _embed(svg) {
  4018. $('use', svg).each(function (i, use) {
  4019. var href = use.getAttribute('xlink:href') || use.getAttribute('href');
  4020. var useElement = $(href)[0];
  4021. if (useElement) {
  4022. var title = $('title', use)[0];
  4023. var viewBox = !svg.getAttribute('viewBox') && useElement.getAttribute('viewBox');
  4024. var newSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
  4025. $.each(use.attributes, function (index, attr) {
  4026. newSvg.setAttribute(attr.name, attr.value);
  4027. });
  4028. // conditionally set the viewBox on the SVG
  4029. if (viewBox) {
  4030. newSvg.setAttribute('viewBox', viewBox);
  4031. }
  4032. var clone = useElement.cloneNode(true);
  4033. while (clone.firstChild) {
  4034. if (clone.firstChild.tagName === 'title') {
  4035. clone.removeChild(clone.firstChild);
  4036. } else {
  4037. newSvg.appendChild(clone.firstChild);
  4038. }
  4039. }
  4040. var useParent = use.parentNode;
  4041. useParent.appendChild(newSvg);
  4042. if (title) {
  4043. useParent.appendChild(title);
  4044. }
  4045. useParent.removeChild(use);
  4046. }
  4047. });
  4048. },
  4049. /** Embed the SVG use icon in the SVG itself.
  4050. * @param parent of the SVG, can be a jQuery object or not.
  4051. */
  4052. embedSVGIcon: function embedSVGIcon(parent) {
  4053. if (!BrowserUtils.isIE()) {
  4054. return parent;
  4055. }
  4056. var $svg = $('svg', parent);
  4057. if (!$svg.length) {
  4058. $svg = $(parent).filter('svg');
  4059. }
  4060. if ($svg.length) {
  4061. $svg.each(function (i, svg) {
  4062. this._embed(svg);
  4063. }.bind(this));
  4064. }
  4065. return parent;
  4066. },
  4067. /** Prepends an image to the specified jQuery $widget
  4068. * @public
  4069. * @param $widget either a jQuery in which to prepend the image/icon
  4070. * @param icon the icon to insert. Can be a web font, an image URL or an svg sprite reference
  4071. * @param iconTooltip the tooltip to use for this icon, if specified
  4072. * @param ariaLabel The value to use for aria-label or alt attributes. If not specified, defaults to iconTooltip
  4073. * @param right boolean. default is false. Set to true if the icon should be appended after the inner html.
  4074. * @param iconColor color of the icon to be used
  4075. */
  4076. setIcon: function setIcon($widget, icon, iconTooltip, ariaLabel, right, iconColor) {
  4077. if (icon) {
  4078. if (!_.isBoolean(right)) {
  4079. right = false;
  4080. }
  4081. var label = ariaLabel ? ariaLabel : iconTooltip;
  4082. var template;
  4083. var svg = false;
  4084. if (this._isWebFont(icon)) {
  4085. template = doT.template(webfontTemplate);
  4086. } else if (this._isImageIcon(icon)) {
  4087. template = doT.template(imageTemplate);
  4088. } else {
  4089. svg = true;
  4090. template = doT.template(svgTemplate);
  4091. }
  4092. var html = template({
  4093. icon: icon,
  4094. tooltip: iconTooltip,
  4095. label: label,
  4096. color: iconColor,
  4097. fill: iconColor
  4098. });
  4099. var $html = $(html);
  4100. if (svg) {
  4101. this.embedSVGIcon($html);
  4102. }
  4103. if (right) {
  4104. $widget.append($html);
  4105. } else {
  4106. $widget.prepend($html);
  4107. }
  4108. }
  4109. },
  4110. /**
  4111. * Show a loading animation to handle long operation; If the large format is shown,
  4112. * an Aria alert element is inserted in the DOM for screen readers
  4113. * @param {Number} type of loading icon; 1 is small; anything else or undefined is large
  4114. * @returns A html object of the loading animation.
  4115. */
  4116. getLoadingAnimation: function getLoadingAnimation(number) {
  4117. var $loadingIcon;
  4118. var html;
  4119. var options = {
  4120. loadingBarLabel: StringResources.get('loading')
  4121. };
  4122. if (number === 1) {
  4123. html = doT.template(animation1);
  4124. } else {
  4125. html = doT.template(animation2);
  4126. this.activateAriaAlert(options.loadingBarLabel);
  4127. }
  4128. $loadingIcon = $(html(options));
  4129. $loadingIcon.attr('aria-label', StringResources.get('loading'));
  4130. return $loadingIcon[0];
  4131. },
  4132. /**
  4133. * Show a loading Spinner animation to handle long operation.
  4134. * @return a html object of the Spinner animation.
  4135. */
  4136. getSpinner: function getSpinner() {
  4137. var options = {
  4138. loadingBarLabel: StringResources.get('loading')
  4139. };
  4140. var html = doT.template(MediumSpinner);
  4141. var $loadingIcon = $(html(options));
  4142. $loadingIcon.attr('aria-label', StringResources.get('loading'));
  4143. return $loadingIcon[0];
  4144. },
  4145. /**
  4146. * Inserts or removes & adds an alert element at the DOM body level to be read by screen reader.
  4147. * @param {String} Message to be read by screen reader
  4148. */
  4149. activateAriaAlert: function activateAriaAlert(sMessage) {
  4150. if (!sMessage || !sMessage.length) {
  4151. return;
  4152. }
  4153. var $divElem = $('#' + this.ALERT_ID);
  4154. if ($divElem.length) {
  4155. $divElem.remove();
  4156. }
  4157. $divElem = $('<div>', {
  4158. 'id': this.ALERT_ID,
  4159. 'style': 'position:absolute; top:-9000px;',
  4160. 'role': 'alert',
  4161. 'aria-live': 'assertive'
  4162. });
  4163. $divElem.text(sMessage);
  4164. $('body').append($divElem);
  4165. setTimeout(function () {
  4166. $divElem.remove();
  4167. }.bind(this), 100);
  4168. },
  4169. /**
  4170. * Closes the currently open dialog. Assumes the dialog has a cancel button.
  4171. * @public
  4172. */
  4173. closeDialog: function closeDialog() {
  4174. $('.dialogBlocker').find('#cancel').trigger('primaryaction');
  4175. },
  4176. _isWebFont: function _isWebFont(icon) {
  4177. if (icon) {
  4178. for (var i in matchPatterns) {
  4179. var pattern = matchPatterns[i];
  4180. var regEx = new RegExp('^' + pattern, 'g');
  4181. if (icon.search(regEx) !== -1) {
  4182. return true;
  4183. }
  4184. }
  4185. }
  4186. return false;
  4187. },
  4188. _isImageIcon: function _isImageIcon(icon) {
  4189. if (icon) {
  4190. for (var i in imageIcons) {
  4191. var pattern = imageIcons[i];
  4192. var regEx = new RegExp(pattern, 'g');
  4193. if (icon.search(regEx) !== -1) {
  4194. return true;
  4195. }
  4196. }
  4197. }
  4198. return false;
  4199. },
  4200. /**
  4201. * Launch a legacy Cognos application in a separate tab
  4202. * @Deprected. See LegacyUtils.legacyLaunch
  4203. */
  4204. legacyLaunch: function legacyLaunch(glassContext, tool, object, folder) {
  4205. return LegacyUtils.legacyLaunch(glassContext, tool, object, folder);
  4206. },
  4207. /**
  4208. * @public
  4209. * @property {String} EVENT_DIALOG - event property name.
  4210. */
  4211. EVENT_DIALOG: 'eventDialog',
  4212. /**
  4213. * @public
  4214. * Sets the event property.
  4215. *
  4216. * @param {Object} event - The JQuery event object.
  4217. * @param {String} propertyName - The property name to associate with the event.
  4218. * @param {Object} propertyValue - The value of the property.
  4219. *
  4220. */
  4221. setEventProperty: function setEventProperty(event, propertyName, propertyValue) {
  4222. var srcEvent = this._getSourceEvent(event);
  4223. srcEvent[propertyName] = propertyValue;
  4224. },
  4225. /**
  4226. * @public
  4227. * Gets the event property.
  4228. *
  4229. * @param {Object} event - The JQuery event object.
  4230. * @param {String} propertyName - The property name to associate with the event.
  4231. * @return {boolean} true if it is, false otherwise
  4232. */
  4233. getEventProperty: function getEventProperty(event, propertyName) {
  4234. var srcEvent = this._getSourceEvent(event);
  4235. return srcEvent[propertyName] && srcEvent[propertyName] === true;
  4236. },
  4237. _getSourceEvent: function _getSourceEvent(event) {
  4238. var srcEvent;
  4239. if (event.gesture) {
  4240. srcEvent = event.gesture.srcEvent;
  4241. } else if (event.originalEvent) {
  4242. srcEvent = event.originalEvent;
  4243. } else {
  4244. srcEvent = event;
  4245. }
  4246. return srcEvent;
  4247. },
  4248. isIpad: function isIpad() {
  4249. if (navigator.userAgent.match(/iPad/i) !== null) {
  4250. $('body').addClass('mobile');
  4251. return true;
  4252. }
  4253. return false;
  4254. },
  4255. /**
  4256. * @public
  4257. * Determines if the functional control key is pressed. For windows, this will
  4258. * simply return true or false if <code>crtl</code> is pressed. For the Mac environment
  4259. * this will return true or false if the <code>command</code> key is pressed. This is
  4260. * because the <code>crtl</code> key maps to the <code>command</code> on a Mac. The
  4261. * <code>control</code> key on a Mac does not provide the functionality that it does
  4262. * in other environments (this is by Apple convention). The <code>control</code> key
  4263. * in the Mac environment normally acts as though it were a "right-click", rather than
  4264. * a secondary function key.
  4265. *
  4266. * @param {object} evt - a browser event object
  4267. * @return {boolean} true if command key for Mac is pressed, or control key on other platforms. False otherwise
  4268. */
  4269. isControlKey: function isControlKey(evt) {
  4270. var agentRegEx = /Macintosh/;
  4271. if (agentRegEx.test(this._getBrowserUserAgent())) {
  4272. return evt.metaKey;
  4273. }
  4274. return evt.ctrlKey;
  4275. },
  4276. _getBrowserUserAgent: function _getBrowserUserAgent() {
  4277. return navigator.userAgent;
  4278. },
  4279. /**
  4280. * @description Detect if a given window is in an iframe.
  4281. * @param {Object} currentWindow (optional) - A window. If not provided, the current window will be used.
  4282. * @returns {Boolean} true if window is in an iframe; false otherwise.
  4283. */
  4284. isInIframe: function isInIframe(currentWindow) {
  4285. try {
  4286. currentWindow = currentWindow || window;
  4287. return currentWindow.self !== currentWindow.top;
  4288. } catch (e) {
  4289. // Cross-domain iframe will throw security acception when
  4290. // attempting to access window.top.
  4291. return true;
  4292. }
  4293. },
  4294. /**
  4295. Returns a formated duration string
  4296. **/
  4297. formatDuration: function formatDuration(milliseconds) {
  4298. if (!milliseconds || isNaN(milliseconds)) {
  4299. return StringResources.get('unknown');
  4300. }
  4301. var seconds = Math.floor(milliseconds / 1000);
  4302. var minutes = Math.floor(seconds / 60);
  4303. var hours = Math.floor(minutes / 60);
  4304. var days = Math.floor(hours / 24);
  4305. seconds = seconds % 60;
  4306. minutes = minutes % 60;
  4307. hours = hours % 24;
  4308. if (days > 0) {
  4309. return StringResources.get('EllapsedTimeDays', {
  4310. 'days': days,
  4311. 'hours': hours,
  4312. 'minutes': minutes,
  4313. 'seconds': seconds
  4314. });
  4315. } else if (hours > 0) {
  4316. return StringResources.get('EllapsedTimeHours', {
  4317. 'hours': hours,
  4318. 'minutes': minutes,
  4319. 'seconds': seconds
  4320. });
  4321. } else if (minutes > 0) {
  4322. return StringResources.get('EllapsedTimeMinutes', {
  4323. 'minutes': minutes,
  4324. 'seconds': seconds
  4325. });
  4326. } else {
  4327. return StringResources.get('EllapsedTimeSeconds', {
  4328. 'seconds': seconds
  4329. });
  4330. }
  4331. },
  4332. /** Converts a rgb string to an hex representation of the color
  4333. * @param rgb rgb string
  4334. */
  4335. rgbToHex: function rgbToHex(rgb) {
  4336. rgb = rgb.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);
  4337. return rgb && rgb.length === 4 ? '#' + ('0' + parseInt(rgb[1], 10).toString(16)).slice(-2) + ('0' + parseInt(rgb[2], 10).toString(16)).slice(-2) + ('0' + parseInt(rgb[3], 10).toString(16)).slice(-2) : '';
  4338. },
  4339. createTemporaryContainer: function createTemporaryContainer() {
  4340. var container = $(document.body).find('.reactTemporaryContainer');
  4341. if (container.length === 0) {
  4342. container = $('<div class="reactTemporaryContainer">');
  4343. $(document.body).append(container);
  4344. }
  4345. return container.get(0);
  4346. },
  4347. removeTemporaryContainer: function removeTemporaryContainer() {
  4348. $(document.body).find('.reactTemporaryContainer').remove();
  4349. },
  4350. reactRender: function reactRender(element, container) {
  4351. return new Promise(function (resolve, reject) {
  4352. require(['react-dom'], function (ReactDOM) {
  4353. try {
  4354. ReactDOM.render(element, container, resolve);
  4355. } catch (error) {
  4356. reject(error);
  4357. }
  4358. }, reject);
  4359. });
  4360. },
  4361. is24HrFormat: function is24HrFormat() {
  4362. throw new Error('This function has been removed; Use core-client/utils/DateTimeUtils.is24HrFormat');
  4363. },
  4364. /**
  4365. * @return the current Browser window object
  4366. */
  4367. getCurrentWindow: function getCurrentWindow() {
  4368. return window;
  4369. },
  4370. createPerformanceMark: function createPerformanceMark() {
  4371. throw new Error('This function has been removed; Use core-client/utils/PerfUtils.createPerformanceMark');
  4372. },
  4373. clearPerformanceMark: function clearPerformanceMark() {
  4374. throw new Error('This function has been removed; Use core-client/utils/PerfUtils.clearPerformanceMark');
  4375. },
  4376. /**
  4377. * @public
  4378. * Traverse a JavaScript object and call matchCallback on each defined elements.
  4379. * @returns found object
  4380. *
  4381. * @param {object} obj JavaScript object to be traversed
  4382. * @param {function} matchCallback function which should return true when the element is matched
  4383. * @example
  4384. * utils.traverse([{id: 4}, {id: 5}], function(obj) {
  4385. return obj.id === 4;
  4386. });
  4387. */
  4388. traverse: function traverse(obj, matchCallback) {
  4389. var queue = [obj];
  4390. while (queue.length) {
  4391. var current = queue.shift();
  4392. if (current && matchCallback(current)) {
  4393. return current;
  4394. }
  4395. if (_.isObject(current) || _.isArray(current)) {
  4396. queue = queue.concat(_.values(current));
  4397. }
  4398. }
  4399. }
  4400. };
  4401. });
  4402. //# sourceMappingURL=Utils.js.map
  4403. ;
  4404. /**
  4405. * Licensed Materials - Property of IBM
  4406. *
  4407. * IBM Cognos Products: BI
  4408. *
  4409. * Copyright IBM Corp. 2015, 2017
  4410. *
  4411. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  4412. */
  4413. define('baglass/core-client/js/core-client/ui/ToastMessage',['./core/Class', 'underscore', 'jquery', 'toastr', '../utils/Utils', '../nls/StringResources', 'jquery-ui'], function (Class, _, $, toastr, utils, stringResources) {
  4414. var ToastMessage = Class.extend(
  4415. /**
  4416. * @lends ToastMessage.prototype
  4417. */
  4418. {
  4419. TIMEOUT: 3000,
  4420. MAX_TOAST: 5,
  4421. currentOptions: {},
  4422. /**
  4423. * @classdesc Class that allows you to create a toast message under the nav-bar. There is 4 type of toast :
  4424. * 1.'success' to specify a positive message that a certain action was successfuly completed. (Default toast)
  4425. * 2.'error' to specify an error after a certain action
  4426. * 3.'warning' to warn the user.
  4427. * 4.'info' to inform the user.
  4428. * @constructs
  4429. * @public
  4430. * @param {Object} [options] Options to override the behaviour of the toast.
  4431. * @param {String} [options.showMethod] : How the toast will show up (show, fadeIn, slideDown)
  4432. * @param {String} [options.hideMethod] : How the toast will hide (hide, fadeOut,slideUp)
  4433. * @param {String} [options.type] : Type of the toast (success, error, info, warning)
  4434. * @param {String} [options.btnLabel] : Give a label to the close button
  4435. * @param {Function} [options.callback] : Override the default callback for close button
  4436. * @param {Function} [options.onHidden] : Override the default callback when the toast is hidden
  4437. * @param {Function} [options.onShown] : Override the default callback when the toast is shown
  4438. * @param {Boolean} [options.preventDuplicates] : When true, it prevents a same toast from appearing twice
  4439. * @param {Number} [options.timeOut] : Optional value for custom timeout for the toast dismissal
  4440. * @returns An object with the options of the toast.
  4441. *
  4442. * @example : var toast = new ToastMessage({'type':'warning', 'btnLabel':'OK', 'callback':function(){console.log('worked');}});
  4443. */
  4444. defaultOptions: {
  4445. 'closeButton': true,
  4446. 'newestOnTop': false,
  4447. 'tapToDismiss': false,
  4448. 'positionClass': 'toast-top-center',
  4449. 'showDuration': '500',
  4450. 'hideDuration': '500',
  4451. 'showEasing': 'swing',
  4452. 'hideEasing': 'linear',
  4453. 'showMethod': 'slideDown',
  4454. 'hideMethod': 'slideUp',
  4455. 'type': 'success',
  4456. iconClasses: {
  4457. error: 'toast-error',
  4458. info: 'toast-info',
  4459. success: 'toast-success',
  4460. warning: 'toast-warning'
  4461. },
  4462. 'secondaryLabel': stringResources.get('details')
  4463. },
  4464. init: function init(options) {
  4465. this.toastrOptions = {};
  4466. $.extend(true, this.toastrOptions, this.defaultOptions, options);
  4467. this.toastrOptions.timeOut = this.toastrOptions.timeOut || 0;
  4468. this.toastrOptions.extendedTimeOut = 0;
  4469. ToastMessage.inherited('init', this, arguments);
  4470. },
  4471. render: function render(message) {
  4472. var timestamp = $.now();
  4473. var msgId = 'toast-message' + timestamp;
  4474. var iconId = 'toast-icon' + timestamp;
  4475. if (_.isUndefined(toastr.options.type)) {
  4476. toastr.options.type = 'success';
  4477. }
  4478. var iconLabel = stringResources.get(toastr.options.type);
  4479. if (toastr.options.btnLabel) {
  4480. var $btn = $('<div></div>', {
  4481. 'aria-label': toastr.options.btnLabel,
  4482. 'title': toastr.options.btnLabel,
  4483. 'class': 'toast-close-label',
  4484. 'type': 'button',
  4485. 'role': 'button',
  4486. 'tabIndex': '0'
  4487. });
  4488. $btn.text(toastr.options.btnLabel);
  4489. toastr.options.closeHtml = $btn[0];
  4490. } else {
  4491. var lblClose = stringResources.get('close');
  4492. var $temp = $('<div></div>', {
  4493. 'role': 'button',
  4494. 'aria-label': lblClose,
  4495. 'title': lblClose,
  4496. 'class': 'toast-close-div',
  4497. 'tabIndex': '0'
  4498. });
  4499. utils.setIcon($temp, 'common-close_icon', lblClose);
  4500. toastr.options.closeHtml = $temp[0];
  4501. }
  4502. toastr.options.type = toastr.options.type.toLowerCase();
  4503. var toastIcon = 'common-success';
  4504. message = _.escape(message);
  4505. if (this._isMessageLarge(message)) {
  4506. _.each(toastr.options.iconClasses, function (value, key) {
  4507. toastr.options.iconClasses[key] = value.concat(' large');
  4508. });
  4509. }
  4510. var $el;
  4511. switch (toastr.options.type) {
  4512. case 'info':
  4513. toastr.options.timeOut = toastr.options.timeOut === 0 ? this.TIMEOUT : toastr.options.timeOut;
  4514. $el = toastr.info(message);
  4515. toastIcon = 'common-info-moreinfo';
  4516. break;
  4517. case 'warning':
  4518. toastr.options.timeOut = toastr.options.timeOut || 0;
  4519. $el = toastr.warning(message);
  4520. toastIcon = 'common-warning';
  4521. break;
  4522. case 'error':
  4523. toastr.options.timeOut = toastr.options.timeOut || 0;
  4524. $el = toastr.error(message);
  4525. toastIcon = 'common-error';
  4526. break;
  4527. default:
  4528. toastr.options.timeOut = toastr.options.timeOut === 0 ? this.TIMEOUT : toastr.options.timeOut;
  4529. $el = toastr.success(message);
  4530. }
  4531. if ($el) {
  4532. /*
  4533. * Remove applicable container aria attributes added by Toastr
  4534. * micro library which caused all visible toasts to be read again.
  4535. */
  4536. $el.parent().removeAttr('role aria-live');
  4537. utils.activateAriaAlert(message);
  4538. $el.attr('aria-labelledby', iconId + ' ' + msgId);
  4539. $el.find('.toast-message').attr('id', msgId);
  4540. var $iconToast = $('<div></div>', {
  4541. 'class': 'toast-icon',
  4542. 'id': iconId,
  4543. 'aria-label': iconLabel
  4544. });
  4545. $el.append($iconToast);
  4546. utils.setIcon($iconToast, toastIcon, iconLabel);
  4547. if (_.isFunction(toastr.options.callback)) {
  4548. $el.find('.toast-close-button').on('primaryaction', toastr.options.callback);
  4549. }
  4550. $($el).unbind('mouseenter mouseleave');
  4551. var $closeBtn = $el.find('.toast-close-button');
  4552. this._addSecondaryButton($closeBtn);
  4553. $closeBtn.on('primaryaction', function (e) {
  4554. $closeBtn.off('primaryaction');
  4555. $closeBtn.trigger('click');
  4556. this.setNextTabFocus($el);
  4557. if (e) {
  4558. e.stopPropagation();
  4559. }
  4560. }.bind(this));
  4561. $el.on('click', function (e) {
  4562. if (e) {
  4563. e.stopPropagation();
  4564. }
  4565. }.bind(this));
  4566. this._limitToast();
  4567. }
  4568. return $el;
  4569. },
  4570. /**
  4571. * @classdesc Show the toast you created on the screen
  4572. * @constructs
  4573. * @public
  4574. * @param {String} [message] Message of the toast
  4575. * @returns a jquery object of the toast message
  4576. * @example toast.show('A message');
  4577. */
  4578. show: function show(message) {
  4579. toastr.options = this.toastrOptions;
  4580. return this.render(message);
  4581. },
  4582. /** @protected */
  4583. setNextTabFocus: function setNextTabFocus($el) {
  4584. var $focusEl = $el.next('.toast').find('.toast-close-button').first();
  4585. if ($focusEl.length === 0) {
  4586. $focusEl = $el.prev('.toast').find('.toast-close-button').first();
  4587. }
  4588. if ($focusEl.length === 0) {
  4589. //No toasts remain. Since Toasts are the last tab order, set focus to first tab in the document
  4590. $(':tabbable:first').focus();
  4591. } else {
  4592. $focusEl.focus();
  4593. }
  4594. },
  4595. _limitToast: function _limitToast() {
  4596. var toastShown = $(document).find('#toast-container').children();
  4597. if (toastShown.length > this.MAX_TOAST) {
  4598. var removableToast = toastShown.length - this.MAX_TOAST;
  4599. for (var i = 0; i < removableToast; i++) {
  4600. if (!$(toastShown[i]).hasClass('toast-progress')) {
  4601. toastr.clear($(toastShown[i]));
  4602. }
  4603. }
  4604. }
  4605. },
  4606. _addSecondaryButton: function _addSecondaryButton($closeBtn) {
  4607. var _this = this;
  4608. if (this.toastrOptions.secondaryCallback) {
  4609. var secondaryButton = $('<button class="secondaryButton">' + this.toastrOptions.secondaryLabel + '</button>');
  4610. secondaryButton.click(function () {
  4611. _this.toastrOptions.secondaryCallback();
  4612. $closeBtn.trigger('primaryaction');
  4613. });
  4614. $closeBtn.after(secondaryButton);
  4615. }
  4616. },
  4617. _isMessageLarge: function _isMessageLarge(message) {
  4618. var result = false;
  4619. var $tempDiv = $('<span class = "test-message">' + message + '</span>');
  4620. $tempDiv.css('width', 200);
  4621. $tempDiv.css('height', 'auto');
  4622. $tempDiv.css('font-size', 15);
  4623. $tempDiv.css('font-family', 'HelvNeue Roman for IBM');
  4624. $tempDiv.css('word-wrap', 'break-word');
  4625. var $container = $('<div></div>');
  4626. $container.css('width', 200);
  4627. $container.css('position', 'absolute');
  4628. $container.css('left', -500);
  4629. $container.append($tempDiv);
  4630. $('body').append($container);
  4631. result = $tempDiv.height() > 30;
  4632. $container.remove();
  4633. return result;
  4634. }
  4635. });
  4636. ToastMessage.remove = function () {
  4637. $('#toast-container').children(':not(.toast-progress)').remove();
  4638. };
  4639. return ToastMessage;
  4640. });
  4641. //# sourceMappingURL=ToastMessage.js.map
  4642. ;
  4643. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4644. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  4645. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  4646. /**
  4647. * Licensed Materials - Property of IBM
  4648. * IBM Cognos Products: BI Glass
  4649. * (C) Copyright IBM Corp. 2018
  4650. * US Government Users Restricted Rights - Use, duplication or disclosure
  4651. * restricted by GSA ADP Schedule Contract with IBM Corp.
  4652. */
  4653. define('baglass/app/utils/CloseViewUtils',['jquery', 'baglass/nls/StringResources'], function ($, StringResources) {
  4654. var CloseViewUtils = /*#__PURE__*/function () {
  4655. function CloseViewUtils() {
  4656. _classCallCheck(this, CloseViewUtils);
  4657. }
  4658. _createClass(CloseViewUtils, null, [{
  4659. key: "waitForCloseConfirmation",
  4660. value: function waitForCloseConfirmation(glassContext, options) {
  4661. return new Promise(function (resolve, reject) {
  4662. options = options || {};
  4663. var message = options.unsaveMessage || StringResources.get('unsavedViewMsg2');
  4664. var title = options.title || StringResources.get('unsavedViewMsg1');
  4665. var buttons = [{
  4666. defaultId: 'ok',
  4667. text: StringResources.get('unsavedViewMsg3')
  4668. }, 'cancel'];
  4669. glassContext.showMessage(message, title, 'info', buttons, undefined, function (event) {
  4670. if (event.btn === 'ok') {
  4671. resolve();
  4672. }
  4673. reject();
  4674. }).then(function () {
  4675. $('.dialogButton.secondary').focus();
  4676. });
  4677. });
  4678. }
  4679. }]);
  4680. return CloseViewUtils;
  4681. }();
  4682. return CloseViewUtils;
  4683. });
  4684. //# sourceMappingURL=CloseViewUtils.js.map
  4685. ;
  4686. /**
  4687. * Licensed Materials - Property of IBM
  4688. *
  4689. * "Restricted Materials of IBM"
  4690. *
  4691. * 5746-SM2
  4692. *
  4693. * (C) Copyright IBM Corp. 2016
  4694. *
  4695. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  4696. */
  4697. define('baglass/core-client/js/core-client/ui/AccessibleView',['jquery', 'underscore', './View'], function ($, _, View) {
  4698. var AccessibleView = View.extend({
  4699. /**
  4700. * @classdesc Base class supporting keyboard accessibility by allowing the view to set focus within it's content and keep track of the launch point of the view.
  4701. * @constructs
  4702. * @public
  4703. * @param {Object} options - set of initial properties
  4704. * @param {DOMElement} [options.launchPoint] - the DOM UI element from which the view was launched. If not provided by the invoker, the last active element is used.
  4705. * @param {Boolean} [options.enableTabLooping]- Set to true to allow tab looping within the view.
  4706. */
  4707. init: function init(options) {
  4708. AccessibleView.inherited('init', this, arguments);
  4709. _.extend(this, options);
  4710. if (this.launchPoint === undefined || this.launchPoint === null) {
  4711. this._launchPoint = document.activeElement;
  4712. } else {
  4713. this._launchPoint = this.launchPoint;
  4714. delete this.launchPoint;
  4715. }
  4716. this.$entryHeader = $('<div tabindex="0" class="entryHeaderAV"></div>');
  4717. this.$exitHeader = $('<div tabindex="0" class="exitHeaderAV"></div>');
  4718. this.$el.append(this.$entryHeader);
  4719. this.$el.append(this.$exitHeader);
  4720. this.$entryHeader.on('focus', this._enterView.bind(this));
  4721. this.$exitHeader.on('focus', this._setFocusToLaunchPoint.bind(this));
  4722. },
  4723. /**
  4724. * Returns the launch point or the DOM element which invoked the current view. Implementing classes may override this method if there are special cases leading to
  4725. * different launch points.
  4726. * @public
  4727. * @returns {String|DOM element|JQuery Object} the launch point which can be a String representing a JQuery selector, DOM element or Jquery Object
  4728. */
  4729. getLaunchPoint: function getLaunchPoint() {
  4730. return this._launchPoint;
  4731. },
  4732. setInnerContent: function setInnerContent($content) {
  4733. if ($content instanceof $) {
  4734. $content.insertAfter(this.$exitHeader);
  4735. }
  4736. },
  4737. _enterView: function _enterView() {
  4738. var tabbableEls = this.$el.find(':tabbable');
  4739. tabbableEls.eq(2).focus();
  4740. },
  4741. /**
  4742. * Sets the launch point
  4743. * @public
  4744. * @param {String|DOM element|JQuery Object} - the launch point which can be a String representing a JQuery selector, DOM element or Jquery Object
  4745. */
  4746. setLaunchPoint: function setLaunchPoint(launchPoint) {
  4747. this._launchPoint = launchPoint;
  4748. },
  4749. /**
  4750. * Enables keyboard tab looping on a container.
  4751. * @public
  4752. * @param {JQuery Object} - the jquery UI object you want to enable the looping on.
  4753. */
  4754. enableLooping: function enableLooping($container) {
  4755. if ($container instanceof $ && this.enableTabLooping === true && $container.next().hasClass('tabLoopFooter') === false) {
  4756. this.$loopFooter = $('<div class="tabLoopFooter" tabindex="0" style="height:0px;width:0px"></div>');
  4757. this.$loopFooter.insertAfter($container);
  4758. this.$loopFooter.on('focus', this._tabToFirstElementInView.bind($container));
  4759. this.$loopHeader = $('<div class="tabLoopHeader" tabindex="0" style="height:0px;width:0px"></div>');
  4760. this.$loopHeader.insertBefore($container);
  4761. this.$loopHeader.on('focus', this._tabToLastElementInView.bind($container));
  4762. }
  4763. },
  4764. /**
  4765. * @private
  4766. * Action handler to shift the focus to the launch point when the root DOM node of the view gets the focus.
  4767. */
  4768. _setFocusToLaunchPoint: function _setFocusToLaunchPoint() {
  4769. if (this.getLaunchPoint() !== undefined && this.getLaunchPoint() !== null) {
  4770. $(this.getLaunchPoint()).focus();
  4771. }
  4772. },
  4773. _tabToFirstElementInView: function _tabToFirstElementInView() {
  4774. var firstTabbableElement = this.find(':tabbable').first();
  4775. if (firstTabbableElement !== undefined && firstTabbableElement !== null) {
  4776. firstTabbableElement.focus();
  4777. }
  4778. },
  4779. _tabToLastElementInView: function _tabToLastElementInView() {
  4780. var lastTabbableElement = this.find(':tabbable').last();
  4781. if (lastTabbableElement !== undefined && lastTabbableElement !== null) {
  4782. lastTabbableElement.focus();
  4783. }
  4784. },
  4785. /**
  4786. * @public
  4787. * Removes the root container for the View from the natural tab order. Does not work for the content of the view.
  4788. * The contributors are responsible for ensuring that the content they put in the view is also taken our of the natural tab order.
  4789. */
  4790. removeContainerOnlyFromTabOrder: function removeContainerOnlyFromTabOrder() {
  4791. this.$entryHeader.removeAttr('tabIndex');
  4792. this.$exitHeader.removeAttr('tabIndex');
  4793. if (this.$loopFooter) {
  4794. this.$loopFooter.removeAttr('tabIndex');
  4795. }
  4796. if (this.$loopHeader) {
  4797. this.$loopHeader.removeAttr('tabIndex');
  4798. }
  4799. },
  4800. /**
  4801. * @public
  4802. * Adds the root container for the View to the natural tab order. Does not work for the content of the view.
  4803. * The contributors are responsible for ensuring that the content they put in the view is also put back in the natural tab order.
  4804. */
  4805. enterContainerOnlyInTabOrder: function enterContainerOnlyInTabOrder() {
  4806. this.$entryHeader.attr('tabindex', '0');
  4807. this.$exitHeader.attr('tabindex', '0');
  4808. if (this.$loopFooter) {
  4809. this.$loopFooter.attr('tabIndex', '0');
  4810. }
  4811. if (this.$loopHeader) {
  4812. this.$loopHeader.attr('tabIndex', '0');
  4813. }
  4814. },
  4815. remove: function remove() {
  4816. AccessibleView.inherited('remove', this, arguments);
  4817. }
  4818. });
  4819. return AccessibleView;
  4820. });
  4821. //# sourceMappingURL=AccessibleView.js.map
  4822. ;
  4823. define('baglass/core-client/js/core-client/utils/PerfUtils',['underscore'], function (_) {
  4824. return {
  4825. /**
  4826. * @public
  4827. * Create a performance entry in the browser's performance entry buffer.
  4828. *
  4829. * @param {string} options.component - component name, for example, glass
  4830. * @param {String} options.name - entry name, for example, openPerspective
  4831. * @param {String} options.state - state, for example, start or stop
  4832. */
  4833. createPerformanceMark: function createPerformanceMark(options) {
  4834. if (!_.isUndefined(options)) {
  4835. var performance = this._getPerformance();
  4836. if (!_.isUndefined(performance) && _.isFunction(performance.mark)) {
  4837. performance.mark(options.component + '-' + options.name + '-' + options.state);
  4838. }
  4839. }
  4840. },
  4841. /**
  4842. * @public
  4843. * Clear a performance entry in the browser's performance entry buffer.
  4844. *
  4845. * @param {string} options.component
  4846. * @param {String} options.name
  4847. * @param {String} options.state
  4848. */
  4849. clearPerformanceMark: function clearPerformanceMark(options) {
  4850. if (!_.isUndefined(options)) {
  4851. var performance = this._getPerformance();
  4852. if (!_.isUndefined(performance) && _.isFunction(performance.clearMarks)) {
  4853. performance.clearMarks(options.component + '-' + options.name + '-' + options.state);
  4854. }
  4855. }
  4856. },
  4857. _getPerformance: function _getPerformance() {
  4858. return performance;
  4859. }
  4860. };
  4861. });
  4862. //# sourceMappingURL=PerfUtils.js.map
  4863. ;
  4864. /**
  4865. * Licensed Materials - Property of IBM
  4866. * IBM Cognos Products: BI Glass
  4867. * Copyright IBM Corp. 2015, 2018
  4868. * US Government Users Restricted Rights - Use, duplication or disclosure
  4869. * restricted by GSA ADP Schedule Contract with IBM Corp.
  4870. */
  4871. define('baglass/core-client/js/core-client/ui/Slideout',['./AccessibleView', 'jquery', 'underscore', '../utils/ClassFactory', '../utils/Utils', '../utils/PerfUtils', '../nls/StringResources', 'jquery-ui', 'touch-punch'], function (View, $, _, ClassFactory, Utils, PerfUtils, StringResources) {
  4872. /**
  4873. * This Class is the Glass Slider
  4874. */
  4875. var Slideout = null;
  4876. /**
  4877. * Sets the id of the slideout
  4878. */
  4879. function __setId() {
  4880. if (!_.isString(this.id)) {
  4881. this.id = this.content && _.isString(this.content.module) ? this.content.module : _.uniqueId('undefinedModule');
  4882. }
  4883. }
  4884. function __isTargetInSlideout(slideout, target) {
  4885. var targetInSlideout = false;
  4886. while (slideout !== null) {
  4887. targetInSlideout = targetInSlideout || $.contains(slideout.$el.get(0), target);
  4888. slideout = slideout.child;
  4889. }
  4890. return targetInSlideout;
  4891. }
  4892. function __isUniqueOption(hidingOptions, optionToCheck) {
  4893. return hidingOptions.every(function (hidingOption) {
  4894. return ['force', 'hideOnly', 'depth', 'isEscape'].some(function (prop) {
  4895. return hidingOption[prop] !== optionToCheck[prop];
  4896. });
  4897. });
  4898. }
  4899. /**
  4900. * We cancel the hide if any of the following conditions applies:
  4901. * jshint maxcomplexity:14
  4902. */
  4903. function __shouldSlideoutHide(slideout, event, lastMouseDownEvent) {
  4904. // - The event target is a child of the slideout
  4905. if (__isTargetInSlideout(slideout, event.target)) {
  4906. return false;
  4907. }
  4908. // - The event target is not a part of the body. This is to avoid closing the slideout when updating the content in the maximized content apps view
  4909. if (!$.contains(document.body, event.target)) {
  4910. return false;
  4911. }
  4912. // - preventDefault has been called.
  4913. if (event.isDefaultPrevented()) {
  4914. return false;
  4915. }
  4916. // - The container is hidden
  4917. if (slideout.$el.closest('.tabhidden').length !== 0) {
  4918. return false;
  4919. }
  4920. // - The event is a dialog event
  4921. if (Utils.getEventProperty(event, Utils.EVENT_DIALOG)) {
  4922. return false;
  4923. }
  4924. // - The mouse down event was in the slideout. This avoids closing the slideout if we click inside the slideout and drag the mouse outside the slideout.
  4925. // For example, by selecting the resizable handle, and then release the mouse outside of the slideout.
  4926. if (lastMouseDownEvent !== null && __isTargetInSlideout(slideout, lastMouseDownEvent.target)) {
  4927. return false;
  4928. }
  4929. return true;
  4930. }
  4931. /**
  4932. * creates the hideHandler only for the parent
  4933. */
  4934. function __createHideHandler() {
  4935. var lastMouseDownEvent = null;
  4936. if (this.parent === null) {
  4937. this.hideHandler = function (event) {
  4938. if (event.type === 'mousedown' || event.type === 'touchstart') {
  4939. lastMouseDownEvent = event;
  4940. } else {
  4941. if (__shouldSlideoutHide(this, event, lastMouseDownEvent)) {
  4942. this.hide({
  4943. hideOnly: this.hideOnly
  4944. });
  4945. }
  4946. lastMouseDownEvent = null;
  4947. }
  4948. }.bind(this);
  4949. }
  4950. }
  4951. /**
  4952. * Complete the hide operation
  4953. * Wire off the hide handler if necessary and trigger the hide event
  4954. */
  4955. function __completeHide() {
  4956. if (this.hideHandler !== null && !this.hasOpenChild()) {
  4957. $(document).off(this.closeEventPattern, this.hideHandler);
  4958. }
  4959. this.$el.children('.ui-resizable-handle').hide();
  4960. this.trigger('hide');
  4961. }
  4962. function __addChild(child, options) {
  4963. var _this = this;
  4964. if (!this.addChildLocked) {
  4965. this.addChildLocked = true;
  4966. this.removeChild().then(function () {
  4967. _this.child = child;
  4968. if (options.overlay) {
  4969. _this.$el.css('z-index', '2999');
  4970. $(_this.$el.parents()[0]).append(_this.child.$el);
  4971. } else {
  4972. _this.$el.children('.pane-child').append(_this.child.$el);
  4973. }
  4974. _this.child.render();
  4975. _this.child.setContent(options.content);
  4976. return _this.child.show();
  4977. }).then(function () {
  4978. _this.addChildLocked = false;
  4979. });
  4980. }
  4981. }
  4982. /**
  4983. * @public
  4984. */
  4985. Slideout = View.extend(
  4986. /**
  4987. * @lends Slideout.prototype
  4988. */
  4989. {
  4990. _ClassFactory: ClassFactory,
  4991. /**
  4992. * delay after which the animation is considered complete
  4993. */
  4994. ANIMATION_TIMEOUT: 500,
  4995. /**
  4996. * Default limit for the number of slideout being shown before the collapse bar appears
  4997. */
  4998. DISPLAY_LIMIT: 3,
  4999. /**
  5000. * This value has to be exactly the same as the value in slideout.css line 177 - the width of the pagination pane
  5001. */
  5002. PAGINATION_WIDTH: 36,
  5003. open: false,
  5004. events: {
  5005. 'primaryaction .pane-pagination-control': 'pageBack',
  5006. 'primaryaction .pin-icon': '_togglePin'
  5007. },
  5008. closeEventPattern: 'mousedown.slideout touchstart.slideout clicktap.slideout',
  5009. /**
  5010. * This type is used to provide info on how the slideout is shown
  5011. * @typedef DisplayInfo
  5012. * @type Object
  5013. * @property {Slideout} firstToCollapse - first slideout to collapse if required
  5014. * @property {Number} width - width of the displayed slideouts
  5015. * @property {Slideout[]} visible - Array of displayed slideouts
  5016. * @property {Number} firstDisplayedAfterCollapsed - expected to be null when there is no slideout to collapse
  5017. * @property {Slideout[]} collapsed - Arrays of slideouts to collapse
  5018. */
  5019. /**
  5020. * @classdesc class allowing to open/show/hide/close a slider
  5021. * @constructs
  5022. * @public
  5023. * @param {Object} options - set of initial properties
  5024. * @param {String} options.position - The position of the slideout; Supported values: left and right
  5025. * @param {GlassContext} options.glassContext - The glassContext of the application
  5026. * @param {Number} options.width - The width for the slideout
  5027. * @param {Number} [options.displayLimit] - Number of slideouts being shown without being collapsed where there is enough space
  5028. * @param {function} [options.onHide] - callback invoked when the slideout.hide is invoked
  5029. * @param {Object} [options.pinning] - pinning properties
  5030. * @param {boolean} [options.pinning.isPinned=false] - slideout is pinned when true
  5031. * @param {boolean} [options.pinning.float=true] - no-float class is applied when false
  5032. * @param {boolean} [options.pinning.display=false or true if isPinned is true] - default pin is shown when true
  5033. * @param {Number} [options.collapseRootIndex=0] - index of the slideout which is to be the root of the collapse
  5034. * @param {Boolean} [options.hideOnly=undefined] - indicates if the slideout is to be hidden only. Only applicable for the parent/whole slideout
  5035. * @param {Boolean} [options.hideOnParentClick=true] - indicates if the slideout is to be hidden only when closing it using the clicktap event. Only applicable for the parent/whole slideout
  5036. * @param {String} [options.label=Slideout] - specifies the label that will be used for the slideout by assistive technologies.
  5037. * @param {Boolean} [options.enableTabLooping=undefined] - if true, enable tab looping within the slideout.
  5038. * @param {Boolean} [options.resizable=false] - if true or object, the slideout will have a resizable handle.
  5039. * @param {function} [options.onResize] - callback invoked during slideout resize
  5040. * @param {function} [options.onResizeStart] - callback invoked at the beginning of slideout resize
  5041. * @param {function} [options.onResizeStop] - callback invoked at the end of slideout resize
  5042. * @param {Boolean} [options.resizable.min=300] - The minimum width the slideout should be allowed to resize to.
  5043. * @param {Boolean} [options.resizable.max=1000] - The maximum width the slideout should be allowed to resize to.
  5044. * @example
  5045. * To create a left slideout:
  5046. * new Slideout({
  5047. * glassContext: this.glassContext,
  5048. * position: 'left'
  5049. * });
  5050. *
  5051. * To create a left pinned slideout without the shown pin:
  5052. * new Slideout({
  5053. * glassContext: this.glassContext,
  5054. * position: 'left',
  5055. * pinning: {
  5056. * isPinned: true,
  5057. * display: false
  5058. * }
  5059. * });
  5060. *
  5061. * */
  5062. init: function init(options) {
  5063. this.child = null;
  5064. this.open = false;
  5065. this.parent = null;
  5066. Slideout.inherited('init', this, arguments);
  5067. $.extend(this, options);
  5068. this.hideHandler = null;
  5069. this._showing = null;
  5070. this.hideOnParentClick = this.hideOnParentClick !== false;
  5071. this._root = this.parent === null ? this : this.parent._root;
  5072. this._index = this.parent === null ? 0 : this.parent._index + 1;
  5073. this.__initPinningSettings();
  5074. this.__initDisplaySettings();
  5075. __setId.call(this);
  5076. __createHideHandler.call(this, options);
  5077. this._childToAdd = [];
  5078. this._paginationLaunchPoint = null;
  5079. if (this.label === undefined || this.label === null) {
  5080. this.label = _.uniqueId(StringResources.get('defaultSlideoutLabel'));
  5081. }
  5082. },
  5083. /**
  5084. * initializes the pinning info
  5085. * When the slideout is marked as pinned, the pin is shown by default
  5086. */
  5087. __initPinningSettings: function __initPinningSettings() {
  5088. if (_.isUndefined(this.pinning)) {
  5089. this.pinning = {
  5090. isPinned: false,
  5091. float: true,
  5092. display: false
  5093. };
  5094. }
  5095. if (!_.isBoolean(this.pinning.isPinned)) {
  5096. this.pinning.isPinned = false;
  5097. }
  5098. if (!_.isBoolean(this.pinning.float)) {
  5099. this.pinning.float = true;
  5100. }
  5101. if (!_.isBoolean(this.pinning.display)) {
  5102. if (this.pinning.isPinned === true) {
  5103. this.pinning.display = true;
  5104. } else {
  5105. this.pinning.display = false;
  5106. }
  5107. }
  5108. },
  5109. /**
  5110. * initializes the display settings
  5111. */
  5112. __initDisplaySettings: function __initDisplaySettings() {
  5113. this._displayIndex = this.parent !== null && this.overlay === true ? this.parent._displayIndex : this._index;
  5114. if (this.parent === null) {
  5115. this._root.displayLimit = _.isNumber(this.displayLimit) && this.displayLimit > 0 ? this.displayLimit : Slideout.prototype.DISPLAY_LIMIT;
  5116. this._root.collapseRootIndex = _.isNumber(this.collapseRootIndex) && this.collapseRootIndex >= 0 ? this.collapseRootIndex : 0;
  5117. }
  5118. this._displayInfo = {
  5119. firstDisplayedAfterCollapsed: null
  5120. };
  5121. },
  5122. /**
  5123. * Gets the slidedout id
  5124. * @public
  5125. *
  5126. */
  5127. getRootId: function getRootId() {
  5128. return this.getRootParent().id;
  5129. },
  5130. /**
  5131. * Determines if the slideout is the last one
  5132. * @public
  5133. * @return {Boolean} true if it is, false otherwise
  5134. */
  5135. isLast: function isLast() {
  5136. return this.child === null;
  5137. },
  5138. /**
  5139. * renders content to page
  5140. * @param content. Content to be displayed to the page
  5141. *
  5142. * */
  5143. setContent: function setContent(content) {
  5144. if (this.contentView) {
  5145. this.contentView.remove();
  5146. this.contentView = null;
  5147. }
  5148. this.content = content;
  5149. if (this.isRendered && _.isObject(this.content) && this.content.module) {
  5150. return this._createContent();
  5151. }
  5152. return Promise.resolve();
  5153. },
  5154. /**
  5155. * sets pinned value
  5156. * @param pinned. Boolean value
  5157. *
  5158. * */
  5159. setPinned: function setPinned(pinned) {
  5160. if (pinned === undefined) {
  5161. this.pinning.isPinned = false;
  5162. } else {
  5163. this.pinning.isPinned = pinned;
  5164. }
  5165. this._updatePinCss();
  5166. this.trigger('change:pinState', {
  5167. pinned: this.isPinned()
  5168. });
  5169. },
  5170. /**
  5171. * @return {Number} displayLimit - the number of slideouts being shown before the collapse bar is shown
  5172. */
  5173. getDisplayLimit: function getDisplayLimit() {
  5174. return this._root.displayLimit;
  5175. },
  5176. _handleEscape: function _handleEscape() {
  5177. var paneContainer = this.$el.children('.pane-child');
  5178. var pane = paneContainer.children();
  5179. if (pane.length >= 1) {
  5180. this.removeChild();
  5181. } else {
  5182. this.hide({
  5183. hideOnly: this.hideOnly,
  5184. force: true,
  5185. isEscape: true
  5186. });
  5187. }
  5188. },
  5189. /**
  5190. * render slideout to the page
  5191. *
  5192. * */
  5193. render: function render() {
  5194. PerfUtils.createPerformanceMark({
  5195. 'component': 'glass',
  5196. 'name': 'renderSlideout',
  5197. 'state': 'start'
  5198. });
  5199. this.isRendered = true;
  5200. this.$el.attr('role', 'group');
  5201. this.$el.attr('aria-label', this.label);
  5202. if (!this.parent) {
  5203. this.$el.addClass('root');
  5204. this._windowResizeHandler = this._collapseChildren.bind(this);
  5205. $(window).on('resize', this._windowResizeHandler);
  5206. this.$el.on('escapeaction', $.proxy(this._handleEscape, this));
  5207. }
  5208. this.fireResizeStart = true;
  5209. this.$el.on('resize', this._handleResize.bind(this));
  5210. this.$el.addClass('flyoutPane pane-' + this.position);
  5211. var $content = $('<div class="pane-pagination-control" role="button"></div><div class="pane-content"></div><div class="pane-child"></div>');
  5212. this.setInnerContent($content);
  5213. var $paginationControl = this.$el.find('.pane-pagination-control');
  5214. Utils.setIcon($paginationControl, 'common-chevron_left');
  5215. var paginationAriaLabel = StringResources.get('paginationControl');
  5216. $paginationControl.attr('aria-label', paginationAriaLabel);
  5217. if (this.width) {
  5218. this.setWidth(this.width);
  5219. }
  5220. if (this.resizable) {
  5221. this._setResizable($content);
  5222. }
  5223. if (this.isPinDisplayed()) {
  5224. this.$el.find('.pane-content').append('<div class="pin-icon-container"><div class="pin-icon" tabindex="0"><svg class="svgIcon"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#common-pin"></use></svg></div></div>');
  5225. var $pin = this.$el.find('.pin-icon');
  5226. var ariaLabel;
  5227. if (!this.isPinned()) {
  5228. $pin.addClass('transform-pin');
  5229. ariaLabel = StringResources.get('pinSlideout');
  5230. } else {
  5231. this.$el.find('.pane-content').addClass('pane-pinned');
  5232. ariaLabel = StringResources.get('unpinSlideout');
  5233. }
  5234. $pin.attr('aria-label', ariaLabel);
  5235. }
  5236. if (_.isObject(this.content) && this.content.module) {
  5237. return this._createContent();
  5238. } else {
  5239. return Promise.resolve();
  5240. }
  5241. },
  5242. _onResizeStop: function _onResizeStop(event) {
  5243. return function () {
  5244. this.onResizeStop && this.onResizeStop(event);
  5245. this.fireResizeStart = true;
  5246. }.bind(this);
  5247. },
  5248. _handleResize: function _handleResize(event) {
  5249. if (event.target === event.currentTarget) {
  5250. if (this.fireResizeStart) {
  5251. this.onResizeStart && this.onResizeStart(event);
  5252. this.fireResizeStart = false;
  5253. }
  5254. this.onResize && this.onResize(event);
  5255. clearTimeout(this.resizeTimeout);
  5256. this.resizeTimeout = setTimeout(this._onResizeStop(event), 200);
  5257. }
  5258. },
  5259. /**
  5260. * Adds and shows a child slideout
  5261. * It waits for 600ms till the slideout is open before adding it; otherwise showing the child may occur before the parent is actually
  5262. * shown. In this case the child is not displayed
  5263. * @public
  5264. * @param {object} [options] - same options as the constructor except for position, glassContext which are retrieved from the current slideout and extra properties
  5265. * @param {Boolean} [options.overlay=false] - the child is shown on the top of the parent if true
  5266. * @param {Number} [options.width] - Width of the child slideout - if slideout is an overlay and is smaller, will be overriden with the width of the parent
  5267. * @param {launchPoint} [options.launchPoint]- Optional, The UI dom element that launched the slideout. The last active element if not specified.
  5268. * @param {String} [options.label]- The aria-label for the slideout. If no label is provided a default label is used.
  5269. * @return {Slideout} Child slideout; It may be returned before the slideout is actually shown
  5270. */
  5271. addChild: function addChild(options) {
  5272. var childOptions = _.isObject(options) ? options : {};
  5273. childOptions.overlay = childOptions.overlay === true;
  5274. if (childOptions.overlay && (_.isUndefined(childOptions.width) || childOptions.width < this.width)) {
  5275. childOptions.width = this.width;
  5276. }
  5277. var child = this._createSlideout({
  5278. glassContext: this.glassContext,
  5279. position: this.position,
  5280. overlay: childOptions.overlay,
  5281. hideOnParentClick: childOptions.hideOnParentClick,
  5282. width: childOptions.width,
  5283. onHide: childOptions.onHide,
  5284. pinning: childOptions.pinning,
  5285. launchPoint: childOptions.launchPoint,
  5286. label: childOptions.label,
  5287. parent: this,
  5288. enableTabLooping: childOptions.enableTabLooping,
  5289. resizable: childOptions.resizable
  5290. });
  5291. if (this.open) {
  5292. __addChild.call(this, child, childOptions);
  5293. } else {
  5294. this._childToAdd.push(function (child, childOptions) {
  5295. __addChild.call(this, child, childOptions);
  5296. }.bind(this, child, childOptions));
  5297. }
  5298. return child;
  5299. },
  5300. removeChild: function removeChild(options) {
  5301. if (this.child !== null) {
  5302. return this.child.hide(options);
  5303. } else {
  5304. return Promise.resolve();
  5305. }
  5306. },
  5307. /**
  5308. * @return true if the slideout is pinned, false otherwise
  5309. */
  5310. isPinned: function isPinned() {
  5311. return this.pinning.isPinned;
  5312. },
  5313. isFloat: function isFloat() {
  5314. return this.pinning.float;
  5315. },
  5316. isPinDisplayed: function isPinDisplayed() {
  5317. return this.pinning.display;
  5318. },
  5319. _initializePinning: function _initializePinning() {
  5320. this.pinning = {
  5321. isPinned: false,
  5322. float: true,
  5323. display: false
  5324. };
  5325. },
  5326. /**
  5327. * Shows the rendered slideout.
  5328. * Attaches hide callback on the clicktap event
  5329. * Triggers 'done:show' event when the animation completes
  5330. * For Pinned slideouts that have the pinning.float set to false, the no-float class is added.
  5331. * See this._hide where it is removed
  5332. * @public
  5333. *
  5334. * **/
  5335. show: function show() {
  5336. var shown;
  5337. if (this.open || this.isBeingShown()) {
  5338. shown = this._showing;
  5339. } else {
  5340. shown = this._showing = Promise.delay(30).then(function () {
  5341. this.trigger('show');
  5342. return this._show();
  5343. }.bind(this)).then(this._setFocusOnLast.bind(this));
  5344. }
  5345. return shown;
  5346. },
  5347. _setFocusOnLast: function _setFocusOnLast() {
  5348. if (this.isLast()) {
  5349. try {
  5350. if (this.contentView) {
  5351. this._setFocusInContentView();
  5352. }
  5353. } catch (err) {
  5354. return err;
  5355. }
  5356. }
  5357. },
  5358. /**
  5359. * internal show method
  5360. */
  5361. _show: function _show() {
  5362. this.$el.children('.ui-resizable-handle').show();
  5363. this.$el.children('.pane-content').removeClass('tabhidden');
  5364. this.$el.addClass('active');
  5365. this.$el.removeClass('inactive');
  5366. this.enterContainerOnlyInTabOrder();
  5367. this.open = true;
  5368. if (this.child !== null) {
  5369. this.child.show();
  5370. }
  5371. var childToAdd = _.last(this._childToAdd);
  5372. this._childToAdd = [];
  5373. if (_.isFunction(childToAdd)) {
  5374. childToAdd();
  5375. }
  5376. if (this.$el.hasClass('root')) {
  5377. this._button = $('.toolpane button.currentlySelected');
  5378. this._button.addClass('slideoutOpen');
  5379. }
  5380. if (this.hideHandler !== null) {
  5381. $(document).on(this.closeEventPattern, null, {
  5382. allowPropagationDefaultAction: true
  5383. }, this.hideHandler);
  5384. }
  5385. this._addShadowToFinalSlideoutChild();
  5386. if (this.parent !== null && this.hideOnParentClick === true) {
  5387. this.parent.$el.children('.pane-content').on('clicktap.removeChild', function () {
  5388. this.removeChild();
  5389. }.bind(this.parent));
  5390. }
  5391. // Wait for the animation to complete as interrupting an animation causes artifacts on FireFox
  5392. return this.whenAnimationDone('show').then(this._showHelper.bind(this));
  5393. },
  5394. _showHelper: function _showHelper() {
  5395. if (this.child === null) {
  5396. this._collapseChildren();
  5397. }
  5398. if (this.isPinned() && !this.isFloat() && !this.$el.hasClass('no-float')) {
  5399. this._updatePinCss();
  5400. }
  5401. this.trigger('done:show');
  5402. },
  5403. /**
  5404. * @return {Boolean} true if it is open
  5405. */
  5406. isOpen: function isOpen() {
  5407. return this.open;
  5408. },
  5409. /**
  5410. * Checks if the slideout is currently being shown
  5411. * @return {Boolean} true it is showing
  5412. */
  5413. isBeingShown: function isBeingShown() {
  5414. return this._showing !== null && this._showing.isPending();
  5415. },
  5416. /**
  5417. * Checks if the current slideout has any open child
  5418. * @return {boolean} true if there is at least one open child
  5419. */
  5420. hasOpenChild: function hasOpenChild() {
  5421. var child = this.child;
  5422. var hasOpenChild = false;
  5423. while (child !== null && !hasOpenChild) {
  5424. hasOpenChild = child.open;
  5425. child = child.child;
  5426. }
  5427. return hasOpenChild;
  5428. },
  5429. /**
  5430. * hides content on the page. changes div from class 'active' to 'inactive'
  5431. * also removes the slideout element from the DOM after the animation is finished
  5432. * <p>
  5433. * When a parent pinned is found, continue the hiding process to delete the children.
  5434. * Important limitation: a unpinned parent hides all the children, whatever their pin state.
  5435. *
  5436. * </p>
  5437. * @public
  5438. *
  5439. * @param {Object} [options] set of hide options
  5440. * @param {boolean} [options.force=false] - hides pinned slideout
  5441. * @param {boolean} [options.hideOnly=false] - if true, keeps the slideout element in the DOM
  5442. * @param {Number} [options.depth=-1] - index of the last slideout to hide: this is only applicable when options.hideOnly is true; -1 or lower means all slideouts are hidden; 0 means only the current one is removed
  5443. * @param {boolean} [options.isEscape=false] - specified if the hide operation is to be executed in a escape context or not ; it is set to true in the escape handler of the root slideout
  5444. * @return {Promise} resolve when the slideout is hidden; rejected if it is not
  5445. * @example
  5446. * To hide a pinned slideout: slideout.hide({force: true});
  5447. * If hide() is called more than once before resolving, we store an array of promises to ensure they are all handled in seqeunce.
  5448. * Only one hide call per unique options signature will be executed (a unique options signature is defined as having at least one different option as defined above relative to all other options objects)
  5449. * **/
  5450. hide: function hide(options) {
  5451. var doHiding = function (options) {
  5452. var _this2 = this;
  5453. var force = _.isObject(options) && options.force === true;
  5454. var hideOnly = _.isObject(options) && options.hideOnly === true;
  5455. var depth = _.isObject(options) && _.isNumber(options.depth) && hideOnly ? options.depth : -1;
  5456. var fullHideOptions = $.extend({}, {
  5457. force: force,
  5458. hideOnly: hideOnly,
  5459. depth: depth
  5460. });
  5461. var isEscape = _.isObject(options) && options.isEscape === true;
  5462. return this._canHide({
  5463. isEscape: isEscape,
  5464. depth: depth
  5465. }).then(this._doHide.bind(this, fullHideOptions)).then(function () {
  5466. if (this._button && this === this.getRootParent()) {
  5467. this._button.removeClass('slideoutOpen');
  5468. this._button.removeClass('currentlySelected');
  5469. this._button = null;
  5470. }
  5471. }.bind(this)).finally(function () {
  5472. _this2._hidingPromises.shift();
  5473. _this2._hidingOptions.shift();
  5474. });
  5475. }.bind(this);
  5476. if (!this._hidingPromises || this._hidingPromises.length === 0) {
  5477. this._hidingPromises = [];
  5478. this._hidingOptions = [];
  5479. this._hidingPromises.push(doHiding(options));
  5480. this._hidingOptions.push(options || {});
  5481. } else if (__isUniqueOption(this._hidingOptions, options || {})) {
  5482. this._hidingOptions.push(options || {});
  5483. this._hidingPromises.push(_.last(this._hidingPromises).finally(function () {
  5484. return doHiding(options);
  5485. }));
  5486. }
  5487. return _.last(this._hidingPromises);
  5488. },
  5489. /**
  5490. * Checks if the slideout can be hidden
  5491. * Recursive method: it is stopped in one of the following cases:
  5492. * - the first canHide method does not return true or a rejected promise
  5493. * - the last slideout to hide is reached
  5494. * - the last child is reached
  5495. * @param {Object} - options
  5496. * @param {Boolean} - options.isEscape - true if it is an escaped hiding; false otherwise
  5497. * @param {Number} - options.depth - index of the last slideout to hide
  5498. * @return {promise} resolved when it can be hidden or it is already hidden; rejected otherwise;
  5499. */
  5500. _canHide: function _canHide(options) {
  5501. return new Promise(function (resolve, reject) {
  5502. var needToInvokeCanHide = this.isOpen() && this.contentView && _.isFunction(this.contentView.canHide);
  5503. var canHideChild = function canHideChild(options) {
  5504. var isLastToHide = options.depth === 0;
  5505. options.depth--;
  5506. if (isLastToHide || this.isLast()) {
  5507. resolve();
  5508. } else {
  5509. return this.child._canHide(options).then(resolve, reject);
  5510. }
  5511. };
  5512. if (!needToInvokeCanHide) {
  5513. canHideChild.call(this, options);
  5514. } else {
  5515. var result = true;
  5516. try {
  5517. result = this.contentView.canHide(options);
  5518. } catch (error) {
  5519. console.error('Error while executing canHide method', error);
  5520. }
  5521. Promise.resolve(result).then(function (slideCanHide) {
  5522. if (slideCanHide === true || _.isUndefined(slideCanHide)) {
  5523. canHideChild.call(this, options).then(resolve, reject);
  5524. } else {
  5525. reject();
  5526. }
  5527. }.bind(this)).catch(function () {
  5528. reject();
  5529. });
  5530. }
  5531. }.bind(this));
  5532. },
  5533. /**
  5534. * does the hiding
  5535. */
  5536. _doHide: function _doHide(options) {
  5537. return new Promise(function (resolve) {
  5538. if (!this.open) {
  5539. var removeMySelfOnly = options.depth === 0;
  5540. if (removeMySelfOnly) {
  5541. __completeHide.call(this);
  5542. resolve();
  5543. } else {
  5544. options.depth = options.depth - 1;
  5545. this._hideChild(options).then(function () {
  5546. __completeHide.call(this);
  5547. if (!options.hideOnly && (options.force || !this.isPinned())) {
  5548. this.remove();
  5549. }
  5550. resolve();
  5551. }.bind(this));
  5552. }
  5553. } else {
  5554. var transferFocus = $.contains(this.$el[0], document.activeElement);
  5555. var hidingSlideouts = [];
  5556. var slideoutToRemove = this._hideOnly(hidingSlideouts, options);
  5557. if (_.isEmpty(hidingSlideouts)) {
  5558. resolve();
  5559. } else {
  5560. Promise.all(hidingSlideouts).then(function () {
  5561. __completeHide.call(this);
  5562. if (!options.hideOnly) {
  5563. slideoutToRemove.remove();
  5564. }
  5565. if (transferFocus) {
  5566. this._setFocusToLaunchPoint();
  5567. }
  5568. resolve();
  5569. }.bind(this));
  5570. }
  5571. }
  5572. }.bind(this));
  5573. },
  5574. /**
  5575. * Hides the child when it is defined
  5576. * @param {object} options passed in the hide method with the set values for the depth, force and hideOnly properties
  5577. * @return {Promise} promise resolved when the child is hidden
  5578. */
  5579. _hideChild: function _hideChild(options) {
  5580. if (this.child === null) {
  5581. return Promise.resolve('no child to hide');
  5582. } else {
  5583. var hidingSlideouts = [];
  5584. this._hideOnly(hidingSlideouts, options);
  5585. return Promise.all(hidingSlideouts);
  5586. }
  5587. },
  5588. /**
  5589. * Hides the slideouts only visually
  5590. * @Param {Array} hidingSlideouts - Array of promises which is populated by this method
  5591. * @param {object} options passed in the hide method with the set values for the depth, force and hideOnly properties
  5592. * @return {Slideout} slideout to remove if necessary
  5593. */
  5594. _hideOnly: function _hideOnly(hidingSlideouts, options) {
  5595. var slideout = this;
  5596. var slideoutToRemove;
  5597. var index = 0;
  5598. var ignorePinning = options.force;
  5599. while (_.isObject(slideout) && (index <= options.depth || options.depth < 0)) {
  5600. if (ignorePinning || !slideout.isPinned()) {
  5601. if (_.isUndefined(slideoutToRemove)) {
  5602. slideoutToRemove = slideout;
  5603. ignorePinning = true;
  5604. }
  5605. hidingSlideouts.push(slideout._hide(options));
  5606. }
  5607. slideout = slideout.child;
  5608. index++;
  5609. }
  5610. if (!_.isEmpty(hidingSlideouts)) {
  5611. this._collapseChildren();
  5612. }
  5613. return slideoutToRemove;
  5614. },
  5615. /**
  5616. * Performs the hide of the current slideout only
  5617. * For pinned slideouts, the no-float class is removed avoid to have them shown when opening another one.
  5618. * @return promise - resolved when the animation is finished
  5619. */
  5620. _hide: function _hide() {
  5621. var whenAnimationEnd = new Promise(function (resolve) {
  5622. if (!this.open) {
  5623. resolve('Slideout already hidden');
  5624. } else {
  5625. this.open = false;
  5626. if (this.$el.closest('html').length === 0) {
  5627. console.log('The slideout DOM element is already removed');
  5628. resolve('Slideout already removed');
  5629. } else {
  5630. if (this.parent) {
  5631. this.parent.$el.children('.pane-content').off('clicktap.removeChild');
  5632. }
  5633. this.whenAnimationDone('_hide').then(function () {
  5634. if (this.onHide) {
  5635. this.onHide();
  5636. }
  5637. resolve();
  5638. }.bind(this));
  5639. }
  5640. }
  5641. }.bind(this));
  5642. whenAnimationEnd.then(function () {
  5643. if (this.open === false) {
  5644. this.$el.children('.pane-content').addClass('tabhidden');
  5645. this.removeContainerOnlyFromTabOrder();
  5646. }
  5647. this._addShadowToFinalSlideoutChild();
  5648. }.bind(this));
  5649. if (this.isPinned()) {
  5650. this.$el.removeClass('no-float');
  5651. }
  5652. this.$el.removeClass('collapsed');
  5653. this.$el.removeClass('collapseRoot');
  5654. // Add the class notransition to let the browser complete it's animation before hiding the slideout
  5655. this.$el.addClass('notransition');
  5656. // Trigger a reflow, flushing the CSS changes
  5657. // eslint-disable-next-line
  5658. this.$el[0].offsetHeight;
  5659. this.$el.removeClass('active');
  5660. this.$el.addClass('inactive');
  5661. this.$el.removeClass('notransition');
  5662. return whenAnimationEnd;
  5663. },
  5664. /**
  5665. * removes Slideout AND its children from the DOM.
  5666. * if this is used directly on a slideout instance (eg. Slideout.remove())
  5667. * it WILL NOT pick up the animation and the slideout will disapear immediately
  5668. */
  5669. remove: function remove() {
  5670. if (this.child) {
  5671. this.child.remove();
  5672. }
  5673. if (this.parent !== null) {
  5674. if (this.parent.child === this) {
  5675. this.parent.child = null;
  5676. }
  5677. }
  5678. if (this._windowResizeHandler) {
  5679. $(window).off('resize', this._windowResizeHandler);
  5680. this.$el.off('resize', this._handleResize);
  5681. }
  5682. if (this.hideHandler) {
  5683. $(document).off(this.closeEventPattern, this.hideHandler);
  5684. this.hideHandler = null;
  5685. }
  5686. if (this.contentView) {
  5687. this.contentView.remove();
  5688. }
  5689. this.$el.off('escapeaction');
  5690. if (this.open) {
  5691. this.trigger('hide');
  5692. }
  5693. this.trigger('remove');
  5694. Slideout.inherited('remove', this, arguments);
  5695. },
  5696. setWidth: function setWidth(slide_width) {
  5697. if ($.isPlainObject(slide_width)) {
  5698. this.$el.css(slide_width);
  5699. } else {
  5700. this.$el.css('width', slide_width);
  5701. }
  5702. },
  5703. /**
  5704. * Appends content view to DOM
  5705. *
  5706. * **/
  5707. _createContent: function _createContent() {
  5708. var options = this.content || {};
  5709. options.slideout = this;
  5710. options = this.glassContext.addToOptions(options);
  5711. return this._ClassFactory.instantiate(this.content.module, options).then(function (contentView) {
  5712. this.contentView = contentView;
  5713. this.$el.children('.pane-content').append(this.contentView.$el);
  5714. var setFocusInContentView = function setFocusInContentView() {
  5715. PerfUtils.createPerformanceMark({
  5716. 'component': 'glass',
  5717. 'name': 'renderSlideout',
  5718. 'state': 'end'
  5719. });
  5720. if (this.isOpen() && !this.isBeingShown()) {
  5721. this._setFocusInContentView();
  5722. }
  5723. };
  5724. var result = this.contentView.render();
  5725. return Promise.resolve(result).then(function () {
  5726. setFocusInContentView.call(this);
  5727. this.enableLooping(this.contentView.$el);
  5728. }.bind(this)).catch(function (error) {
  5729. this.logger.error('Error While rendering the content view for the slideout', error);
  5730. return Promise.reject(error);
  5731. }.bind(this));
  5732. }.bind(this));
  5733. },
  5734. /**
  5735. * Sets the focus in the content view
  5736. */
  5737. _setFocusInContentView: function _setFocusInContentView() {
  5738. if (_.isFunction(this.contentView.setFocus)) {
  5739. this.contentView.setFocus();
  5740. }
  5741. },
  5742. /**
  5743. * Get the root part slideout
  5744. *
  5745. * @return - root slideout object
  5746. */
  5747. getRootParent: function getRootParent() {
  5748. return this._root;
  5749. },
  5750. getLaunchPoint: function getLaunchPoint() {
  5751. if (this._paginationLaunchPoint !== null) {
  5752. return this._paginationLaunchPoint;
  5753. }
  5754. return Slideout.inherited('getLaunchPoint', this);
  5755. },
  5756. /**
  5757. * Get the width of the slideout
  5758. *
  5759. * @return - width of the slideout
  5760. */
  5761. getWidth: function getWidth() {
  5762. return this.$el.outerWidth();
  5763. },
  5764. /**
  5765. * Get the list children slideout including the current slider
  5766. *
  5767. * @return array of slideouts
  5768. */
  5769. getChildrenWithSelf: function getChildrenWithSelf() {
  5770. var sliders = [this];
  5771. var slider = this;
  5772. while (slider.child) {
  5773. sliders.push(slider.child);
  5774. slider = slider.child;
  5775. }
  5776. return sliders;
  5777. },
  5778. /**
  5779. * Collapse panels if necessary
  5780. */
  5781. _collapseChildren: function _collapseChildren() {
  5782. var displayInfo = this._findFirstToCollapse();
  5783. this.getRootParent()._displayInfo = displayInfo;
  5784. if (displayInfo.firstToCollapse !== null) {
  5785. var firstToCollapse = displayInfo.firstToCollapse;
  5786. displayInfo = this._findSlideoutsToCollapse(displayInfo);
  5787. _.each(displayInfo.visible, function (slideout) {
  5788. slideout.$el.children('.pane-content').removeClass('tabhidden');
  5789. slideout.enterContainerOnlyInTabOrder();
  5790. });
  5791. if (_.isEmpty(displayInfo.collapsed)) {
  5792. firstToCollapse.$el.children('.pane-pagination-control:not(.collapsed .pane-pagination-control)').removeClass('visible');
  5793. firstToCollapse.$el.children('.pane-pagination-control:not(.collapsed .pane-pagination-control)').removeAttr('tabindex');
  5794. _.each(displayInfo.visible, function (slideout) {
  5795. slideout._paginationLaunchPoint = null;
  5796. });
  5797. } else {
  5798. firstToCollapse.$el.addClass('collapseRoot');
  5799. if (!firstToCollapse.$el.hasClass('collapsed')) {
  5800. firstToCollapse.$el.addClass('animationPhase');
  5801. firstToCollapse.whenAnimationDone('collapseChildren').then(function () {
  5802. this.$el.children('.collapsed .pane-pagination-control').addClass('visible');
  5803. this.$el.children('.collapsed .pane-pagination-control').attr('tabindex', '0');
  5804. }.bind(firstToCollapse));
  5805. }
  5806. _.each(displayInfo.collapsed, function (slideout) {
  5807. slideout.$el.removeClass('active').addClass('collapsed');
  5808. slideout.$el.children('.pane-content').addClass('tabhidden');
  5809. if (slideout.$el[0] !== firstToCollapse.$el[0]) {
  5810. slideout.removeContainerOnlyFromTabOrder();
  5811. }
  5812. });
  5813. for (var i = 1; i < displayInfo.visible.length; i++) {
  5814. displayInfo.visible[i]._paginationLaunchPoint = null;
  5815. }
  5816. displayInfo.firstDisplayedAfterCollapsed._paginationLaunchPoint = firstToCollapse.$el.children('.collapsed .pane-pagination-control')[0];
  5817. }
  5818. }
  5819. },
  5820. /**
  5821. * Gets the available width to display the slideout
  5822. */
  5823. _getAvailableWidth: function _getAvailableWidth() {
  5824. return this.getRootParent().$el.parent().innerWidth();
  5825. },
  5826. /**
  5827. * Finds the first slideout to be collapsed if this is necessary based on the _collapseRootIndex
  5828. *
  5829. * @return {DisplayInfo} displayInfo
  5830. */
  5831. _findFirstToCollapse: function _findFirstToCollapse() {
  5832. var root = null;
  5833. var slideout = this.getRootParent();
  5834. var width = 0;
  5835. var visible = [];
  5836. var searchIsDone = false;
  5837. while (!searchIsDone) {
  5838. if (slideout.open) {
  5839. if (root === null) {
  5840. if (slideout._displayIndex >= this._root.collapseRootIndex) {
  5841. root = slideout;
  5842. } else if (_.isEmpty(visible) || _.last(visible)._displayIndex !== slideout._displayIndex) {
  5843. width += slideout.getWidth();
  5844. visible.push(slideout);
  5845. }
  5846. } else {
  5847. if (slideout._displayIndex === root._displayIndex) {
  5848. root = slideout;
  5849. } else {
  5850. searchIsDone = true;
  5851. }
  5852. }
  5853. }
  5854. slideout = slideout.child;
  5855. searchIsDone = slideout === null || searchIsDone;
  5856. }
  5857. return {
  5858. firstToCollapse: root,
  5859. visible: visible,
  5860. width: width,
  5861. firstDisplayedAfterCollapsed: null,
  5862. collapsed: []
  5863. };
  5864. },
  5865. /**
  5866. * Finds the slideouts to collapse given the display info.
  5867. * @param {object} displayInfo - Information containing the first slideout to collapse if this is necessary
  5868. * @return {object} displayInfo - Updated displayed information with an array of slideouts to collapse and the first visible slideout.
  5869. * The latter is null if there is no slideout to collapse
  5870. */
  5871. _findSlideoutsToCollapse: function _findSlideoutsToCollapse(displayInfo) {
  5872. var lastSlideout = null;
  5873. var slideout;
  5874. var availableWidth = this.getRootParent()._getAvailableWidth();
  5875. var displayLimit = this.getDisplayLimit();
  5876. var visibleAfterCollapsed = [];
  5877. var forceCollapse = false;
  5878. if (displayInfo.firstToCollapse !== null) {
  5879. slideout = displayInfo.firstToCollapse;
  5880. while (slideout !== null) {
  5881. lastSlideout = slideout;
  5882. slideout = slideout.child;
  5883. }
  5884. slideout = lastSlideout;
  5885. var searchIsDone = false;
  5886. var last = true;
  5887. var displayedNbr = displayInfo.visible.length;
  5888. while (!searchIsDone) {
  5889. if (slideout.open === true) {
  5890. if (forceCollapse) {
  5891. displayInfo.collapsed.unshift(slideout);
  5892. } else {
  5893. if (last || displayInfo.width + slideout.getWidth() + Slideout.prototype.PAGINATION_WIDTH < availableWidth && displayedNbr < displayLimit) {
  5894. last = false;
  5895. slideout.$el.removeClass('collapsed').removeClass('collapseRoot').addClass('active');
  5896. if (_.isEmpty(visibleAfterCollapsed) || slideout._displayIndex !== _.first(visibleAfterCollapsed)._displayIndex) {
  5897. displayInfo.width += slideout.getWidth();
  5898. visibleAfterCollapsed.unshift(slideout);
  5899. displayedNbr++;
  5900. }
  5901. } else {
  5902. if (slideout._displayIndex === _.first(visibleAfterCollapsed)._displayIndex) {
  5903. slideout.$el.removeClass('collapsed').removeClass('collapseRoot').addClass('active');
  5904. } else {
  5905. displayInfo.firstDisplayedAfterCollapsed = _.first(visibleAfterCollapsed);
  5906. displayInfo.collapsed.unshift(slideout);
  5907. forceCollapse = true;
  5908. }
  5909. }
  5910. }
  5911. }
  5912. searchIsDone = slideout === displayInfo.firstToCollapse;
  5913. slideout = slideout.parent;
  5914. searchIsDone = slideout === null || searchIsDone;
  5915. }
  5916. }
  5917. displayInfo.visible = displayInfo.visible.concat(visibleAfterCollapsed);
  5918. return displayInfo;
  5919. },
  5920. /**
  5921. * for animating the pin icon on the slideout and also setting pinned boolean.
  5922. */
  5923. _togglePin: function _togglePin() {
  5924. this.setPinned(!this.isPinned());
  5925. },
  5926. _updatePinCss: function _updatePinCss() {
  5927. var $pin = this.$el.find('.pin-icon');
  5928. var ariaLabel;
  5929. if (this.isPinned()) {
  5930. this.$el.find('.pane-content').addClass('pane-pinned');
  5931. if (!this.isFloat()) {
  5932. this.$el.addClass('notransition'); // Disable transitions
  5933. this.$el.addClass('no-float');
  5934. // Trigger a reflow, flushing the CSS changes
  5935. // eslint-disable-next-line
  5936. this.$el[0].offsetHeight;
  5937. this.$el.removeClass('notransition');
  5938. }
  5939. $pin.removeClass('transform-pin');
  5940. ariaLabel = StringResources.get('unpinSlideout');
  5941. $pin.attr('aria-label', ariaLabel);
  5942. } else {
  5943. this.$el.find('.pane-content').removeClass('pane-pinned');
  5944. this.$el.addClass('notransition'); // Disable transitions
  5945. this.$el.removeClass('no-float');
  5946. //Trigger a reflow, flushing the CSS changes
  5947. // eslint-disable-next-line
  5948. this.$el[0].offsetHeight;
  5949. this.$el.removeClass('notransition');
  5950. $pin.addClass('transform-pin');
  5951. ariaLabel = StringResources.get('pinSlideout');
  5952. $pin.attr('aria-label', ariaLabel);
  5953. }
  5954. },
  5955. /**
  5956. * Paginate back. This method will do the following:
  5957. * The child of the first visible slideout is hidden if it exists otherwise the first visible is hidden
  5958. */
  5959. pageBack: function pageBack(event) {
  5960. if (!event.isDefaultPrevented() && this._root._displayInfo.firstDisplayedAfterCollapsed !== null) {
  5961. var firstVisible = this._root._displayInfo.firstDisplayedAfterCollapsed;
  5962. var slideoutToHide = firstVisible.child !== null ? firstVisible.child : firstVisible;
  5963. slideoutToHide.hide();
  5964. event.preventDefault();
  5965. slideoutToHide._setFocusToLaunchPoint();
  5966. }
  5967. },
  5968. /**
  5969. * Indicate when the the current css animation is complete
  5970. * Sets a timeout to avoid none-resolved promise - this is used by the unit tests
  5971. * where no css is loaded
  5972. * @return - a promise that will be resolved when the animation is complete
  5973. */
  5974. whenAnimationDone: function whenAnimationDone(operation) {
  5975. return new Promise(function (resolve) {
  5976. this.$el.off('transitionend webkitTransitionEnd oTransitionEnd');
  5977. this.$el.on('transitionend webkitTransitionEnd oTransitionEnd', function () {
  5978. resolve();
  5979. });
  5980. }.bind(this)).timeout(this.ANIMATION_TIMEOUT).catch(Promise.TimeoutError, function () {
  5981. console.log('failed to detect the end of the slideout animation, force the resolve; operation: ' + operation);
  5982. return Promise.resolve();
  5983. });
  5984. },
  5985. /**
  5986. * Sets the shadow class to the final slideout; remove it for all the others
  5987. */
  5988. _addShadowToFinalSlideoutChild: function _addShadowToFinalSlideoutChild() {
  5989. var current_slideout = this.getRootParent();
  5990. var lastOpenChild = current_slideout;
  5991. while (current_slideout.child !== null) {
  5992. current_slideout.$el.removeClass('shadow');
  5993. current_slideout = current_slideout.child;
  5994. if (current_slideout.open) {
  5995. lastOpenChild = current_slideout;
  5996. }
  5997. }
  5998. lastOpenChild.$el.addClass('shadow');
  5999. },
  6000. /**
  6001. * Create a slideout with the passed options
  6002. * @param {Object} options - slideout properties
  6003. * @return {Object}
  6004. */
  6005. _createSlideout: function _createSlideout(options) {
  6006. return new Slideout(options);
  6007. },
  6008. _setResizable: function _setResizable($content) {
  6009. var isPosRight = this.position === 'right';
  6010. var $paneContent = $content.filter('.pane-content');
  6011. var $resizeHandle = $('<div>').addClass('resize-handle ui-resizable-handle ui-resizable-' + (isPosRight ? 'w' : 'e'));
  6012. var resizable = {
  6013. handles: [$resizeHandle],
  6014. minWidth: this.resizable.min || 300,
  6015. maxWidth: this.resizable.max || 1000,
  6016. direction: isPosRight ? 'left' : 'right'
  6017. };
  6018. if (isPosRight) {
  6019. $resizeHandle.insertBefore($paneContent);
  6020. } else {
  6021. $resizeHandle.insertAfter($paneContent);
  6022. }
  6023. Utils.setIcon($resizeHandle, 'common-handle');
  6024. this.$el.resizable(resizable);
  6025. }
  6026. });
  6027. return Slideout;
  6028. });
  6029. //# sourceMappingURL=Slideout.js.map
  6030. ;
  6031. /*
  6032. * Licensed Materials - Property of IBM
  6033. *
  6034. * IBM Cognos Products: BI
  6035. *
  6036. * (C) Copyright IBM Corp. 2015, 2017
  6037. *
  6038. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  6039. */
  6040. define('baglass/common/ui/SlideoutRegistry',['../../core-client/js/core-client/ui/core/Events', 'jquery', 'underscore', '../../core-client/js/core-client/ui/Slideout'], function (Events, $, _, Slideout) {
  6041. var ERROR_INVALID_PARAM = 'SlidoutRegistry:openSlideout - Invalid Slideout parameter';
  6042. var ERROR_INVALID_POSITION = 'SlidoutRegistry:openSlideout - Invalid Slideout position';
  6043. var ERROR_INVALID_CONTAINER = 'SlidoutRegistry:openSlideout - Undefined or invalid container';
  6044. var ERROR_ALREADY_OPEN = 'SlidoutRegistry:openSlideout - One slideout is already open';
  6045. var ERROR_CHANGE_CONTAINER_INVALID_CONTAINER = 'SlidoutRegistry:changeContainer - Undefined or invalid container';
  6046. var ERROR_CHANGE_CONTAINER_OPEN_SLIDEOUT = 'SlidoutRegistry:changeContainer - Slideout is open';
  6047. var ERROR_GET_OPEN_SLIDEOUT_INVALID_POSITION = 'SlidoutRegistry:getOpenSlideout - Invalid Slideout position';
  6048. /**
  6049. * Adds the slideout to the container. Prepend for left position, append for right one;
  6050. * @param {jquery} $container - container to update
  6051. * @param {SLideout} slideout - slideout to add
  6052. *
  6053. */
  6054. var _addSlideoutToContainer = function _addSlideoutToContainer($container, slideout) {
  6055. if (slideout.position === 'left') {
  6056. $container.prepend(slideout.$el);
  6057. } else {
  6058. $container.append(slideout.$el);
  6059. }
  6060. };
  6061. /**
  6062. * Builds an error with a toString method
  6063. */
  6064. var _buildError = function _buildError(error) {
  6065. error.toString = function () {
  6066. return error.msg;
  6067. };
  6068. return error;
  6069. };
  6070. /**
  6071. * @throws ERROR_INVALID_POSITION error when it is not left or right
  6072. */
  6073. var _validatePosition = function _validatePosition(position) {
  6074. if (position !== 'right' && position !== 'left') {
  6075. throw _buildError({
  6076. msg: ERROR_INVALID_POSITION,
  6077. position: position
  6078. });
  6079. }
  6080. };
  6081. /**
  6082. * Opens the slideout from an slideout instance; It assumes that the slideout is not rendered when it is not registered
  6083. * @param {Slideout} slideout - the passed slideout
  6084. * @return {Slideout} The passed slideout
  6085. * @throws ERROR_ALREADY_OPEN or ERROR_INVALID_POSITION
  6086. */
  6087. var _openSlideoutFromInstance = function _openSlideoutFromInstance(slideout) {
  6088. var position = slideout.position;
  6089. _validatePosition(position);
  6090. if (!_.isUndefined(this._open[position])) {
  6091. throw _buildError({
  6092. msg: ERROR_ALREADY_OPEN,
  6093. open: this._open[position]
  6094. });
  6095. }
  6096. if (_.isUndefined(this._registered[slideout.getRootId()])) {
  6097. slideout.render();
  6098. _addSlideoutToContainer(this.$container, slideout);
  6099. } else {
  6100. if (slideout.getRootParent() !== this._registered[slideout.getRootId()]) {
  6101. slideout = this._registered[slideout.getRootId()];
  6102. }
  6103. }
  6104. slideout.show();
  6105. return slideout;
  6106. };
  6107. /**
  6108. * Opens the slideout from an object spec
  6109. * @param {object} object - the specs of the slideout to show
  6110. * @return {Slideout}
  6111. * @throws ERROR_INVALID_POSITION or ERROR_ALREADY_OPEN
  6112. */
  6113. var _openSlideoutFromObject = function _openSlideoutFromObject(object) {
  6114. var position = object.position;
  6115. var slideout;
  6116. if (this._registered[object.id]) {
  6117. slideout = this._registered[object.id];
  6118. } else {
  6119. _validatePosition(position);
  6120. if (!_.isUndefined(this._open[position])) {
  6121. throw _buildError({
  6122. msg: ERROR_ALREADY_OPEN
  6123. });
  6124. }
  6125. slideout = new Slideout(object);
  6126. slideout.render();
  6127. _addSlideoutToContainer(this.$container, slideout);
  6128. }
  6129. slideout.show();
  6130. return slideout;
  6131. };
  6132. /**
  6133. * Sets the callback on hide and remove.
  6134. * hide: Unflags the slideout as open and move it to be registered; removes itself from the slideout callback
  6135. * remove: Unregisters the slideout, Unflag it as open if necessary, remove itself and the hide callback
  6136. * @param {Slideout} Slideout - slideout instance to which we attach the callback
  6137. */
  6138. var _setCallbacks = function _setCallbacks(slideout) {
  6139. var hideCallback = function (slideout) {
  6140. if (!slideout.hasOpenChild()) {
  6141. delete this._open[slideout.position];
  6142. this._registered[slideout.getRootId()] = slideout;
  6143. slideout.off('hide', hideCallback);
  6144. }
  6145. }.bind(this, slideout);
  6146. var removeCallback = function (slideout) {
  6147. if (this._open[slideout.position] === slideout) {
  6148. delete this._open[slideout.position];
  6149. }
  6150. delete this._registered[slideout.getRootId()];
  6151. slideout.off('remove', removeCallback);
  6152. slideout.off('hide', hideCallback);
  6153. }.bind(this, slideout);
  6154. slideout.on('hide', hideCallback);
  6155. slideout.on('remove', removeCallback);
  6156. };
  6157. /**
  6158. * @public
  6159. */
  6160. var Registry = Events.extend(
  6161. /**
  6162. * @lends SlideoutRegistry.prototype
  6163. */
  6164. {
  6165. /**
  6166. * @classdesc Class allowing to register a {@link Slideout} when opening it in a specific container
  6167. * @constructs
  6168. * @public
  6169. * @param {object} options - Init properties
  6170. * @param {Jquery} options.$container - container where the slideouts are to be shown
  6171. * application & application.appView
  6172. */
  6173. init: function init(options) {
  6174. Registry.inherited('init', this, arguments);
  6175. $.extend(this, options);
  6176. this._open = {};
  6177. this._registered = {};
  6178. },
  6179. /**
  6180. * Opens the provided slideout
  6181. * @public
  6182. * @param {Object|Slideout} slideout - Object containing the properties of the slideout to show; See {@link Slideout}, Slideout object,
  6183. * @return {Slideout} slideout - the shown slideout; null if there is no container
  6184. * @throws ERROR_ALREADY_OPEN, ERROR_INVALID_POSITION or ERROR_INVALID_CONTAINER
  6185. */
  6186. openSlideout: function openSlideout(slideout) {
  6187. var openSlideout;
  6188. if (!$.prototype.isPrototypeOf(this.$container)) {
  6189. throw _buildError({
  6190. msg: ERROR_INVALID_CONTAINER,
  6191. container: this.$container
  6192. });
  6193. }
  6194. if (Slideout.prototype.isPrototypeOf(slideout)) {
  6195. openSlideout = _openSlideoutFromInstance.call(this, slideout);
  6196. } else if (_.isObject(slideout)) {
  6197. openSlideout = _openSlideoutFromObject.call(this, slideout);
  6198. } else {
  6199. throw _buildError({
  6200. msg: ERROR_INVALID_PARAM,
  6201. parameter: slideout
  6202. });
  6203. }
  6204. this._open[openSlideout.position] = openSlideout.getRootParent();
  6205. _setCallbacks.call(this, this._open[openSlideout.position]);
  6206. return openSlideout;
  6207. },
  6208. /**
  6209. * Returns the open slideout for the given position
  6210. * @public
  6211. * @param {String} position - left or right
  6212. * @return {Slideout} the open slideout for the given position or undefined if none is open or if the position is invalid
  6213. * @throw ERROR_GET_OPEN_SLIDEOUT_INVALID_POSITION
  6214. */
  6215. getOpenSlideout: function getOpenSlideout(position) {
  6216. if (position !== 'left' && position !== 'right') {
  6217. throw _buildError({
  6218. msg: ERROR_GET_OPEN_SLIDEOUT_INVALID_POSITION,
  6219. position: position
  6220. });
  6221. }
  6222. return this._open[position];
  6223. },
  6224. /**
  6225. * Returns array of the open slideouts from the 2 positions: left and right
  6226. * @public
  6227. * @return {Slideout[]} Array of open slideouts; Empty if none is open
  6228. */
  6229. getOpenSlideouts: function getOpenSlideouts() {
  6230. var openSlideouts = [];
  6231. if (!_.isUndefined(this._open.left)) {
  6232. openSlideouts.push(this._open.left);
  6233. }
  6234. if (!_.isUndefined(this._open.right)) {
  6235. openSlideouts.push(this._open.right);
  6236. }
  6237. return openSlideouts;
  6238. },
  6239. /**
  6240. * Gets the registered slideout based on the id
  6241. * @public
  6242. * @param {String} id - id of the slideout
  6243. * @return {Slideout} undefined if not found or id is not a sting
  6244. */
  6245. getRegisteredSlideout: function getRegisteredSlideout(id) {
  6246. var slideout;
  6247. if (_.isString(id)) {
  6248. slideout = this._registered[id];
  6249. }
  6250. return slideout;
  6251. },
  6252. /**
  6253. * Gets the registry container
  6254. * @return {jquery} Container as a jquery object
  6255. */
  6256. getContainer: function getContainer() {
  6257. return this.$container;
  6258. },
  6259. /**
  6260. * Changes the container
  6261. * @public
  6262. * @param {jQuery} $newContainer - new container to move to
  6263. * @throws ERROR_INVALID_CONTAINER is $newContainer is invalid
  6264. */
  6265. changeContainer: function changeContainer($newContainer) {
  6266. if (!$.prototype.isPrototypeOf($newContainer)) {
  6267. throw _buildError({
  6268. msg: ERROR_CHANGE_CONTAINER_INVALID_CONTAINER,
  6269. container: this.$container
  6270. });
  6271. }
  6272. if (this._open.left || this._open.right) {
  6273. throw _buildError({
  6274. msg: ERROR_CHANGE_CONTAINER_OPEN_SLIDEOUT,
  6275. open: this._open
  6276. });
  6277. }
  6278. _.each(this._registered, function (slideout
  6279. /*, id*/
  6280. ) {
  6281. _addSlideoutToContainer($newContainer, slideout);
  6282. }, this);
  6283. this.$container = $newContainer;
  6284. },
  6285. _removeSlideout: function _removeSlideout(slideout) {
  6286. if (slideout) {
  6287. slideout.remove();
  6288. }
  6289. },
  6290. cleanupSlideouts: function cleanupSlideouts() {
  6291. _.each(this._open, function (slideout) {
  6292. if (slideout) {
  6293. slideout.remove();
  6294. }
  6295. });
  6296. _.each(this._registered, function (slideout) {
  6297. if (slideout) {
  6298. slideout.remove();
  6299. }
  6300. });
  6301. }
  6302. });
  6303. return Registry;
  6304. });
  6305. //# sourceMappingURL=SlideoutRegistry.js.map
  6306. ;
  6307. /**
  6308. * Licensed Materials - Property of IBM
  6309. * IBM Cognos Products: BI Glass
  6310. * (C) Copyright IBM Corp. 2017
  6311. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  6312. */
  6313. define('baglass/ajax/AjaxErrorFactory',['../core-client/js/core-client/errors/BaseError'], function (BaseError) {
  6314. var AjaxErrorFactory = {
  6315. /**
  6316. * Creates a an AjaxError from the jqXHR objects
  6317. * @public
  6318. * @param {Object} jqXHR - jquery XHR object
  6319. * @return {AjaxError} - instance of AjaxError that has code and requestInfo properties
  6320. */
  6321. create: function create(jqXHR, textStatus, errorThrown) {
  6322. var AjaxError = BaseError.extend({
  6323. init: function init(status, options) {
  6324. AjaxError.inherited('init', this, arguments);
  6325. this.name = 'AjaxError';
  6326. this.jqXHR = options.requestInfo.jqXHR;
  6327. this.textStatus = options.requestInfo.textStatus;
  6328. this.errorThrown = options.requestInfo.errorThrown;
  6329. }
  6330. });
  6331. return new AjaxError(jqXHR.statusText, {
  6332. requestInfo: {
  6333. jqXHR: jqXHR,
  6334. textStatus: textStatus,
  6335. errorThrown: errorThrown
  6336. },
  6337. code: jqXHR.status
  6338. });
  6339. }
  6340. };
  6341. return AjaxErrorFactory;
  6342. });
  6343. //# sourceMappingURL=AjaxErrorFactory.js.map
  6344. ;
  6345. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  6346. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  6347. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  6348. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  6349. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6350. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  6351. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  6352. /**
  6353. * Licensed Materials - Property of IBM
  6354. * IBM Business Analytics (C) Copyright IBM Corp. 2017
  6355. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  6356. */
  6357. define('baglass/services/AjaxService',['jquery', '../ajax/AjaxErrorFactory'], function ($, AjaxErrorFactory) {
  6358. var AjaxService = /*#__PURE__*/function () {
  6359. /**
  6360. * @description Constructor
  6361. * @param {Object} - (optional) options.logger - Logger
  6362. * @param {Object} - (optional) @deprecated options.errorDialog -
  6363. */
  6364. function AjaxService(options) {
  6365. var _this = this;
  6366. _classCallCheck(this, AjaxService);
  6367. this._logWarning = function (msg) {
  6368. if (_this._logger && _this._logger.warn) {
  6369. _this._logger.warn('AjaxService', msg);
  6370. }
  6371. };
  6372. this._handleUrlTooLong = function (request, reqInfo, originalParams, urlReducer) {
  6373. var warnMsg = "Request too long. ".concat(JSON.stringify(request), ". Prepared URL length: ").concat(reqInfo.preparedReqLen, " exceeds max configured length ").concat(reqInfo.maxQuerySize, ".");
  6374. _this._logWarning(warnMsg);
  6375. var reducedParams = urlReducer(originalParams);
  6376. warnMsg = "URL reducer invoked and returned reduced params: ".concat(JSON.stringify(reducedParams), ".");
  6377. _this._logWarning(warnMsg);
  6378. reducedParams.skipUrlReducer = true;
  6379. return _this.ajax(reducedParams);
  6380. };
  6381. this._issueRequest = function (request, originalParams) {
  6382. var params = request.params;
  6383. if (params.urlReducer && !params.skipUrlReducer) {
  6384. return _this._checkUrlLength(request).then(function (reqInfo) {
  6385. if (reqInfo.urlTooLong) {
  6386. return _this._handleUrlTooLong(request, reqInfo, originalParams, params.urlReducer);
  6387. }
  6388. return _this.executeProcessedAjax(request.params);
  6389. });
  6390. }
  6391. return _this._sendRequest(request);
  6392. };
  6393. this._sendRequest = function (request) {
  6394. return new Promise(function (resolve, reject) {
  6395. _this._cntr++;
  6396. var requestId = 'xhr' + _this._cntr;
  6397. var jqXHR = _this.ajaxFn(request.params);
  6398. _this._inflightRequests[requestId] = jqXHR;
  6399. jqXHR.then(function (data, textStatus, jqXHR) {
  6400. resolve({
  6401. data: data,
  6402. textStatus: textStatus,
  6403. jqXHR: jqXHR
  6404. });
  6405. }).fail(function (jqXHR, textStatus, errorThrown) {
  6406. if (errorThrown !== 'abort') {
  6407. reject(_this._AjaxErrorFactory.create(jqXHR, textStatus, errorThrown));
  6408. } else {
  6409. resolve({
  6410. textStatus: textStatus,
  6411. jqXHR: jqXHR
  6412. });
  6413. }
  6414. }).done(function () {
  6415. if (_this._inflightRequests[requestId]) {
  6416. delete _this._inflightRequests[requestId];
  6417. }
  6418. });
  6419. });
  6420. };
  6421. this._logger = options && options.logger || console;
  6422. this._configService = options && options.configService;
  6423. this._errorMessageRenderer = options && options.errorDialog || undefined;
  6424. this._requestHandlers = [];
  6425. this._responseHandlers = [];
  6426. this._errorHandler = null;
  6427. this._cntr = 0;
  6428. this._inflightRequests = {};
  6429. }
  6430. /**
  6431. * @description Adds a handler to the request chain that will be called before every request.
  6432. * @param {Object} handler
  6433. * handler - Object with function: prepareRequest(params)
  6434. * @throws if handler is not provided, or does not provide a "prepareRequest" function.
  6435. */
  6436. _createClass(AjaxService, [{
  6437. key: "addRequestHandler",
  6438. value: function addRequestHandler(handler) {
  6439. if (handler && typeof handler.prepareRequest === 'function') {
  6440. this._requestHandlers.push(handler);
  6441. } else {
  6442. throw new Error('Handler must implement function "prepareRequest"');
  6443. }
  6444. }
  6445. /**
  6446. * @description Adds a handler to the response chain which will be called on every response.
  6447. * @param {Object} handler
  6448. * handler - Object with function: handleResponse(data, textStatus, jqXHR)
  6449. * @throws if handler is not provided, or does not provide a "handleResponse" function.
  6450. */
  6451. }, {
  6452. key: "addResponseHandler",
  6453. value: function addResponseHandler(handler) {
  6454. if (handler && typeof handler.handleResponse === 'function') {
  6455. this._responseHandlers.push(handler);
  6456. } else {
  6457. throw new Error('Handler must implement function "handleResponse"');
  6458. }
  6459. }
  6460. /**
  6461. * @description Sets a single handler which will be called on every error response.
  6462. * @param {Object} handler
  6463. * handler - Object with function: handleError(request, error)
  6464. * @throws if handler is not provided, or does not provide a "handleError" function.
  6465. */
  6466. }, {
  6467. key: "setErrorHandler",
  6468. value: function setErrorHandler(handler) {
  6469. if (handler && typeof handler.handleError === 'function') {
  6470. this._errorHandler = handler;
  6471. } else {
  6472. throw new Error('Handler must implement function "handleError"');
  6473. }
  6474. }
  6475. }, {
  6476. key: "_buildRequestObject",
  6477. value: function _buildRequestObject(params) {
  6478. return {
  6479. params: params || {}
  6480. };
  6481. }
  6482. }, {
  6483. key: "ajax",
  6484. value:
  6485. /**
  6486. * @description Send an AJAX request.
  6487. * @param params jQuery style ajax params object
  6488. * @returns {Promise} (A+ Spec)
  6489. */
  6490. function ajax(params) {
  6491. var request = this._buildRequestObject(params); // The _prepareRequest has request handlers that potentially modify the request.
  6492. // If there is a urlReducer, make a copy of the original params.
  6493. var originalParams = params && params.urlReducer ? _objectSpread({}, params) : null;
  6494. return this._prepareRequest(request).then(this._issueRequest.bind(this, request, originalParams)).then(this._handleResponse.bind(this, request), this._handleError.bind(this, request));
  6495. }
  6496. /**
  6497. * @description Send an AJAX request without running requestHandlers.
  6498. * @param params jQuery style ajax params object
  6499. * @returns {Promise} (A+ Spec)
  6500. */
  6501. }, {
  6502. key: "executeProcessedAjax",
  6503. value: function executeProcessedAjax(params) {
  6504. var request = this._buildRequestObject(params);
  6505. return this._executeProcessedAjax(request);
  6506. }
  6507. }, {
  6508. key: "_executeProcessedAjax",
  6509. value: function _executeProcessedAjax(request) {
  6510. return this._sendRequest(request).then(this._handleResponse.bind(this, request), this._handleError.bind(this, request));
  6511. }
  6512. /**
  6513. * @description Prepare AJAX request with configured requestHandlers.
  6514. * @param params jQuery style ajax params object
  6515. * @returns {Promise} (A+ Spec)
  6516. */
  6517. }, {
  6518. key: "prepareRequest",
  6519. value: function prepareRequest(params) {
  6520. var request = this._buildRequestObject(params);
  6521. return this._prepareRequest(request, true);
  6522. }
  6523. /**
  6524. * @description For GET requests, calculate length of URL plus data items as query params.
  6525. * For non-GET requests, calculate length of just URL part.
  6526. * @param preparedReq Request after registered req handlers have processed the req
  6527. * @returns {Integer} length
  6528. */
  6529. }, {
  6530. key: "_getUrlAndParmsLength",
  6531. value: function _getUrlAndParmsLength(params) {
  6532. var url = params.url,
  6533. data = params.data,
  6534. method = params.method;
  6535. var urlLenth = url.length;
  6536. if (method === 'GET') {
  6537. // jQuery will move the content in .data onto URL as query parms.
  6538. var dataQueryItems = '';
  6539. if (typeof data === 'string') {
  6540. var dataItems = data.split('&');
  6541. dataQueryItems = dataItems.reduce(function (urlItems, item) {
  6542. var itemPair = item.split('=');
  6543. return "".concat(urlItems, "&").concat(itemPair[0], "=").concat(encodeURIComponent(itemPair[1]));
  6544. }, '');
  6545. } else if (Array.isArray(data)) {
  6546. dataQueryItems = data.reduce(function (urlItems, d) {
  6547. return "".concat(urlItems, "&").concat(encodeURIComponent(d.name), "=").concat(encodeURIComponent(d.value));
  6548. }, '');
  6549. } else if (_typeof(data) === 'object') {
  6550. for (var d in data) {
  6551. dataQueryItems = "".concat(dataQueryItems, "&").concat(encodeURIComponent(d), "=").concat(encodeURIComponent(data[d]));
  6552. }
  6553. }
  6554. return urlLenth + dataQueryItems.length;
  6555. }
  6556. return urlLenth;
  6557. }
  6558. }, {
  6559. key: "_checkUrlLength",
  6560. value: function _checkUrlLength(request) {
  6561. var _this2 = this;
  6562. return this._configService.getDatasetQuerySize().then(function (maxQuerySize) {
  6563. var preparedReqLen = _this2._getUrlAndParmsLength(request.params);
  6564. return {
  6565. urlTooLong: preparedReqLen > maxQuerySize,
  6566. maxQuerySize: maxQuerySize,
  6567. preparedReqLen: preparedReqLen
  6568. };
  6569. });
  6570. }
  6571. }, {
  6572. key: "_prepareRequest",
  6573. value: function _prepareRequest(request) {
  6574. var promise = Promise.resolve();
  6575. this._requestHandlers.forEach(function (handler) {
  6576. promise = promise.then(handler.prepareRequest.bind(handler, request));
  6577. });
  6578. return promise;
  6579. }
  6580. /**
  6581. * @description Cancels all in-flight requests. Errors reported by these requests (as 'aborted')
  6582. * will be swallowed.
  6583. */
  6584. }, {
  6585. key: "cancelAllRequests",
  6586. value: function cancelAllRequests() {
  6587. var _this3 = this;
  6588. Object.keys(this._inflightRequests).forEach(function (key) {
  6589. try {
  6590. var jqXHR = _this3._inflightRequests[key];
  6591. jqXHR.abort();
  6592. } catch (err) {
  6593. if (_this3._logger && _this3._logger.error) {
  6594. _this3._logger.error('AjaxService.cancelAllRequests', err);
  6595. }
  6596. }
  6597. });
  6598. }
  6599. /**
  6600. * @description Displays an error dialog
  6601. * @deprecated
  6602. * @param {Object} jqXHR - the request
  6603. * @param {String} errMsg - text to display
  6604. */
  6605. }, {
  6606. key: "showError",
  6607. value: function showError(jqXHR, errMsg) {
  6608. if (this._errorMessageRenderer && typeof this._errorMessageRenderer.showError === 'function') {
  6609. return this._errorMessageRenderer.showError(jqXHR, errMsg);
  6610. } else {
  6611. return Promise.reject(new Error('Unable to display error dialog: ' + errMsg));
  6612. }
  6613. }
  6614. }, {
  6615. key: "_handleResponse",
  6616. value: function _handleResponse(request, response) {
  6617. var promise = Promise.resolve();
  6618. this._responseHandlers.forEach(function (handler) {
  6619. promise = promise.then(handler.handleResponse.bind(handler, request, response));
  6620. });
  6621. return promise.then(function () {
  6622. return response;
  6623. });
  6624. }
  6625. }, {
  6626. key: "_handleError",
  6627. value: function _handleError(request, error) {
  6628. if (this._errorHandler) {
  6629. return this._errorHandler.handleError(request, error);
  6630. } else {
  6631. return Promise.reject(error);
  6632. }
  6633. }
  6634. }]);
  6635. return AjaxService;
  6636. }();
  6637. AjaxService.prototype.ajaxFn = $.ajax;
  6638. AjaxService.prototype._AjaxErrorFactory = AjaxErrorFactory;
  6639. return AjaxService;
  6640. });
  6641. //# sourceMappingURL=AjaxService.js.map
  6642. ;
  6643. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  6644. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6645. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  6646. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  6647. /**
  6648. * Licensed Materials - Property of IBM
  6649. * IBM Cognos Products: BI Glass
  6650. * (C) Copyright IBM Corp. 2018
  6651. * US Government Users Restricted Rights - Use, duplication or disclosure
  6652. * restricted by GSA ADP Schedule Contract with IBM Corp.
  6653. */
  6654. define('baglass/services/ClipboardService',['underscore'], function (_) {
  6655. /**
  6656. * @lends ClipboardService
  6657. **/
  6658. var ClipboardService = /*#__PURE__*/function () {
  6659. /**
  6660. * Contructor for ClipboardService
  6661. * @public
  6662. * @constructs ClipboardService
  6663. * @classdesc Shared clipboard service which has implemented following spec draft:
  6664. * <br> - API will provide async set, get and clear
  6665. * <br> - API will accept and return string/object/number data transparently without changing type
  6666. * <br> - Stringification and parsing of clipboard data will be handled internally for convenience
  6667. * <br> - TODO: Service will rehydrate from localStorage on creation in cases where new window
  6668. * <br> is opened after copying or to prevent data loss/ overwriting when switching between apps
  6669. * <br> - Example clipboard data (guideline, not yet decided):
  6670. * <br> {
  6671. * <br> dashboardSpec: <JSONSpec>,
  6672. * <br> reportingSpec: <V5Spec as Str>,
  6673. * <br> otherData: <any type>
  6674. * <br> }
  6675. * @param {Boolean} initNow - Wether to initialize the service now at creation
  6676. * or later, defaults to false and follows regular
  6677. * glass paradigm of deferred initialization
  6678. * @param {Object} glassContext - glassContext
  6679. **/
  6680. function ClipboardService(initNow, glassContext) {
  6681. _classCallCheck(this, ClipboardService);
  6682. if (initNow) {
  6683. this.initialize(glassContext);
  6684. }
  6685. }
  6686. /**
  6687. * Initializer for clipboard service
  6688. * @public
  6689. * @param {Object} glassContext - glassContext
  6690. **/
  6691. _createClass(ClipboardService, [{
  6692. key: "initialize",
  6693. value: function initialize(glassContext) {
  6694. this.glassContext = glassContext;
  6695. this._clipboardData = '';
  6696. this._storedType = 'string';
  6697. }
  6698. /**
  6699. * Async set data in localStorage. In case of non-existent localStorage
  6700. * We save data simply to this._clipboardData in this shared service
  6701. * @public
  6702. * @param {String | Object} data - object containing the data to set
  6703. * @return {Promise} returns resolve or reject. Reject will propagate error, resolve is empty
  6704. */
  6705. }, {
  6706. key: "set",
  6707. value: function set(data) {
  6708. var _this = this;
  6709. return new Promise(function (resolve, reject) {
  6710. try {
  6711. _this._set(data);
  6712. resolve();
  6713. } catch (e) {
  6714. reject(e);
  6715. }
  6716. });
  6717. }
  6718. /**
  6719. * Asynchronously get data in localStorage. In case of non-existent localStorage
  6720. * We get data from this._clipboardData in this shared service
  6721. * @public
  6722. * @return {Promise<String | Object>} returns a promise which resolves with {JSON} of all data
  6723. */
  6724. }, {
  6725. key: "get",
  6726. value: function get() {
  6727. var _this2 = this;
  6728. return new Promise(function (resolve) {
  6729. resolve(_this2._get());
  6730. });
  6731. }
  6732. /**
  6733. * Asynchronously clears all data in this service and associated localstorage
  6734. * @public
  6735. * @return {Promise} returns a promise which resolves after clearing everything or rejects on err
  6736. */
  6737. }, {
  6738. key: "clear",
  6739. value: function clear() {
  6740. var _this3 = this;
  6741. return new Promise(function (resolve) {
  6742. _this3._clipboardData = '';
  6743. _this3._storedType = 'string';
  6744. resolve();
  6745. });
  6746. }
  6747. /**
  6748. * sets clipboard data
  6749. * @private
  6750. **/
  6751. }, {
  6752. key: "_set",
  6753. value: function _set(str) {
  6754. if (_.isFunction(str)) {
  6755. throw new Error('Exception: Cannot encode functions for clipboard storage');
  6756. }
  6757. this._storedType = _typeof(str);
  6758. if (!_.isString(str)) {
  6759. str = JSON.stringify(str);
  6760. }
  6761. this._clipboardData = str;
  6762. }
  6763. /**
  6764. * gets clipboard data, attempting to return what was set
  6765. * @private
  6766. **/
  6767. }, {
  6768. key: "_get",
  6769. value: function _get() {
  6770. var ret = this._clipboardData;
  6771. if (this._storedType === 'object') {
  6772. ret = JSON.parse(this._clipboardData);
  6773. } else if (this._storedType === 'number') {
  6774. ret = Number(this._clipboardData);
  6775. }
  6776. return ret;
  6777. }
  6778. }]);
  6779. return ClipboardService;
  6780. }();
  6781. return ClipboardService;
  6782. });
  6783. //# sourceMappingURL=ClipboardService.js.map
  6784. ;
  6785. define('text!baglass/app/templates/CoachMarkBubble.html',[],function () { return '<div role="button" tabIndex="0" position="relative"\n\taria-label="{{=it.label}}">\n\t<div title="{{=it.label}}">\n\t\t<svg class="wa-hint-bubble wa-hint-bubble-outside-animated">\n\t\t\t<use style="pointer-events: none;" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#common-coachmark-outer"></use>\n\t\t</svg>\n\t\t<svg class="wa-hint-bubble wa-hint-bubble-inside-animated">\n\t\t\t<title>{{=it.label}}</title>\n\t\t\t<use style="pointer-events: none;" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#common-coachmark-inner"></use>\n\t\t</svg>\n\t</div>\n</div>\n';});
  6786. define('text!baglass/app/templates/CoachMarkPopover.html',[],function () { return '<div class="popover coachMarkPopover" role="dialog" aria-labelledby="coachTitle" aria-describedby="coachText">\n\t<div class="arrow"></div>\n\t<div class="coachMarkContent">\n\t\t<div class="popover-title coachMarkTitle"></div>\n\t\t<div type="button" role="button" class="coachMarkClose" tabIndex="0" title="{{=it.closeText}}">\n\t\t\t<svg fill="#3D4852" stroke="#3D4852">\n\t\t\t\t<use style="pointer-events: none;" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#common-titan-dialog-close"></use>\n\t\t\t</svg>\n\t\t</div>\n\t\t<div class="popover-content coachMarkText"></div>\n\t\t<div class="actionableLink">\n\t\t\t<a href="javascript:void(0);">{{=it.turnOffText}}</a>\n\t\t</div>\n\t</div>\n</div>';});
  6787. /**
  6788. * Licensed Materials - Property of IBM
  6789. * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2015, 2018
  6790. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  6791. */
  6792. define('baglass/app/CoachMark',['../core-client/js/core-client/ui/AccessibleView', 'jquery', 'text!./templates/CoachMarkBubble.html', 'text!./templates/CoachMarkPopover.html', '../nls/StringResources', 'doT', 'underscore', 'bootstrap', // currently required for usage of bspopover
  6793. 'jquery-ui'], function (AccessibleView, $, CoachMarkBubble, CoachMarkPopover, StringResources, dot, _) {
  6794. /**
  6795. * Implements Coach marks functionality
  6796. * @private
  6797. */
  6798. var CoachMark = AccessibleView.extend({
  6799. init: function init(options) {
  6800. this.persistence = options.glassContext.getCoreSvc('.CoachMarkService').getPersistence();
  6801. var label = StringResources.get('coachMarkLabel', {
  6802. title: _.escape(options.title)
  6803. });
  6804. var sHtml = dot.template(CoachMarkBubble)({
  6805. 'label': label
  6806. });
  6807. this._$coachMark = $(sHtml);
  6808. options.launchPoint = this._$coachMark;
  6809. options.enableTabLooping = true;
  6810. CoachMark.inherited('init', this, arguments);
  6811. },
  6812. render: function render($container, isVisible) {
  6813. $('.coachMarkPopover').remove();
  6814. var $coachMark = this._$coachMark;
  6815. var containerId = $container.attr('id');
  6816. $coachMark.addClass('coachMark');
  6817. if (!isVisible) {
  6818. $coachMark.hide();
  6819. }
  6820. $coachMark.data('containerId', containerId);
  6821. $container.append($coachMark);
  6822. $container.addClass('coachMarkContainer');
  6823. var $toolBarParent = $container.closest('.toolpane');
  6824. if ($toolBarParent.hasClass('toolpaneLeft') || $toolBarParent.hasClass('toolpaneRight')) {
  6825. $coachMark.addClass('vertical');
  6826. }
  6827. if (!this.placement) {
  6828. this.placement = 'right';
  6829. if ($toolBarParent.hasClass('toolpaneRight')) {
  6830. this.placement = 'left';
  6831. } else if ($toolBarParent.hasClass('toolpaneTop')) {
  6832. this.placement = 'bottom';
  6833. } else if ($toolBarParent.hasClass('toolpaneBottom')) {
  6834. this.placement = 'top';
  6835. }
  6836. }
  6837. var turnOffText = StringResources.get('coachMarkTurnOffHints');
  6838. var closeText = StringResources.get('coachMarkClose');
  6839. var sHtml = dot.template(CoachMarkPopover)({
  6840. 'turnOffText': turnOffText,
  6841. 'closeText': closeText
  6842. });
  6843. var popoverOptions = {
  6844. placement: this.placement,
  6845. trigger: 'manual',
  6846. container: 'body',
  6847. title: this.title || {},
  6848. content: this.contents || {},
  6849. template: sHtml,
  6850. sanitize: false
  6851. };
  6852. this.$popover = $coachMark.popover(popoverOptions);
  6853. var popoverClickListener = function (event) {
  6854. if (event.which === $.ui.keyCode.ESCAPE || $('.coachMarkPopover:visible').length === 1) {
  6855. this.$popover.popover('hide');
  6856. removeEventListener('blur', popoverBlurListener);
  6857. removeEventListener('touchstart', popoverClickListener, true);
  6858. removeEventListener('click', popoverClickListener, true);
  6859. removeEventListener('resize', popoverClickListener, true);
  6860. $('body').off('keydown');
  6861. var $clickOnCoachMark = $(event.target).closest('.coachMark');
  6862. if ($clickOnCoachMark.length !== 0 && containerId === $clickOnCoachMark.data('containerId')) {
  6863. event.stopPropagation();
  6864. }
  6865. } else if ($('.coachMarkPopover').length === 0 || $('.coachMarkPopover:hidden').length === 1) {
  6866. this.$popover.popover('show');
  6867. }
  6868. }.bind(this); // required for contained iFrames (report studio)
  6869. var popoverBlurListener = function () {
  6870. if (document.activeElement && $(document.activeElement).is('iframe')) {
  6871. this.$popover.popover('hide');
  6872. }
  6873. }.bind(this);
  6874. var escapeListener = function (event) {
  6875. if (event.which === $.ui.keyCode.ESCAPE) {
  6876. this.getLaunchPoint().focus();
  6877. popoverClickListener(event);
  6878. }
  6879. }.bind(this);
  6880. this.$popover.on('shown.bs.popover', function () {
  6881. var $coachMarkPopover = $('.coachMarkPopover');
  6882. $('.coachMarkTitle', $coachMarkPopover).attr('id', 'coachTitle');
  6883. $('.coachMarkText', $coachMarkPopover).attr('id', 'coachText');
  6884. $('.coachMarkClose', $coachMarkPopover).focus();
  6885. this.enableLooping($('.coachMarkContent', $coachMarkPopover));
  6886. $('.coachMarkClose', $coachMarkPopover).on('primaryaction', function (event) {
  6887. this.$popover.popover('hide');
  6888. var readId = this.$popover.data('containerId');
  6889. if (readId) {
  6890. this.persistence.marksAsRead(readId); // hide this coach mark in all open perspectives
  6891. $('.coachMark').filter(function () {
  6892. return $(this).data('containerId') === readId;
  6893. }).hide();
  6894. } else {
  6895. $(event.target).closest('.coachMarkPopover').hide();
  6896. }
  6897. }.bind(this));
  6898. $('.actionableLink a', $coachMarkPopover).on('primaryaction', function () {
  6899. var userProfile = this.glassContext.getCoreSvc('.UserProfile');
  6900. userProfile.preferences[CoachMark.PREFERENCES_KEY] = CoachMark.HIDE_ALL;
  6901. $('.coachMark').hide();
  6902. this.$popover.popover('hide');
  6903. var saveData = {};
  6904. saveData[CoachMark.PREFERENCES_KEY] = CoachMark.HIDE_ALL;
  6905. userProfile.savePreferences(saveData);
  6906. }.bind(this));
  6907. addEventListener('click', popoverClickListener, true);
  6908. addEventListener('resize', popoverClickListener, true);
  6909. addEventListener('touchstart', popoverClickListener, true);
  6910. addEventListener('blur', popoverBlurListener);
  6911. $('body').on('keydown', escapeListener);
  6912. }.bind(this));
  6913. this.$popover.on('hidden.bs.popover', function () {
  6914. removeEventListener('blur', popoverBlurListener);
  6915. removeEventListener('touchstart', popoverClickListener, true);
  6916. removeEventListener('click', popoverClickListener, true);
  6917. removeEventListener('resize', popoverClickListener, true);
  6918. $('body').off('keydown');
  6919. }.bind(this));
  6920. this.$popover.on('primaryaction', function (event) {
  6921. event.stopPropagation();
  6922. this.$popover.popover('show');
  6923. }.bind(this));
  6924. }
  6925. });
  6926. CoachMark.PREFERENCES_KEY = 'showHints';
  6927. CoachMark.HIDE_ALL = 'hideAll';
  6928. return CoachMark;
  6929. });
  6930. //# sourceMappingURL=CoachMark.js.map
  6931. ;
  6932. /**
  6933. * Licensed Materials - Property of IBM
  6934. * IBM Cognos Products: BI Glass
  6935. * (C) Copyright IBM Corp. 2015, 2018
  6936. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  6937. */
  6938. define('baglass/app/CoachMarkPersistence',['../core-client/js/core-client/ui/core/Class', 'jquery'], function (Class, $) {
  6939. /**
  6940. * Implement Coach marks persistence functionality
  6941. * @private
  6942. */
  6943. var CoachMarkPersistence = Class.extend({
  6944. init: function init(options) {
  6945. this.glassContext = options.glassContext;
  6946. },
  6947. isRead: function isRead(id) {
  6948. var _this = this;
  6949. var showHints = this.glassContext.getCoreSvc('.UserProfile').preferences.showHints;
  6950. if (showHints === 'hideAll') {
  6951. return Promise.resolve(true);
  6952. } else {
  6953. if (this._readCoachMarks === undefined) {
  6954. return this._getHints().then(function (json) {
  6955. _this._readCoachMarks = json;
  6956. return _this._readCoachMarks[id] === true;
  6957. }).catch(function (err) {
  6958. _this._readCoachMarks = {};
  6959. var jqXHR = err.jqXHR;
  6960. if (jqXHR && jqXHR.status === 404) {
  6961. return false;
  6962. } else {
  6963. _this.glassContext.getCoreSvc('.Logger').error('Internal error: Unable to read coach mark' + err.jqXHR.responseText);
  6964. throw err;
  6965. }
  6966. });
  6967. } else {
  6968. return Promise.resolve(this._readCoachMarks[id] === true);
  6969. }
  6970. }
  6971. },
  6972. marksAsRead: function marksAsRead(id) {
  6973. var _this2 = this;
  6974. if (this._readCoachMarks) {
  6975. this._readCoachMarks[id] = true;
  6976. var jsonData = JSON.stringify(this._readCoachMarks);
  6977. return this.glassContext.getCoreSvc('.Ajax').ajax({
  6978. url: CoachMarkPersistence.SERVICE_URL,
  6979. type: 'PUT',
  6980. 'headers': {
  6981. 'Content-Type': 'application/json'
  6982. },
  6983. data: jsonData
  6984. }).catch(function (err) {
  6985. _this2.glassContext.getCoreSvc('.Logger').error('Internal error: Update coach mark status failed: ' + err.jqXHR.responseText);
  6986. throw err;
  6987. });
  6988. }
  6989. },
  6990. reset: function reset() {
  6991. var _this3 = this;
  6992. this._readCoachMarks = undefined;
  6993. return this.glassContext.getCoreSvc('.Ajax').ajax({
  6994. url: CoachMarkPersistence.SERVICE_URL,
  6995. type: 'DELETE'
  6996. }).then(function () {
  6997. $('.coachMark').show();
  6998. }).catch(function (err) {
  6999. _this3.glassContext.getCoreSvc('.Logger').error('Internal error: unable to delete coach marks status: ' + err.jqXHR.responseText);
  7000. throw err;
  7001. });
  7002. },
  7003. // Don't issue multiple, concurrent requests for the same info...
  7004. _getHints: function _getHints() {
  7005. var _this4 = this;
  7006. if (!this._hintsRequest) {
  7007. this._hintsRequest = this.glassContext.getCoreSvc('.Ajax').ajax({
  7008. url: CoachMarkPersistence.SERVICE_URL,
  7009. type: 'GET',
  7010. headers: {
  7011. 'Accept': 'application/json'
  7012. }
  7013. }).then(function (results) {
  7014. _this4._hintsRequest = null;
  7015. return results.data;
  7016. });
  7017. }
  7018. return this._hintsRequest;
  7019. }
  7020. });
  7021. CoachMarkPersistence.SERVICE_URL = 'v1/users/~/items/uihints';
  7022. return CoachMarkPersistence;
  7023. });
  7024. //# sourceMappingURL=CoachMarkPersistence.js.map
  7025. ;
  7026. /**
  7027. * Licensed Materials - Property of IBM
  7028. * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2018
  7029. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7030. */
  7031. define('baglass/app/services/CoachMarkService',['../../core-client/js/core-client/ui/core/Events', '../CoachMark', '../CoachMarkPersistence'], function (Events, CoachMark, CoachMarkPersistence) {
  7032. var CoachMarkService = Events.extend({
  7033. init: function init(glassContext) {
  7034. CoachMarkService.inherited('init', this, arguments);
  7035. this.renderer = CoachMark;
  7036. this.glassContext = glassContext;
  7037. this.persistence = new CoachMarkPersistence({
  7038. glassContext: glassContext
  7039. });
  7040. },
  7041. setRenderer: function setRenderer(renderer) {
  7042. this.renderer = renderer;
  7043. },
  7044. setPersistence: function setPersistence(persistence) {
  7045. this.persistence = persistence;
  7046. },
  7047. getRenderer: function getRenderer() {
  7048. return this.renderer;
  7049. },
  7050. getPersistence: function getPersistence() {
  7051. return this.persistence;
  7052. },
  7053. isCoachMarkEnabled: function isCoachMarkEnabled() {
  7054. if (typeof this.persistence.isEnabled === 'function') {
  7055. return this.persistence.isEnabled().then(function (enabled) {
  7056. if (enabled === true) {
  7057. return true;
  7058. } else {
  7059. return false;
  7060. }
  7061. }).fail(function () {
  7062. return false;
  7063. });
  7064. } else {
  7065. return Promise.resolve();
  7066. }
  7067. },
  7068. disableCoachMarks: function disableCoachMarks() {
  7069. this.trigger('disable:all', {});
  7070. if (typeof this.persistence.disable === 'function') {
  7071. return this.persistence.disable().then(function () {
  7072. return true;
  7073. }).catch(function () {
  7074. return false;
  7075. });
  7076. } else {
  7077. return Promise.resolve();
  7078. }
  7079. },
  7080. enableAndRestart: function enableAndRestart() {
  7081. this.trigger('enable:restart', {});
  7082. if (typeof this.persistence.restart === 'function') {
  7083. return this.persistence.restart().then(function () {
  7084. return true;
  7085. }).catch(function () {
  7086. return false;
  7087. });
  7088. } else {
  7089. return Promise.resolve();
  7090. }
  7091. },
  7092. enableAndContinue: function enableAndContinue() {
  7093. this.trigger('enable:continue', {});
  7094. if (typeof this.persistence.restart === 'function') {
  7095. return this.persistence.restart().then(function () {
  7096. return true;
  7097. }).catch(function () {
  7098. return false;
  7099. });
  7100. } else {
  7101. return Promise.resolve();
  7102. }
  7103. }
  7104. });
  7105. return CoachMarkService;
  7106. });
  7107. //# sourceMappingURL=CoachMarkService.js.map
  7108. ;
  7109. /*
  7110. * Licensed Materials - Property of IBM
  7111. *
  7112. * IBM Cognos Products: BI Glass
  7113. *
  7114. * (C) Copyright IBM Corp. 2015, 2016
  7115. *
  7116. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7117. */
  7118. define('baglass/app/RestUrls',[], function () {
  7119. var VERSION = 'v1';
  7120. var RestUrls = {
  7121. JSON_CONTENT_TYPE: 'application/json; charset=utf-8',
  7122. JSON_DATA_TYPE: 'json',
  7123. INSTALL_ENV: VERSION + '/configuration/keys/Glass/installMode',
  7124. SSO_URL: VERSION + '/ui/sso'
  7125. };
  7126. return RestUrls;
  7127. });
  7128. //# sourceMappingURL=RestUrls.js.map
  7129. ;
  7130. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7131. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  7132. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  7133. /**
  7134. * Licensed Materials - Property of IBM
  7135. *
  7136. * IBM Cognos Products: Glass
  7137. *
  7138. * Copyright IBM Corp. 2019
  7139. *
  7140. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7141. */
  7142. define('baglass/app/services/ConfigService',['jquery', 'underscore', '../RestUrls', '../../nls/StringResources'], function ($, _, restUrls, StringResources) {
  7143. /**
  7144. * This Class is a utility class to provide Config api for glass
  7145. * @public
  7146. */
  7147. var ConfigService = /*#__PURE__*/function () {
  7148. function ConfigService(options) {
  7149. _classCallCheck(this, ConfigService);
  7150. $.extend(this, options);
  7151. this.CONTENTLOCALES = ConfigService.CONTENTLOCALES;
  7152. this.PRODUCTLOCALES = ConfigService.PRODUCTLOCALES;
  7153. this.TIMEZONES = ConfigService.TIMEZONES;
  7154. this.LEGACYLAUNCHABLE = ConfigService.LEGACYLAUNCHABLE;
  7155. }
  7156. /**
  7157. * Initialize the config service with values harvested from elsewhere...
  7158. * @public
  7159. * @param {Object} context - Config names and values
  7160. */
  7161. _createClass(ConfigService, [{
  7162. key: "initialize",
  7163. value: function initialize(context) {
  7164. if (_.isObject(context)) {
  7165. _.extend(this, _.pick(context, ConfigService.CONTENTLOCALES, ConfigService.PRODUCTLOCALES, ConfigService.TIMEZONES, ConfigService.LEGACYLAUNCHABLE, ConfigService.DEFAULTHOME, ConfigService.DEFAULTLOGIN, ConfigService.PRODUCTVERSION, ConfigService.SSOINFO, ConfigService.PORTAL_PAGES, ConfigService.DATA_SERVICE_QUERY_SIZE, ConfigService.INSTRUMENTATION_CONFIG, ConfigService.DIGITAL_CONTEXT_ENABLED, ConfigService.CLIENT_VALID_DOMAIN_LIST, ConfigService.XSS_CHECKING, ConfigService.CONF_MAPBOX_TOKEN, ConfigService.CONF_MAPBOX_ACCOUNTNAME, ConfigService.CONF_MAPBOX_SECRETTOKEN, ConfigService.MAINTENANCE_MESSAGE, ConfigService.MAINTENANCE_LINK, ConfigService.DISABLE_WHATSNEWSERVICE, ConfigService.DISABLE_ALERTBANNER, ConfigService.DISABLE_GLOBALTOAST));
  7166. if (this[ConfigService.SSOINFO]) {
  7167. this._processSSOInfo(this[ConfigService.SSOINFO]);
  7168. }
  7169. if (this[ConfigService.CONTENTLOCALES]) {
  7170. try {
  7171. this[ConfigService.CONTENTLOCALES] = JSON.parse(this[ConfigService.CONTENTLOCALES]);
  7172. } catch (error) {
  7173. this.glassContext.getCoreSvc('.Logger').error('Error parsing supportContentLocales JSON', error);
  7174. this[ConfigService.CONTENTLOCALES] = undefined;
  7175. }
  7176. }
  7177. if (context.featureRules) {
  7178. try {
  7179. var featureRules = JSON.parse(context.featureRules);
  7180. this.glassContext.getCoreSvc('.FeatureChecker').addRules(featureRules);
  7181. } catch (err) {
  7182. this.glassContext.getCoreSvc('.Logger').error(err);
  7183. }
  7184. }
  7185. } else {
  7186. throw new Error('Invalid configuration context');
  7187. }
  7188. }
  7189. /**
  7190. * Sets config values based on passed in key.
  7191. * @public
  7192. * @param {string} key - The key for the config value. Try using static keys from this class.
  7193. * @param {string} data - The data to store.
  7194. * @return {Promise} result of ajax call to set config value.
  7195. */
  7196. }, {
  7197. key: "setConfigValue",
  7198. value: function setConfigValue(key, data) {
  7199. var _this = this;
  7200. var configData = {};
  7201. configData[key] = _.isObject(data) ? JSON.stringify(data) : data;
  7202. return this.glassContext.getCoreSvc('.Ajax').ajax({
  7203. url: ConfigService.BASE_URL + ConfigService.GLOBAL,
  7204. type: 'PUT',
  7205. contentType: 'application/json',
  7206. data: JSON.stringify(configData)
  7207. }).then(function () {
  7208. _this[key] = data;
  7209. }).catch(function (err) {
  7210. var error = new Error(ConfigService.ERR_SET_CONFIG_VALUES);
  7211. error.msg = error.message;
  7212. error.causedBy = err;
  7213. throw error;
  7214. });
  7215. }
  7216. /**
  7217. * Retrieve product version for the current user. Always return a resolved promise.
  7218. * @public
  7219. * @return {Promise} promise resolved to either a Json object with user's product version or undefined.
  7220. */
  7221. }, {
  7222. key: "getProductVersion",
  7223. value: function getProductVersion() {
  7224. return this.getConfigValue(ConfigService.PRODUCTVERSION);
  7225. }
  7226. /**
  7227. * Synchronously retrieve product version for the current user.
  7228. * @public
  7229. * @return {string} String with user's product version or undefined.
  7230. */
  7231. }, {
  7232. key: "getVersion",
  7233. value: function getVersion() {
  7234. return this.getConfigValueSync(ConfigService.PRODUCTVERSION);
  7235. }
  7236. /**
  7237. * Retrieve content locales for the current user. Always returns a resolved promise.
  7238. * @public
  7239. * @return {Promise} promise resolved to either a Json object with user's content locales or undefined.
  7240. */
  7241. }, {
  7242. key: "getContentLocales",
  7243. value: function getContentLocales() {
  7244. return this._getConfigList(ConfigService.CONTENTLOCALES, true);
  7245. }
  7246. /**
  7247. * Retrieve product locales for the current user. Always returns a resolved promise.
  7248. * @public
  7249. * @return {Promise} promise resolved to either a Json object with user's product locales or undefined.
  7250. */
  7251. }, {
  7252. key: "getProductLocales",
  7253. value: function getProductLocales() {
  7254. return this._getConfigList(ConfigService.PRODUCTLOCALES, true);
  7255. }
  7256. /**
  7257. * Retrieve time zone for the current user. Always returns a resolved promise.
  7258. * @public
  7259. * @return {Promise} promise resolved to either a Json object with user's time zones or undefined.
  7260. */
  7261. }, {
  7262. key: "getTimeZones",
  7263. value: function getTimeZones() {
  7264. return this._getConfigList(ConfigService.TIMEZONES, true);
  7265. }
  7266. /**
  7267. * Retrieve the system legacy launchable value. Always returns a resolved promise.
  7268. * @public
  7269. * @return {Promise} promise resolved to a value representing the legacy value or undefined.
  7270. */
  7271. }, {
  7272. key: "getLegacyLaunchable",
  7273. value: function getLegacyLaunchable() {
  7274. return this._getConfigList(ConfigService.LEGACYLAUNCHABLE);
  7275. }
  7276. /**
  7277. * Retrieve the system legacy launchable value. Always returns a resolved promise.
  7278. * @public
  7279. * @return {Promise} promise resolved to a value representing the legacy value or undefined.
  7280. */
  7281. }, {
  7282. key: "getDefaultHome",
  7283. value: function getDefaultHome() {
  7284. return this._getConfigList(ConfigService.DEFAULTHOME);
  7285. }
  7286. /**
  7287. * Retrieve the system legacy launchable value. Always returns a resolved promise.
  7288. * @public
  7289. * @return {Promise} promise resolved to a value representing the legacy value or undefined.
  7290. */
  7291. }, {
  7292. key: "getDefaultLogin",
  7293. value: function getDefaultLogin() {
  7294. return this.getConfigValue(ConfigService.DEFAULTLOGIN);
  7295. }
  7296. /**
  7297. * Retrieve the Dataset Service URL Query Size. Always returns a resolved promise.
  7298. * @public
  7299. * @return {Promise} promise resolved to a value representing the dataset service URL query size or undefined.
  7300. */
  7301. }, {
  7302. key: "getDatasetQuerySize",
  7303. value: function getDatasetQuerySize() {
  7304. return this.getConfigValue(ConfigService.DATA_SERVICE_QUERY_SIZE);
  7305. }
  7306. /**
  7307. * Retrieve the XSS Checking Flag
  7308. * @public
  7309. * @return Boolean value representing the XSS checking flag or undefined.
  7310. */
  7311. }, {
  7312. key: "getXSSChecking",
  7313. value: function getXSSChecking() {
  7314. return this[ConfigService.XSS_CHECKING];
  7315. }
  7316. /**
  7317. * Asynchronous retrieval of a given configName
  7318. * @public
  7319. * @param {String} configName
  7320. * @param {boolean} isLocalized
  7321. * @return {Promise} result of ajax call to set config value.
  7322. */
  7323. }, {
  7324. key: "getConfigValue",
  7325. value: function getConfigValue(configName, isLocalized) {
  7326. return this._getHelper(configName, isLocalized, false);
  7327. }
  7328. /**
  7329. * Synchronous retrieval of a given configName from
  7330. * @public
  7331. * @param {String} configName
  7332. * @return {String} resulting config string or empty object
  7333. */
  7334. }, {
  7335. key: "getConfigValueSync",
  7336. value: function getConfigValueSync(configName) {
  7337. return this._getHelperSync(configName);
  7338. }
  7339. /**
  7340. * Get SSO urlLoginParameters
  7341. * @public
  7342. * @return {String} the parameters or undefined
  7343. */
  7344. }, {
  7345. key: "getAllowedUrlLoginParameters",
  7346. value: function getAllowedUrlLoginParameters() {
  7347. return this._getSSOInfo().urlLoginParameters;
  7348. }
  7349. /**
  7350. * Get SSO login url
  7351. * @public
  7352. * @return {String} the login url or undefined
  7353. */
  7354. }, {
  7355. key: "getSSOLoginURL",
  7356. value: function getSSOLoginURL() {
  7357. if (this[ConfigService.SSO_LOGIN]) return this[ConfigService.SSO_LOGIN];
  7358. return this._getSSOInfo().login;
  7359. }
  7360. /**
  7361. * Get SSO logout url
  7362. * @public
  7363. * @return {String} the logout url or undefined
  7364. */
  7365. }, {
  7366. key: "getSSOLogoutURL",
  7367. value: function getSSOLogoutURL() {
  7368. if (this[ConfigService.SSO_LOGOUT]) return this[ConfigService.SSO_LOGOUT];
  7369. return this._getSSOInfo().logout;
  7370. }
  7371. }, {
  7372. key: "getInstrumentationConfig",
  7373. value: function getInstrumentationConfig() {
  7374. return this.getConfigValueSync(ConfigService.INSTRUMENTATION_CONFIG);
  7375. }
  7376. /**
  7377. * Get Digital Context Enabled Flag
  7378. */
  7379. }, {
  7380. key: "isDigitalContextEnabled",
  7381. value: function isDigitalContextEnabled() {
  7382. return this.getConfigValueSync(ConfigService.DIGITAL_CONTEXT_ENABLED);
  7383. }
  7384. }, {
  7385. key: "_getConfigList",
  7386. value: function _getConfigList(configName, isLocalized) {
  7387. return this._getHelper(configName, isLocalized, true);
  7388. }
  7389. }, {
  7390. key: "_getSSOInfo",
  7391. value: function _getSSOInfo() {
  7392. return this.getConfigValueSync(ConfigService.SSOINFO) || {};
  7393. }
  7394. }, {
  7395. key: "_getHelper",
  7396. value: function _getHelper(configName, isLocalized, isJSON) {
  7397. var _this2 = this;
  7398. if (!_.isUndefined(this[configName])) {
  7399. return Promise.resolve(this[configName]);
  7400. } else {
  7401. var apiURL = ConfigService.BASE_URL + configName;
  7402. var ups = this.glassContext.getCoreSvc('.UserProfile');
  7403. if (isLocalized) {
  7404. apiURL += ups.preferences.productLocale;
  7405. }
  7406. return this.glassContext.getCoreSvc('.Ajax').ajax({
  7407. url: apiURL,
  7408. type: 'GET'
  7409. }).then(function (ajaxResultObj) {
  7410. var ajaxResult = ajaxResultObj.data;
  7411. try {
  7412. var ajaxKey = configName;
  7413. if (isLocalized) {
  7414. ajaxKey += ups.preferences.productLocale;
  7415. }
  7416. if (isJSON) {
  7417. ajaxResult = JSON.parse(ajaxResult[ajaxKey]);
  7418. } else {
  7419. ajaxResult = ajaxResult[ajaxKey];
  7420. }
  7421. if (!_.isUndefined(ajaxResult)) {
  7422. _this2[configName] = ajaxResult;
  7423. }
  7424. } catch (err) {
  7425. var message = '"' + err.message + '" encountered while parsing ' + configName;
  7426. _this2.glassContext.getCoreSvc('.Logger').error(message);
  7427. }
  7428. return _this2[configName];
  7429. }).catchReturn();
  7430. }
  7431. }
  7432. }, {
  7433. key: "_getHelperSync",
  7434. value: function _getHelperSync(configName) {
  7435. return this[configName];
  7436. }
  7437. }, {
  7438. key: "_getFormats",
  7439. value: function _getFormats() {
  7440. return {
  7441. 'HTML': StringResources.get('html'),
  7442. 'PDF': StringResources.get('pdf'),
  7443. 'CSV': StringResources.get('csv'),
  7444. 'spreadsheetML': StringResources.get('spreadsheetML'),
  7445. 'xlsxData': StringResources.get('xlsxData')
  7446. };
  7447. }
  7448. }, {
  7449. key: "_getBaseTextDirections",
  7450. value: function _getBaseTextDirections() {
  7451. return {
  7452. 'RTL': StringResources.get('rtl'),
  7453. 'LTR': StringResources.get('ltr'),
  7454. 'AUTO': StringResources.get('contextual')
  7455. };
  7456. }
  7457. }, {
  7458. key: "_getShowHints",
  7459. value: function _getShowHints() {
  7460. return {
  7461. 'showAll': StringResources.get('showAll'),
  7462. 'hideAll': StringResources.get('hideAll')
  7463. };
  7464. }
  7465. }, {
  7466. key: "clearConfigs",
  7467. value: function clearConfigs() {
  7468. this._contentLocales = undefined;
  7469. this._productLocales = undefined;
  7470. this._timeZoneIDs = undefined;
  7471. this._defaultHome = undefined;
  7472. }
  7473. }, {
  7474. key: "setSSOURL",
  7475. value: function setSSOURL() {
  7476. var _this3 = this;
  7477. if (this[ConfigService.SSOINFO]) {
  7478. return Promise.try(function () {
  7479. return _this3._processSSOInfo(_this3[ConfigService.SSOINFO]);
  7480. });
  7481. } else {
  7482. // TODO: Remove this when ssoInfo is injected by Entry page...
  7483. return this.glassContext.getCoreSvc('.Ajax').ajax({
  7484. url: restUrls.SSO_URL,
  7485. type: 'GET',
  7486. contentType: restUrls.JSON_CONTENT_TYPE,
  7487. dataType: restUrls.JSON_DATA_TYPE
  7488. }).then(function (results) {
  7489. var ssoData = results.data;
  7490. _this3[ConfigService.SSOINFO] = ssoData;
  7491. return _this3._processSSOInfo(ssoData);
  7492. }).catch(function (err) {
  7493. _this3.glassContext.getCoreSvc('.Logger').error('Internal error: set SSO URL failed: ' + err.jqXHR.responseText);
  7494. throw err;
  7495. });
  7496. }
  7497. }
  7498. }, {
  7499. key: "_processSSOInfo",
  7500. value: function _processSSOInfo(ssoInfo) {
  7501. if (ssoInfo && (ssoInfo.login || ssoInfo.logout)) {
  7502. $.ajaxSetup({
  7503. headers: {
  7504. 'X-CA-SSO': this.glassContext.ajaxCodes.SSO
  7505. }
  7506. });
  7507. }
  7508. }
  7509. }]);
  7510. return ConfigService;
  7511. }();
  7512. ConfigService.BASE_URL = 'v1/configuration/keys/';
  7513. ConfigService.CONTENTLOCALES = 'supportedContentLocales_';
  7514. ConfigService.PRODUCTLOCALES = 'supportedProductLocales_';
  7515. ConfigService.TIMEZONES = 'timeZones_';
  7516. ConfigService.LEGACYLAUNCHABLE = 'Configuration.LegacyLaunchable';
  7517. ConfigService.SSOINFO = 'ssoInfo';
  7518. ConfigService.DEFAULTHOME = 'Glass.welcomePage';
  7519. ConfigService.DEFAULTLOGIN = 'Glass.loginPage';
  7520. ConfigService.PRODUCTVERSION = 'InstallService.productVersion';
  7521. ConfigService.DIGITAL_CONTEXT_ENABLED = 'Glass.digitalContextEnabled';
  7522. ConfigService.PORTAL_PAGES = 'ContentApps/enableMyPortalPages';
  7523. ConfigService.GLOBAL = 'global';
  7524. ConfigService.ERR_SET_CONFIG_VALUES = 'setConfigValue failed';
  7525. ConfigService.DATA_SERVICE_QUERY_SIZE = 'DatasetService/urlQuerySize';
  7526. ConfigService.INSTRUMENTATION_CONFIG = 'instrumentationConfig';
  7527. ConfigService.CLIENT_VALID_DOMAIN_LIST = 'ClientValidDomainList';
  7528. ConfigService.XSS_CHECKING = 'CAF.caf_tpXSSCheckingUsed';
  7529. ConfigService.CONF_MAPBOX_TOKEN = 'Mapbox.token';
  7530. ConfigService.CONF_MAPBOX_SECRETTOKEN = 'Mapbox.secretToken';
  7531. ConfigService.CONF_MAPBOX_ACCOUNTNAME = 'Mapbox.accountName';
  7532. ConfigService.MAINTENANCE_MESSAGE = 'Glass.maintenanceMessage';
  7533. ConfigService.MAINTENANCE_LINK = 'Glass.maintenanceLink';
  7534. ConfigService.DISABLE_WHATSNEWSERVICE = 'Glass.disableWhatsNewAlerts';
  7535. ConfigService.DISABLE_ALERTBANNER = 'Glass.disableAlertBanner';
  7536. ConfigService.DISABLE_GLOBALTOAST = 'Glass.disableGlobalToast';
  7537. ConfigService.SSO_LOGIN = 'Glass.sso_login';
  7538. ConfigService.SSO_LOGOUT = 'Glass.sso_logout';
  7539. return ConfigService;
  7540. });
  7541. //# sourceMappingURL=ConfigService.js.map
  7542. ;
  7543. /**
  7544. * Licensed Materials - Property of IBM
  7545. * IBM Business Analytics (C) Copyright IBM Corp. 2017, 2018
  7546. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7547. */
  7548. define('baglass/services/ContextService',[], function () {
  7549. /**
  7550. * @constructs ContextService
  7551. * @classdesc This Class exposes the glass context
  7552. * @public
  7553. */
  7554. var ContextService = function ContextService(opt) {
  7555. this.glassContext = opt.glassContext;
  7556. };
  7557. ContextService.prototype.get = function (key) {
  7558. return this.glassContext.getCoreSvc('.UserProfile')[key];
  7559. };
  7560. return ContextService;
  7561. });
  7562. //# sourceMappingURL=ContextService.js.map
  7563. ;
  7564. /**
  7565. * Licensed Materials - Property of IBM
  7566. * IBM Business Analytics (C) Copyright IBM Corp. 2017
  7567. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7568. */
  7569. define('baglass/services/EventsService',['../core-client/js/core-client/ui/core/Events'], function (Events) {
  7570. 'use strict';
  7571. var EventsService;
  7572. EventsService = Events.extend({// nothing special here - for future use
  7573. });
  7574. return EventsService;
  7575. });
  7576. //# sourceMappingURL=EventsService.js.map
  7577. ;
  7578. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  7579. /**
  7580. * Licensed Materials - Property of IBM
  7581. * IBM Business Analytics (C) Copyright IBM Corp. 2017
  7582. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7583. */
  7584. define('baglass/services/FeatureChecker',[], function () {
  7585. 'use strict';
  7586. var isObject = function isObject(obj) {
  7587. return _typeof(obj) === 'object' && !Array.isArray(obj);
  7588. };
  7589. /**
  7590. * @constructor
  7591. */
  7592. var FeatureChecker = function FeatureChecker(rules) {
  7593. this._rules = rules || {};
  7594. };
  7595. /**
  7596. * @param {Object} rules - object describing feature rules.
  7597. */
  7598. FeatureChecker.prototype.setRules = function (rules) {
  7599. this._rules = rules;
  7600. };
  7601. /**
  7602. * @description Update feature rules
  7603. * @param {Object} rules - object describing feature rules.
  7604. */
  7605. FeatureChecker.prototype.addRules = function (rules) {
  7606. if (isObject(rules)) {
  7607. Object.keys(rules).forEach(function (category) {
  7608. if (isObject(rules[category])) {
  7609. if (this._rules[category]) {
  7610. Object.keys(rules[category]).forEach(function (flag) {
  7611. this._rules[category][flag] = rules[category][flag];
  7612. }.bind(this));
  7613. } else {
  7614. // Category doesn't exist; Simply add it.
  7615. this._rules[category] = rules[category];
  7616. }
  7617. }
  7618. }.bind(this));
  7619. }
  7620. };
  7621. /**
  7622. * Checks value against expected;
  7623. * @param {string} category - ba-header associated with the flag. ie: 'ba-save', 'ba-share', etc...
  7624. * @param {string} flag - flag associated with category
  7625. * @param {string} expected - expected values
  7626. * @return {boolean} true if category.flag === expected; false otherwise.
  7627. */
  7628. FeatureChecker.prototype.checkValue = function (category, flag, expected) {
  7629. var ret = false;
  7630. if (category && flag && this._rules[category] && this._rules[category][flag] !== undefined) {
  7631. ret = this._rules[category][flag] === expected;
  7632. }
  7633. return ret;
  7634. };
  7635. /**
  7636. * Gets the value of a rule
  7637. * @param {string} category - ba-header associated with the flag. ie: 'ba-save', 'ba-share', etc...
  7638. * @param {string} flag - flag associated with category
  7639. * @return {string} value of category.flag, or null;
  7640. */
  7641. FeatureChecker.prototype.getFeatureFlag = function (category, flag) {
  7642. var ret = null;
  7643. if (category && flag && this._rules[category]) {
  7644. ret = this._rules[category][flag];
  7645. }
  7646. return ret;
  7647. };
  7648. /**
  7649. * Gets all rules associated with a category
  7650. * @param {string} category - ba-header associated with the flag. ie: 'ba-save', 'ba-share', etc...
  7651. * @return {Object} value of category.flag, or undefined;
  7652. */
  7653. FeatureChecker.prototype.getFeatureFlags = function (category) {
  7654. return category ? this._rules[category] : null;
  7655. };
  7656. /**
  7657. * Serialize the rules
  7658. * @return {string} JSON/string
  7659. */
  7660. FeatureChecker.prototype.toJSON = function () {
  7661. return JSON.stringify(this._rules);
  7662. };
  7663. return FeatureChecker;
  7664. });
  7665. //# sourceMappingURL=FeatureChecker.js.map
  7666. ;
  7667. /**
  7668. * Licensed Materials - Property of IBM
  7669. * IBM Cognos Products: BA
  7670. * (C) Copyright IBM Corp. 2017
  7671. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7672. */
  7673. define('baglass/app/FeatureRules',[], function () {
  7674. // Default feature flag set for the ba-glass application.
  7675. // Format:
  7676. /*
  7677. return {
  7678. category: {
  7679. flag: 'value',
  7680. other: 'value'
  7681. }
  7682. };
  7683. */
  7684. return {
  7685. 'ba-glass': {
  7686. 'stringOnlyQS': 'enabled'
  7687. }
  7688. };
  7689. });
  7690. //# sourceMappingURL=FeatureRules.js.map
  7691. ;
  7692. /**
  7693. * Licensed Materials - Property of IBM
  7694. * IBM Cognos Products: BI Glass
  7695. * (C) Copyright IBM Corp. 2017
  7696. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule
  7697. * Contract with IBM Corp.
  7698. */
  7699. define('baglass/app/services/FetchService',['jquery', '../../core-client/js/core-client/ui/core/Class', '../../ajax/AjaxErrorFactory'], function ($, Class, AjaxErrorFactory) {
  7700. /**
  7701. * This Class is a utility class to provide RESTFul APIs for Glass
  7702. */
  7703. var FetchService = Class.extend(
  7704. /**
  7705. * @lends FetchService
  7706. */
  7707. {
  7708. /**
  7709. * @classdesc Class Implementating the Ajax service returning a promise
  7710. * @constructs
  7711. * @public
  7712. * @param {Object} options - options
  7713. * @param {GlassContext} options.glassContext - glass context
  7714. *
  7715. */
  7716. init: function init(options) {
  7717. $.extend(this, options);
  7718. },
  7719. /**
  7720. * Sends an ajax request with jquery
  7721. * @public
  7722. * @param {String} url - url
  7723. * @param {Object} [options] - Ajax options
  7724. * @param {String} [options.type=GET] - method to invokes
  7725. * @param {Object} [options.data] - data to send in case of POST or PUT
  7726. * @param {String} [options.contentType=application/x-www-form-urlencoded; charset=UTF-8] - type of data sent
  7727. * @param {String} [options.dataType] - type of expected data
  7728. * @return {Promise} promise with the returned data
  7729. * @throws {AjaxError|Error}
  7730. *
  7731. */
  7732. sendBaseRequest: function sendBaseRequest(url, options) {
  7733. options = $.extend(true, {}, options, {
  7734. url: url
  7735. });
  7736. return this.glassContext.getCoreSvc('.Ajax').ajax(options).then(function (results) {
  7737. return {
  7738. data: results.data,
  7739. code: results.jqXHR.status
  7740. };
  7741. }).catch(function (error) {
  7742. var jqXHR = error.jqXHR;
  7743. throw AjaxErrorFactory.create(jqXHR, jqXHR.statusText, error);
  7744. });
  7745. },
  7746. /**
  7747. * Sends a request and handles errors; the latter is the difference with sentBaseError
  7748. * It also sends a notification request when the initial one is successful
  7749. * @public
  7750. * @param {String} url - url
  7751. * @param {Object} options - Ajax options
  7752. * @param {String} [options.type=GET] - method to invokes
  7753. * @param {Object} [options.data] - data to send in case of POST or PUT
  7754. * @param {String} [options.contentType=application/x-www-form-urlencoded; charset=UTF-8] - type of data sent
  7755. * @param {String} [options.dataType] - type of expected data
  7756. * @return {Promise} promise with the returned data
  7757. * @throws {AjaxError|Error}
  7758. */
  7759. send: function send(url, options) {
  7760. return this.sendBaseRequest(url, options);
  7761. },
  7762. post: function post(url, options) {
  7763. var getOptions = $.extend(true, {}, options, {
  7764. type: 'POST'
  7765. });
  7766. return this.send(url, getOptions);
  7767. },
  7768. put: function put(url, options) {
  7769. var getOptions = $.extend(true, {}, options, {
  7770. type: 'PUT'
  7771. });
  7772. return this.send(url, getOptions);
  7773. },
  7774. delete: function _delete(url, options) {
  7775. var getOptions = $.extend(true, {}, options, {
  7776. type: 'DELETE'
  7777. });
  7778. return this.send(url, getOptions);
  7779. },
  7780. get: function get(url, options) {
  7781. var getOptions = $.extend(true, {}, options, {
  7782. type: 'GET'
  7783. });
  7784. return this.send(url, getOptions);
  7785. }
  7786. });
  7787. return FetchService;
  7788. });
  7789. //# sourceMappingURL=FetchService.js.map
  7790. ;
  7791. /**
  7792. * Licensed Materials - Property of IBM
  7793. * IBM Cognos Products: BI Glass
  7794. * (C) Copyright IBM Corp. 2015, 2017
  7795. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule
  7796. * Contract with IBM Corp.
  7797. */
  7798. define('baglass/app/services/AjaxService',['jquery', '../../core-client/js/core-client/ui/core/Class'], function ($, Class) {
  7799. /**
  7800. * This Class is a utility class to provide RESTFul APIs for Glass
  7801. */
  7802. var AjaxService = Class.extend({
  7803. init: function init(options) {
  7804. $.extend(this, options); // Inject RESTFul methods to class
  7805. $.each(['get', 'put', 'post', 'delete'], function (i, method) {
  7806. AjaxService.prototype[method] = function (path, options) {
  7807. var _options = $.extend({}, options);
  7808. _options.type = method;
  7809. _options.url = path;
  7810. return this.ajax(_options);
  7811. };
  7812. });
  7813. },
  7814. ajax: function ajax(options) {
  7815. var dfd = $.Deferred();
  7816. this.glassContext.getCoreSvc('.Ajax').ajax(options).then(function (results) {
  7817. dfd.resolve(results.data, results.textStatus, results.jqXHR);
  7818. }).catch(function (error) {
  7819. dfd.reject(dfd, error.jqXHR, error.textStatus, error.errorThrown);
  7820. });
  7821. return dfd.promise();
  7822. }
  7823. });
  7824. return AjaxService;
  7825. });
  7826. //# sourceMappingURL=AjaxService.js.map
  7827. ;
  7828. /**
  7829. * Licensed Materials - Property of IBM
  7830. * IBM Cognos Products: BI
  7831. * (C) Copyright IBM Corp. 2017
  7832. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7833. */
  7834. define('baglass/services/LogService',[], function () {
  7835. var Logger = function Logger() {
  7836. this.logLevelEnum = {
  7837. 'debug': 50,
  7838. 'info': 40,
  7839. 'warn': 30,
  7840. 'error': 20
  7841. };
  7842. this._level = this.logLevelEnum.error;
  7843. this._active = true;
  7844. this.localStorageKeys = {
  7845. 'isActive': 'com.ibm.ba.config.logging.isActive',
  7846. 'level': 'com.ibm.ba.config.logging.level'
  7847. };
  7848. var loggingConfigActive = this._getLocalStorage(this.localStorageKeys.isActive);
  7849. if (loggingConfigActive !== null) {
  7850. if (typeof loggingConfigActive.toLowerCase === 'function' && loggingConfigActive.toLowerCase() === 'true') {
  7851. this._active = true;
  7852. } else {
  7853. this._active = false;
  7854. }
  7855. }
  7856. var loggingConfigLevel = this._getLocalStorage(this.localStorageKeys.level);
  7857. if (loggingConfigLevel !== null) {
  7858. this._level = loggingConfigLevel;
  7859. }
  7860. };
  7861. Logger.prototype.turnOnLogging = function () {
  7862. this._active = true;
  7863. };
  7864. Logger.prototype.turnOffLogging = function () {
  7865. this._active = false;
  7866. };
  7867. Logger.prototype.isActive = function () {
  7868. return this._active;
  7869. };
  7870. Logger.prototype.getLevel = function () {
  7871. return parseInt(this._level);
  7872. };
  7873. Logger.prototype.setLevelError = function () {
  7874. this._level = this.logLevelEnum['error'];
  7875. };
  7876. Logger.prototype.setLevelWarn = function () {
  7877. this._level = this.logLevelEnum['warn'];
  7878. };
  7879. Logger.prototype.setLevelInfo = function () {
  7880. this._level = this.logLevelEnum['info'];
  7881. };
  7882. Logger.prototype.setLevelDebug = function () {
  7883. this._level = this.logLevelEnum['debug'];
  7884. };
  7885. Logger.prototype.error = function () {
  7886. if (this._active && this._level >= this.logLevelEnum['error']) {
  7887. console.error.apply(console, this._addStack(arguments));
  7888. }
  7889. };
  7890. Logger.prototype.warn = function () {
  7891. if (this._active && this._level >= this.logLevelEnum['warn']) {
  7892. console.warn.apply(console, arguments);
  7893. }
  7894. };
  7895. Logger.prototype.info = function () {
  7896. if (this._active && this._level >= this.logLevelEnum['info']) {
  7897. console.info.apply(console, arguments);
  7898. }
  7899. };
  7900. Logger.prototype.debug = function () {
  7901. if (this._active && this._level >= this.logLevelEnum['debug']) {
  7902. console.debug.apply(console, arguments);
  7903. }
  7904. };
  7905. Logger.prototype.log = function () {
  7906. if (this._active) {
  7907. console.log.apply(console, arguments);
  7908. }
  7909. };
  7910. Logger.prototype.saveConfig = function (level, active) {
  7911. if (level !== undefined) {
  7912. this._level = level;
  7913. }
  7914. if (active !== undefined) {
  7915. this._active = active;
  7916. }
  7917. this._setLocalStorage(this.localStorageKeys.isActive, this._active ? 'true' : 'false');
  7918. this._setLocalStorage(this.localStorageKeys.level, this._level);
  7919. };
  7920. Logger.prototype._setLocalStorage = function (key, value) {
  7921. try {
  7922. window.localStorage.setItem(key, value);
  7923. } catch (err) {
  7924. console.error(err);
  7925. }
  7926. };
  7927. Logger.prototype._getLocalStorage = function (key) {
  7928. var ret = null;
  7929. try {
  7930. ret = window.localStorage.getItem(key) || null;
  7931. } catch (err) {
  7932. console.error(err);
  7933. }
  7934. return ret;
  7935. }; // create a dummy error so error.stack will be defined in IE
  7936. Logger.prototype._addStack = function () {
  7937. var args = Array.prototype.slice.call(arguments);
  7938. var stack = new Error().stack || '';
  7939. if (stack === '') {
  7940. try {
  7941. // eslint-disable-next-line
  7942. var x = y.name;
  7943. } catch (e) {
  7944. stack = e.stack;
  7945. }
  7946. }
  7947. stack = stack.split('\n').map(function (line) {
  7948. return line.trim();
  7949. });
  7950. var arr = stack.splice(stack[0] === 'Error' ? 2 : 1);
  7951. args.push({
  7952. stack: arr
  7953. });
  7954. return args;
  7955. };
  7956. return Logger;
  7957. });
  7958. //# sourceMappingURL=LogService.js.map
  7959. ;
  7960. /**
  7961. * Licensed Materials - Property of IBM
  7962. * IBM Cognos Products: BI
  7963. * (C) Copyright IBM Corp. 2018
  7964. * US Government Users Restricted Rights - Use, duplication or disclosure
  7965. * restricted by GSA ADP Schedule Contract with IBM Corp.
  7966. */
  7967. define('baglass/utils/RequestIdleCallback',[], function () {
  7968. // Polyfill requestIdleCallback for IE11
  7969. var TIMEOUT = 50;
  7970. var polyfill = {
  7971. requestIdleCallback: function requestIdleCallback(callback) {
  7972. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  7973. return setTimeout(function () {
  7974. callback();
  7975. }, Math.floor(Math.random() * (options.timeout || TIMEOUT)));
  7976. }
  7977. };
  7978. if (!window.requestIdleCallback) {
  7979. window.requestIdleCallback = polyfill.requestIdleCallback;
  7980. }
  7981. return polyfill;
  7982. });
  7983. //# sourceMappingURL=RequestIdleCallback.js.map
  7984. ;
  7985. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7986. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  7987. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  7988. /**
  7989. * Licensed Materials - Property of IBM
  7990. * IBM Business Analytics (C) Copyright IBM Corp. 2018
  7991. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7992. */
  7993. define('baglass/services/PrefetchService',['underscore', '../utils/RequestIdleCallback'], function (_) {
  7994. var TIMEOUT = 50;
  7995. /**
  7996. * @lends PrefetchService
  7997. **/
  7998. var PrefetchService = /*#__PURE__*/function () {
  7999. /**
  8000. * Contructor for PrefetchService
  8001. * @public
  8002. * @constructs PrefetchService
  8003. * @classdesc The PrefetchService is used to lazily fetch resources that
  8004. * are not needed now, but may be needed in the future. By prefetching
  8005. * these resources in the background while the browser is otherwise idle,
  8006. * the user will not experience the lag associated with fetching them on-demand.
  8007. * @param {Object} glassContext - glassContext
  8008. **/
  8009. function PrefetchService(glassContext) {
  8010. _classCallCheck(this, PrefetchService);
  8011. this._FETCHED = {};
  8012. this.glassContext = glassContext;
  8013. }
  8014. /**
  8015. * @public
  8016. * @description Fetches resources in a given array... one at a time and
  8017. * when the browser is idle.
  8018. * @param {Array} resources - List of file-paths to require.
  8019. * @returns {Promise} resolved when we have tried to prefetch all resources.
  8020. */
  8021. _createClass(PrefetchService, [{
  8022. key: "prefetchResources",
  8023. value: function prefetchResources(resources) {
  8024. var _this = this;
  8025. var chain = Promise.resolve();
  8026. if (_.isArray(resources)) {
  8027. resources.forEach(function (resource) {
  8028. if (_.isString(resource)) {
  8029. if (!_this._FETCHED[resource]) {
  8030. chain = chain.then(_this._requireResource.bind(_this, resource));
  8031. }
  8032. } else {
  8033. _this.glassContext.getCoreSvc('.Logger').warn("Resource ".concat(JSON.stringify(resource), " is not a string..."));
  8034. }
  8035. });
  8036. } else {
  8037. this.glassContext.getCoreSvc('.Logger').warn("Parameter ".concat(JSON.stringify(resources), " is not an array..."));
  8038. }
  8039. return chain;
  8040. }
  8041. }, {
  8042. key: "_requireResource",
  8043. value: function _requireResource(resource) {
  8044. var _this2 = this;
  8045. this._FETCHED[resource] = true;
  8046. return new Promise(function (resolve) {
  8047. window.requestIdleCallback(function () {
  8048. require([resource], resolve, function (err) {
  8049. _this2.glassContext.getCoreSvc('.Logger').warn("Failed to prefetch resource at path: ".concat(resource), err);
  8050. resolve();
  8051. });
  8052. }, {
  8053. timeout: TIMEOUT
  8054. });
  8055. });
  8056. }
  8057. }]);
  8058. return PrefetchService;
  8059. }();
  8060. return PrefetchService;
  8061. });
  8062. //# sourceMappingURL=PrefetchService.js.map
  8063. ;
  8064. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8065. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  8066. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  8067. /**
  8068. * Licensed Materials - Property of IBM
  8069. * IBM Business Analytics (C) Copyright IBM Corp. 2017
  8070. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  8071. */
  8072. define('baglass/services/ServiceRegistry',[], function () {
  8073. var DEFAULT_TIMEOUT = 30000;
  8074. var ServiceRegistry = /*#__PURE__*/function () {
  8075. /**
  8076. * Constructor
  8077. *
  8078. * Options allow injecting different implementations (helps with unit testing)
  8079. *
  8080. * Registry contains a map of services. Some services can be pre-populated at construction time.
  8081. * Others will be fetched when someone needs access to the service.
  8082. *
  8083. * @param options
  8084. * options.services map of pre-setup services
  8085. */
  8086. function ServiceRegistry(options) {
  8087. _classCallCheck(this, ServiceRegistry);
  8088. this.services = options.services || {}; //pre-setup services
  8089. this.deprecated = {};
  8090. this._waitList = {};
  8091. this._declared = {};
  8092. }
  8093. /**
  8094. * get service from registry, follows async model Services can be lazy
  8095. * loaded
  8096. *
  8097. * @param {string } name of service to retrieve
  8098. * @param {number} [timeout] timeout value in ms
  8099. * @return {promise} resolved with service on success, rejected with error on failure
  8100. */
  8101. _createClass(ServiceRegistry, [{
  8102. key: "getSvc",
  8103. value: function getSvc(name, timeout) {
  8104. var _this = this;
  8105. return new Promise(function (resolve, reject) {
  8106. try {
  8107. _this._get(name, resolve, reject, timeout);
  8108. } catch (err) {
  8109. reject(err);
  8110. }
  8111. });
  8112. }
  8113. /**
  8114. * @description Get service from registry synchronously. Avoid if possible and use Promise-based async/API.
  8115. * @throws if service is not found.
  8116. *
  8117. * @param {string } name - name of service to retrieve
  8118. * @return {object} the service
  8119. */
  8120. }, {
  8121. key: "getSvcSync",
  8122. value: function getSvcSync(name) {
  8123. if (this.services[name]) {
  8124. return this.services[name];
  8125. }
  8126. throw new Error('Service "' + name + '" has not been registered');
  8127. }
  8128. /**
  8129. * get service from registry, follows async model Services can be lazy
  8130. * loaded
  8131. * @deprecated
  8132. * @param {string } name of service to retrieve
  8133. * @param {function} callback
  8134. * callback function invoked on service becoming available
  8135. * service obj is passed to the callback. Using this simpler
  8136. * model instead of jQuery Deferred objects to avoid
  8137. * dependency on jQuery
  8138. * @param {function} [errcb]
  8139. * Error callback, called if we are not able to get the service and timeout occurs
  8140. * @param {number} [timeout]
  8141. * timeout value in ms
  8142. */
  8143. }, {
  8144. key: "get",
  8145. value: function get(name, callback, errcb, timeout) {
  8146. this._get(name, callback, errcb, timeout);
  8147. }
  8148. }, {
  8149. key: "exists",
  8150. value: function exists(name) {
  8151. return !!(name && this.services[name]);
  8152. }
  8153. /**
  8154. * @description Destroys an existing service and removes it from the registry.
  8155. * If the service was declared, but not registered, it is removed from the
  8156. * declared list as well.
  8157. */
  8158. }, {
  8159. key: "deregister",
  8160. value: function deregister(name) {
  8161. if (this._declared[name]) {
  8162. delete this._declared[name];
  8163. }
  8164. if (this.exists(name)) {
  8165. if (typeof this.services[name].destroy === 'function') {
  8166. this.services[name].destroy();
  8167. }
  8168. delete this.services[name];
  8169. this._cleanupWaitList(name);
  8170. }
  8171. }
  8172. /**
  8173. * @description Declares a service that will be loaded when required.
  8174. * @param {String} name - the service name
  8175. * @param {String} modulePath - the path to the module to be loaded
  8176. * @param {Object} initializeWith - (optional) An object to be passed to the services' initialize function
  8177. */
  8178. }, {
  8179. key: "declare",
  8180. value: function declare(name, modulePath, initializeWith) {
  8181. if (!name) {
  8182. throw new Error('Illegal service declaration: name missing');
  8183. }
  8184. if (!modulePath) {
  8185. throw new Error('Illegal service declaration: modulePath missing');
  8186. }
  8187. if (!this.exists(name)) {
  8188. if (this._declared[name] && this._declared[name].modulePath !== modulePath) {
  8189. throw new Error('Illegal service declaration. Attempted to re-declare a service with a different module path');
  8190. } else {
  8191. this._declared[name] = {
  8192. modulePath: modulePath,
  8193. initializeWith: initializeWith
  8194. };
  8195. if (this._waitList[name]) {
  8196. this._loadDeclaredService(name);
  8197. }
  8198. }
  8199. }
  8200. }
  8201. }, {
  8202. key: "declared",
  8203. value: function declared(name) {
  8204. return !!this._declared[name];
  8205. }
  8206. }, {
  8207. key: "_get",
  8208. value: function _get(name, callback, errcb, timeout) {
  8209. var _this2 = this;
  8210. var cb = function cb(svc) {
  8211. if (_this2.deprecated[name]) {
  8212. console.warn('The service \'' + name + '\' has been deprecated.');
  8213. if (_this2.deprecated[name]._replacedBy) {
  8214. console.info('The service \'' + name + '\' has been replaced by \'' + svc.replacedBy + '\'.');
  8215. }
  8216. }
  8217. if (callback) {
  8218. callback(svc);
  8219. }
  8220. };
  8221. if (!this.services[name]) {
  8222. if (name[0] === '.' || timeout) {
  8223. if (this._declared[name]) {
  8224. this._loadDeclaredService(name).then(cb);
  8225. } else {
  8226. //any service name that starts with . will be treated as an object that will be registered
  8227. //this is so that we don't do a require to fetch the service
  8228. //a timeout value is associated so that consumers don't wait endlessly
  8229. this._waitForRegister(name, cb, errcb, timeout || DEFAULT_TIMEOUT);
  8230. }
  8231. } else {
  8232. this._loadServiceByModuleName(name, cb, errcb);
  8233. }
  8234. } else {
  8235. cb(this.services[name]);
  8236. }
  8237. }
  8238. /**
  8239. * @deprecated Legacy behaviour; Not sure if this is ever used...
  8240. * @description Services with names not starting with '.' are assumed to
  8241. * be module paths. As a last-ditch effort, we attempt to require and
  8242. * construct the service here.
  8243. */
  8244. }, {
  8245. key: "_loadServiceByModuleName",
  8246. value: function _loadServiceByModuleName(name, cb, errcb) {
  8247. var _this3 = this;
  8248. require([name], function (Service) {
  8249. if (!_this3.services[name]) {
  8250. // The service may have been registered while we were waiting for the requirejs/callback
  8251. _this3.register(name, new Service());
  8252. }
  8253. cb(_this3.services[name]);
  8254. }, function (err) {
  8255. var msg = 'Service module: \'' + name + '\' not found.';
  8256. if (errcb) {
  8257. var error = new Error(msg);
  8258. error.causedBy = err;
  8259. errcb(error);
  8260. } else {
  8261. console.error(msg);
  8262. }
  8263. });
  8264. }
  8265. }, {
  8266. key: "_loadDeclaredService",
  8267. value: function _loadDeclaredService(name) {
  8268. var _this4 = this;
  8269. var modulePath = this._declared[name].modulePath;
  8270. var initArg = this._declared[name].initializeWith;
  8271. delete this._declared[name];
  8272. return new Promise(function (resolve, reject) {
  8273. require([modulePath], function (Service) {
  8274. try {
  8275. if (!_this4.services[name]) {
  8276. // The service may have been registered while we were waiting for the requirejs/callback
  8277. var svc = new Service();
  8278. Promise.resolve().then(function () {
  8279. if (typeof svc.initialize === 'function') {
  8280. return svc.initialize(initArg);
  8281. }
  8282. }).then(function () {
  8283. _this4.register(name, svc);
  8284. resolve(svc);
  8285. });
  8286. } else {
  8287. resolve(_this4.services[name]);
  8288. }
  8289. } catch (err) {
  8290. reject(err);
  8291. }
  8292. }, reject);
  8293. });
  8294. }
  8295. }, {
  8296. key: "_waitForRegister",
  8297. value: function _waitForRegister(name, cb, errcb, timeout) {
  8298. var list = this._waitList[name] || [];
  8299. var timer = setTimeout(this._signalRegisterFailure.bind(this, name, cb, errcb), timeout);
  8300. list.push({
  8301. cb: cb,
  8302. errcb: errcb,
  8303. timer: timer
  8304. });
  8305. this._waitList[name] = list;
  8306. }
  8307. }, {
  8308. key: "_signalRegisterFailure",
  8309. value: function _signalRegisterFailure(name, cb, errcb) {
  8310. var list = this._waitList[name] || [];
  8311. for (var i = list.length - 1; i >= 0; i--) {
  8312. if (list[i].cb === cb) {
  8313. list.splice(i, 1);
  8314. }
  8315. }
  8316. this._waitList[name] = list;
  8317. var error = new Error('Service: \'' + name + '\' not found.');
  8318. if (errcb) {
  8319. errcb(error);
  8320. } else {
  8321. console.error(error);
  8322. }
  8323. }
  8324. }, {
  8325. key: "register",
  8326. value: function register(name, oSvc, options) {
  8327. var _this5 = this;
  8328. if (name && oSvc) {
  8329. var service = oSvc;
  8330. service._registry = this; //allow service to invoke other services
  8331. if (options && options.deprecated) {
  8332. this.deprecated[name] = {};
  8333. }
  8334. if (options && options.replacedBy) {
  8335. this.deprecated[name]._replacedBy = options.replacedBy;
  8336. }
  8337. if (this._declared[name]) {
  8338. delete this._declared[name];
  8339. }
  8340. if (typeof service.__initialize === 'function') {
  8341. Promise.resolve(service.__initialize()).then(function () {
  8342. _this5.services[name] = oSvc;
  8343. _this5._notifyWaitingConsumers(name, oSvc);
  8344. });
  8345. } else {
  8346. this.services[name] = oSvc;
  8347. this._notifyWaitingConsumers(name, oSvc);
  8348. }
  8349. }
  8350. }
  8351. }, {
  8352. key: "_notifyWaitingConsumers",
  8353. value: function _notifyWaitingConsumers(name, oSvc) {
  8354. var list = this._waitList[name] || [];
  8355. for (var i = 0; i < list.length; i++) {
  8356. var fn = list[i].cb;
  8357. if (list[i].timer) {
  8358. clearTimeout(list[i].timer);
  8359. }
  8360. fn(oSvc);
  8361. }
  8362. this._waitList[name] = [];
  8363. }
  8364. }, {
  8365. key: "_cleanupWaitList",
  8366. value: function _cleanupWaitList(name) {
  8367. var list = this._waitList[name] || [];
  8368. for (var i = list.length - 1; i >= 0; i--) {
  8369. if (list[i].timer) {
  8370. clearTimeout(list[i].timer);
  8371. }
  8372. }
  8373. this._waitList[name] = [];
  8374. }
  8375. }, {
  8376. key: "destroy",
  8377. value: function destroy() {
  8378. Object.keys(this.services).forEach(this.deregister.bind(this));
  8379. }
  8380. }]);
  8381. return ServiceRegistry;
  8382. }();
  8383. return ServiceRegistry;
  8384. });
  8385. //# sourceMappingURL=ServiceRegistry.js.map
  8386. ;
  8387. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  8388. /**
  8389. * Licensed Materials - Property of IBM
  8390. * IBM Cognos Products: BI Glass
  8391. * (C) Copyright IBM Corp. 2015, 2017
  8392. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  8393. */
  8394. define('baglass/app/services/UserProfileService',['../../core-client/js/core-client/ui/core/Class', 'underscore'], function (Class, _) {
  8395. /**
  8396. * This Class exposes a javascript API for the userProfile REST service
  8397. */
  8398. var UserProfileService = Class.extend({
  8399. init: function init(options) {
  8400. this.preferences = {};
  8401. _.extend(this, options);
  8402. },
  8403. updateContext: function updateContext(profile) {
  8404. _.extend(this, profile);
  8405. return Promise.resolve();
  8406. },
  8407. /* Get Methods */
  8408. getHomePagePref: function getHomePagePref() {
  8409. if (_typeof(this.preferences) != undefined) {
  8410. if (this.preferences.hasOwnProperty('homePage')) {
  8411. return this.preferences.homePage;
  8412. } else {
  8413. return null;
  8414. }
  8415. } else {
  8416. return null;
  8417. }
  8418. }
  8419. });
  8420. return UserProfileService;
  8421. });
  8422. //# sourceMappingURL=UserProfileService.js.map
  8423. ;
  8424. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8425. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  8426. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  8427. /**
  8428. * Licensed Materials - Property of IBM
  8429. * IBM Cognos Products: Glass
  8430. * (C) Copyright IBM Corp. 2022
  8431. * US Government Users Restricted Rights - Use, duplication or disclosure
  8432. * restricted by GSA ADP Schedule Contract with IBM Corp.
  8433. */
  8434. define('baglass/services/WindowProxyService',['baglass/nls/StringResources'], function (StringResources) {
  8435. function _throwError(proxyService, url, isRemote) {
  8436. if (proxyService.config && proxyService.config.dialog) {
  8437. var callback = function callback(evt) {
  8438. if (evt.btn === 'ok') {
  8439. proxyService.context.close().then(function () {
  8440. proxyService.window.location.assign(proxyService.window.location.origin, isRemote);
  8441. });
  8442. }
  8443. };
  8444. proxyService.context.appController.showMessage(StringResources.get('invalidUrl'), StringResources.get('cannotOpenLocation'), 'error', ['ok', 'cancel'], 'small', callback, true, 'LocationDialog');
  8445. }
  8446. throw new Error('Invalid redirect detected: ' + url);
  8447. }
  8448. function _validateUrl(proxyService, targetUrl, isRemote) {
  8449. var _proxyService$context, _proxyService$context4;
  8450. /**
  8451. * check a redirect url against a reference one;
  8452. * related to https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy
  8453. * */
  8454. var args = ["url: ".concat(targetUrl), "isRemote: ".concat(isRemote)];
  8455. (_proxyService$context = proxyService.context.getCoreSvc('.Logger')).debug.apply(_proxyService$context, ["validating url:"].concat(args));
  8456. var fromUrlObj = proxyService.window.location;
  8457. if (targetUrl) {
  8458. try {
  8459. var invalidCharsRE = /[^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789%\-._~:/?#[\]@!$&'()*+,;= ]/;
  8460. var hasJsRE = /javascript:|data:/;
  8461. var url = targetUrl.toString().toLowerCase().trim();
  8462. var hasInvalidCharacters = invalidCharsRE.exec(url) === null ? false : true;
  8463. var hasJs = hasJsRE.exec(url) === null ? false : true;
  8464. var hasFile = url.startsWith('//');
  8465. var targetUrlObj = document.createElement('a');
  8466. targetUrlObj.href = url;
  8467. var hasProtocol = targetUrlObj.protocol && targetUrlObj.protocol.startsWith('http');
  8468. var isValidURL = hasProtocol && !hasInvalidCharacters && !hasJs && !hasFile;
  8469. if (isValidURL && isRemote !== true) {
  8470. isValidURL = targetUrlObj.protocol === fromUrlObj.protocol && targetUrlObj.hostname === fromUrlObj.hostname && targetUrlObj.port === fromUrlObj.port;
  8471. }
  8472. if (isValidURL) {
  8473. var _proxyService$context2;
  8474. (_proxyService$context2 = proxyService.context.getCoreSvc('.Logger')).debug.apply(_proxyService$context2, ["Url validation success:"].concat(args));
  8475. return true;
  8476. }
  8477. } catch (e) {
  8478. var _proxyService$context3;
  8479. (_proxyService$context3 = proxyService.context.getCoreSvc('.Logger')).error.apply(_proxyService$context3, ['Url validation error:'].concat(args, [e]));
  8480. }
  8481. }
  8482. (_proxyService$context4 = proxyService.context.getCoreSvc('.Logger')).error.apply(_proxyService$context4, ["Url validation failed:"].concat(args));
  8483. return false;
  8484. }
  8485. function _assign(url, isRemote) {
  8486. this.context.getCoreSvc('.Logger').info('Navigating to:', "url: ".concat(url), "isRemote: ".concat(isRemote));
  8487. if (_validateUrl(this, url, isRemote)) {
  8488. return this.window.location.assign(url);
  8489. } else {
  8490. _throwError(this, url, isRemote);
  8491. }
  8492. }
  8493. function _replace(url, isRemote) {
  8494. this.context.getCoreSvc('.Logger').info('Navigating to:', "url: ".concat(url), "isRemote: ".concat(isRemote));
  8495. if (_validateUrl(this, url, isRemote)) {
  8496. return this.window.location.replace(url);
  8497. } else {
  8498. _throwError(this, url, isRemote);
  8499. }
  8500. }
  8501. function _reload() {
  8502. this.context.getCoreSvc('.Logger').debug('reloading page...');
  8503. return this.window.location.reload();
  8504. }
  8505. /*
  8506. Provides a standard means of tracking and validating programatic browser window location operations
  8507. by wrapping browser Window object.
  8508. */
  8509. var WindowProxyService = /*#__PURE__*/function () {
  8510. function WindowProxyService() {
  8511. var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  8512. var nativeWindow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window;
  8513. var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
  8514. dialog: false
  8515. };
  8516. _classCallCheck(this, WindowProxyService);
  8517. this.context = context;
  8518. this.config = config;
  8519. this.window = nativeWindow;
  8520. if (nativeWindow.Proxy) {
  8521. this.proxyWindow = this.proxy(nativeWindow);
  8522. this.context.window = this.proxyWindow;
  8523. } else {
  8524. this.context.getCoreSvc('.Logger').debug('Unable to initialize WindowProxyService. Unsupported browser.');
  8525. }
  8526. }
  8527. /*
  8528. * returns a new Window proxy for the supplied Window object
  8529. * @param {Object} nativeWindow - a browser window
  8530. */
  8531. _createClass(WindowProxyService, [{
  8532. key: "proxy",
  8533. value: function proxy(nativeWindow) {
  8534. var _this = this;
  8535. this.context.getCoreSvc('.Logger').debug('Creating a new Window Proxy service for', nativeWindow);
  8536. var _location = Object.fromEntries(Object.entries(nativeWindow.location));
  8537. _location.assign = _assign.bind(this);
  8538. _location.reload = _reload.bind(this);
  8539. _location.replace = _replace.bind(this);
  8540. _location.toString = nativeWindow.location.toString.bind(nativeWindow.location);
  8541. var locationProxy = new Proxy(_location, {
  8542. set: function set(target, key, value) {
  8543. var urlAttributes = ['href', 'protocol', 'host', 'hostname', 'port', 'pathname', 'search', 'hash', 'origin'];
  8544. _this.context.getCoreSvc('.Logger').info("Setting window.location object '".concat(key, "' to ").concat(value, "..."));
  8545. if (urlAttributes.includes(key)) {
  8546. var _target = new window.URL(target.href);
  8547. try {
  8548. _target[key] = value;
  8549. if (_validateUrl(_this, _target.href)) {
  8550. nativeWindow.location[key] = value;
  8551. } else {
  8552. throw new Error();
  8553. }
  8554. } catch (e) {
  8555. _this.context.getCoreSvc('.Logger').error("Error setting window.location object '".concat(key, "' to ").concat(value, "."));
  8556. _throwError(_this, target.href);
  8557. }
  8558. } else {
  8559. nativeWindow.location[key] = value;
  8560. }
  8561. return true;
  8562. }
  8563. });
  8564. var windowProxy = new Proxy(nativeWindow, {
  8565. set: function set(target, key, value) {
  8566. _this.context.getCoreSvc('.Logger').info("Setting window object '".concat(key, "' to ").concat(value, "..."));
  8567. if (key === 'location') {
  8568. if (_validateUrl(_this, value)) {
  8569. nativeWindow.location = value;
  8570. } else {
  8571. _throwError(_this, value);
  8572. }
  8573. } else {
  8574. target[key] = value;
  8575. }
  8576. return true;
  8577. },
  8578. get: function get(target, key) {
  8579. return key === 'location' ? locationProxy : nativeWindow[key] instanceof Function ? nativeWindow[key].bind(nativeWindow) : nativeWindow[key];
  8580. }
  8581. });
  8582. return windowProxy;
  8583. }
  8584. }]);
  8585. return WindowProxyService;
  8586. }();
  8587. return WindowProxyService;
  8588. });
  8589. //# sourceMappingURL=WindowProxyService.js.map
  8590. ;
  8591. /*
  8592. * Licensed Materials - Property of IBM
  8593. *
  8594. * IBM Cognos Products: BI
  8595. *
  8596. * (C) Copyright IBM Corp. 2015, 2019
  8597. *
  8598. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  8599. */
  8600. define('baglass/common/ui/SlideoutController',['../../core-client/js/core-client/ui/core/Events', 'jquery', 'underscore', './SlideoutRegistry', '../../core-client/js/core-client/ui/Slideout'], function (Events, $, _, SlideoutRegistry, Slideout) {
  8601. /**
  8602. * Finds the open slideout
  8603. */
  8604. var _findOpenSlideout = function _findOpenSlideout(position) {
  8605. var openSlideout = this.registry.application.getOpenSlideout(position);
  8606. if (!openSlideout) {
  8607. openSlideout = this.registry.appView.getOpenSlideout(position);
  8608. }
  8609. return openSlideout;
  8610. };
  8611. /**
  8612. * Creates the slideout or takes the passed one
  8613. * Verifies if it is already registered
  8614. * @param {String} sceop - requested scope
  8615. * @param {object|Slideout} slideout - slideout or object defining the slideout to open
  8616. * @return {object} object with the slideout to open and the right scope if it is registered
  8617. */
  8618. var _createSlideoutToOpen = function _createSlideoutToOpen(scope, slideout) {
  8619. var newSlideout;
  8620. var realScope = scope;
  8621. if (Slideout.prototype.isPrototypeOf(slideout)) {
  8622. newSlideout = slideout;
  8623. } else {
  8624. newSlideout = new Slideout(slideout);
  8625. }
  8626. var registered = this.registry.application.getRegisteredSlideout(newSlideout.getRootId());
  8627. if (registered) {
  8628. realScope = 'application';
  8629. } else {
  8630. registered = this.registry.appView.getRegisteredSlideout(newSlideout.getRootId());
  8631. if (registered) {
  8632. realScope = 'appView';
  8633. }
  8634. }
  8635. if (registered && registered !== newSlideout.getRootParent()) {
  8636. newSlideout = registered;
  8637. }
  8638. return {
  8639. slideout: newSlideout,
  8640. scope: realScope
  8641. };
  8642. };
  8643. var _openSlideoutCount = 0;
  8644. var _openPerspectiveViewSlideoutCount = 0;
  8645. var _onSlideoutHide = function _onSlideoutHide(scope) {
  8646. if (scope === 'application') {
  8647. _openSlideoutCount = Math.max(0, _openSlideoutCount - 1);
  8648. } else if (scope === 'appView') {
  8649. _openPerspectiveViewSlideoutCount = Math.max(0, _openPerspectiveViewSlideoutCount - 1);
  8650. }
  8651. if (_openSlideoutCount === 0) {
  8652. $('body').removeClass('openedSlideout');
  8653. }
  8654. if (_openPerspectiveViewSlideoutCount === 0) {
  8655. $('body').removeClass('openedAppViewSlideout');
  8656. }
  8657. };
  8658. /**
  8659. * @public
  8660. */
  8661. var Controller = Events.extend(
  8662. /**
  8663. * @lends Controller.prototype
  8664. */
  8665. {
  8666. /**
  8667. * @classdesc Class Controlling the application & appView registries, see {SlideoutRegitry}
  8668. * @constructs
  8669. * @public
  8670. * @param {object} options - Init properties
  8671. * @param {object} options.registry - Object containing the application and appView registries
  8672. * @param {SlideoutRegistry} options.registry.application - Registry for the application
  8673. * @param {SlideoutRegistry} options.registry.appView - Registry for the appView
  8674. * application & application.appView
  8675. */
  8676. init: function init(options) {
  8677. Controller.inherited('init', this, arguments);
  8678. $.extend(this, options);
  8679. _openPerspectiveViewSlideoutCount = 0;
  8680. },
  8681. /**
  8682. * Opens a slideout in a given scope; Hides the one that is potentially already open
  8683. * @param {String} scope - application or appView
  8684. * @param {object|Slideout} - slideout to open defined as an object or an instance
  8685. * @return {Slideout} the open slideout
  8686. * @thorw Error when the scope or the slideout position is invalid
  8687. */
  8688. openSlideout: function openSlideout(scope, slideout) {
  8689. var reusedSlideout = this._checkForSlideoutInstanceReuse(scope, slideout);
  8690. if (reusedSlideout) {
  8691. return reusedSlideout;
  8692. }
  8693. var slideoutToOpen = _createSlideoutToOpen.call(this, scope, slideout);
  8694. var openSlideout = _findOpenSlideout.call(this, slideoutToOpen.slideout.position);
  8695. if (scope === 'application') {
  8696. _openSlideoutCount++;
  8697. $('body').addClass('openedSlideout');
  8698. } else if (scope === 'appView') {
  8699. _openPerspectiveViewSlideoutCount++;
  8700. $('body').addClass('openedAppViewSlideout');
  8701. }
  8702. if (openSlideout) {
  8703. openSlideout.hide({
  8704. hideOnly: openSlideout.hideOnly,
  8705. force: true
  8706. }).done(function () {
  8707. this.registry[slideoutToOpen.scope].openSlideout(slideoutToOpen.slideout);
  8708. this._checkNavBarButtons(slideoutToOpen);
  8709. }.bind(this));
  8710. } else {
  8711. this.registry[slideoutToOpen.scope].openSlideout(slideoutToOpen.slideout);
  8712. this._checkNavBarButtons(slideoutToOpen);
  8713. } // introduced a new class for appView, so now we need to remove the class from the body on hide of the slideout
  8714. // the handler needs to be triggered for appView now, but we don't want to remove/add the handle when the reuseSlideout flag is set
  8715. if (!slideout.reuseSlideout) {
  8716. slideoutToOpen.slideout.off('hide', null, 'slideoutHideHandler');
  8717. slideoutToOpen.slideout.on('hide', _onSlideoutHide.bind(this, scope), 'slideoutHideHandler');
  8718. }
  8719. return slideoutToOpen.slideout;
  8720. },
  8721. /**
  8722. * Check for an opened "appView" slideout that matches the new slideout id.
  8723. * When we have an appView slideout that is already open with the same id, then we will reuse the slideout instance
  8724. * This reused slideout is only enabled when the slidepout option "reuseSlideout=true" is used.
  8725. * @param {String} scope - application or appView
  8726. * @param {object|Slideout} - slideout to open defined as an object or an instance
  8727. * @return {Slideout} the open slideout or null if there is no match
  8728. */
  8729. _checkForSlideoutInstanceReuse: function _checkForSlideoutInstanceReuse(scope, slideout) {
  8730. var id = slideout.id; // when we have an appView slideout that is already open with the same id,
  8731. // and "reuseSlideout" is true, then we will reuse the slideout instance
  8732. var appViewOpenedSlideout = this.registry.appView.getOpenSlideout(slideout.position);
  8733. if (appViewOpenedSlideout && scope === 'appView' && id === appViewOpenedSlideout.id && slideout.reuseSlideout) {
  8734. appViewOpenedSlideout.trigger('hide');
  8735. appViewOpenedSlideout.off();
  8736. appViewOpenedSlideout.setContent(slideout.content);
  8737. this.registry[scope].openSlideout(appViewOpenedSlideout); // <Make sure that we maintain the minimum width if there is one
  8738. var minWidth = slideout.resizable && slideout.resizable.min;
  8739. if (!minWidth) {
  8740. minWidth = parseInt(slideout.width, 10);
  8741. }
  8742. if (minWidth && minWidth > appViewOpenedSlideout.getWidth()) {
  8743. appViewOpenedSlideout.setWidth(minWidth);
  8744. } // This seems to be called when a slideout is open, so we call it here just to be consistent.
  8745. this._checkNavBarButtons({
  8746. scope: scope,
  8747. slideout: appViewOpenedSlideout
  8748. });
  8749. return appViewOpenedSlideout;
  8750. }
  8751. return null;
  8752. },
  8753. _checkNavBarButtons: function _checkNavBarButtons(slideoutToOpen) {
  8754. if (slideoutToOpen.slideout.content) {
  8755. var buttonId = null;
  8756. if (slideoutToOpen.slideout.content.module.indexOf('bi/content_apps/MyContent') !== -1) {
  8757. buttonId = 'com.ibm.bi.contentApps.myContentFoldersSlideout';
  8758. } else if (slideoutToOpen.slideout.content.module.indexOf('bi/content_apps/TeamFolders') !== -1) {
  8759. buttonId = 'com.ibm.bi.contentApps.teamFoldersSlideout';
  8760. }
  8761. if (buttonId && slideoutToOpen.slideout.glassContext) {
  8762. var plugin = slideoutToOpen.slideout.glassContext.findPlugin(buttonId);
  8763. plugin.setPressed();
  8764. slideoutToOpen.slideout.on('hide', plugin.setUnpressed.bind(plugin));
  8765. }
  8766. }
  8767. },
  8768. /**
  8769. * Updates the containers of the registry
  8770. * @param $container
  8771. */
  8772. updateRegistryContainer: function updateRegistryContainer($container) {
  8773. this.registry.application.changeContainer($container);
  8774. if (!this.registry.appView.getContainer()) {
  8775. this.registry.appView.changeContainer($container);
  8776. }
  8777. },
  8778. cleanupSlideoutRegistry: function cleanupSlideoutRegistry() {
  8779. this.registry.application.cleanupSlideouts();
  8780. this.registry.appView.cleanupSlideouts();
  8781. },
  8782. /**
  8783. * Closes all opened slide outs
  8784. *
  8785. * @return {promise} A promise resolved to true after all sliders are closed
  8786. */
  8787. closeAllOpenedSlideouts: function closeAllOpenedSlideouts() {
  8788. var excludeAppViewSlideouts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
  8789. var promises = [];
  8790. var slideoutsToClose = this.registry.application.getOpenSlideouts();
  8791. if (!excludeAppViewSlideouts) {
  8792. slideoutsToClose = slideoutsToClose.concat(this.registry.appView.getOpenSlideouts());
  8793. }
  8794. slideoutsToClose.forEach(function (slideout) {
  8795. promises.push(slideout.hide({
  8796. force: true,
  8797. hideOnly: slideout.hideOnly
  8798. }));
  8799. });
  8800. return Promise.all(promises).then(function () {
  8801. return true;
  8802. });
  8803. }
  8804. });
  8805. return Controller;
  8806. });
  8807. //# sourceMappingURL=SlideoutController.js.map
  8808. ;
  8809. /**
  8810. * Licensed Materials - Property of IBM
  8811. * IBM Cognos Products: BI
  8812. * (C) Copyright IBM Corp. 2018
  8813. * US Government Users Restricted Rights - Use, duplication or disclosure
  8814. * restricted by GSA ADP Schedule Contract with IBM Corp.
  8815. */
  8816. define('baglass/app/AppEvents',[], function () {
  8817. var appViewEvent = function appViewEvent(suffix) {
  8818. return suffix ? 'appView' + suffix : 'appview';
  8819. };
  8820. return Object.freeze({
  8821. APPVIEW: appViewEvent(),
  8822. APPVIEW_LOADED: appViewEvent(':loaded')
  8823. });
  8824. });
  8825. //# sourceMappingURL=AppEvents.js.map
  8826. ;
  8827. /**
  8828. * Licensed Materials - Property of IBM
  8829. * IBM Cognos Products: BI
  8830. * (C) Copyright IBM Corp. 2015, 2018
  8831. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  8832. */
  8833. define('baglass/app/plugins/GlassPlugin',['../../core-client/js/core-client/ui/core/Class', '../../core-client/js/core-client/utils/Utils', '../../core-client/js/core-client/utils/ClassFactory', 'jquery', 'underscore', '../../utils/Utils', '../AppEvents'], function (Class, Utils, ClassFactory, $, _, GlassUtils, AppEvents) {
  8834. /**
  8835. *
  8836. * @public
  8837. */
  8838. var GlassPlugin = Class.extend(
  8839. /**
  8840. * @lends GlassPlugin.prototype
  8841. */
  8842. {
  8843. /**
  8844. * @constructs
  8845. * @classdesc This Class acts as a base class for the GlassPlugin API interface Glass Plugins should implement all public methods in this base class.
  8846. * Abstract methods need to be implemented.
  8847. * @public
  8848. * @param {Object} options - Option with itemSpec and glassContext
  8849. *
  8850. */
  8851. init: function init(options) {
  8852. $.extend(true, this, options);
  8853. this.itemSpec = this.itemSpec || {};
  8854. this.$el = $('<div>');
  8855. GlassUtils.errorProtect(this, ['render', 'show', 'hide', 'changeLabel']);
  8856. },
  8857. /**
  8858. * Gets the container element of the plugin.
  8859. * @public
  8860. * @returns {Object} dom element shown in the perspective
  8861. */
  8862. getRootElement: function getRootElement() {
  8863. return this.$el;
  8864. },
  8865. /**
  8866. * Render the plugin.
  8867. * @public
  8868. * @virtual
  8869. * @returns (Deferred) the returned value is the dom element
  8870. */
  8871. render: function render() {
  8872. this.$el.text(_.unescape(this.itemSpec.label));
  8873. this._addClass(this.$el, this.itemSpec['class']);
  8874. this._setIcon(this.$el);
  8875. this.registerOneTimeCallback(AppEvents.APPVIEW_LOADED);
  8876. return Promise.resolve(this.$el.get()[0]);
  8877. },
  8878. /**
  8879. * Remove the plugin from it's container.
  8880. */
  8881. remove: function remove() {
  8882. this.$el.remove();
  8883. },
  8884. /**
  8885. * attaches the event callbacks using the defined actionController
  8886. * @protected
  8887. *
  8888. */
  8889. attachActionControllerCallbacks: function attachActionControllerCallbacks() {
  8890. console.debug('attachActionControllerCallbacks not implemented');
  8891. },
  8892. /**
  8893. * Enables the plugin
  8894. * @public
  8895. */
  8896. enable: function enable() {
  8897. this._getContainer().removeClass('disabled');
  8898. this._getContainer().children().attr('tabindex', '0');
  8899. },
  8900. /**
  8901. * Disables the plugin
  8902. * @public
  8903. */
  8904. disable: function disable() {
  8905. this._getContainer().addClass('disabled');
  8906. this._getContainer().children().attr('tabindex', '-1');
  8907. },
  8908. /**
  8909. * Makes the plugin visible
  8910. * @public
  8911. */
  8912. show: function show() {
  8913. this._getContainer().show();
  8914. },
  8915. /**
  8916. * Hides the plugin
  8917. * @public
  8918. */
  8919. hide: function hide() {
  8920. this._getContainer().hide();
  8921. },
  8922. /**
  8923. * returns the instance of the associated controller
  8924. * @protected
  8925. * @return {Promise} always resolved with the instance of the controller
  8926. */
  8927. getController: function getController() {
  8928. var _this = this;
  8929. if (!this._loadingController) {
  8930. if (this.itemSpec.actionController) {
  8931. if (!_.isString(this.itemSpec.actionController)) {
  8932. this._loadingController = Promise.reject(new Error('actionController is not a string'));
  8933. } else {
  8934. this._loadingController = ClassFactory.instantiate(this.itemSpec.actionController.trim()).then(function (controller) {
  8935. _this._controller = controller;
  8936. if (_.isFunction(_this._controller.initialize)) {
  8937. return _this._controller.initialize({
  8938. glassContext: _this.glassContext,
  8939. target: {
  8940. plugin: _this,
  8941. itemId: _this.itemSpec.id
  8942. }
  8943. });
  8944. }
  8945. }).then(function () {
  8946. return _this._controller;
  8947. });
  8948. }
  8949. } else {
  8950. this._loadingController = Promise.resolve(this._controller);
  8951. }
  8952. }
  8953. return this._loadingController;
  8954. },
  8955. /**
  8956. * shows coachmark when defines.
  8957. * @protected
  8958. * @return {Promise} when resolved returns a boolean set to false when no coachMark is shown, true otherwise
  8959. */
  8960. showCoachMark: function showCoachMark() {
  8961. var _this2 = this;
  8962. return new Promise(function (resolve) {
  8963. var coachMarkservice = _this2.glassContext.getCoreSvc('.CoachMarkService');
  8964. var Renderer = coachMarkservice.getRenderer();
  8965. var persistence = coachMarkservice.getPersistence();
  8966. var containerId = _this2.itemSpec.id + 'PluginContainer';
  8967. resolve(persistence.isRead(containerId).then(function (isRead) {
  8968. var coachMarkSpec = {};
  8969. $.extend(coachMarkSpec, _this2.itemSpec.coachMark);
  8970. return _this2.getController().then(function (controller) {
  8971. var shown = false;
  8972. if (_.isFunction(controller.getCoachMarkSpec)) {
  8973. var eventContext = {
  8974. glassContext: _this2.glassContext,
  8975. target: {
  8976. coachMark: coachMarkSpec,
  8977. itemId: _this2.itemSpec.id
  8978. }
  8979. };
  8980. coachMarkSpec = controller.getCoachMarkSpec(eventContext) || coachMarkSpec;
  8981. }
  8982. if (!_.isEmpty(coachMarkSpec)) {
  8983. _this2.glassContext.addToOptions(coachMarkSpec);
  8984. _this2.coachMark = new Renderer(coachMarkSpec);
  8985. shown = _this2._getContainer().hasClass('disabled') ? false : !isRead;
  8986. _this2.coachMark.render(_this2._getContainer(), shown);
  8987. }
  8988. return shown;
  8989. });
  8990. }));
  8991. });
  8992. },
  8993. _getContainer: function _getContainer() {
  8994. return this.$container;
  8995. },
  8996. /**
  8997. * Changes the label of the plugin; Label remains unchanged if the passed label is undefined
  8998. * @virtual
  8999. * @public
  9000. * @param {String} label new label
  9001. */
  9002. changeLabel: function changeLabel(label) {
  9003. console.info('GlassPlugin.changeLabel no implemented - passed label is: ' + label);
  9004. },
  9005. /**
  9006. * Changes the icon of the plugin; icon remains unchanged if the passed icon is undefined.
  9007. * @virtual
  9008. * @public
  9009. * @param {String} icon The icon to insert. Can be a web font, an image URL or an svg sprite reference.
  9010. * @param {String} iconTooltip The tooltip to use for this icon, if specified
  9011. * @param {String} ariaLabel The value to use for aria-label or alt attributes. If not specified, defaults to iconTooltip
  9012. */
  9013. changeIcon: function changeIcon(icon, iconTooltip, ariaLabel) {
  9014. if (icon) {
  9015. this.$el.find('svg.svgIcon, img, span.webfont').first().remove();
  9016. Utils.setIcon(this.$el, icon, iconTooltip, ariaLabel);
  9017. } else {
  9018. console.warn('Invalid plugin icon. Icon unchanged.');
  9019. }
  9020. },
  9021. /**
  9022. * Registers a onetime callback asso the passed eventName
  9023. * the callback is an anonymous method which call this.onEventListener if it is defined
  9024. * this is to be invoked in the render method of any sub class
  9025. * @protected
  9026. * @param {String} eventName - name of the event to attach the callback
  9027. */
  9028. registerOneTimeCallback: function registerOneTimeCallback(eventName) {
  9029. var _this3 = this;
  9030. var result = this.glassContext.getCoreSvc('.Events').on(eventName, function (event, eventName) {
  9031. var callback = _.isFunction(_this3.onEventListener) ? _this3.onEventListener : function () {};
  9032. try {
  9033. callback.call(_this3, event, eventName);
  9034. } catch (error) {
  9035. _this3.glassContext.getCoreSvc('.Logger').error('GlassPlugin event callbak failure', event, eventName, error);
  9036. } finally {
  9037. result.remove();
  9038. }
  9039. }, this);
  9040. },
  9041. /**
  9042. * event listener: invokes the method(s) corresponding to the events
  9043. *
  9044. * @protected
  9045. * @return {promise}
  9046. */
  9047. onEventListener: function onEventListener(event, eventName) {
  9048. var _this4 = this;
  9049. var logger = this.glassContext.getCoreSvc('.Logger');
  9050. return this.getController().then(function (controller) {
  9051. if (controller) {
  9052. switch (eventName) {
  9053. case AppEvents.APPVIEW_LOADED:
  9054. if (_this4.appView && _this4.appView === event.appView) {
  9055. _this4._onAppViewLoaded(controller, logger, event, eventName);
  9056. } else {
  9057. logger.info(AppEvents.APPVIEW_LOADED + ' is ignored due to mismatched appView', _this4.appView, event.appView);
  9058. }
  9059. break;
  9060. default:
  9061. logger.warn('unhandled event in plugin', _this4, event, eventName);
  9062. }
  9063. }
  9064. }).catch(function (error) {
  9065. logger.error('error on event callback', _this4, error);
  9066. });
  9067. },
  9068. /**
  9069. * callback corresponding to the appView:loaded event
  9070. * @private
  9071. */
  9072. _onAppViewLoaded: function _onAppViewLoaded(controller, logger) {
  9073. if (_.isFunction(controller.onRender)) {
  9074. controller.onRender({
  9075. glassContext: this.glassContext,
  9076. target: {
  9077. plugin: this,
  9078. itemId: this.itemSpec.id
  9079. }
  9080. });
  9081. }
  9082. this.showCoachMark().catch(function (error) {
  9083. logger.error('failed to show coachmark', error);
  9084. });
  9085. },
  9086. /**
  9087. * ======================Private Helper functions useful for all Plugins==============================
  9088. */
  9089. /** Sets the attribute only if value is defined.
  9090. */
  9091. _setAttr: function _setAttr($plugin, sAttr, sValue) {
  9092. if (sValue) {
  9093. $plugin.attr(sAttr, sValue);
  9094. }
  9095. },
  9096. /** Adds the sClassname if it's defined to the element.
  9097. */
  9098. _addClass: function _addClass($plugin, className) {
  9099. if (className) {
  9100. $plugin.addClass(className);
  9101. }
  9102. },
  9103. _setIcon: function _setIcon($widget) {
  9104. var icon = this.itemSpec.icon;
  9105. Utils.setIcon($widget, icon);
  9106. }
  9107. });
  9108. return GlassPlugin;
  9109. });
  9110. //# sourceMappingURL=GlassPlugin.js.map
  9111. ;
  9112. /**
  9113. * Licensed Materials - Property of IBM
  9114. * IBM Watson Analytics (C) Copyright IBM Corp. 2017
  9115. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  9116. */
  9117. define('baglass/core-client/js/core-client/utils/Deferred',[], function () {
  9118. 'use strict';
  9119. /**
  9120. * Create a Deferred from a Promise class
  9121. * The reason this function is in common-core is because this is used in client and serveside JS
  9122. * Instantiates the class and uses the promise instance and resolve/reject methods to create a deferred object.
  9123. * @return {[type]} [description]
  9124. */
  9125. return function () {
  9126. var resolve, reject;
  9127. var promise = new Promise(function () {
  9128. resolve = arguments[0];
  9129. reject = arguments[1];
  9130. });
  9131. return {
  9132. resolve: resolve,
  9133. reject: reject,
  9134. promise: promise
  9135. };
  9136. };
  9137. });
  9138. //# sourceMappingURL=Deferred.js.map
  9139. ;
  9140. /**
  9141. * Licensed Materials - Property of IBM
  9142. *
  9143. * "Restricted Materials of IBM"
  9144. *
  9145. * 5746-SM2
  9146. *
  9147. * (C) Copyright IBM Corp. 2015, 2016
  9148. *
  9149. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  9150. */
  9151. define('baglass/app/plugins/MenuActionInterface',['../../core-client/js/core-client/ui/core/Class'], function (Class) {
  9152. /**
  9153. * This class lists all the methods corresponding to the actions supported by a menu
  9154. * It plays the role of an interface, consumer can extend it.
  9155. *
  9156. * @interface
  9157. */
  9158. var MenuActionInterface = Class.extend({
  9159. /**
  9160. * method to be invoked on the press action for a menu item
  9161. * @param {context} which contains the following:
  9162. * <ul>
  9163. * <li>glassContext</li>
  9164. * <li>target: object containing info on the target: plugin and itemId</li>
  9165. * </ul>
  9166. */
  9167. onSelectItem: function
  9168. /* context */
  9169. onSelectItem() {},
  9170. /**
  9171. * method to be invoked for a menu item
  9172. * @param {context} which contains the following:
  9173. * <ul>
  9174. * <li>glassContext</li>
  9175. * <li>target: object containing info on the target: plugin and itemId</li>
  9176. * </ul>
  9177. */
  9178. onRenderItem: function
  9179. /* context */
  9180. onRenderItem() {},
  9181. /**
  9182. * Method invoked when rendering the menu to determine if the item should be displayed
  9183. * @param {context} which contains the following:
  9184. * <ul>
  9185. * <li>glassContext</li>
  9186. * <li>target: object containing info on the target: plugin and itemId</li>
  9187. * <li>activeObject: object for which the menu is displayed, used for the context menu</li>
  9188. * </ul>
  9189. * @return true or false
  9190. */
  9191. isItemVisible: function
  9192. /* context */
  9193. isItemVisible() {
  9194. return true;
  9195. },
  9196. /**
  9197. * Method invoked when rendering the menu to determine if the item should be selected
  9198. * @param {context} which contains the following:
  9199. * <ul>
  9200. * <li>glassContext</li>
  9201. * <li>target: object containing info on the target: plugin and itemId</li>
  9202. * <li>activeObject: object for which the menu is displayed, used for the context menu</li>
  9203. * </ul>
  9204. * @return true or false
  9205. */
  9206. isItemSelected: function
  9207. /* context */
  9208. isItemSelected() {
  9209. return false;
  9210. },
  9211. /**
  9212. * method to be invoked when the menu is rendered
  9213. * @param {context} which contains the following:
  9214. * <ul>
  9215. * <li>glassContext</li>
  9216. * <li>target: object containing info on the target; one is the plugin</li>
  9217. * </ul>
  9218. */
  9219. onRender: function
  9220. /* context */
  9221. onRender() {},
  9222. /**
  9223. * method to be invoked when the menu is opened, before the menuItems are shown.
  9224. * @param {context} which contains the following:
  9225. * <ul>
  9226. * <li>glassContext</li>
  9227. * <li>target: object containing info on the target; one is the plugin</li>
  9228. * </ul>
  9229. */
  9230. onOpen: function
  9231. /* context */
  9232. onOpen() {},
  9233. /**
  9234. * Method to be invoked when loading a coachmark.
  9235. * Can be used to dynamically set the coachmark's title
  9236. * or contents
  9237. * @param {Object} context - The context for this coach mark
  9238. * @param {Object} context.glassContext - The glass context.
  9239. * @param {Object} context.target - The coachMark target for which we want the spec
  9240. * @param {string} context.target.itemId - The id of the item for which we want the
  9241. * coach mark spec
  9242. * @param {Object} context.target.coachMark - The current spec of the coachMark, if any
  9243. * @returns {Object} A coach mark specification, including title and contents.
  9244. */
  9245. getCoachMarkSpec: function
  9246. /* context */
  9247. getCoachMarkSpec() {},
  9248. /**
  9249. * Method invoked when rendering the menu to determine
  9250. * if the item should have a custom label instead of the default one from the spec.
  9251. * @param {context} which contains the following:
  9252. * <ul>
  9253. * <li>glassContext</li>
  9254. * <li>target: object containing info on the target: plugin and itemId</li>
  9255. * </ul>
  9256. * @returns {string} A custom label to override the default one that is in the spec.
  9257. * If returns undefined then the default label from the spec is used.
  9258. */
  9259. getLabel: function
  9260. /* context */
  9261. getLabel() {}
  9262. });
  9263. return MenuActionInterface;
  9264. });
  9265. //# sourceMappingURL=MenuActionInterface.js.map
  9266. ;
  9267. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  9268. /**
  9269. * Licensed Materials - Property of IBM
  9270. *
  9271. * "Restricted Materials of IBM"
  9272. *
  9273. * 5746-SM2
  9274. *
  9275. * (C) Copyright IBM Corp. 2015, 2018
  9276. *
  9277. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  9278. */
  9279. define('baglass/app/plugins/MenuActionControllerDispatcher',['underscore', 'jquery', './MenuActionInterface', '../../api/Context'], function (_, $, MenuActionInterface, Context) {
  9280. /**
  9281. * This class lists all the methods corresponding to the actions supported by a menu
  9282. * It plays the role of an interface, consumer can extend it.
  9283. *
  9284. * @interface
  9285. */
  9286. var MenuActionInterfaceDispatcher = MenuActionInterface.extend({
  9287. /**
  9288. *constructor
  9289. *@actionControllers map of featureId with actionControllers:
  9290. *{
  9291. * featureId: path/to/controller
  9292. *}
  9293. */
  9294. init: function init(actionControllers) {
  9295. this._oControllerMap = {};
  9296. this._oItemMap = {};
  9297. _.extend(this._oControllerMap, actionControllers);
  9298. },
  9299. /**
  9300. * Getter for the controller map
  9301. */
  9302. getControllerMap: function getControllerMap() {
  9303. return this._oControllerMap;
  9304. },
  9305. /**
  9306. * Dispatches the callback invocation to the right controller
  9307. * @override
  9308. *
  9309. */
  9310. onSelectItem: function onSelectItem(context) {
  9311. var sItemId = context.target.itemId;
  9312. var oController = this._findController(sItemId);
  9313. if (oController && _.isFunction(oController.onSelectItem)) {
  9314. oController.onSelectItem.call(oController, context);
  9315. } else if (oController && _.isFunction(oController.execute)) {
  9316. var apiContext = new Context(context.glassContext);
  9317. var apiOptions = this._getOptions(context);
  9318. oController.execute.call(oController, apiContext, apiOptions);
  9319. }
  9320. },
  9321. /**
  9322. * Invokes the onRender on right controller
  9323. * @override
  9324. *
  9325. */
  9326. onRender: function onRender(context) {
  9327. _.each(this._oControllerMap, function (oController) {
  9328. if (oController && _.isFunction(oController.onRender)) {
  9329. oController.onRender.call(oController, $.extend(true, {}, context));
  9330. }
  9331. }, this);
  9332. },
  9333. /**
  9334. * Invokes the onOpen on right controller
  9335. * @override
  9336. *
  9337. */
  9338. onOpen: function onOpen(context) {
  9339. var all = _.values(this._oControllerMap).map(function (oController) {
  9340. if (oController && _.isFunction(oController.onOpen)) {
  9341. return new Promise(function (resolve) {
  9342. resolve(oController.onOpen($.extend(true, {}, context)));
  9343. }).catch(function (e) {
  9344. context.glassContext.getCoreSvc('.Logger').warn(e);
  9345. });
  9346. }
  9347. });
  9348. return Promise.all(all);
  9349. },
  9350. /**
  9351. * Invokes the onRemoveItem on right controller
  9352. * @override
  9353. *
  9354. */
  9355. onRemoveItem: function onRemoveItem(context) {
  9356. var sItemId = context.target.itemId;
  9357. var oController = this._findController(sItemId);
  9358. if (oController && _.isFunction(oController.onRemoveItem)) {
  9359. return oController.onRemoveItem.call(oController, $.extend(true, {}, context));
  9360. }
  9361. },
  9362. /**
  9363. * Invokes the onRenderItem on right controller
  9364. * @override
  9365. *
  9366. */
  9367. onRenderItem: function onRenderItem(context) {
  9368. var sItemId = context.target.itemId;
  9369. var oController = this._findController(sItemId);
  9370. if (oController && _.isFunction(oController.onRenderItem)) {
  9371. oController.onRenderItem.call(oController, $.extend(true, {}, context));
  9372. }
  9373. },
  9374. _getOptions: function _getOptions(context) {
  9375. var options;
  9376. if (context.options) {
  9377. options = this._combineOptions(context);
  9378. } else {
  9379. options = context.target.plugin.itemSpec.items[context.target.specItemIndex].options;
  9380. }
  9381. return {
  9382. options: options
  9383. };
  9384. },
  9385. _combineOptions: function _combineOptions(context) {
  9386. var options;
  9387. var pluginOptions = this._checkValidityPluginOptions(context) ? context.target.plugin.itemSpec.items[context.target.specItemIndex].options : {}; // Array will be converted to Object here with index kept as keys
  9388. options = Object.assign({}, context.options);
  9389. if (pluginOptions) {
  9390. // contextOption shouldn't be overwritten when duplicated keys exists
  9391. for (var key in pluginOptions) {
  9392. if (key in options) {
  9393. continue;
  9394. }
  9395. options[key] = pluginOptions[key];
  9396. }
  9397. }
  9398. return options;
  9399. },
  9400. _checkValidityPluginOptions: function _checkValidityPluginOptions(context) {
  9401. var itemExists = context && context.target && context.target.plugin && context.target.plugin.itemSpec && context.target.plugin.itemSpec.items && Array.isArray(context.target.plugin.itemSpec.items);
  9402. var inRange = itemExists && context.target.specItemIndex !== undefined && context.target.specItemIndex !== null && context.target.specItemIndex >= 0 && context.target.specItemIndex < context.target.plugin.itemSpec.items.length;
  9403. var isValidOptions = itemExists && inRange && context.target.plugin.itemSpec.items[context.target.specItemIndex].options && _typeof(context.target.plugin.itemSpec.items[context.target.specItemIndex].options) === 'object';
  9404. return isValidOptions;
  9405. },
  9406. _invokeControllerIsItemVisible: function _invokeControllerIsItemVisible(context) {
  9407. var itemId = context.target.itemId;
  9408. var oController = this._findController(itemId);
  9409. var isVisible = !_.isUndefined(oController);
  9410. if (isVisible && _.isFunction(oController.isItemVisible)) {
  9411. isVisible = oController.isItemVisible.call(oController, context);
  9412. } else if (isVisible && _.isFunction(oController.isVisible)) {
  9413. var apiContext = new Context(context.glassContext);
  9414. var apiOptions = this._getOptions(context);
  9415. isVisible = oController.isVisible.call(oController, apiContext, apiOptions);
  9416. }
  9417. isVisible = _.isBoolean(isVisible) ? isVisible : false;
  9418. return isVisible;
  9419. },
  9420. /**
  9421. * invokes the isItemDisabled on the right controller
  9422. * @override
  9423. */
  9424. isItemDisabled: function isItemDisabled(context) {
  9425. var itemId = context.target.itemId;
  9426. var oController = this._findController(itemId);
  9427. if (oController && _.isFunction(oController.isItemDisabled)) {
  9428. return oController.isItemDisabled.call(oController, context);
  9429. } else {
  9430. return false;
  9431. }
  9432. },
  9433. /**
  9434. * Invokes the isItemVisible on the right controller
  9435. * @override
  9436. *
  9437. */
  9438. isItemVisible: function isItemVisible(context) {
  9439. var contentView = context.glassContext.getCurrentContentView();
  9440. var isVisible;
  9441. if (contentView && _.isFunction(contentView.isMenuItemVisible)) {
  9442. if (contentView.isMenuItemVisible(context) === true) {
  9443. isVisible = this._invokeControllerIsItemVisible(context);
  9444. } else {
  9445. isVisible = false;
  9446. }
  9447. } else {
  9448. isVisible = this._invokeControllerIsItemVisible(context);
  9449. }
  9450. return isVisible;
  9451. },
  9452. /**
  9453. * Invokes the isItemSelected on the right controller
  9454. * @override
  9455. *
  9456. */
  9457. isItemSelected: function isItemSelected(context) {
  9458. var itemId = context.target.itemId;
  9459. var isSelected = false;
  9460. var oController = this._findController(itemId);
  9461. if (oController && _.isFunction(oController.isItemSelected)) {
  9462. isSelected = oController.isItemSelected.call(oController, context);
  9463. isSelected = _.isBoolean(isSelected) ? isSelected : false;
  9464. }
  9465. return isSelected;
  9466. },
  9467. /**
  9468. * Invokes the getLabel on right controller
  9469. * @override
  9470. *
  9471. */
  9472. getLabel: function getLabel(context) {
  9473. var sItemId = context.target.itemId;
  9474. var oController = this._findController(sItemId);
  9475. if (oController && _.isFunction(oController.getLabel)) {
  9476. return oController.getLabel.call(oController, $.extend(true, {}, context));
  9477. }
  9478. },
  9479. /**
  9480. * convert the arrays of items into a map
  9481. */
  9482. buildItemMap: function buildItemMap(aItems) {
  9483. _.reduce(aItems, function (oMap, item) {
  9484. if (item.id) {
  9485. oMap[item.id] = item;
  9486. }
  9487. return oMap;
  9488. }, this._oItemMap);
  9489. },
  9490. /**
  9491. * return the itemMap
  9492. */
  9493. getItemMap: function getItemMap() {
  9494. return this._oItemMap;
  9495. },
  9496. /**
  9497. * Sets the glass menu
  9498. * @param glassMenu - glass menu widget
  9499. */
  9500. setGlassMenu: function setGlassMenu(glassMenu) {
  9501. this._glassMenu = glassMenu;
  9502. },
  9503. _findController: function _findController(sItemId) {
  9504. var oController;
  9505. var oItem = this._oItemMap[sItemId];
  9506. if (oItem) {
  9507. oController = this._oControllerMap[oItem.featureId];
  9508. }
  9509. return oController;
  9510. }
  9511. });
  9512. return MenuActionInterfaceDispatcher;
  9513. });
  9514. //# sourceMappingURL=MenuActionControllerDispatcher.js.map
  9515. ;
  9516. /**
  9517. * Licensed Materials - Property of IBM
  9518. *
  9519. * IBM Cognos Products: BI ui_commons
  9520. *
  9521. * Copyright IBM Corp. 2015, 2017
  9522. *
  9523. * US Government Users Restricted Rights - Use, duplication or disclosure
  9524. * restricted by GSA ADP Schedule Contract with IBM Corp.
  9525. */
  9526. define('baglass/core-client/js/core-client/ui/Menu',['./AccessibleView', '../utils/Utils', '../nls/StringResources', '../utils/BidiUtil', 'underscore', 'jquery', 'jquery-ui'], function (View, uiUtils, StringResources, BidiUtil, _, $) {
  9527. /**
  9528. * This class represents a menu
  9529. */
  9530. var Menu = View.extend({
  9531. /**
  9532. * @lends Menu.prototype
  9533. */
  9534. tagName: 'nav',
  9535. events: {
  9536. 'primaryaction .commonMenuItem': '_onSelectItem',
  9537. 'primaryaction .moduleMenuItem': '_onSelectModuleItem',
  9538. 'escapeaction': '_handleEscape'
  9539. },
  9540. /**
  9541. * @classdesc class representing a menu
  9542. * @augments AccessibleView
  9543. * @constructs
  9544. * @public
  9545. *
  9546. * @param {options}
  9547. * set of initial properties:
  9548. * <ul>
  9549. * <li>spec: specification of the menu</li>
  9550. * </ul>
  9551. *
  9552. */
  9553. init: function init(options) {
  9554. _.extend(this, options.spec);
  9555. this.enableTabLooping = true;
  9556. Menu.inherited('init', this, options.spec);
  9557. this.$el.attr('role', 'navigation');
  9558. this.closeMenu = this._closeMenu.bind(this);
  9559. },
  9560. /**
  9561. * Renders the menu
  9562. *
  9563. * @override
  9564. * @return promise; it is rejected when no specification is set
  9565. * for the menu
  9566. * <ul>
  9567. * <li>resolve Value = dom element representing the
  9568. * menu</li>
  9569. * </ul>
  9570. */
  9571. render: function render() {
  9572. try {
  9573. this.$el.empty();
  9574. this.$el.attr('class', '');
  9575. this.$el.addClass('commonMenu').addClass('commonMenuActive');
  9576. this._itemMap = {};
  9577. var $ul = $('<ul></ul>', {
  9578. 'role': 'menu',
  9579. 'tabIndex': '0'
  9580. }).addClass('commonMenuItems');
  9581. var hasIcon = _.filter(this.items, function (item) {
  9582. return item.icon !== '' && item.icon !== undefined;
  9583. });
  9584. _.each(this.items, function (item) {
  9585. var $item = $('<li></li>', {
  9586. 'role': 'group',
  9587. 'tabIndex': '0'
  9588. }).addClass('commonMenuItem');
  9589. if (item.selected === true) {
  9590. $item.addClass('selected');
  9591. }
  9592. if (item.disabled) {
  9593. $item.addClass('disabled');
  9594. }
  9595. $item.addClass(item.id);
  9596. var domItemId = this._buildDomItemId();
  9597. this._itemMap[domItemId] = item;
  9598. $item.attr('id', domItemId);
  9599. if (item.module) {
  9600. $item.append(this._loadModule($item, item.module));
  9601. $item.removeClass('commonMenuItem');
  9602. $item.addClass('moduleMenuItem');
  9603. } else if (item.type === 'divider') {
  9604. // Make a special type divider as we have to remove tabIndex for accessibility
  9605. $item.addClass(item.type);
  9606. $item.attr('tabIndex', '-1');
  9607. } else {
  9608. var $a = $('<a></a>').addClass('commonMenuLink');
  9609. var $span = $('<span></span>');
  9610. var title = _.isString(item.label) ? item.label : '';
  9611. $a.attr('role', 'menuitem');
  9612. $item.attr('aria-label', title);
  9613. $span.text(title);
  9614. $span.attr('title', BidiUtil.enforceTextDirection(title));
  9615. $span.attr('dir', BidiUtil.resolveBaseTextDir(title));
  9616. if (hasIcon.length && item.indent !== false) {
  9617. $span.addClass('hasIcon');
  9618. }
  9619. if (item.badge) {
  9620. $('<span>').addClass('badge').text(item.badge).appendTo($span);
  9621. }
  9622. $a.append($span);
  9623. uiUtils.setIcon($a, item.icon, item.iconTooltip, null, null, item.iconColor);
  9624. $item.append($a);
  9625. }
  9626. if (item.rightIcon) {
  9627. var $rightIconDiv = $('<div>').addClass('rightIcon').attr('title', item.rightIcon.title);
  9628. uiUtils.setIcon($rightIconDiv, item.rightIcon.icon);
  9629. $item.append($rightIconDiv);
  9630. }
  9631. if (item.removable) {
  9632. var label = item.removeIconLabel || StringResources.get('remove');
  9633. var $removeItem = $('<div></div>', {
  9634. 'role': 'button',
  9635. 'aria-labelledby': domItemId,
  9636. 'title': label,
  9637. 'tabIndex': '0'
  9638. }).addClass('removeItemIcon');
  9639. $removeItem.focus(function (event) {
  9640. $(event.target).parent().addClass('hasFocus');
  9641. });
  9642. $removeItem.blur(function (event) {
  9643. $(event.target).parent().removeClass('hasFocus');
  9644. });
  9645. uiUtils.setIcon($removeItem, 'common-close_16');
  9646. $removeItem.on('primaryaction.bi.commons.ui.menu', this._handleRemoveItem.bind(this, $item));
  9647. $item.append($removeItem);
  9648. }
  9649. $ul.append($item);
  9650. if (item && _.isFunction(item.onRender)) {
  9651. item.onRender($item);
  9652. }
  9653. }, this);
  9654. if (!$ul.is(':empty')) {
  9655. this.$el.append($ul);
  9656. this.enableLooping($ul);
  9657. }
  9658. Menu._registerOpenMenu(this);
  9659. // DO NOT REMOVE THIS: this is required so that, the
  9660. // attached handler does not catch
  9661. // the click event that just happened.
  9662. setTimeout(function () {
  9663. this.setFocus();
  9664. this._attachCloseCallbacks();
  9665. }.bind(this), 200);
  9666. return Promise.resolve(this.el);
  9667. } catch (err) {
  9668. return Promise.reject(err);
  9669. }
  9670. },
  9671. /**
  9672. * Set the focus to an element within the view.
  9673. *
  9674. * @public
  9675. */
  9676. setFocus: function setFocus() {
  9677. this.$el.find('.commonMenuItems').focus();
  9678. },
  9679. _handleRemoveItem: function _handleRemoveItem($item, event) {
  9680. var specItem = this._itemMap[$item.attr('id')];
  9681. event.stopPropagation();
  9682. if (specItem && _.isFunction(specItem.onRemove)) {
  9683. var result = specItem.onRemove();
  9684. Promise.resolve(result).then(function (removeMenuItem) {
  9685. if (removeMenuItem) {
  9686. this._setNextTabFocus($item);
  9687. $item.remove();
  9688. }
  9689. }.bind(this));
  9690. delete this._itemMap[$item.attr('id')];
  9691. }
  9692. },
  9693. _setNextTabFocus: function _setNextTabFocus($el) {
  9694. var $focusEl = $el.next('.commonMenuItem');
  9695. if ($focusEl.length === 0) {
  9696. $focusEl = $el.prev('.commonMenuItem');
  9697. }
  9698. $focusEl.focus();
  9699. },
  9700. _handleEscape: function _handleEscape(event) {
  9701. this._closeMenu(event, false);
  9702. this.getLaunchPoint().focus();
  9703. return false;
  9704. },
  9705. /**
  9706. * @private callback attached to all the items
  9707. * @param the
  9708. * corresponding event
  9709. */
  9710. _onSelectItem: function _onSelectItem(event) {
  9711. var specItem = this._itemMap[event.currentTarget.id];
  9712. event.stopPropagation();
  9713. if (event.gesture) {
  9714. event.gesture.preventDefault();
  9715. }
  9716. this._closeMenu(event, false);
  9717. if (specItem && _.isFunction(specItem.onSelect)) {
  9718. specItem.onSelect();
  9719. }
  9720. },
  9721. _onSelectModuleItem: function _onSelectModuleItem(event) {
  9722. var specItem = this._itemMap[event.currentTarget.id];
  9723. event.stopPropagation();
  9724. this._closeMenu(event, true);
  9725. if (specItem && _.isFunction(specItem.onSelect)) {
  9726. specItem.onSelect();
  9727. }
  9728. },
  9729. /**
  9730. * @private Builds the displayed item id; format is
  9731. * this.viewId_item<random number>.
  9732. */
  9733. _buildDomItemId: function _buildDomItemId() {
  9734. return this.viewId + '_' + _.uniqueId('item');
  9735. },
  9736. /**
  9737. * @private Closes the menu on a given set of events
  9738. */
  9739. _attachCloseCallbacks: function _attachCloseCallbacks() {
  9740. $(document).on('primaryaction.bi.commons.ui.menu', this.closeMenu);
  9741. $(document).on('contextmenu.bi.commons.ui.menu', this.closeMenu);
  9742. $(window).on('resize.bi.commons.ui.menu', this.closeMenu);
  9743. },
  9744. /**
  9745. * @private closes the menu
  9746. */
  9747. _closeMenu: function _closeMenu(event, stayOpen) {
  9748. if (stayOpen) {
  9749. return Promise.resolve();
  9750. }
  9751. if (_.isFunction(this.whenReadyToClose)) {
  9752. return this.whenReadyToClose(event).then(this.remove.bind(this), this.remove.bind(this));
  9753. } else {
  9754. this.remove();
  9755. return Promise.resolve();
  9756. }
  9757. },
  9758. _loadModule: function _loadModule(context, module) {
  9759. require([module], function (Module) {
  9760. var module = new Module({
  9761. '$el': context
  9762. });
  9763. return module.render();
  9764. }.bind(this));
  9765. },
  9766. remove: function remove() {
  9767. Menu._unregisterOpenMenu(this);
  9768. $(document).off('.bi.commons.ui.menu', this.closeMenu);
  9769. $(window).off('.bi.commons.ui.menu', this.closeMenu);
  9770. Menu.inherited('remove', this, arguments);
  9771. }
  9772. });
  9773. /**
  9774. * @private
  9775. */
  9776. Menu._openMenus = [];
  9777. /**
  9778. * @private
  9779. */
  9780. Menu._registerOpenMenu = function (menu) {
  9781. if (!_.contains(Menu._openMenus, menu)) {
  9782. Menu._openMenus.push(menu);
  9783. if (!$('body').hasClass('openedMenu')) {
  9784. $('body').addClass('openedMenu');
  9785. }
  9786. }
  9787. };
  9788. /**
  9789. * @private
  9790. */
  9791. Menu._unregisterOpenMenu = function (menu) {
  9792. Menu._openMenus = _.reject(Menu._openMenus, function (m) {
  9793. return m === menu;
  9794. });
  9795. if (Menu._openMenus.length === 0) {
  9796. $('body').removeClass('openedMenu');
  9797. }
  9798. };
  9799. /**
  9800. * Triggers an event to notify all Menu instances to close themselves.
  9801. * @static
  9802. */
  9803. Menu.hideOpenMenus = function () {
  9804. _.each(Menu._openMenus, function (menu) {
  9805. menu.closeMenu();
  9806. });
  9807. };
  9808. return Menu;
  9809. });
  9810. //# sourceMappingURL=Menu.js.map
  9811. ;
  9812. /**
  9813. * Licensed Materials - Property of IBM
  9814. *
  9815. * IBM Cognos Products: BI Titan
  9816. *
  9817. * Copyright IBM Corp. 2015, 2017
  9818. *
  9819. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  9820. */
  9821. define('baglass/app/plugins/GlassContextMenu',['./GlassPlugin', 'jquery', 'underscore', '../../core-client/js/core-client/utils/ClassFactory', '../../core-client/js/core-client/utils/Deferred', './MenuActionControllerDispatcher', '../../core-client/js/core-client/ui/Menu', '../../utils/Utils'], function (GlassPlugin, $, _, ClassFactory, Deferred, ControllerDispatcher, Menu, Utils) {
  9822. /**
  9823. * This Class renders a contextual menu defined in the perspective
  9824. */
  9825. var GlassContextMenu = GlassPlugin.extend(
  9826. /**
  9827. * @lends ContextMenu.prototype
  9828. */
  9829. {
  9830. _ClassFactory: ClassFactory,
  9831. /**
  9832. * @classdesc class representing a context menu
  9833. * @augments GlassPlugin
  9834. * @constructs
  9835. * @public
  9836. * @param {Object} options - set of initial properties
  9837. * @param {Object} options.glassContext - glassContext
  9838. * @param {Object} options.itemSpecs - specification of the menu to show
  9839. * @param {Object} options.activeObject - object for which the menu is shown
  9840. *
  9841. * */
  9842. init: function init(options) {
  9843. $.extend(true, this, options);
  9844. },
  9845. /**
  9846. * Get the container element of the plugin.
  9847. */
  9848. getRootElement: function getRootElement() {
  9849. this.glassContext.getCoreSvc('.Logger').warn('GlassContextMenu::getRootElement() is being deprecated!');
  9850. return this.$el;
  9851. },
  9852. /**
  9853. * Gets the ContextMenu instance associated with this plugin
  9854. * @public
  9855. * @example
  9856. * //Used in the menu controller to reference the menu instance. Useful for getting menu's launchPoint
  9857. * onSelectItem: function(options) {
  9858. * var menu = options.target.plugin.getMenu()
  9859. * var launchPoint = menu.getLaunchPoint();
  9860. * }
  9861. *
  9862. * @returns {Menu} the ContextMenu instance
  9863. */
  9864. getMenu: function getMenu() {
  9865. this.glassContext.getCoreSvc('.Logger').warn('GlassContextMenu::getMenu() is being deprecated!');
  9866. return this._menu;
  9867. },
  9868. /**
  9869. * Renders the plugin.
  9870. * @override
  9871. */
  9872. render: function render() {
  9873. var deferred = new Deferred();
  9874. var aModulePromises = [];
  9875. var aFeatures = [];
  9876. var oControllerMap = {};
  9877. _.each(this.itemSpec.actionControllers, function (module, key) {
  9878. aModulePromises.push(this._createController(module, key));
  9879. aFeatures.push(key);
  9880. }.bind(this));
  9881. Utils.waitForAllOrSomePromises(aModulePromises).done(function () {
  9882. try {
  9883. Menu.hideOpenMenus();
  9884. _.each(aModulePromises, function (item, index) {
  9885. if (item.isFulfilled()) {
  9886. oControllerMap[aFeatures[index]] = item.responseModule;
  9887. }
  9888. });
  9889. this._oControllerDispatcher = this._createControllerDispatcher(oControllerMap);
  9890. var shownItems = [];
  9891. this._oControllerDispatcher.buildItemMap(this.itemSpec.items);
  9892. this._menu = this._createUIMenu(shownItems);
  9893. _.each(this.itemSpec.items, function (item, index) {
  9894. var oEventContext = {
  9895. glassContext: this.glassContext,
  9896. target: {
  9897. plugin: this,
  9898. itemId: item.id,
  9899. activeObject: this.activeObject,
  9900. specItemIndex: index
  9901. },
  9902. options: this.options
  9903. };
  9904. var isVisible = this._oControllerDispatcher.isItemVisible(oEventContext);
  9905. if (isVisible) {
  9906. var uiItem = {};
  9907. $.extend(true, uiItem, item);
  9908. uiItem.name = item.id;
  9909. uiItem.onSelect = this._oControllerDispatcher.onSelectItem.bind(this._oControllerDispatcher, oEventContext);
  9910. uiItem.disabled = this._oControllerDispatcher.isItemDisabled(oEventContext);
  9911. var customLabel = this._oControllerDispatcher.getLabel(oEventContext);
  9912. if (!_.isUndefined(customLabel)) {
  9913. uiItem.label = customLabel;
  9914. }
  9915. var isSelected = this._oControllerDispatcher.isItemSelected(oEventContext);
  9916. if (isSelected) {
  9917. uiItem.selected = true;
  9918. }
  9919. shownItems.push(uiItem);
  9920. }
  9921. }, this);
  9922. this._menu.render().then(function (domMenu) {
  9923. this.$el = $(domMenu);
  9924. var oEventContext = {
  9925. glassContext: this.glassContext,
  9926. target: {
  9927. plugin: this,
  9928. itemId: this.itemSpec.id,
  9929. activeObject: this.activeObject
  9930. }
  9931. };
  9932. this._oControllerDispatcher.onRender(oEventContext);
  9933. deferred.resolve(domMenu);
  9934. }.bind(this), function (reason) {
  9935. deferred.reject({
  9936. msg: GlassContextMenu.errors.FAILURE_RENDERING_MENU,
  9937. causedBy: reason
  9938. });
  9939. });
  9940. } catch (e) {
  9941. deferred.reject({
  9942. msg: GlassContextMenu.errors.FAILURE_RENDERING_MENU,
  9943. causedBy: e
  9944. });
  9945. }
  9946. }.bind(this)).fail(function (reason) {
  9947. deferred.reject({
  9948. msg: GlassContextMenu.errors.FAILURE_RENDERING_MENU,
  9949. causedBy: reason
  9950. });
  9951. });
  9952. return deferred.promise;
  9953. },
  9954. /**
  9955. * Creates the controller dispatcher providing the controller Map
  9956. * @private
  9957. * @param controllerMap
  9958. * @return Instance of the controller Dispatcher
  9959. */
  9960. _createControllerDispatcher: function _createControllerDispatcher(controllerMap) {
  9961. return new ControllerDispatcher(controllerMap);
  9962. },
  9963. /**
  9964. * Creates the UI menu
  9965. * @private
  9966. * @param shownItems array of items to show
  9967. */
  9968. _createUIMenu: function _createUIMenu(shownItems) {
  9969. return new Menu({
  9970. spec: {
  9971. items: shownItems
  9972. }
  9973. });
  9974. },
  9975. _createController: function _createController(module, key) {
  9976. var oEventContext = {
  9977. glassContext: this.glassContext,
  9978. target: {
  9979. plugin: this,
  9980. itemId: this.itemSpec.id
  9981. },
  9982. controllerConfig: this.itemSpec.controllerConfig && this.itemSpec.controllerConfig[key]
  9983. };
  9984. var _controller;
  9985. return this._ClassFactory.instantiate(module).then(function (controller) {
  9986. _controller = controller;
  9987. if (_.isFunction(_controller.initialize)) {
  9988. return _controller.initialize(oEventContext);
  9989. }
  9990. }).then(function () {
  9991. if (_.isFunction(_controller.onOpen)) {
  9992. return _controller.onOpen(oEventContext);
  9993. }
  9994. }).then(function () {
  9995. return _controller;
  9996. });
  9997. }
  9998. });
  9999. GlassContextMenu.errors = {
  10000. FAILURE_RENDERING_MENU: 'Failure when rendering the contextual menu',
  10001. FAILURE_CREATING_CONTROLLER: 'Failure creating one of the menu controllers'
  10002. };
  10003. return GlassContextMenu;
  10004. });
  10005. //# sourceMappingURL=GlassContextMenu.js.map
  10006. ;
  10007. /**
  10008. * Licensed Materials - Property of IBM
  10009. * IBM Cognos Products: BI
  10010. * (C) Copyright IBM Corp. 2017
  10011. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  10012. */
  10013. define('baglass/utils/WorkArounds',['../core-client/js/core-client/utils/Utils'], function (Utils) {
  10014. return {
  10015. apply: function apply() {
  10016. this._locationOrigin();
  10017. },
  10018. /**
  10019. * From Bug: 178943: Wrong glass URL on Windows 10 Enterprise 2015 LTSB Edition / IE 11 combo
  10020. * In IE11 on Windows 10, window.location.origin is undefined. This work around fills in the origin on the global object.
  10021. */
  10022. _locationOrigin: function _locationOrigin() {
  10023. var w = Utils.getCurrentWindow();
  10024. if (!w.location.origin) {
  10025. w.location.origin = w.location.protocol + '//' + w.location.hostname + (w.location.port ? ':' + w.location.port : '');
  10026. }
  10027. }
  10028. };
  10029. });
  10030. //# sourceMappingURL=WorkArounds.js.map
  10031. ;
  10032. !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("prop-types"),require("react"),require("underscore"),require("jquery"),require("mobx-state-tree"),require("baglass/core-client/js/core-client/utils/ClassFactory"),require("ca-ui-toolkit-core"),require("mobx-react"),require("mobx"),require("baglass/nls/StringResources"),require("baglass/utils/Utils"),require("baglass/core-client/js/core-client/errors/BaseError"),require("react-dom"),require("baglass/api/Url"),require("baglass/core-client/js/core-client/ui/KeyCodes"),require("baglass/core-client/js/core-client/ui/ToastMessage"),require("baglass/app/utils/CloseViewUtils"),require("baglass/common/ui/SlideoutRegistry"),require("baglass/api/Context"),require("baglass/services/AjaxService"),require("baglass/services/ClipboardService"),require("baglass/app/services/CoachMarkService"),require("baglass/app/services/ConfigService"),require("baglass/services/ContextService"),require("baglass/services/EventsService"),require("baglass/services/FeatureChecker"),require("baglass/app/FeatureRules"),require("baglass/app/services/FetchService"),require("baglass/app/services/AjaxService"),require("baglass/services/LogService"),require("baglass/services/PrefetchService"),require("baglass/services/ServiceRegistry"),require("baglass/app/services/UserProfileService"),require("baglass/services/WindowProxyService"),require("baglass/core-client/js/core-client/utils/PerfUtils"),require("baglass/core-client/js/core-client/ui/Slideout"),require("baglass/common/ui/SlideoutController"),require("baglass/app/plugins/GlassContextMenu"),require("baglass/core-client/js/core-client/ui/Menu"),require("baglass/utils/WorkArounds"));else if("function"==typeof define&&define.amd)define('baglass/glass.webpack.bundle',["prop-types","react","underscore","jquery","mobx-state-tree","baglass/core-client/js/core-client/utils/ClassFactory","ca-ui-toolkit-core","mobx-react","mobx","baglass/nls/StringResources","baglass/utils/Utils","baglass/core-client/js/core-client/errors/BaseError","react-dom","baglass/api/Url","baglass/core-client/js/core-client/ui/KeyCodes","baglass/core-client/js/core-client/ui/ToastMessage","baglass/app/utils/CloseViewUtils","baglass/common/ui/SlideoutRegistry","baglass/api/Context","baglass/services/AjaxService","baglass/services/ClipboardService","baglass/app/services/CoachMarkService","baglass/app/services/ConfigService","baglass/services/ContextService","baglass/services/EventsService","baglass/services/FeatureChecker","baglass/app/FeatureRules","baglass/app/services/FetchService","baglass/app/services/AjaxService","baglass/services/LogService","baglass/services/PrefetchService","baglass/services/ServiceRegistry","baglass/app/services/UserProfileService","baglass/services/WindowProxyService","baglass/core-client/js/core-client/utils/PerfUtils","baglass/core-client/js/core-client/ui/Slideout","baglass/common/ui/SlideoutController","baglass/app/plugins/GlassContextMenu","baglass/core-client/js/core-client/ui/Menu","baglass/utils/WorkArounds"],t);else{var n="object"==typeof exports?t(require("prop-types"),require("react"),require("underscore"),require("jquery"),require("mobx-state-tree"),require("baglass/core-client/js/core-client/utils/ClassFactory"),require("ca-ui-toolkit-core"),require("mobx-react"),require("mobx"),require("baglass/nls/StringResources"),require("baglass/utils/Utils"),require("baglass/core-client/js/core-client/errors/BaseError"),require("react-dom"),require("baglass/api/Url"),require("baglass/core-client/js/core-client/ui/KeyCodes"),require("baglass/core-client/js/core-client/ui/ToastMessage"),require("baglass/app/utils/CloseViewUtils"),require("baglass/common/ui/SlideoutRegistry"),require("baglass/api/Context"),require("baglass/services/AjaxService"),require("baglass/services/ClipboardService"),require("baglass/app/services/CoachMarkService"),require("baglass/app/services/ConfigService"),require("baglass/services/ContextService"),require("baglass/services/EventsService"),require("baglass/services/FeatureChecker"),require("baglass/app/FeatureRules"),require("baglass/app/services/FetchService"),require("baglass/app/services/AjaxService"),require("baglass/services/LogService"),require("baglass/services/PrefetchService"),require("baglass/services/ServiceRegistry"),require("baglass/app/services/UserProfileService"),require("baglass/services/WindowProxyService"),require("baglass/core-client/js/core-client/utils/PerfUtils"),require("baglass/core-client/js/core-client/ui/Slideout"),require("baglass/common/ui/SlideoutController"),require("baglass/app/plugins/GlassContextMenu"),require("baglass/core-client/js/core-client/ui/Menu"),require("baglass/utils/WorkArounds")):t(e["prop-types"],e.react,e.underscore,e.jquery,e["mobx-state-tree"],e["baglass/core-client/js/core-client/utils/ClassFactory"],e["ca-ui-toolkit-core"],e["mobx-react"],e.mobx,e["baglass/nls/StringResources"],e["baglass/utils/Utils"],e["baglass/core-client/js/core-client/errors/BaseError"],e["react-dom"],e["baglass/api/Url"],e["baglass/core-client/js/core-client/ui/KeyCodes"],e["baglass/core-client/js/core-client/ui/ToastMessage"],e["baglass/app/utils/CloseViewUtils"],e["baglass/common/ui/SlideoutRegistry"],e["baglass/api/Context"],e["baglass/services/AjaxService"],e["baglass/services/ClipboardService"],e["baglass/app/services/CoachMarkService"],e["baglass/app/services/ConfigService"],e["baglass/services/ContextService"],e["baglass/services/EventsService"],e["baglass/services/FeatureChecker"],e["baglass/app/FeatureRules"],e["baglass/app/services/FetchService"],e["baglass/app/services/AjaxService"],e["baglass/services/LogService"],e["baglass/services/PrefetchService"],e["baglass/services/ServiceRegistry"],e["baglass/app/services/UserProfileService"],e["baglass/services/WindowProxyService"],e["baglass/core-client/js/core-client/utils/PerfUtils"],e["baglass/core-client/js/core-client/ui/Slideout"],e["baglass/common/ui/SlideoutController"],e["baglass/app/plugins/GlassContextMenu"],e["baglass/core-client/js/core-client/ui/Menu"],e["baglass/utils/WorkArounds"]);for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(window,(function(e,t,n,r,o,i,s,a,c,u,l,p,f,d,h,y,v,g,b,w,m,C,_,P,S,O,E,x,j,R,k,V,T,M,A,I,D,L,N,G){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/bi/js/glass/baglass/js/baglass/app/",n(n.s=52)}([function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(t),n.d(t,"default",(function(){return i}));var i=o((function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}));i.POSITION="position",i.PLACEMENT="placement",i.CENTER="center",i.LEADING="leading",i.LOOPS="loops",i.PANE="pane",i.TOOL_ITEMS="toolItems",i.TRAILING="trailing",i.TOP="top",i.BOTTOM="bottom",i.LEFT="left",i.RIGHT="right",i.INVERSE_DIRECTION_MAP={left:"right",right:"left",top:"bottom",bottom:"top"}},function(e,t){e.exports=n},function(e,t){e.exports=r},function(e,t){e.exports=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e){this.Glass=e,this.eventService=e.getCoreSvc(".Events"),this.logger=e.getCoreSvc(".Logger")};t.default=r},function(e,t){e.exports=i},function(e,t){e.exports=s},function(e,t){e.exports=a},function(e,t){e.exports=c},function(e,t){e.exports=u},function(e,t){e.exports=l},function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return a}));var r=n(2),o=n(3),i=n.n(o);function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var a=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,o;return t=e,o=[{key:"generatePositionMap",value:function(e){var t={};return e.forEach((function(e){var n=e[r.default.POSITION];if(n){t[n]||(t[n]=[]),e.attr={},e.id&&(e.attr.id=e.id),i.a.isString(e.role)&&(e.attr.role=e.role),e["aria-label"]&&(e.attr["aria-label"]=e["aria-label"]);var o=r.default.INVERSE_DIRECTION_MAP[n]||"right";e.toolItemGroups&&e.toolItemGroups.forEach((function(e){e.toolItems&&e.toolItems.forEach((function(e){e.ddMenuPlacement=e[r.default.PLACEMENT]||o}))})),t[n].push(e)}})),t}},{key:"isContentPane",value:function(e){return i.a.isEmpty(e)}},{key:"convertToolBarsToLayoutObject",value:function(e){var t={};return e&&e.length>0?t=this.generatePositionMap(e):t[r.default.LOOPS]=[],(t[r.default.TOP]||t[r.default.BOTTOM])&&(t.class="paneColumn",t[r.default.LOOPS]=[r.default.TOP,r.default.BOTTOM],t[r.default.PANE]={}),(t[r.default.LEFT]||t[r.default.RIGHT])&&(t[r.default.PANE]?(t[r.default.LEFT]&&(t[r.default.PANE][r.default.LEFT]=t[r.default.LEFT],delete t[r.default.LEFT]),t[r.default.RIGHT]&&(t[r.default.PANE][r.default.RIGHT]=t[r.default.RIGHT],delete t[r.default.RIGHT]),t[r.default.PANE].class="paneRow",t[r.default.PANE][r.default.LOOPS]=[r.default.LEFT,r.default.RIGHT],t[r.default.PANE][r.default.PANE]={}):(t.class="paneRow",t[r.default.LOOPS]=[r.default.LEFT,r.default.RIGHT],t[r.default.PANE]={})),t}}],(n=null)&&s(t.prototype,n),o&&s(t,o),Object.defineProperty(t,"prototype",{writable:!1}),e}()},function(e,t){e.exports=p},function(e,t,n){"use strict";n.r(t);var r=Object.freeze({APPVIEW:"appview",APPVIEW_LOADED:"appView:loaded"}),o=n(3),i=n.n(o),s=n(7),a=n.n(s);function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var p=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Object.assign(this,t),this.registerOneTimeCallback(r.APPVIEW_LOADED)}var t,n,o;return t=e,(n=[{key:"getRootElement",value:function(){this.glassContext.getCoreSvc(".Logger").debug("getRootElement not implemented")}},{key:"render",value:function(){this.glassContext.getCoreSvc(".Logger").debug("render not implemented")}},{key:"remove",value:function(){this.store.setVisible(!1)}},{key:"disable",value:function(){this.store.setDisabled(!0)}},{key:"enable",value:function(){this.store.setDisabled(!1)}},{key:"isVisible",value:function(){return this.store.visible}},{key:"show",value:function(){this.store.setVisible(!0),this.showContainer()}},{key:"hide",value:function(){this.store.setVisible(!1),this.hideContainer()}},{key:"changeLabel",value:function(e){this.store.setLabel(e)}},{key:"changeIcon",value:function(e){this.store.setIconId(e)}},{key:"showContainer",value:function(){var e=this.getContainer();e&&e.show&&e.show()}},{key:"hideContainer",value:function(){var e=this.getContainer();e&&e.hide&&e.hide()}},{key:"getActionController",value:function(){var e=this,t=this.glassContext.getCoreSvc(".Logger");if(!this.controllerDispatcher)if(this.itemSpec.actionController)"string"!=typeof this.itemSpec.actionController?this.controllerDispatcher=Promise.reject(new Error("actionController is not a string")):this.controllerDispatcher=a.a.instantiate(this.itemSpec.actionController.trim()).then((function(t){return e.actionController=t,i.a.isFunction(t.initialize)?e.actionController.initialize({glassContext:e.glassContext,target:{plugin:e,itemId:e.itemSpec.id}}):Promise.resolve()})).then((function(){return e.actionController})).catch((function(e){t.error("failed to retrieve the actionController or invoke its method",e)}));else{if(!this.actionController)return Promise.resolve();this.controllerDispatcher=Promise.resolve(this.actionController)}return Promise.resolve(this.controllerDispatcher)}},{key:"getContainer",value:function(){return this.$container}},{key:"showCoachMark",value:function(){var e=this;return new Promise((function(t){var n=e.glassContext.getCoreSvc(".CoachMarkService"),r=n.getRenderer(),o=n.getPersistence(),s="".concat(e.itemSpec.id,"PluginContainer");t(o.isRead(s).then((function(t){var n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach((function(t){u(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},e.itemSpec.coachMark);return e.getActionController().then((function(o){var s=!1;if(i.a.isFunction(o.getCoachMarkSpec)){var a={glassContext:e.glassContext,target:{coachMark:n,itemId:e.itemSpec.id}};n=o.getCoachMarkSpec(a)||n}return i.a.isEmpty(n)||(n.glassContext=e.glassContext,e.coachMark=new r(n),s=!e.getContainer().hasClass("disabled")&&!t,e.coachMark.render(e.getContainer(),s)),s}))})))}))}},{key:"registerOneTimeCallback",value:function(e){var t=this,n=this.glassContext.getCoreSvc(".Events").on(e,(function(e,r){var o=i.a.isFunction(t.onEventListener)?t.onEventListener:function(){};try{o.call(t,e,r)}catch(n){t.glassContext.getCoreSvc(".Logger").error("GlassPlugin event callback failure",e,r,n)}finally{n.remove()}}),this)}},{key:"onEventListener",value:function(e,t){var n=this,o=this.glassContext.getCoreSvc(".Logger");return this.getActionController().then((function(i){if(i)switch(t){case r.APPVIEW_LOADED:n.appView&&n.appView===e.appView?n.onAppViewLoaded(i,o,e,t):o.info("".concat(r.APPVIEW_LOADED," is ignored due to mismatched appView"),n.appView,e.appView);break;default:o.warn("unhandled event in plugin",n,e,t)}})).catch((function(e){o.error("error on event callback",n,e)}))}},{key:"onAppViewLoaded",value:function(e,t){i.a.isFunction(e.onRender)&&e.onRender({glassContext:this.glassContext,target:{plugin:this,itemId:this.itemSpec.id}}),this.showCoachMark().catch((function(e){t.error("failed to show coachmark",e)}))}}])&&l(t.prototype,n),o&&l(t,o),Object.defineProperty(t,"prototype",{writable:!1}),e}();t.default=p},function(e,t,n){"use strict";var r,o=n(1),i=n.n(o),s=n(4),a=n.n(s),c=n(3),u=n.n(c),l=n(0),p=n.n(l),f=n(8),d=n(9);function h(e){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function v(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function g(e,t){return(g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function b(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=m(e);if(t){var o=m(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return w(this,n)}}function w(e,t){if(t&&("object"===h(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function C(e){return e?-1!==e.search(/\.jpeg$|\.jpg$|\.png$|\.gif$|\.svg$/)?function(e){return i.a.createElement("img",{src:e,alt:"Button Icon"})}(e):function(e){return i.a.createElement(f.SVGIcon,{className:"svgIcon",iconId:e,size:"normal",verticalAlign:"middle"})}(e):null}var _=Object(d.observer)(r=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&g(e,t)}(s,e);var t,n,r,o=b(s);function s(){var e;y(this,s);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return(e=o.call.apply(o,[this].concat(n))).setButtonRef=function(t){e.props.store.setButtonRef(t)},e}return t=s,(n=[{key:"componentDidMount",value:function(){var e=this.props.onMount;e&&e()}},{key:"render",value:function(){var e=this.props,t=e.id,n=e.title,r=e.className,o=e.variant,s=e.onClick,a=e.store,c=e.push,u=a.pushed,l=a.disabled,p=a.iconId,d=a.label,h=a.visible,y=C(p),v=!0===Boolean(c)?f.PushButton:f.Button,g=r;return d&&(r?g+=" labelled":g="labelled"),h&&i.a.createElement(v,{id:t,title:n||d,label:d,className:g,variant:y&&o,onClick:s,icon:y,checked:u,disabled:l,intent:"primary",ref:this.setButtonRef})}}])&&v(t.prototype,n),r&&v(t,r),Object.defineProperty(t,"prototype",{writable:!1}),s}(o.Component))||r;_.propTypes={id:p.a.string,title:p.a.string,push:p.a.string,className:p.a.string,variant:p.a.string,onClick:p.a.func,onMount:p.a.func,store:p.a.object.isRequired};var P=_,S=n(5),O=n(31),E=n.n(O),x=S.types.model({pushed:S.types.optional(S.types.boolean,!1)}).volatile((function(){return{buttonNode:null}})).actions((function(e){return{setButtonRef:function(t){e.buttonNode=t},setPushed:function(t){e.pushed=t}}})),j=S.types.compose(x,E.a).named("ButtonStore"),R=n(15),k=n(51),V=n.n(k);function T(e){return(T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function M(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function A(e,t){return(A=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function I(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=L(e);if(t){var o=L(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return D(this,n)}}function D(e,t){if(t&&("object"===T(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function L(e){return(L=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var N=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&A(e,t)}(s,e);var t,n,r,o=I(s);function s(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),(t=o.call(this,e)).onClick=function(){var e=t.glassContext.getCoreSvc(".Logger");return t.getActionController().then((function(){t.triggerOnPress()})).catch((function(t){e.error("failed to retrieve the actionController or invoke its method",t)}))},t.onMount=function(){t.$el=a()(t.getRootElement())},t.render=function(){var e=t.itemSpec,n=e.id,r=e.title,o=e.label,s=e.push;return Promise.resolve(i.a.createElement(P,{id:n,title:r,label:o,className:t.itemSpec.class,variant:"icon",onClick:t.onClick,store:t.store,onMount:t.onMount,push:s}))},t.store=j.create(),t.store.setIconId(t.itemSpec.icon),t.store.setLabel(t.itemSpec.label),t.getActionController().catch((function(e){t.glassContext.getCoreSvc(".Logger").error("failed to retrieve the actionController or invoke its method",e)})),t}return t=s,(n=[{key:"setPressed",value:function(){this.store.setPushed(!0)}},{key:"getRootElement",value:function(){return this.store.buttonNode&&this.store.buttonNode._button&&this.store.buttonNode._button._node}},{key:"setUnpressed",value:function(){this.store.setPushed(!1)}},{key:"getBaseButton",value:function(){return this}},{key:"togglePressed",value:function(){var e=this.store.pushed;return this.store.setPushed(!e),!e}},{key:"setSelected",value:function(){this.setPressed()}},{key:"isPressed",value:function(){return this.store.pushed}},{key:"isEnabled",value:function(){return!this.store.disabled}},{key:"triggerOnPress",value:function(){var e={glassContext:this.glassContext,target:{plugin:this}},t=this.actionController;if(this.itemSpec.push&&(e.pushState=this.togglePressed()),u.a.isFunction(t.onPress))t.onPress(e);else if(u.a.isFunction(t.execute)){var n=new V.a(e.glassContext),r={options:this.itemSpec.options};t.execute(n,r)}}}])&&M(t.prototype,n),r&&M(t,r),Object.defineProperty(t,"prototype",{writable:!1}),s}(R.default);t.a=N},function(e,t){e.exports=f},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=i(n(1)),a=i(n(31)),c=i(n(15)),u=i(n(103)),l=function(e){function t(t){var n=e.call(this,t)||this;return n.render=function(){return Promise.resolve(s.default.createElement(u.default,{store:n.store,className:n.itemSpec.class}))},n.store=a.default.create(),n.store.setIconId(n.itemSpec.icon),n.store.setLabel(n.itemSpec.label),n}return o(t,e),t}(c.default);t.default=l},function(e,t){e.exports=d},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=u(e);if(t){var o=u(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return c(this,n)}}function c(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var l=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}(u,e);var t,n,r,c=a(u);function u(){var e;o(this,u);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return(e=c.call.apply(c,[this].concat(n))).onClick=function(){try{e.isActionControllerLoaded(),e.triggerOnPress()}catch(t){e.glassContext.getCoreSvc(".Logger").error(t)}},e}return t=u,(n=[{key:"isActionControllerLoaded",value:function(){if(!this.actionController)throw new Error("Controller has not been registered")}}])&&i(t.prototype,n),r&&i(t,r),Object.defineProperty(t,"prototype",{writable:!1}),u}(n(16).a);t.a=l},function(e,t,n){"use strict";var r,o=n(1),i=n.n(o),s=n(0),a=n.n(s),c=n(8),u=n(9),l=n(10);function p(e){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=g(e);if(t){var o=g(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return v(this,n)}}function v(e,t){if(t&&("object"===p(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function g(e){return(g=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var b=Object(u.observer)(r=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&h(e,t)}(s,e);var t,n,r,o=y(s);function s(){return f(this,s),o.apply(this,arguments)}return t=s,(n=[{key:"render",value:function(){var e=this.props,t=e.store,n=e.onDismiss,r=e.perspective,o=e.onGoToAction,s=t.getAlertsForPerspective(r);return i.a.createElement(c.PersistentBanner,{alerts:Object(l.toJS)(s),onDismiss:n,onGoToAction:o})}}])&&d(t.prototype,n),r&&d(t,r),Object.defineProperty(t,"prototype",{writable:!1}),s}(o.Component))||r;function w(e){return(w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function m(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function C(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function _(e,t){return(_=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function P(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=O(e);if(t){var o=O(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return S(this,n)}}function S(e,t){if(t&&("object"===w(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function O(e){return(O=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}b.propTypes={store:a.a.object.isRequired,onDismiss:a.a.func,perspective:a.a.string,onGoToAction:a.a.func};var E=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_(e,t)}(s,e);var t,n,r,o=P(s);function s(){var e;m(this,s);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return(e=o.call.apply(o,[this].concat(n))).onDismiss=function(t){return e.glassContext.getCoreSvc(".Message").removeAlert(t)},e.onGoToAction=function(t){var n=t.actionId,r=t.actionContext;if(n){var o={glassContext:e.glassContext,actionContext:r};e.glassContext.performAction(n,o)}},e}return t=s,(n=[{key:"render",value:function(){return Promise.resolve(i.a.createElement(b,{store:this.glassContext.getCoreSvc(".Message").getStore(),onDismiss:this.onDismiss,perspective:this.glassContext.getCurrentPerspective(),onGoToAction:this.onGoToAction}))}}])&&C(t.prototype,n),r&&C(t,r),Object.defineProperty(t,"prototype",{writable:!1}),s}(n(15).default);t.a=E},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var c=a(n(1)),u=a(n(102)),l=c.default.createElement(c.default.Fragment,null),p=function(e){function t(t){var n=e.call(this,t)||this;return n.state={element:l},n.updateElement(),n}return o(t,e),t.prototype.componentDidUpdate=function(e){var t=this.props.render;e.render!==t&&this.updateElement()},t.prototype.updateElement=function(){var e=this,t=this.props.failRenderCallback;this.renderPromise=this.doRender().then((function(t){e.setState({element:t})}),(function(e){return e=e||"unknown plugin render method exception",t&&t(e),Promise.resolve()}))},t.prototype.doRender=function(){return i(this,void 0,void 0,(function(){return s(this,(function(e){return[2,this.props.render?this.callRender():l]}))}))},t.prototype.callRender=function(){return i(this,void 0,void 0,(function(){var e,t,n,r,o,i,a;return s(this,(function(s){switch(s.label){case 0:return e=this.props,t=e.render,n=e.renderScope,r=e.options,o=e.postRenderCallback,i=e.containerRef,[4,t.call(n,r)];case 1:return a=s.sent(),o&&o(),a?(c.default.isValidElement(a)||(a=c.default.createElement(u.default,{htmlElement:a,containerRef:i})),[2,a]):[2,l]}}))}))},t.prototype.render=function(){var e=this.state.element;return c.default.createElement(c.default.Fragment,null,e)},t}(c.default.Component);t.default=p},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=s(n(63)),c=s(n(35)),u=s(n(24)),l=function(){function e(e){this.glassContext=e,this.store=a.default.create(),this.notifier=new c.default}return e.prototype.createDialog=function(e){var t=(0,u.default)("dialog");(e=r(r({},e),{id:t})).callback&&"object"==typeof e.callback&&Object.keys(e.callback).length>0&&Object.values(e.callback).filter((function(e){return e&&"function"==typeof e})).length>0&&e&&e.buttons&&Array.isArray(e.buttons)&&((e.buttons.includes("ok")||e.buttons.filter((function(e){return"ok"===e.defaultId})).length>0)&&this.registerCallbackForButton(e,"ok",t),(e.buttons.includes("cancel")||e.buttons.filter((function(e){return"cancel"===e.defaultId})).length>0)&&this.registerCallbackForButton(e,"cancel",t)),this.store.addDialog(e)},e.prototype.registerCallbackForButton=function(t,n,r){this.notifier.register(r+"-dialog-callback-"+n,(function(){t.callback.general&&e.invokeGeneralCallback(t,n),t.callback[n]&&t.callback[n]()}))},e.invokeGeneralCallback=function(e,t){e.callbackScope&&null!==e.callbackScope[t]&&void 0!==e.callbackScope[t]?e.callback.general.call(e.callbackScope[t],{btn:t}):e.callback.general({btn:t})},e.prototype.removeDialog=function(e){return o(this,void 0,void 0,(function(){var t,n,r;return i(this,(function(o){switch(o.label){case 0:if(t=this.store.dialogsInPlain,!(n=t&&t.length>0?t[t.length-1]:null))return[3,6];o.label=1;case 1:return o.trys.push([1,4,5,6]),!n.hasCallback||"ok"!==e&&"cancel"!==e?[3,3]:[4,this.notifier.notify(n.key+"-dialog-callback-"+e)];case 2:o.sent(),o.label=3;case 3:return[3,6];case 4:return r=o.sent(),this.glassContext.getCoreSvc(".Logger").error("Failed to execute callback function when a dialog is closed",r),[3,6];case 5:return this.store.removeDialog(),n.hasCallback&&(this.notifier.remove(n.key+"-dialog-callback-ok"),this.notifier.remove(n.key+"-dialog-callback-cancel")),[7];case 6:return[2]}}))}))},e.prototype.getDialogs=function(){return this.store.dialogsInPlain},e.prototype.getStore=function(){return this.store},e}();t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=function(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)};return String(e)+t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=i(n(19)),a=i(n(4)),c=i(n(3)),u=i(n(36)),l=function(){function e(e){this.PERSPECTIVE_MODEL_PATH="v1/perspectives/",this.copyObject=function(e){return(0,u.default)(e)},this.glassContext=e,this.url=new s.default,this.modelCache={}}return e.prototype.getModel=function(e,t){var n=this.getPerspectiveUrl(e,t);return this.getPerspectiveModel(n,e)},e.prototype.getModelFromCache=function(e){if(this.modelCache[e]&&JSON.stringify(this.modelCache[e])!==JSON.stringify({}))return this.copyObject(this.modelCache[e])},e.prototype.addModel=function(e,t,n){this.modelCache[this.getPerspectiveUrl(e,n)]=this.copyObject(t)},e.prototype.getPerspectiveUrl=function(e,t){var n=this.PERSPECTIVE_MODEL_PATH+e;if(t&&t.content){var r=c.default.map(this.url.URL_UI_API,(function(e){return e.key})),o=c.default.pick(t.content,r);c.default.keys(o).length>0&&(n+="?"+a.default.param(o))}return n},e.prototype.getPerspectiveModel=function(e,t){return r(this,void 0,void 0,(function(){var n,r;return o(this,(function(o){switch(o.label){case 0:return void 0!==(n=this.getModelFromCache(e))?[2,n]:[4,this.glassContext.getCoreSvc(".Ajax").ajax({url:e,type:"GET",perspective:t})];case 1:return r=o.sent(),this.modelCache[e]=this.copyObject(r.data),[2,r.data]}}))}))},e}();t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){this.glassContext=e,this.qsValueEncoders=[]}return e.prototype.encodeQSValue=function(e){for(var t=0;t<this.qsValueEncoders.length;t+=1)e=this.qsValueEncoders[t](e);return e},e.prototype.registerQSValueEncoder=function(e){this.qsValueEncoders.push(e)},e}();t.default=r},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e){this.BASE_URL="v1",this.TAXONOMY_URL=this.BASE_URL+'"/metadata/modules/taxonomy"',this.glassContext=e}return e.prototype.initialize=function(e){this.taxonomy=e},e.prototype.getTaxonomy=function(){return r(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return this.taxonomy?[2,this.taxonomy]:(e=this,[4,this.loadTaxonomy()]);case 1:return e.taxonomy=t.sent(),[2,this.taxonomy]}}))}))},e.prototype.loadTaxonomy=function(){return r(this,void 0,void 0,(function(){var t,n;return o(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.glassContext.getCoreSvc(".Ajax").ajax({url:e.TAXONOMY_URL,type:"GET"})];case 1:return(t=r.sent()).data&&t.data.data&&t.data.data.taxonomy?[2,t.data.data.taxonomy]:(this.glassContext.getCoreSvc(".Logger").error("Unable to parse the returned result when updating the taxonomy data"),[3,3]);case 2:return n=r.sent(),this.glassContext.getCoreSvc(".Logger").error("Error retrieving the taxonomy data",n),[3,3];case 3:return[2,void 0]}}))}))},e}();t.default=i},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=s(n(29)),c=s(n(35)),u=s(n(24)),l=function(){function e(e){this.Glass=e,this.store=a.default.create({disabled:this.isDisabled()}),this.notifier=new c.default}return e.prototype.isDisabled=function(){var e=this.Glass.getCoreSvc(".Config");return!!(!!e&&e.getConfigValueSync("Glass.disableGlobalToast"))},e.prototype.getDisabled=function(){return this.store.disabled},e.prototype.addToast=function(e,t){var n={message:e,options:t};this.addToasts([n])},e.prototype.addToasts=function(e){var t=this;Array.isArray(e)||(e=[e]);for(var n=[],o=0;o<e.length;o+=1){var i=(0,u.default)("toast");e[o]=r(r({message:e[o].message},e[o].options),{id:i}),e[o].onHidden&&!this.getDisabled()&&this.notifier.register(i+"-toast-onhidden",e[o].onHidden),e[o].callback&&!this.getDisabled()&&this.notifier.register(i+"-toast-callback",e[o].callback),e[o].onShown&&!this.getDisabled()&&(this.notifier.register(i+"-toast-onshown",e[o].onShown),n.push(this.notifier.notify(i+"-toast-onshown")))}this.store.addToasts(e),Promise.all(n).then((function(){})).catch((function(e){t.Glass.getCoreSvc(".Logger").error("Failed to execute onShown function when a toast is added",e)}))},e.prototype.removeToastById=function(e,t){return void 0===t&&(t=!1),o(this,void 0,void 0,(function(){var n,r,o,s=this;return i(this,(function(i){switch(i.label){case 0:if(null===(n=this.store.getToastInPlainById(e)))return[3,8];r=function(){s.store.removeToastById(e)},i.label=1;case 1:return i.trys.push([1,6,7,8]),t&&n.hasCallback?[4,this.notifier.notify(e+"-toast-callback")]:[3,3];case 2:i.sent(),i.label=3;case 3:return n.hasOnHidden?[4,this.notifier.notify(e+"-toast-onhidden")]:[3,5];case 4:i.sent(),i.label=5;case 5:return[3,8];case 6:return o=i.sent(),this.Glass.getCoreSvc(".Logger").error("Failed to execute onHidden/callback function when a toast is removed",o),[3,8];case 7:return r(),this.notifier.remove(e),[7];case 8:return[2]}}))}))},e.prototype.removeAllToasts=function(){this.store.removeAllToasts()},e.prototype.getToastById=function(e){return this.store.getToastInPlainById(e)},e.prototype.getToasts=function(){return this.store.toastsInPlain},e.prototype.getStore=function(){return this.store},e}();t.default=l},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.containerID=t.globalKeyword=void 0;var o=n(10),i=n(5),s=r(n(11));t.globalKeyword="__global__",t.containerID="toolkit-toastContainer-glassGlobal";var a=i.types.model("ToastModel",{key:i.types.optional(i.types.string,""),stackable:i.types.optional(i.types.boolean,!0),statusType:i.types.union(i.types.literal("info"),i.types.literal("success"),i.types.literal("warning"),i.types.literal("error")),contentString:i.types.optional(i.types.string,""),closeText:i.types.optional(i.types.string,s.default.get("close")),btnLabel:i.types.optional(i.types.string,""),scope:i.types.optional(i.types.string,t.globalKeyword),hasOnHidden:i.types.optional(i.types.boolean,!1),hasOnShown:i.types.optional(i.types.boolean,!1),hasCallback:i.types.optional(i.types.boolean,!1),timedDismiss:i.types.optional(i.types.boolean,!1),milliseconds:i.types.optional(i.types.number,3e3)});var c=i.types.model("ToastStore",{disabled:i.types.optional(i.types.boolean,!1),toastQueue:i.types.optional(i.types.array(a),[]),containerID:i.types.optional(i.types.string,t.containerID)}).views((function(e){return{get toasts(){return e.disabled?[]:e.toastQueue},get toastsInPlain(){return e.disabled?[]:(0,o.toJS)(e.toastQueue)},getToastById:function(t){if(e.disabled)return null;var n=e.toasts.filter((function(e){return e.key===t}));return n.length>0?n[0]:null},getToastInPlainById:function(t){return e.disabled?null:(0,o.toJS)(e.getToastById(t))},getToastsForPerspective:function(n){return e.toasts.filter((function(e){return e.scope===t.globalKeyword||e.scope===n})).sort((function(e,n){return e.scope===n.scope?0:e.scope===t.globalKeyword?1:-1}))},getToastsInPlainForPerspective:function(t){return(0,o.toJS)(e.getToastsForPerspective(t))}}})).actions((function(e){return{addToasts:function(n){Array.isArray(n)||(n=[n]);for(var r=0;r<n.length;r+=1)e.toastQueue=(0,o.observable)(e.toastQueue.concat((i=n[r],s=void 0,s={key:i.id,stackable:!0,statusType:i.type||"success",contentString:i.message,btnLabel:i.btnLabel,scope:i.scope?i.scope:t.globalKeyword,hasOnHidden:!!i.onHidden,hasOnShown:!!i.onShown,hasCallback:!!i.callback,timedDismiss:"success"===i.type||"info"===i.type||!i.type,milliseconds:i.timeBeforeDismiss},a.create(s))));var i,s;e.toastQueue.length>5&&(e.toastQueue=(0,o.observable)(e.toastQueue.slice(Math.max(e.toastQueue.length-5,0))))},removeToastById:function(t){var n=e.toasts.filter((function(e){return e.key!==t}));e.toastQueue=(0,o.observable)(n)},removeAllToasts:function(){e.toastQueue=(0,o.observable)([])}}}));t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){var e=document.createElement("div");e.id="svgIcons",e.style.display="none",document.body.appendChild(e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(5),o=r.types.model({visible:r.types.optional(r.types.boolean,!0),disabled:r.types.optional(r.types.boolean,!1),iconId:r.types.optional(r.types.union(r.types.string,r.types.undefined),void 0),label:r.types.optional(r.types.union(r.types.string,r.types.undefined),void 0)}).actions((function(e){return{setVisible:function(t){e.visible=t},setDisabled:function(t){e.disabled=t},setLabel:function(t){e.label=t},setIconId:function(t){e.iconId=t}}}));t.default=o},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var c=a(n(53)),u=a(n(57)),l=a(n(58)),p=a(n(59)),f=a(n(61)),d=a(n(62)),h=a(n(79)),y=a(n(107)),v=a(n(108)),g=a(n(109)),b=a(n(38)),w=a(n(30)),m=n(34),C=n(41),_=a(n(12)),P=a(n(110)),S=function(e){function t(t,n){var r=e.call(this,t)||this;return r.glassMode="mode",r.glassBookmarkMode="bookmark",r.initialize=function(){r.accessibilityController=new c.default(r),r.actionsController=new u.default(r),r.appHomePage=new l.default(r),r.dialogsController=new p.default(r),r.eventsRouter=new f.default(r),r.perspectiveLifeCycle=new h.default(r),r.searchPerspectiveDOM=new y.default(r),r.slideoutController=new v.default(r),r.themeResources=new g.default(r)},r.canExecuteAction=function(e,t){return i(r,void 0,void 0,(function(){return s(this,(function(n){switch(n.label){case 0:return[4,this.actionsController.canExecuteAction(e,t)];case 1:return[2,n.sent()]}}))}))},r.performAction=function(e,t){return r.actionsController.performAction(e,t)},r.detectAccessibilityChange=function(e){return r.accessibilityController.detectAccessibilityChange(e)},r.isHighContrastOn=function(){return(0,m.isApplicationInHighContrast)()},r.getHomePageObject=function(e){return r.appHomePage.getHomePageObject(e)},r.resetHome=function(e){return r.appHomePage.resetAppHomePage(e)},r.setDefaultHomePerspective=function(e){r.appHomePage.defaultHomePerspective=e},r.setDefaultThemePath=function(e){r.themeResources.defaultThemePath=e},r.showContextMenu=function(e){r.currentAppView&&r.currentAppView.showContextMenu(e)},r.showEmbedDialog=function(e){return r.dialogsController.showEmbedDialog(e)},r.showErrorMessage=function(e,t,n,o){return r.dialogsController.showErrorMessage(e,t,n,o)},r.showMessage=function(e,t,n,o,i,s,a,c){return r.dialogsController.showMessage(e,t,n,o,i,s,a,c)},r.showResetHomeDialog=function(e){return r.dialogsController.showResetHomeDialog(e)},r.showShareDialog=function(e){return r.dialogsController.showShareDialog(e)},r.emit=function(e,t){return r.eventsRouter.emit(e,t)},r.off=function(e,t,n){return r.eventsRouter.off(e,t,n)},r.on=function(e,t,n){return r.eventsRouter.on(e,t,n)},r.trigger=function(e,t){return r.eventsRouter.trigger(e,t)},r.closeOpenWidgets=function(){return r.perspectiveLifeCycle.closeOpenWidgets()},r.updateCurrentCachedAppView=function(){return r.perspectiveLifeCycle.updateCurrentPerspectiveCache()},r.isLoginViewShown=function(){return r.perspectiveLifeCycle.isLoginViewShown},r.isOpeningAView=function(){return r.perspectiveLifeCycle.isOpeningAPerspective()},r.openAppView=function(e,t){return r.perspectiveLifeCycle.openPerspective(e,t)},r.openLoginView=function(e){return r.perspectiveLifeCycle.openLoginPerspective(e)},r.openPreviousAppView=function(){return r.perspectiveLifeCycle.openPreviousPerspective()},r.close=function(e,t){return r.perspectiveLifeCycle.closeAllPerspectives(e,t)},r.closeAppView=function(e,t,n){return r.perspectiveLifeCycle.closePerspective(e,t,n)},r.findCollection=function(e){return r.searchPerspectiveDOM.findCollection(e)},r.isCollectionContainerAvailable=function(e){return r.searchPerspectiveDOM.isCollectionContainerAvailable(e)},r.findElement=function(e){return r.searchPerspectiveDOM.findElement(e)},r.findPlugin=function(e){return r.searchPerspectiveDOM.findPlugin(e)},r.hideSlideOut=function(e){return r.slideoutController.hideSlideOut(e)},r.showSlideOut=function(e){return r.slideoutController.showSlideOut(e)},r.reloadTheme=function(){return r.themeResources.reloadTheme()},r.showToast=function(e,t){return t&&(t.timeOut=t.timeBeforeDismiss||t.timeOut),new b.default(t).show(e)},r.getUrl=function(e){return r.perspectiveLifeCycle.url.getUrl(e,r)},r.lockGlass=function(){r.getCoreSvc(".Logger").warn("The lockGlass API will no longer be supported after the R7 release. Please update your usage accordingly");var e=document.getElementsByClassName("appview");if(e.length>0){var t=e[0].getElementsByClassName("navbar");t.length>0&&t[0].classList.add("disabled");var n=e[0].getElementsByClassName("appbar");n.length>0&&n[0].classList.add("disabled")}},r.unlockGlass=function(){r.getCoreSvc(".Logger").warn("The unlockGlass API will no longer be supported after the R7 release. Please update your usage accordingly");var e=document.getElementsByClassName("appview");if(e.length>0){var t=e[0].getElementsByClassName("navbar");t.length>0&&t[0].classList.remove("disabled");var n=e[0].getElementsByClassName("appbar");n.length>0&&n[0].classList.remove("disabled")}},r.rootPane=n.$rootPane,(0,C.loadPerspectiveModels)(n.perspectives,r.getCoreSvc(".Perspective"),r.getCoreSvc(".Logger")),(0,w.default)(),P.default.apply(),r}return o(t,e),Object.defineProperty(t.prototype,"currentAppView",{get:function(){return this.currentPerspective},set:function(e){this.currentPerspective=e,this.appController.currentAppView=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mode",{get:function(){return this.glassMode},set:function(e){this.glassMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bookmarkMode",{get:function(){return this.glassBookmarkMode},set:function(e){this.glassBookmarkMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cachedPerspectives",{get:function(){return this.perspectiveLifeCycle.cachedPerspectives},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"noCloseOnLastPerspective",{get:function(){return"true"===_.default.getObjectProperty(["context","content","closeWindowOnLastView"],this.currentAppView)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"previousAppView",{get:function(){return this.previousPerspective},set:function(e){this.previousPerspective=e,this.appController.previousAppView=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"perspectiveSwitcherRegistry",{get:function(){return this.perspectiveLifeCycle.perspectiveSwitcherRegistry},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"slideoutRegistry",{get:function(){return this.slideoutController.slideoutRegistry},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"windowPoppingState",{get:function(){return this.perspectiveLifeCycle.windowPoppingState},set:function(e){this.perspectiveLifeCycle.windowPoppingState=e},enumerable:!1,configurable:!0}),t.prototype.getCurrentContentView=function(){return this.currentPerspective?this.currentPerspective.getCurrentContentView():null},t.prototype.getCurrentPerspective=function(){return this.currentPerspective?this.currentPerspective.getCurrentPerspective():null},t}(d.default);t.default=S},function(e,t){e.exports=h},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isApplicationStyledForHighContrast=t.styleApplicationForHighContrast=t.isApplicationInHighContrast=void 0,t.isApplicationInHighContrast=function(){var e=!1,t=document.createElement("div");return t.classList.add("hcDetect"),document.body.appendChild(t),getComputedStyle(t).getPropertyValue("border-top-color")===getComputedStyle(t).getPropertyValue("border-left-color")&&""!==getComputedStyle(t).getPropertyValue("border-left-color")&&(e=!0),document.body.removeChild(t),e},t.styleApplicationForHighContrast=function(){document.body.classList.add("highcontrast")},t.isApplicationStyledForHighContrast=function(){return document.body.classList.contains("highcontrast")}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){this.cache={}}return e.prototype.register=function(e,t){var n=this;Array.isArray(e)||(e=[e]),e.forEach((function(e){n.cache[e]=t}))},e.prototype.notify=function(e){return r(this,void 0,void 0,(function(){var t;return o(this,(function(n){switch(n.label){case 0:if(!Object.prototype.hasOwnProperty.call(this.cache,e))return[3,5];n.label=1;case 1:return n.trys.push([1,,2,4]),t=this.cache[e](e),[3,4];case 2:return[4,t=t||Promise.resolve()];case 3:return n.sent(),[7];case 4:return[2,this.remove(e)];case 5:throw new Error("Notifier::notify '"+e+"' not found")}}))}))},e.prototype.remove=function(e){delete this.cache[e]},e}();t.default=i},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(4));t.default=function(e){return o.default.extend(!0,{},e)}},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var c=a(n(6)),u=a(n(38)),l=function(e){function t(t,n,r,o,i){var s=e.call(this,t)||this;return s.pendingOpenPerspectivePromise=null,s.perspectiveSwitcherRegistry=n,s.perspectiveViewsCache=r,s.glassStore=o,s.perspectivesRegistry=i,s}return o(t,e),t.prototype.attemptToOpenPreviousPerspective=function(e,t,n){if(e>=this.perspectiveSwitcherRegistry.size()&&(e=this.perspectiveSwitcherRegistry.size()-1),!n){var r=void 0,o=this.Glass.previousAppView;return this.perspectiveSwitcherRegistry.containsPerspective(o)||(this.Glass.previousAppView=void 0,o=void 0),(r=o&&o.perspective&&o!==t&&"login"!==o.perspective?o:this.perspectiveSwitcherRegistry.getPerspectiveByIndex(e))?this.Glass.openAppView(r.perspective,r.context):this.Glass.openAppView()}return null},t.prototype.closeOpenWidgets=function(e){return i(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this.Glass.hideSlideOut(e)];case 1:return t.sent(),u.default.remove(),[2]}}))}))},t.prototype.setHomeFlag=function(e,t){!0===t&&this.perspectiveSwitcherRegistry.clearAllPerspectiveHomeFlags(),e.setHomeFlag(t)},t.prototype.prefetchResources=function(){var e=this.Glass.getRequireJs(),t=e&&e.s&&e.s.contexts&&e.s.contexts._&&e.s.contexts._.config&&e.s.contexts._.config.bundles;t&&this.Glass.getCoreSvc(".Prefetch").prefetchResources(Object.keys(t))},t}(c.default);t.default=l},function(e,t){e.exports=y},function(e,t){e.exports=v},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=n(5),i=r(n(13)),s=o.types.model({id:o.types.identifier,perspectiveName:o.types.string}).volatile((function(){return{context:{},spec:{}}})).actions((function(e){return{setContext:function(t){e.context=t},setSpec:function(t){e.spec=t}}})).views((function(e){return{get requirejs(){return e.spec.config?e.spec.config.requirejs:void 0},get configStyles(){return e.spec.config?e.spec.config.styles:void 0},get configScripts(){return e.spec.config?e.spec.config.scripts:void 0},get cssStyles(){return e.spec.cssStyles},get svgImages(){return e.spec.svgImages},get contextMenuSettings(){return e.spec.contextMenus},get actions(){return e.spec.actions},get services(){return e.spec.services},get toolBars(){return e.spec.toolBars},get layout(){return i.default.convertToolBarsToLayoutObject(this.toolBars)},get modelId(){return e.context.content&&e.context.content.id?e.context.content.id:e.context.id?e.context.id:e.spec.id?e.spec.id:""},get cacheKey(){return this.modelId?e.perspectiveName+"|"+this.modelId:e.perspectiveName},get contentModule(){return e.spec.content?e.spec.content.module:void 0}}}));t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.arePerspectivesEqual=t.isPerspectiveValid=t.loadPerspectiveModels=void 0,t.loadPerspectiveModels=function(e,t,n){try{Array.isArray(e)&&e.forEach((function(e){var n=e.name,r=e.model,o=e.context;t.addModel(n,r,o)}))}catch(e){n.error("Error while loading perspective models",e)}},t.isPerspectiveValid=function(e){return e&&!e.includes("/")&&!e.includes(".")&&!e.includes("%2F")&&!e.includes("%2f")},t.arePerspectivesEqual=function(e,t){return!(!e||!t||e!==t)}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.preRenderSetup=t.unloadIcons=t.loadStylesAndIcons=void 0;var s=n(83),a=i(n(85)),c=n(43),u=n(44),l=i(n(45)),p=i(n(87));function f(e,t){return r(this,void 0,void 0,(function(){var n;return o(this,(function(r){switch(r.label){case 0:return a.default.loadSVGIcons(e.svgImages,t),n=[],Array.isArray(e.cssStyles)&&(n=n.concat(e.cssStyles)),Array.isArray(e.configStyles)&&(n=n.concat(e.configStyles)),[4,(0,s.loadStyles)(n,t)];case 1:return r.sent(),[2]}}))}))}function d(e,t){return r(this,void 0,void 0,(function(){return o(this,(function(n){switch(n.label){case 0:return(0,c.configureRequire)(e.requirejs,t.getRequireJs()),(0,u.loadContentViewModule)(e.contentModule),[4,Promise.all([(0,p.default)(e.configScripts),f(e,t.getRequireJs())])];case 1:return n.sent(),[2,(0,l.default)(t,e.services)]}}))}))}t.loadStylesAndIcons=f,t.unloadIcons=function(e,t){a.default.unloadSVGIcons(e.svgImages,t)},t.preRenderSetup=function(e,t){return r(this,void 0,void 0,(function(){var n;return o(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,d(e,t)];case 1:return[2,r.sent()];case 2:throw n=r.sent(),t.getCoreSvc(".Logger").error("Failed to setup perspective",n),n;case 3:return[2]}}))}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getUrlArgs=t.configureRequire=void 0,t.configureRequire=function(e,t){e&&e.forEach((function(e){t.config(e)}))},t.getUrlArgs=function(e){var t;try{t=e.s.contexts._.config.urlArgs}catch(e){}return t?"?"+t:""}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.createContentView=t.loadContentViewModule=void 0;var o=r(n(7)),i=r(n(36));function s(e){return o.default.loadModule(e)}t.loadContentViewModule=s,t.createContentView=function(e,t,n){var r=(0,i.default)(e.content);return r.glassContext=t,s(r.module).then((function(e){return new e(r,n)}))}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=i(n(86)),a=i(n(7)),c=i(n(3));function u(e,t,n){return r(this,void 0,void 0,(function(){return o(this,(function(r){switch(r.label){case 0:return e.services.register(t,n),c.default.isFunction(n.initialize)?[4,n.initialize(e)]:[3,2];case 1:return[2,r.sent()];case 2:return[2,void 0]}}))}))}function l(e,t,n){return r(this,void 0,void 0,(function(){var r,i;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,a.default.instantiate(n)];case 1:return r=o.sent(),[4,u(e,t,r)];case 2:return[2,o.sent()];case 3:throw i=o.sent(),e.getCoreSvc(".Logger").error("Failed to load the service module",i),i;case 4:return[2]}}))}))}function p(e,t,n){e.services.declare(t,n,e)}function f(e,t,n){return r(this,void 0,void 0,(function(){return o(this,(function(r){switch(r.label){case 0:if(e.services.exists(t))return[3,5];switch(n.priority){case s.default.Immediate:return[3,1];case s.default.Defer:return[3,3];case s.default.Declare:return[3,4]}return[3,4];case 1:return[4,l(e,t,n.module)];case 2:return[2,r.sent()];case 3:return function(e,t,n){setTimeout((function(){l(e,t,n).catch((function(n){e.getCoreSvc(".Logger").error("Error loading service "+t+": "+JSON.stringify(n))}))}),2e3)}(e,t,n.module),[3,5];case 4:p(e,t,n.module),r.label=5;case 5:return[2,void 0]}}))}))}function d(e,t,n){e.services.exists(t)||p(e,t,n)}t.default=function(e,t){return r(this,void 0,void 0,(function(){var n;return o(this,(function(i){switch(i.label){case 0:return e&&t?(n=Object.keys(t).map((function(n){return function(e,t,n){return r(this,void 0,void 0,(function(){return o(this,(function(r){switch(r.label){case 0:return c.default.isString(n)?[2,d(e,t,n)]:c.default.isObject(n)&&n.module?[4,f(e,t,n)]:[3,2];case 1:return[2,r.sent()];case 2:return e.getCoreSvc(".Logger").warn("Invalid definition for service "+t+": "+JSON.stringify(n)),[2,void 0]}}))}))}(e,n,t[n])})),[4,Promise.all(n)]):[2,void 0];case 1:return i.sent(),[2,void 0]}}))}))}},function(e,t){e.exports=g},function(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.PLUGINS_RENDER_IN_PROGRESS="PLUGINS_RENDER_IN_PROGRESS",e.PLUGINS_RENDER_SUCCESS="PLUGINS_RENDER_SUCCESS",e.CONTENT_VIEW_LOAD_IN_PROGRESS="CONTENT_VIEW_LOAD_IN_PROGRESS",e.CONTENT_VIEW_LOAD_SUCCESS="CONTENT_VIEW_LOAD_SUCCESS",e.CONTENT_VIEW_LOAD_FAILURE="CONTENT_VIEW_LOAD_FAILURE",e.CONTENT_VIEW_RENDER_SUCCESS="CONTENT_VIEW_RENDER_SUCCESS",e.CONTENT_VIEW_RENDER_FAILURE="CONTENT_VIEW_RENDER_FAILURE"}(r||(r={})),t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(5),o=r.types.model({x:r.types.number,y:r.types.number}),i=r.types.model({isVisible:r.types.optional(r.types.boolean,!1),position:r.types.optional(o,{x:0,y:0})}).volatile((function(){return{shownItems:[],selectedItem:{}}})).views((function(e){return{get menuItemsSplitByDivider(){var t=[],n=e.shownItems.reduce((function(e,n){return"divider"===n.type?(e.length>0&&t.push(e),t.push([]),e=[]):e.push(n),e}),[]);return n.length>0&&t.push(n),t}}})).actions((function(e){return{updateItems:function(t){e.shownItems=t},updatePosition:function(t){e.position=t},showMenu:function(){e.isVisible||(e.isVisible=!0)},closeMenu:function(){e.isVisible&&(e.isVisible=!1)},onSelect:function(t){e.selectedItem=t}}}));t.default=i},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.globalKeyword=void 0;var o=n(10),i=n(5);t.globalKeyword="__global__";var s=i.types.model("ActionModel",{id:i.types.optional(i.types.string,""),label:i.types.string,url:i.types.optional(i.types.string,""),actionId:i.types.maybe(i.types.string),actionContext:i.types.frozen(null)}),a=i.types.model("AlertModel",{id:i.types.string,title:i.types.optional(i.types.string,""),message:i.types.optional(i.types.string,""),scope:i.types.optional(i.types.string,t.globalKeyword),action:i.types.optional(s,{label:""})});var c=i.types.model("AlertStore",{disabled:i.types.optional(i.types.boolean,!1),alertList:i.types.optional(i.types.array(a),[])}).views((function(e){return{getAlerts:function(){return e.disabled?[]:e.alertList},getAlertAt:function(t){return e.getAlerts()[t]},getAlertsForPerspective:function(n){return e.getAlerts().filter((function(e){return e.scope===t.globalKeyword||e.scope===n})).sort((function(e,n){return e.scope===n.scope?0:e.scope===t.globalKeyword?1:-1}))}}})).actions((function(e){return{addAlerts:function(t){Array.isArray(t)||(t=[t]),t=function(e){return e.map((function(e){return(e=r({},e)).action&&(e.action=s.create(e.action)),a.create(e)}))}(t),e.alertList=(0,o.observable)(e.alertList.concat(t))},removeAlert:function(t){var n=e.alertList.slice();n.splice(t,1),e.alertList=(0,o.observable)(n)}}}));t.default=c},function(e,t,n){"use strict";function r(e){return!("object"!=typeof e||null==e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function e(t,n){if(!r(t))return t||n||{};if(!r(n))return t;for(var o in n){var i=n[o];i&&"[object Object]"===Object.prototype.toString.call(i)?(t[o]=t[o]||{},e(t[o],i)):void 0!==i&&(t[o]=i)}return t}},function(e,t){e.exports=b},function(e,t,n){e.exports=n(112)},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.idBypassBlockButtonMountpoint=void 0;var s=i(n(6)),a=i(n(1)),c=i(n(17)),u=i(n(33)),l=n(34),p=i(n(54)),f=i(n(55));t.idBypassBlockButtonMountpoint="glass-bypassBlockButton-mountpoint";var d=function(e){function n(t){var n=e.call(this,t)||this;return n.setFocusToMainContent=function(){void 0!==n.Glass.currentAppView&&null!==n.Glass.currentAppView&&"function"==typeof n.Glass.currentAppView.setFocus&&(document.activeElement.blur(),setTimeout((function(){n.Glass.currentAppView.setFocus()}),100))},n.Glass.isHighContrastOn()&&(0,l.styleApplicationForHighContrast)(),n.mountBypassBlockButton(),n.keyPressedSet=new Set,n}return o(n,e),n.prototype.mountBypassBlockButton=function(){var e=document.createElement("div");e.setAttribute("id",t.idBypassBlockButtonMountpoint);var n=document.body;n&&n.childNodes instanceof NodeList&&n.childNodes.length>0?n.insertBefore(e,n.childNodes[0]):n.appendChild(e),c.default.render(a.default.createElement(p.default,{callback:this.setFocusToMainContent}),e)},n.prototype.setFocusToAppbar=function(){if(this.Glass.currentAppView){var e=document.querySelector(".appview.paneColumn:not(.hidden)");if(e){var t=e.querySelector(".appbar");this.focusOnForemostNode(t)}}},n.prototype.focusOnForemostNode=function(e){if(e){var t=e.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');t.length>0&&t[0].id&&this.Glass.findElement(t[0].id.replace(/\./g,"\\.")).focus()}},n.prototype.shortcutListener=function(e,t){"up"===e?(f.default.isModifierKey(t)||this.removeKeyFromSet(t.which),f.default.isMetaKey(t)&&this.clearKeyInSet()):"down"===e&&(f.default.isModifierKey(t)||this.addKeyIntoSet(t.which),this.processShortcutAction(t))},n.prototype.addKeyIntoSet=function(e){this.keyPressedSet.add(e)},n.prototype.removeKeyFromSet=function(e){this.keyPressedSet.delete(e)},n.prototype.clearKeyInSet=function(){this.keyPressedSet.clear()},n.prototype.processShortcutAction=function(e){var t=this,n={shortcutFocusToAppbar:{enabled:f.default.isShortcutTriggered("focusToAppbar",this.keyPressedSet,e),callback:function(){return t.setFocusToAppbar()}},shortcutFocusToMainContent:{enabled:f.default.isShortcutTriggered("focusToMainContent",this.keyPressedSet,e),callback:function(){return t.setFocusToMainContent()}}};Object.keys(n).forEach((function(r){var o=n[r];o.enabled&&"function"==typeof o.callback&&(f.default.metaKeyEnabled(e)&&t.clearKeyInSet(),o.callback())}))},n.prototype.detectAccessibilityChange=function(e){var t=this;if(e){document.body.classList.add("accessibilityMode");var n=function(e){t.shortcutListener("down",e)},r=function(e){t.shortcutListener("up",e)};document.body.onmousedown=function(){document.body.onmousedown=null,t.detectAccessibilityChange(!1)}.bind(this),document.body.onkeydown=n.bind(this),document.body.onkeyup=r.bind(this)}else{n=function(e){e.which===u.default.TAB&&(document.body.onkeydown=null,t.detectAccessibilityChange(!0)),t.shortcutListener("down",e)},r=function(e){t.shortcutListener("up",e)};document.body.classList.remove("accessibilityMode"),document.body.onkeydown=n.bind(this),document.body.onkeyup=r.bind(this)}},n}(s.default);t.default=d},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=i(n(1)),a=n(8),c=i(n(11)),u=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.onclickCallback=function(e){var n=t.props.callback;e.stopPropagation(),e.nativeEvent.stopImmediatePropagation(),n()},t}return o(t,e),t.prototype.render=function(){return s.default.createElement(a.Button,{label:c.default.get("bypassBlockButtonTitle"),variant:"solid",intent:"primary",onClick:this.onclickCallback,style:{position:"absolute",top:"2px",left:"2px"},autofocus:!0})},t}(s.default.Component);t.default=u},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(33)),i=r(n(56)),s=function(){function e(){}return e.isShortcutTriggered=function(t,n,r){var o=e.shortcutMap[t];return null!=o&&e.verifyKeyset(o,n,r)},e.verifyKeyset=function(e,t,n){return Object.keys(e).every((function(r){if("others"===r){if(e.others.filter((function(e){return t.has(e)})).length!==e.others.length)return!1}else if("ctrlKey"===r&&n){if(!i.default.isDeviceMac()&&!n.ctrlKey||i.default.isDeviceMac()&&!n.metaKey)return!1}else if(n&&!n[r])return!1;return!0}))},e.isModifierKey=function(e){return e&&e.key&&["control","shift","alt","meta"].includes(e.key.toLowerCase())},e.isMetaKey=function(e){return e&&e.key&&"meta"===e.key.toLowerCase()},e.metaKeyEnabled=function(e){return e&&e.metaKey},e.shortcutMap={focusToAppbar:{ctrlKey:!0,shiftKey:!0,others:[o.default.NUM1]},focusToMainContent:{ctrlKey:!0,shiftKey:!0,others:[o.default.NUM2]}},e}();t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return e.list={mac:["MacIntel","Macintosh"],windows:["Windows","Win32"]},e.isDeviceMac=function(){return navigator&&e.list.mac&&e.list.mac.includes(navigator.platform)},e.isDeviceWindows=function(){return navigator&&e.list.windows&&e.list.windows.includes(navigator.platform)},e}();t.default=r},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.canExecuteAction=function(e,t){return i(this,void 0,void 0,(function(){return s(this,(function(n){switch(n.label){case 0:return this.Glass.currentAppView?null===e?[2,!1]:[4,this.Glass.currentAppView.canExecuteAction(e,t)]:[3,2];case 1:return[2,n.sent()];case 2:throw new Error("Internal error: No appview loaded.")}}))}))},t.prototype.performAction=function(e,t){if(this.Glass.currentAppView)return Promise.resolve(this.Glass.currentAppView.performAction(e,t));var n=new Error("Internal error: unable to find an appView");throw this.logger.error(n),n},t}(a(n(6)).default);t.default=c},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var c,u=a(n(6)),l=a(n(12)),p=a(n(11)),f=a(n(4));!function(e){e.DEFAULT_HOME_PERSPECTIVE="home"}(c||(c={}));var d=function(e){function t(t){var n=e.call(this,t)||this;return n.initializeHomePageObjects(),n}return o(t,e),Object.defineProperty(t.prototype,"defaultHomePerspective",{set:function(e){this.homePerspectiveDefault=e},enumerable:!1,configurable:!0}),t.prototype.getHomePageObject=function(e){return i(this,void 0,void 0,(function(){var t,n,r,o,i;return s(this,(function(s){switch(s.label){case 0:if(t="number"==typeof e?e:0,n=this.homePageObjs,!(t<n.length))return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,n[t]()];case 2:return!(r=s.sent())||r&&0===Object.keys(r).length?[2,this.getHomePageObject(t+1)]:(o={content:{isHomepage:!0}},[2,r=f.default.extend(!0,o,r)]);case 3:return i=s.sent(),this.logger.error("unable to get home page object",i),[3,4];case 4:throw new Error("Unsupported home page index:"+t)}}))}))},t.prototype.resetAppHomePage=function(e){return i(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this.Glass.getCoreSvc(".UserProfile").resetHome()];case 1:return t.sent(),this.Glass.perspectiveSwitcherRegistry.clearAllPerspectiveHomeFlags(),this.Glass.showToast(p.default.get("resetHomeSuccess"),{type:"success"}),e&&this.Glass.openAppView(),[2]}}))}))},t.prototype.initializeHomePageObjects=function(){this.homePageObjs=[this.getFactoryHomeObj.bind(this)],l.default.isFactoryMode()||this.homePageObjs.unshift(this.getUserHomePageObject.bind(this),this.getSystemHomeObject.bind(this))},t.prototype.getFactoryHomeObj=function(){return{perspective:this.homePerspectiveDefault||c.DEFAULT_HOME_PERSPECTIVE}},t.prototype.getSystemHomeObject=function(){var e=this.Glass.getCoreSvc(".UserProfile");if(e.userProfileSettings&&e.userProfileSettings.ui_homePage){var t=e.userProfileSettings.ui_homePage;return t&&t.content&&"run"===t.content.action&&delete t.content.action,t}return{}},t.prototype.getUserHomePageObject=function(){return i(this,void 0,void 0,(function(){var e,t,n;return s(this,(function(r){switch(r.label){case 0:e=this.Glass.getCoreSvc(".UserProfile"),r.label=1;case 1:return r.trys.push([1,4,,5]),e.preferences&&e.preferences.homePage?[3,3]:[4,e.updateContext()];case 2:r.sent(),r.label=3;case 3:if(t=void 0,e.preferences&&(t=e.preferences.homePage),!t)return[2,{}];try{return[2,JSON.parse(t)]}catch(e){throw this.logger.error("Not valid JSON format. Invalid home page specification.",e),new Error("Not valid JSON format. Invalid home page specification.")}return[3,5];case 4:return n=r.sent(),this.logger.error("Unable to get user home object",n),[2,{}];case 5:return[2]}}))}))},t}(u.default);t.default=d},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var c=a(n(6)),u=a(n(1)),l=a(n(17)),p=a(n(60)),f=a(n(11)),d=function(e){function t(t){var n=e.call(this,t)||this;return n.mountComponent(),n}return o(t,e),t.prototype.mountComponent=function(){var e=document.createElement("div");e.setAttribute("id","glass-dialog-mountpoint"),l.default.render(u.default.createElement(p.default,{store:this.Glass.getCoreSvc(".Dialog").getStore(),Glass:this.Glass}),document.body.appendChild(e))},t.prototype.showErrorMessage=function(e,t,n,r){return i(this,void 0,void 0,(function(){return s(this,(function(o){switch(o.label){case 0:return[4,this.showMessage(e,t,"error",["ok"],"300px",n,r)];case 1:return[2,o.sent()]}}))}))},t.prototype.showMessage=function(e,t,n,r,o,a,c,u){return i(this,void 0,void 0,(function(){var i=this;return s(this,(function(s){return[2,new Promise((function(s){try{var l={message:e,title:t,type:n,buttons:r,width:o,callback:{general:a},htmlContent:c,className:u,callbackScope:{ok:i}};i.Glass.getCoreSvc(".Dialog").createDialog(l),s()}catch(e){throw i.logger.error(e),e}}))]}))}))},t.prototype.showResetHomeDialog=function(e){return i(this,void 0,void 0,(function(){var t=this;return s(this,(function(n){return[2,new Promise((function(n){try{var r={message:e,title:f.default.get("invalidHomePageTitle"),type:"warning",buttons:["ok","cancel"],htmlContent:!1,callback:{ok:function(){return t.Glass.resetHome(!0)}}};t.Glass.getCoreSvc(".Dialog").createDialog(r),n()}catch(e){throw t.logger.error(e),e}}))]}))}))},t.prototype.showShareDialog=function(e){return i(this,void 0,void 0,(function(){var t,n,r;return s(this,(function(o){switch(o.label){case 0:return t={urlMap:e,isEmbed:!1},n=this.Glass.getUrl(t),r={title:f.default.get("shareDialogTitle"),type:"share",width:"500px",buttons:["copy","cancel"],htmlContent:!1,payload:{url:n}},[4,this.showNewModalDialog(r)];case 1:return[2,o.sent()]}}))}))},t.prototype.showEmbedDialog=function(e){return i(this,void 0,void 0,(function(){var t,n,r;return s(this,(function(o){switch(o.label){case 0:return t={urlMap:e,isEmbed:!0},n=this.Glass.getUrl(t),r={title:f.default.get("embedDialogTitle"),type:"embed",width:"500px",buttons:["copy","cancel"],htmlContent:!1,payload:{url:n}},[4,this.showNewModalDialog(r)];case 1:return[2,o.sent()]}}))}))},t.prototype.showNewModalDialog=function(e){return i(this,void 0,void 0,(function(){var t=this;return s(this,(function(n){return[2,new Promise((function(n){try{t.Glass.getCoreSvc(".Dialog").createDialog(e),n()}catch(e){throw t.logger.error("Modal Error: Failed to load modal",e),e}}))]}))}))},t}(c.default);t.default=d},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__decorate||function(e,t,n,r){var o,i=arguments.length,s=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=s(n(1)),c=n(8),u=n(9),l=n(10),p=s(n(11)),f=function(e){function t(t){var n=e.call(this,t)||this;return n.state={embedWidth:500,embedHeight:400},n.isIOSdevice=/iPad/i.test(navigator.userAgent),n.buttonLabelMap={copy:"copyText",ok:"ok",cancel:"cancel",close:"close"},n}return o(t,e),t.prototype.bindOnClose=function(e){for(var t=this.props.Glass,n=0;n<e.length;n+=1)e[n].onClose=function(){return t.getCoreSvc(".Dialog").removeDialog()};return e},t.prototype.copyToClipboard=function(){this.targetTextarea.select(),document.execCommand("copy")},t.prototype.buttonsEmbedShareDialog=function(e){var t=this,n=this.props.Glass;return a.default.createElement(c.Dialog.Footer,null,e.buttons.map((function(r){return a.default.createElement(c.Dialog.Button,{id:"copy"===r?"copy_button":r,className:"button dialogButton "+("copy"===r?"primary":"secondary"),key:""+e.key+r,label:p.default.get(t.buttonLabelMap[r]),primary:"copy"===r,onClick:function(){"cancel"===r?n.getCoreSvc(".Dialog").removeDialog(r):"copy"===r&&t.copyToClipboard()},style:{margin:"0px 0px 0px 16px"}})})))},t.prototype.urlGenerator=function(e){if("embed"===e.type){var t=this.state,n=t.embedWidth,r=t.embedHeight;return'<iframe src="'+(e.payload&&e.payload.url?e.payload.url.replace(/&/g,"&amp;"):"")+'" width="'+n+'" height="'+r+'"></iframe>'}return e.payload&&e.payload.url?e.payload.url:""},t.prototype.urlDisplay=function(e){var t=this;return a.default.createElement("textarea",{className:"displayedURLOrCode","aria-label":p.default.get("share"===e.type?"shareDialogCodeLabel":"embedDialogCodeLabel"),tabIndex:0,readOnly:!this.isIOSdevice,style:{width:"100%",height:"96px"},ref:function(e){t.targetTextarea=e},value:this.urlGenerator(e)})},t.prototype.nodeEmbedDialog=function(e){var t=this,n=this.state,r=n.embedWidth,o=n.embedHeight;return a.default.createElement(a.default.Fragment,null,a.default.createElement(c.Dialog.Body,null,a.default.createElement("div",{className:"embedDialogText",style:{marginBottom:"24px"},"aria-label":p.default.get("embedDialogText")},p.default.get("embedDialogText")),a.default.createElement("div",{className:"embedDialogSizeAdjustor",style:{marginBottom:"16px"}},a.default.createElement("div",{style:{width:"50%",display:"inline-block"}},a.default.createElement("div",null,p.default.get("embedURLWidthLabel")),a.default.createElement(c.NumberInput,{id:"GlassMessageDialog_embedWidth",value:r,scale:1,max:1e5,onValueAccept:function(e,n){return Number(e)===Number(n)&&t.setState({embedWidth:e})}})),a.default.createElement("div",{style:{width:"50%",display:"inline-block"}},a.default.createElement("div",null,p.default.get("embedURLHeightLabel")),a.default.createElement(c.NumberInput,{id:"GlassMessageDialog_embedHeight",value:o,scale:1,max:1e5,onValueAccept:function(e,n){return Number(e)===Number(n)&&t.setState({embedHeight:e})}}))),this.urlDisplay(e)),this.buttonsEmbedShareDialog(e))},t.prototype.nodeShareDialog=function(e){return a.default.createElement(a.default.Fragment,null,a.default.createElement(c.Dialog.Body,null,a.default.createElement("div",{className:"shareDialogText",style:{marginBottom:"16px"},"aria-label":p.default.get("shareDialogText")},p.default.get("shareDialogText")),this.urlDisplay(e)),this.buttonsEmbedShareDialog(e))},t.prototype.nodeGeneralDialog=function(e){var t=this,n=this.props.Glass;return a.default.createElement(a.default.Fragment,null,e.isHTMLContent?a.default.createElement(c.Dialog.Body,{dangerouslySetInnerHTML:{__html:e.message}}):a.default.createElement(c.Dialog.Body,null,a.default.createElement("div",{className:"messageBox "+e.type},e.message)),a.default.createElement(c.Dialog.Footer,null,e.buttons.map((function(r){var o="object"==typeof r&&r.text?r.text:p.default.get(t.buttonLabelMap["string"==typeof r?r:"ok"]),i="object"==typeof r&&r.defaultId?r.defaultId:r,s="ok"===r||"object"==typeof r&&"ok"===r.defaultId;return a.default.createElement(c.Dialog.Button,{key:""+e.key+o,id:i,className:"button dialogButton "+(s?"primary":"secondary"),label:o,primary:s,onClick:function(){return n.getCoreSvc(".Dialog").removeDialog(i)},style:{margin:"0px 0px 0px 16px"}})}))))},t.prototype.renderBodyFooter=function(e){var t;switch(e.type){case"info":case"error":case"warning":t=this.nodeGeneralDialog(e);break;case"share":t=this.nodeShareDialog(e);break;case"embed":t=this.nodeEmbedDialog(e);break;default:t=this.nodeGeneralDialog(e)}return t},t.prototype.render=function(){var e=this,t=this.props.store,n=this.bindOnClose((0,l.toJS)(t?t.dialogs:[]));return n&&n.map((function(t){return a.default.createElement(c.Dialog,{size:t.size,width:t.width,className:t.className,startingFocusIndex:-1,onClose:t.onClose,style:{zIndex:9999999}},a.default.createElement(c.Dialog.SubHeader,null,t.subTitle),a.default.createElement(c.Dialog.Header,null,t.title),e.renderBodyFooter(t))}))},t=i([u.observer],t)}(a.default.Component);t.default=f},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var c=function(e){function t(t){var n=e.call(this,t)||this;return n.attachApplicationEventListeners(),n.attachUnhandledRejectionListenerToWindow(),n.attachPopStateListenerToWindow(),n}return o(t,e),t.prototype.off=function(e,t,n){this.eventService.off(e,t,n)},t.prototype.on=function(e,t,n){this.eventService.on(e,t,n)},t.prototype.emit=function(e,t){this.eventService.trigger(e,t)},t.prototype.trigger=function(e,t){this.eventService.trigger(e,t)},t.prototype.attachApplicationEventListeners=function(){var e=this;this.on("appView:titleChange",(function(t){e.trigger("change:title",t),t.value&&(document.title=t.value)}))},t.prototype.attachPopStateListenerToWindow=function(){var e=this;this.Glass.trackHistory&&(window.onpopstate=function(t){return i(e,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return(e=t.state)?(this.Glass.windowPoppingState=!0,[4,this.Glass.openAppView(e.perspective,e)]):[3,2];case 1:n.sent(),this.Glass.windowPoppingState=!1,n.label=2;case 2:return[2]}}))}))})},t.prototype.attachUnhandledRejectionListenerToWindow=function(){var e=this;window.addEventListener("unhandledrejection",(function(t){t.preventDefault(),t&&t.detail&&t.detail.reason&&e.logger.error(t.detail.reason)}))},t}(a(n(6)).default);t.default=c},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(23)),i=r(n(25)),s=r(n(26)),a=r(n(27)),c=r(n(28)),u=r(n(64)),l=r(n(65)),p=r(n(66)),f=r(n(67)),d=r(n(68)),h=r(n(69)),y=r(n(70)),v=r(n(71)),g=r(n(72)),b=r(n(12)),w=r(n(73)),m=r(n(74)),C=r(n(75)),_=r(n(76)),P=r(n(77)),S=r(n(78)),O=function(){function e(e){this.appController=e.appController,this.authInfo=e.authInfo,this.cacheAppViews=e.cacheAppViews,this.installInfo=e.installInfo,this.versionInfo=e.versionInfo,this.trackHistory=e.trackHistory,this.requirejs=e.requirejs,this.coreServices={},this.services=new _.default({}),this.registerAllCoreServices(),this.registerLegacyServices(),this.profile=this.profile||{},this.ajaxCodes={SSO:441,UNAUTHORIZED:441,AUTH_DENIED:401};var t=b.default.getQueryDataParameterMap(this);this.isAppEmbedded=t&&"embedded"===t.shareMode,this.isPrefetchSvcDisabled=t&&"disabled"===t.prefetchsvc}return e.prototype.getSvc=function(e,t){return this.services.getSvc(e,t)},e.prototype.getSvcSync=function(e){var t=null;try{t=this.services.getSvcSync(e)}catch(e){return t}return t},e.prototype.getCoreSvc=function(e){if(!this.coreServices[e])try{throw new Error('Service "'+e+'" is not a core service and may not be available synchronously...')}catch(e){this.getCoreSvc(".Logger").warn(e)}return this.services.getSvcSync(e)},e.prototype.registerCoreService=function(e,t){this.coreServices[e]=!0,this.services.register(e,t)},e.prototype.addToOptions=function(e){var t=e||{};return t.glassContext=this,t.Glass=this,t},e.prototype.isDevInstall=function(){var e=!1;return"string"==typeof this.installInfo&&(e="development"===this.installInfo.toLowerCase()),e},e.prototype.hasCapability=function(e){var t=this.getCoreSvc(".UserProfile").capabilities;return!!t&&t.includes(e)},e.prototype.isEmbedded=function(){return!!this.isAppEmbedded},e.prototype.isPrefetchDisabled=function(){return!!this.isPrefetchSvcDisabled},e.prototype.getRequireJs=function(){return this.requirejs},e.prototype.registerAllCoreServices=function(){var e=new f.default(this.addToOptions());this.registerCoreService(".Logger",new m.default),this.registerCoreService(".WindowProxy",new S.default(this,window,{dialog:!0})),this.registerCoreService(".Ajax",new u.default({configService:e})),this.registerCoreService(".Logger",new m.default),this.registerCoreService(".Context",new d.default(this.addToOptions())),this.registerCoreService(".CoachMarkService",new p.default(this)),this.registerCoreService(".FeatureChecker",new y.default(v.default)),this.registerCoreService(".Events",new h.default),this.registerCoreService(".Perspective",new i.default(this)),this.registerCoreService(".UserProfile",new P.default(this.addToOptions())),this.registerCoreService(".Config",e),this.registerCoreService(".Clipboard",new l.default(this)),this.registerCoreService(".Prefetch",new C.default(this)),this.registerCoreService(".Taxonomy",new a.default(this)),this.registerCoreService(".URLEncoder",new s.default(this)),this.registerCoreService(".Toast",new c.default(this)),this.registerCoreService(".Dialog",new o.default(this))},e.prototype.registerLegacyServices=function(){var e=this,t={ajax:new w.default(this.addToOptions()),fetch:new g.default(this.addToOptions()),userProfile:this.getCoreSvc(".UserProfile"),config:this.getCoreSvc(".Config"),logger:this.getCoreSvc(".Logger")};Object.keys(t).forEach((function(n){e.services.register(n,t[n]),e.services[n]=t[n]}))},e.prototype.getSSOLoginURL=function(){return this.getCoreSvc(".Logger").info('Glass.getSSOLoginURL has been deprecated... use getCoreSvc(".Config").getSSOLoginURL() instead.'),this.getCoreSvc(".Config").getSSOLoginURL()},e.prototype.getSSOLogoutURL=function(){return this.getCoreSvc(".Logger").info('Glass.getSSOLogoutURL has been deprecated... use getCoreSvc(".Config").getSSOLogoutURL() instead.'),this.getCoreSvc(".Config").getSSOLogoutURL()},e.prototype.getAllowedUrlLoginParameters=function(){return this.getCoreSvc(".Logger").info('Glass.getAllowedUrlLoginParameters has been deprecated... use getCoreSvc(".Config").getAllowedUrlLoginParameters() instead.'),this.getCoreSvc(".Config").getAllowedUrlLoginParameters()},e.prototype.setSSOURL=function(){return this.getCoreSvc(".Logger").info('Glass.setSSOURL has been deprecated... use getCoreSvc(".Config").setSSOURL() instead.'),this.getCoreSvc(".Config").setSSOURL()},e}();t.default=O},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(10),o=n(5),i=o.types.model({url:o.types.optional(o.types.string,"")}),s=o.types.model({defaultId:o.types.string,text:o.types.string}),a=o.types.model("DialogModel",{key:o.types.optional(o.types.string,""),message:o.types.optional(o.types.string,""),title:o.types.string,subTitle:o.types.optional(o.types.string,""),type:o.types.enumeration("dialogType",["info","error","share","embed","warning"]),buttons:o.types.optional(o.types.array(o.types.union(o.types.string,s)),[]),width:o.types.optional(o.types.string,""),hasCallback:o.types.optional(o.types.boolean,!1),isHTMLContent:o.types.optional(o.types.union(o.types.boolean,o.types.null),!1),className:o.types.optional(o.types.string,""),size:o.types.enumeration("dialogSize",["small","large"]),payload:o.types.optional(i,{})});var c=o.types.model("DialogStore",{dialogStack:o.types.optional(o.types.array(a),[])}).views((function(e){return{get dialogs(){return e.dialogStack},get dialogsInPlain(){return(0,r.toJS)(e.dialogStack)}}})).actions((function(e){return{addDialog:function(t){e.dialogStack=(0,r.observable)(e.dialogStack.concat(function(e){var t={message:e.message,title:e.title,subTitle:e.subTitle,type:e.type,buttons:e.buttons&&Array.isArray(e.buttons)?e.buttons:[],width:e.width,hasCallback:e.callback&&"object"==typeof e.callback&&Object.keys(e.callback).length>0&&Object.values(e.callback).filter((function(e){return e&&"function"==typeof e})).length>0,isHTMLContent:e.htmlContent,className:e.className,size:"error"===e.type?"small":"large",key:e.id,payload:e.payload};return a.create(t)}(t)))},removeDialog:function(){e.dialogStack=(0,r.observable)(e.dialogStack.slice(0,e.dialogStack.length-1))},removeAllDialogs:function(){e.dialogStack=(0,r.observable)([])}}}));t.default=c},function(e,t){e.exports=w},function(e,t){e.exports=m},function(e,t){e.exports=C},function(e,t){e.exports=_},function(e,t){e.exports=P},function(e,t){e.exports=S},function(e,t){e.exports=O},function(e,t){e.exports=E},function(e,t){e.exports=x},function(e,t){e.exports=j},function(e,t){e.exports=R},function(e,t){e.exports=k},function(e,t){e.exports=V},function(e,t){e.exports=T},function(e,t){e.exports=M},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=i(n(6)),a=i(n(1)),c=i(n(17)),u=i(n(80)),l=i(n(81)),p=i(n(82)),f=i(n(88)),d=i(n(90)),h=i(n(104)),y=i(n(105)),v=i(n(106)),g=i(n(19)),b=function(e){function t(t){var n=e.call(this,t)||this;return n.closeOpenWidgets=function(){return n.openPerspectiveController.closeOpenWidgets()},n.updateCurrentPerspectiveCache=function(){return n.perspectiveViewsCache.updateCache(n.Glass.currentAppView)},n.isOpeningAPerspective=function(){return n.openPerspectiveController.isOpeningAPerspective()},n.openLoginPerspective=function(e){return n.openPerspectiveController.openLoginPerspective(e)},n.openPerspective=function(e,t){return n.openPerspectiveController.openPerspective(e,t)},n.openPreviousPerspective=function(){return n.openPerspectiveController.openPreviousPerspective()},n.closeAllPerspectives=function(e,t){return n.closePerspectiveController.closeAllPerspectives(e,t)},n.closePerspective=function(e,t,r){return n.closePerspectiveController.closePerspective(e,t,r)},n.perspectiveSwitcherRegistry=new v.default(n.Glass),n.perspectiveViewsCache=new y.default(n.Glass),n.urlHelper=new g.default,n.initializeGlassUIRender(),n.openPerspectiveController=new p.default(n.Glass,n.perspectiveSwitcherRegistry,n.perspectiveViewsCache,n.glassStore,n.perspectivesRegistry,n.perspectivesFactory,n.urlHelper),n.closePerspectiveController=new u.default(n.Glass,n.perspectiveSwitcherRegistry,n.perspectiveViewsCache,n.glassStore,n.perspectivesRegistry),n}return o(t,e),Object.defineProperty(t.prototype,"cachedPerspectives",{get:function(){return this.perspectiveViewsCache.getCachedPerspectives()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isLoginViewShown",{get:function(){return!!this.openPerspectiveController.loginView},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"url",{get:function(){return this.urlHelper},enumerable:!1,configurable:!0}),t.prototype.getMountPointForGlassUI=function(){return this.Glass.rootPane.length>0&&this.Glass.rootPane[0]?this.Glass.rootPane[0]:document.getElementById("main")},t.prototype.initializeGlassUIRender=function(){this.glassStore=l.default.create(),this.perspectivesRegistry=new h.default(this.glassStore),this.perspectivesFactory=new d.default(this.perspectivesRegistry,this.Glass);try{c.default.render(a.default.createElement(f.default,{perspectiveRegistry:this.perspectivesRegistry,glassStore:this.glassStore}),this.getMountPointForGlassUI())}catch(e){this.logger.error("Mount point is not correctly set for Glass UI",e,this.Glass.rootPane)}},t}(s.default);t.default=b},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var c=a(n(37)),u=a(n(39)),l=a(n(11));var p=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.closeAllPerspectives=function(e,t){var n=this.perspectiveViewsCache.getDirtyCachedViews();if(e||!0!==t||0!==n.length){if(!e&&n.length>0)return t?function(e){var t=l.default.get("unsavedViewsMsg")+"\n\r";return e.forEach((function(e){t+=e.getTitle(!0)+"\r"})),t}(n):this.closeAllPerspectivesWithConfirmation();var r=this.closeAllPerspectiveViews(t,!0);return t?void 0:new Promise((function(e,t){r.then(e,t)}))}},t.prototype.closePerspective=function(e,t,n){return i(this,void 0,void 0,(function(){var r,o;return s(this,(function(i){return r={perspective:e},t&&(r.content={id:t}),o=this.perspectiveViewsCache.getCachedViewByPerspectiveNameAndContext(e,r),[2,this.closePerspectiveView(o,null,null,n)]}))}))},t.prototype.closeAllPerspectivesWithConfirmation=function(){return i(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,u.default.waitForCloseConfirmation(this.Glass)];case 1:return e.sent(),this.closeAllPerspectiveViews(!1,!0),[2]}}))}))},t.prototype.closeAllPerspectiveViews=function(e,t){return i(this,void 0,void 0,(function(){var n,r=this;return s(this,(function(o){return e&&this.Glass.currentAppView.updateRenderState(!0),this.Glass.previousAppView=void 0,n=[],this.perspectiveViewsCache.getCacheKeys().forEach((function(e){var o=r.perspectiveViewsCache.getCachedView(e);o.cleanupSlideoutController();var i=r.closePerspectiveView.bind(r,o,!0,t);n.push(i())})),this.perspectiveViewsCache.clearCache(),[2,Promise.all(n)]}))}))},t.prototype.closePerspectiveView=function(e,t,n,r){return i(this,void 0,void 0,(function(){return s(this,(function(o){switch(o.label){case 0:return e?!e.shouldShowCloseConfirmationDialog()||t?[3,2]:[4,u.default.waitForCloseConfirmation(this.Glass,r)]:[3,6];case 1:o.sent(),o.label=2;case 2:return e!==this.Glass.currentAppView?[3,4]:[4,this.closeOpenWidgets()];case 3:o.sent(),o.label=4;case 4:return[4,this.removePerspective(e,r)];case 5:o.sent(),this.removePerspectiveEvents(e),this.cleanSwitcherRegistry(e,n),this.Glass.previousAppView===e&&(this.Glass.previousAppView=void 0),this.perspectiveViewsCache.removeCachedView(e.cacheKey),null==n&&this.postPerspectiveClose(),o.label=6;case 6:return[2,!0]}}))}))},t.prototype.cleanSwitcherRegistry=function(e,t){var n=this.perspectiveSwitcherRegistry.getIndexOfPerspective(e);this.Glass.perspectiveSwitcherRegistry.removePerspective(e),e===this.Glass.currentAppView&&(-1===n&&(n=0),this.attemptToOpenPreviousPerspective(n,e,t))},t.prototype.postPerspectiveClose=function(){var e=this.Glass.noCloseOnLastPerspective;0===this.perspectiveSwitcherRegistry.size()&&e&&window.close(),this.pendingOpenPerspectivePromise=null},t.prototype.removePerspective=function(e,t){return i(this,void 0,void 0,(function(){return s(this,(function(n){switch(n.label){case 0:return this.perspectivesRegistry.remove(e.perspectiveModel.id),this.glassStore.removePerspectiveModel(e.perspectiveModel.id),[4,e.remove(!0,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.removePerspectiveEvents=function(e){this.Glass.off("change:title",void 0,e.viewId)},t}(c.default);t.default=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(5),o=n(10),i=r.types.model({perspectiveModels:r.types.optional(r.types.array(r.types.string),[]),registeredPerspectives:r.types.optional(r.types.array(r.types.string),[]),currentPerspective:r.types.optional(r.types.string,"")}).actions((function(e){return{addPerspectiveModel:function(t){e.perspectiveModels.push(t.id)},removePerspectiveModel:function(t){var n=e.perspectiveModels.filter((function(e){return e!==t}));e.perspectiveModels=(0,o.observable)(n)},registerPerspective:function(t){e.registeredPerspectives.push(t)},deregisterPerspective:function(t){e.registeredPerspectives.remove(t)},setCurrentPerspective:function(t){e.currentPerspective=t}}}));t.default=i},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t},c=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},u=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},l=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var p=l(n(37)),f=a(n(10)),d=l(n(24)),h=l(n(40)),y=n(41),v=n(42),g=l(n(14)),b=l(n(12)),w=l(n(11)),m=l(n(19)),C=l(n(4));var _=function(e){function t(t,n,r,o,i,s,a){var c=e.call(this,t,n,r,o,i)||this;return c.perspectivesFactory=s,c.urlHelper=a,c}return o(t,e),t.prototype.isOpeningAPerspective=function(){return void 0!==this.pendingOpenPerspectivePromise&&null!==this.pendingOpenPerspectivePromise},t.prototype.openLoginPerspective=function(e){return c(this,void 0,void 0,(function(){var t,n;return u(this,(function(r){switch(r.label){case 0:return e=void 0===e?{}:e,this.isOpeningAPerspective()?e&&e.content&&e.content.origin&&e.content.origin.relogin?(this.pendingOpenPerspectivePromise=null,[3,3]):[3,1]:[3,3];case 1:return[4,this.openPendingPerspective()];case 2:r.sent(),r.label=3;case 3:return r.trys.push([3,6,7,8]),[4,this.closeOpenWidgets()];case 4:return r.sent(),[4,this.renderPerspective("login",e,this.Glass.currentAppView)];case 5:return t=r.sent(),this.loginView=t,[2,t];case 6:throw n=r.sent(),this.handleOpenLoginViewError(),n;case 7:return this.Glass.reloadTheme(),[7];case 8:return[2]}}))}))},t.prototype.openPerspective=function(e,t){return c(this,void 0,void 0,(function(){var n,r;return u(this,(function(o){switch(o.label){case 0:return[4,this.openPendingPerspective()];case 1:o.sent(),o.label=2;case 2:return o.trys.push([2,6,,7]),"login"===e?(this.pendingOpenPerspectivePromise=this.openLoginPerspective(t),[2,this.pendingOpenPerspectivePromise]):[4,this.closeOpenWidgets()];case 3:return o.sent(),[4,this.buildPerspectiveContext(e,t)];case 4:return n=o.sent(),this.pendingOpenPerspectivePromise=this.showPerspective(n.perspectiveName,n.context),[4,this.pendingOpenPerspectivePromise];case 5:return[2,o.sent()];case 6:return r=o.sent(),this.pendingOpenPerspectivePromise=this.handleOpenPerspectiveError(r),[2,this.pendingOpenPerspectivePromise];case 7:return[2]}}))}))},t.prototype.openPreviousPerspective=function(){return this.Glass.previousAppView&&this.perspectiveViewsCache.getCachedView(this.Glass.previousAppView.cacheKey)?this.openPerspective(this.Glass.previousAppView.perspective,this.Glass.previousAppView.context):this.isOpeningAPerspective()?this.openPerspective():null},t.prototype.displayPerspective=function(e,t){return e&&"function"==typeof e.hasHomeFlag&&this.setHomeFlag(e,e.hasHomeFlag()),t&&"function"==typeof t.hide&&(t.hide(),this.perspectiveSwitcherRegistry.size()>0&&this.perspectiveViewsCache.updateCache(t)),"login"!==e.perspective&&this.loginView&&(this.removeLoginView(),this.Glass.reloadTheme()),e.show(),this.Glass.trigger("appView:loaded",{perspective:e.perspective,context:e.context,appView:e}),e.setFocus(),this.perspectiveSwitcherRegistry.addPerspective(e),this.Glass.unlockGlass(),this.Glass.isEmbedded()||this.Glass.isPrefetchDisabled()||this.prefetchResources(),e},t.prototype.deactivateCurrentPerspective=function(){return c(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return this.Glass.currentAppView?[4,this.Glass.currentAppView.deactivate()]:[3,2];case 1:e.sent(),"login"!==this.Glass.currentAppView.perspective&&(this.Glass.previousAppView=this.Glass.currentAppView),e.label=2;case 2:return[2]}}))}))},t.prototype.getPerspectiveModel=function(e,t){return c(this,void 0,void 0,(function(){var n,r,o;return u(this,(function(i){switch(i.label){case 0:return[4,this.Glass.getCoreSvc(".Perspective").getModel(e,t)];case 1:return n=i.sent(),r=C.default.extend(!0,{},n,t),(o=h.default.create({id:"login"===e?"login":(0,d.default)("id"),perspectiveName:e||r.perspective})).setSpec(r),o.setContext(t),[2,o]}}))}))},t.prototype.openHomePerspective=function(e){return c(this,void 0,void 0,(function(){var t,n,r;return u(this,(function(o){switch(o.label){case 0:return t="number"==typeof e?e:0,[4,this.Glass.getHomePageObject(t)];case 1:n=o.sent(),o.label=2;case 2:return o.trys.push([2,5,,6]),"login"===n.perspective?[2,this.openLoginPerspective(n)]:[4,this.closeOpenWidgets()];case 3:return o.sent(),[4,this.buildPerspectiveContext(n.perspective,n)];case 4:return r=o.sent(),[2,this.showPerspective(r.perspectiveName,r.context)];case 5:return o.sent(),this.logger.warn("Failed to open home page:",t,n.perspective),[2,this.openHomePerspective(t+1)];case 6:return[2]}}))}))},t.prototype.renderPerspective=function(e,t,n){return c(this,void 0,void 0,(function(){var r,o,i;return u(this,(function(s){switch(s.label){case 0:if((0,y.isPerspectiveValid)(e))return[3,1];throw new g.default(w.default.get("invalidPerspectiveErrorMessage"));case 1:return[4,this.getPerspectiveModel(e,t)];case 2:return r=s.sent(),"login"!==e&&this.updateUserProfileContext(r),[4,this.deactivateCurrentPerspective()];case 3:return s.sent(),[4,(0,v.preRenderSetup)(r,this.Glass)];case 4:return s.sent(),[4,this.renderPerspectiveView(r)];case 5:return o=s.sent(),this.perspectiveViewsCache.cacheView(e,r.spec,o),i=function(e,t,n,r){var o=JSON.parse(JSON.stringify(e));return o.content=r.content,o.perspective=n||t.perspectiveName,!o.id&&t.modelId&&(o.id=t.modelId),o}(t,r,e,o),o.context=i,[2,this.displayPerspective(o,n)]}}))}))},t.prototype.renderPerspectiveView=function(e){var t=this;this.glassStore.addPerspectiveModel(e),this.perspectivesFactory.create(e),this.glassStore.setCurrentPerspective(e.id);var n=this.perspectivesRegistry.getPerspectiveById(e.id),r=n.getPerspectiveController();this.Glass.currentAppView=r;var o=n.getPerspectiveStore();return new Promise((function(e,n){f.when((function(){return o.contentViewRendered}),(function(){return e(r)})),f.when((function(){return o.contentViewRenderFailed}),(function(){t.logger.error(new Error("AppView Error: Error creating the AppView")),n()}))}))},t.prototype.showCachedPerspective=function(e,t,n){return c(this,void 0,void 0,(function(){return u(this,(function(r){switch(r.label){case 0:return e&&n?e===this.Glass.currentAppView?[3,2]:[4,this.Glass.currentAppView.deactivate()]:[3,3];case 1:return r.sent(),[2,this.showContentView(e,t,n)];case 2:return[2,this.showContentView(e,t,n)];case 3:throw new Error("Cached appview and/or its context can not be null.")}}))}))},t.prototype.showNonCachedPerspective=function(e,t,n){return c(this,void 0,void 0,(function(){var r,o;return u(this,(function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),function(e){return e.isHomepage||e.content&&e.content.isHomepage}(t)?[3,2]:[4,this.Glass.getHomePageObject()];case 1:return r=i.sent(),!function(e,t,n){return t&&t.perspective===n&&e.content&&t.content&&e.content.pathRef===t.content.pathRef}(t,r,e)?t.isHomepage=!1:t.isHomepage=!0,[2,this.renderPerspective(e,t,n)];case 2:return t.isHomepage=!0,t.content&&delete t.content.isHomepage,[2,this.renderPerspective(e,t,n)];case 3:return o=i.sent(),this.handleShowNonCachedPerspectiveError(o,t),[3,4];case 4:return[2,null]}}))}))},t.prototype.showContentView=function(e,t,n){return c(this,void 0,void 0,(function(){return u(this,(function(r){switch(r.label){case 0:return this.Glass.previousAppView=this.Glass.currentAppView,this.Glass.currentAppView=e,this.glassStore.setCurrentPerspective(e.perspectiveModel.id),[4,e.showContentView(n)];case 1:return r.sent(),t&&(n.perspective=t),[2,e]}}))}))},t.prototype.showPerspective=function(e,t){return c(this,void 0,void 0,(function(){var n,r,o;return u(this,(function(i){switch(i.label){case 0:return n=this.perspectiveViewsCache.getCachedViewByPerspectiveNameAndContext(e,t),r=this.Glass.currentAppView,(0,y.arePerspectivesEqual)(n,r)?[2,n]:n?[4,this.showCachedPerspective(n,e,t)]:[3,2];case 1:return i.sent(),o=n.hasHomeFlag()||t&&t.isHomepage,this.setHomeFlag(n,o),[2,this.displayPerspective(n,r)];case 2:return[4,this.showNonCachedPerspective(e,t,r)];case 3:return[2,i.sent()]}}))}))},t.prototype.buildPerspectiveContext=function(e,t){return c(this,void 0,void 0,(function(){var n,r;return u(this,(function(o){switch(o.label){case 0:return n=this.buildNewPerspectiveContext(e,t),void 0!==e&&void 0===n.content.pathRef?[2,{context:n,perspectiveName:e}]:[4,this.getDefaultActionUrlMap(n.content)];case 1:return r=o.sent(),[2,{context:function(e,t,n){var r=t;return void 0===e&&(r.isDefaultAction=!0),r.isHomepage=t.isHomepage||n&&n.isHomepage,r.content=n,r}(e,n,r),perspectiveName:void 0===e?r.perspective:e}]}}))}))},t.prototype.buildNewPerspectiveContext=function(e,t){var n=t||{};return n.content=n.content||{},n.content.perspective=e,this.Glass.currentAppView&&this.Glass.currentAppView.context&&this.Glass.currentAppView.context.content&&(n=this.urlHelper.updateContextWithCurrentUIFilters(this.Glass.currentAppView.context.content,n)),n},t.prototype.getDefaultActionUrlMap=function(e){return c(this,void 0,void 0,(function(){var t,n,r,o,i;return u(this,(function(s){switch(s.label){case 0:return e&&(e.pathRef||e.objRef)?[4,this.urlHelper.getObjInfoFromContent(this.Glass,e)]:[3,3];case 1:return t=s.sent(),C.default.extend(!0,t,e),void 0===t.id&&(t.id=t.objRef),t.perspective?[2,t]:[4,b.default.getSharedResourceActionController(this.Glass,t.type)];case 2:return n=s.sent(),r={urlMap:t,mode:m.default.MODES.DEFAULT_ACTION,Glass:this.Glass,glassContext:this.Glass},[2,this.urlHelper.getUrlMap(n,this.Glass,r)];case 3:return e&&e.perspective?[3,5]:[4,this.Glass.getHomePageObject()];case 4:return o=s.sent(),i={perspective:o.perspective},C.default.extend(!0,i,e,o.content),i.pathRef?[2,this.getDefaultActionUrlMap(i)]:[2,i];case 5:return[2,null]}}))}))},t.prototype.handleOpenLoginViewError=function(){var e=w.default.get("customLoginPerspectiveNotFound"),t=w.default.get("defaultToIBMLoginPage");this.Glass.showErrorMessage(t,e,(function(){var e=window.location.href;e.includes("/",e.length-1)?window.location.href=e+"?factoryMode=true":window.location.href=e+"&factoryMode=true"}))},t.prototype.handleOpenPerspectiveError=function(e){return c(this,void 0,void 0,(function(){var t,n,r,o=this;return u(this,(function(i){switch(i.label){case 0:if(this.logger.error("openAppView",e),t=function(e){var t=!0===e?"errLoadingViewShowHome":"errLoadingView";o.Glass.showToast(w.default.get(t),{type:"error",preventDuplicates:!1})},n=function(){var e=w.default.get("errLoadingView"),t=w.default.get("errorLabel");return o.Glass.showErrorMessage(e,t),o.Glass.currentAppView},0!==this.perspectiveSwitcherRegistry.size())return[3,4];this.pendingOpenPerspectivePromise=null,i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.openHomePerspective()];case 2:return r=i.sent(),t(!0),[2,r];case 3:return i.sent(),n(),[3,4];case 4:return t(),[2,null]}}))}))},t.prototype.handleShowNonCachedPerspectiveError=function(e,t){var n=e.message,r="Error";throw e.ajaxOptions&&e.ajaxOptions.url?(n="Glass Perspective Service : "+e.ajaxOptions.url,r=w.default.get("error404NotFound")):"BaseError"===e.name?r="Error: "+w.default.get("invalidPerspectiveErrorTitle"):404===e.code&&(r=w.default.get("perspective404ErrorTitle"),n=w.default.get("perspective404ErrorMessage"),t.isHomepage&&(n=w.default.get("perspective404HomeErrorMessage"))),this.logger.error("Perspective Error: Failed to load the requested perspective"),this.Glass.showErrorMessage(n,r),e},t.prototype.openPendingPerspective=function(){var e=this;try{return this.pendingOpenPerspectivePromise=Promise.resolve(this.pendingOpenPerspectivePromise).finally((function(){e.pendingOpenPerspectivePromise=null})),this.pendingOpenPerspectivePromise}catch(e){return this.logger.error("openAppView - previous attempt failed",e),Promise.resolve()}},t.prototype.removeLoginView=function(){this.perspectivesRegistry.remove("login"),this.loginView.getContentPane().remove(),this.loginView.remove(!0),this.loginView=void 0},t.prototype.updateUserProfileContext=function(e){return c(this,void 0,void 0,(function(){var t;return u(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.Glass.getCoreSvc(".UserProfile").updateContext(e.context)];case 1:return n.sent(),[3,3];case 2:return t=n.sent(),this.logger.error("Perspective Error: Could not get the account info",t),this.Glass.showErrorMessage(w.default.get("unableGetAccountInfo"),w.default.get("accountInfoTitle")),[3,3];case 3:return[2]}}))}))},t}(p.default);t.default=_},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.loadStyles=t.disableStylesFromInactivePerspectives=void 0;var s=n(43),a=n(84),c=i(n(4));function u(e){return r(this,void 0,void 0,(function(){var t,n;return o(this,(function(r){switch(r.label){case 0:return t=function(e){return e.includes("?")&&(e=e.substring(0,e.indexOf("?"))),e}(e),(n=function(e){return document.querySelector('head style[styleid="'+e+'"], head link[styleid="'+e+'"]')}(t))?(n.setAttribute("media","all"),[3,3]):[3,1];case 1:return[4,(0,a.loadStylesheet)(c.default.ajax,e,[{name:"styleid",type:t},{name:"loader",type:"ba-glass"},{name:"type",type:"text/css"},{name:"media",type:"all"}])];case 2:r.sent(),r.label=3;case 3:return[2]}}))}))}function l(e,t){for(var n=t.querySelectorAll('head link[rel="stylesheet"], head style[loader="ba-glass"]'),r=0;r<n.length;r+=1){var o=n[r],i=o.getAttribute("styleid");i&&!e.includes(i)&&o.setAttribute("media","none")}}t.disableStylesFromInactivePerspectives=l,t.loadStyles=function(e,t){return r(this,void 0,void 0,(function(){var n,r,i;return o(this,(function(o){switch(o.label){case 0:return e?(n=(0,s.getUrlArgs)(t),r=e.map((function(e){return n&&(e+=n),u(e)})),[4,Promise.all(r)]):[3,2];case 1:return i=o.sent(),l(e,document),[2,i];case 2:return[2,[]]}}))}))}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.loadStylesheet=t.updateRelativeUrlsInCssFile=void 0;var i=["data:","//",'url("/',"url('/","url(/"],s=['url("./','url("',"url('./","url('","url(./","url("];function a(e,t){if(!t||!t.includes("/"))return e;try{var n=t.split("/");n.pop();var r=n.join("/"),o=e.match(/url\([^)]+\)/g);o&&o.length>0&&o.filter((function(e){for(var t=0;t<i.length;t+=1)if(e.includes(i[t]))return!1;return!0})).forEach((function(t){for(var n=0;n<s.length;n+=1){var o=s[n];if(t.includes(o)){var i=t.replace(o,""+o.replace("./","")+r+"/");e=e.replace(t,i);break}}}))}catch(e){console.error(e)}return e}t.updateRelativeUrlsInCssFile=a,t.loadStylesheet=function(e,t,n){return void 0===n&&(n=[]),r(this,void 0,void 0,(function(){var r,i;return o(this,(function(o){switch(o.label){case 0:return r=new Promise((function(r,o){e(t).then((function(e){var o=a(e,t),i=document.createElement("style");i.innerHTML=o,n.forEach((function(e){return i.setAttribute(e.name,e.type)})),document.getElementsByTagName("head")[0].appendChild(i),r(i)})).catch(o)})),i=new Promise((function(e,t){setTimeout(t,12e4)})),[4,Promise.race([r,i])];case 1:return[2,o.sent()]}}))}))}},function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return c}));var r=n(7),o=n.n(r),i=n(30),s=n.n(i);function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var c=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,r;return t=e,r=[{key:"loadSVGIcons",value:function(e){var t=this;e&&e.forEach((function(e){t.setSVGIcons(e)}))}},{key:"unloadSVGIcons",value:function(e){var t=this;e&&e.forEach((function(e){t.unsetSVGIcons(e)}))}},{key:"setSVGIcons",value:function(e){var t=this.getSVGId(e);document.getElementById(t)||this.loadSVGModule(e).then((function(e){var n=document.createElement("div");n.setAttribute("id",t),n.innerHTML=e;var r=document.getElementById("svgIcons");r||s()(),r.appendChild(n)})).catch((function(){throw new Error("failed to load svg icon: ".concat(e))}))}},{key:"unsetSVGIcons",value:function(e){var t=this.getSVGId(e),n=document.getElementById(t);n&&n.parentNode&&n.parentNode.removeChild(n)}},{key:"loadSVGModule",value:function(e){return o.a.loadModule("text!".concat(e,"!strip"))}},{key:"getSVGId",value:function(e){return e.replace(/[^\w]/g,"_")}}],(n=null)&&a(t.prototype,n),r&&a(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}()},function(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.Immediate="immediate",e.Defer="defer",e.Declare="declare"}(r||(r={})),t.default=r},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=i(n(7));t.default=function(e){return r(this,void 0,void 0,(function(){var t;return o(this,(function(n){switch(n.label){case 0:return e?(t=e.map((function(e){return s.default.loadModule(e)})),[4,Promise.all(t)]):[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}}))}))}},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__decorate||function(e,t,n,r){var o,i=arguments.length,s=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=s(n(1)),c=n(9),u=s(n(89)),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.getPerspectiveView=function(e){var t=this.props,n=t.glassStore,r=t.perspectiveRegistry.getPerspectiveById(e);return a.default.createElement(u.default,{key:e,perspectiveStore:r.getPerspectiveStore(),glassStore:n},r.getPerspectiveView())},t.prototype.render=function(){var e=this,t=this.props.glassStore;return a.default.createElement(a.default.Fragment,null,t.registeredPerspectives.map((function(t){return e.getPerspectiveView(t)})))},t=i([c.observer],t)}(a.default.Component);t.default=l},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__decorate||function(e,t,n,r){var o,i=arguments.length,s=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=s(n(1)),c=n(9),u=s(n(2)),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.getClassNames=function(){var e=this.props,t=e.perspectiveStore,n=e.glassStore,r="appview";t.perspectiveModel.id!==n.currentPerspective&&(r+=" hidden");var o=t.perspectiveModel.layout;return o[u.default.LOOPS]&&o.class&&(r+=" "+o.class),r},t.prototype.render=function(){var e=this.props.children;return a.default.createElement("div",{className:this.getClassNames()},e)},t=i([c.observer],t)}(a.default.Component);t.default=l},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(91)),i=function(){function e(e,t){this.glassContext=t,this.perspectivesRegistry=e}return e.prototype.create=function(e){var t=this;e?(Array.isArray(e)||(e=[e]),e.forEach((function(e){t.perspectivesRegistry.add(e.id,new o.default(e,t.glassContext))}))):this.glassContext.getCoreSvc(".Logger").error("Error creating the perspective, perspectiveModels is undefined")},e}();t.default=i},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(1)),i=r(n(92)),s=r(n(101)),a=r(n(111)),c=r(n(48));var u=function(){function e(e,t){this.perspectiveStore=function(e){return s.default.create({perspectiveModel:e,contextMenuStore:c.default.create()})}(e),this.perspectiveController=function(e,t){return new i.default(e,t)}(this.perspectiveStore,t),this.perspectiveView=function(e,t,n){return o.default.createElement(a.default,{appView:e,glassContext:n,perspectiveStore:t,toolBars:t.perspectiveModel.toolBars,addPluginRenderToQueue:e.addPluginRenderToQueue,onPerspectiveViewMounted:e.renderAllPlugins,onContentContainerMounted:e.setContentContainerMounted,onNoContentViewFound:e.resolveViewRenderPromise,successContentViewRenderCallback:e.successContentViewRenderCallback,failureContentViewRenderCallback:e.failureContentViewRenderCallback,getContentView:e.getCurrentContentView})}(this.perspectiveController,this.perspectiveStore,t),this.registeredPlugins={}}return e.prototype.registerPlugin=function(e,t){this.registeredPlugins[e]=t},e.prototype.getRegisteredPlugin=function(e){return this.registeredPlugins[e]?this.registeredPlugins[e]:null},e.prototype.getPerspectiveController=function(){return this.perspectiveController},e.prototype.getPerspectiveStore=function(){return this.perspectiveStore},e.prototype.getPerspectiveView=function(){return this.perspectiveView},e}();t.default=u},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},o=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&o(t,e,n);return i(t,e),t},a=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},c=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},u=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var l=u(n(4)),p=u(n(3)),f=s(n(10)),d=u(n(14)),h=u(n(39)),y=u(n(93)),v=u(n(94)),g=u(n(95)),b=u(n(46)),w=u(n(11)),m=u(n(19)),C=u(n(12)),_=u(n(96)),P=n(42),S=u(n(99)),O=u(n(47)),E=u(n(100)),x=n(44),j=function(){function e(e,t){var n=this;this.onContentViewReadyToLoad=function(){try{n.loadContentView()}catch(e){n.glassContext.getCoreSvc(".Logger").error("Error loading Content View",e)}},this.loadContentView=function(){var e=O.default.CONTENT_VIEW_LOAD_IN_PROGRESS;n.perspectiveStore.updateRenderState(e);var t=n._getContextForContentView();return(0,x.createContentView)(t,n.glassContext,n).then((function(e){return n.postContentViewCreation(t,e)})).catch((function(e){var t=O.default.CONTENT_VIEW_LOAD_FAILURE;n.perspectiveStore.updateRenderState(t),n.glassContext.getCoreSvc(".Logger").error("Failure showing the content view",e)}))},this.addPluginRenderToQueue=function(e){n.pluginsRenderQueue.push(e)},this.renderAllPlugins=function(){return Promise.all(n.pluginsRenderQueue).then((function(e){e.forEach((function(e){if(e&&e.pluginId){var t=e.pluginId,r=e.plugin;n.registerPlugin(t,r)}}));var t=O.default.PLUGINS_RENDER_SUCCESS;n.perspectiveStore.updateRenderState(t)}))},this.setContentContainerMounted=function(e){n.perspectiveStore.setContainerMounted(!0),n.setContentPane(e)},this.successContentViewRenderCallback=function(){var e=n.getCurrentContentView();e&&(p.default.isFunction(e.on)?(e.on("change:title",n._triggerTitleChange),e.on("change:dirty",n._triggerStateChange),e.on("change:state",n._triggerStateChange)):(e.triggerTitleChange=n._triggerTitleChange,e.triggerStateChange=n._triggerStateChange)),n._triggerTitleChange({value:n.getTitle()}),y.default.createPerformanceMark({component:"glass",name:"renderContentView",state:"end"}),n.perspectiveStore.updateRenderState(O.default.CONTENT_VIEW_RENDER_SUCCESS)},this.failureContentViewRenderCallback=function(e){n.glassContext.getCoreSvc(".Logger").error("ContentView Error","Failed loading content view",e),e&&e.message&&""!==e.message&&n.glassContext.showErrorMessage(e.message,"Error",null,null),n.perspectiveStore.updateRenderState(O.default.CONTENT_VIEW_RENDER_FAILURE)},this.resolveViewRenderPromise=function(){n.perspectiveStore.updateRenderState(O.default.CONTENT_VIEW_RENDER_SUCCESS)},this.setContextMenuItemsAndPosition=function(e,t){var r=n.perspectiveStore.contextMenuStore;r&&(r.updatePosition(t),r.updateItems(e),r.showMenu())},this._getContextForContentView=function(){var e=r({},n.perspectiveModel.spec)||{};e.content||(e.content=n.defaultContent);var t=e.content;return t&&!t.module&&(e.module=n.defaultContent.module),e},this._triggerStateChange=function(){n.updateRenderState(!0)},this._triggerTitleChange=function(e){n.glassContext.trigger("appView:titleChange",{value:e.value,appView:n})},this.getCurrentContentView=function(){return n.currentContentView},this.perspectiveStore=e,this.perspectiveModel=this.perspectiveStore.perspectiveModel,this.perspective=this.perspectiveModel.perspectiveName,this.glassContext=t,this.defaultContent=this.perspectiveModel.spec.content,this.pluginsRenderQueue=[],this.registeredPlugins={},this._slideoutController=new g.default({registry:{application:t.slideoutRegistry,appView:new b.default}}),this._url=new m.default,this.isHomepage=!1,f.when((function(){return n.perspectiveStore.viewReadyToLoadContentView}),this.onContentViewReadyToLoad)}return e.prototype.postContentViewCreation=function(e,t){var n=this;return this.prependContentView(t),this._updateSlideoutContainer().then((function(){n._setCurrentContentView(t,e),y.default.createPerformanceMark({component:"glass",name:"renderContentView",state:"start"});var r=O.default.CONTENT_VIEW_LOAD_SUCCESS;n.perspectiveStore.updateRenderState(r)}))},e.prototype.prependContentView=function(e){this.$contentViewDomContainer=this.getContentPane(),this.$contentViewDomContainer.prepend(e.$el)},e.prototype.showContextMenu=function(e){return a(this,void 0,void 0,(function(){var t;return c(this,(function(n){switch(n.label){case 0:return(t=this.perspectiveModel.contextMenuSettings)?[4,(0,_.default)(t,e,this.glassContext)]:[3,2];case 1:return[2,n.sent()];case 2:return[2,null]}}))}))},e.prototype.show=function(){(0,P.loadStylesAndIcons)(this.perspectiveModel,this.glassContext)},e.prototype.hide=function(){(0,P.unloadIcons)(this.perspectiveModel,this.glassContext)},e.prototype.deactivate=function(){var e=this;return this.glassContext.getCoreSvc(".Events").trigger("deactivate"),this.currentContentView&&this.currentContentView.deactivate&&!this.currentContentView.deactivated?Promise.resolve(this.currentContentView.deactivate()).then((function(){e.currentContentView.deactivated=!0})):Promise.resolve()},e.prototype.remove=function(e,t){var n=this;return!e&&this.shouldShowCloseConfirmationDialog()?h.default.waitForCloseConfirmation(this.glassContext,t).then((function(){return n._remove()})):this._remove()},e.prototype._remove=function(){var e=this;if(this.deactivate(),this===this.glassContext.currentAppView&&this.glassContext.perspectiveSwitcherRegistry.size()>1){var t=this.glassContext.perspectiveSwitcherRegistry.getPerspectiveByIndex(0),n=t.getContentPane();n&&t._slideoutController.updateRegistryContainer(n)}return Promise.resolve().then((function(){return e.currentContentView&&p.default.isFunction(e.currentContentView.remove)?(e.contentViewRemoved=!0,e.currentContentView.remove()):Promise.resolve()})).catch((function(t){e.glassContext.getCoreSvc(".Logger").error("An error occurred while removing the content view",t)})).then(this._postRemove.bind(this))},e.prototype._postRemove=function(){this.setContentPane(void 0)},e.prototype.isDirty=function(){return this.currentContentView&&p.default.isFunction(this.currentContentView.isDirty)&&this.currentContentView.isDirty()},e.prototype.shouldShowCloseConfirmationDialog=function(){return!!this.isDirty()&&(!this.currentContentView||!p.default.isFunction(this.currentContentView.shouldShowCloseConfirmationDialog)||this.currentContentView.shouldShowCloseConfirmationDialog())},e.prototype.getTitle=function(e){var t=this.currentContentView&&p.default.isFunction(this.currentContentView.getTitle)?this.currentContentView.getTitle():this.perspectiveModel.perspectiveName;return void 0===t&&(t=w.default.get("unavailable")),!e&&this.isDirty()&&(t+=" *"),t},e.prototype.getIcon=function(){return this.currentContentView&&p.default.isFunction(this.currentContentView.getIcon)&&this.currentContentView.getIcon()},e.prototype.getIconTooltip=function(){return this.currentContentView&&p.default.isFunction(this.currentContentView.getIconTooltip)&&this.currentContentView.getIconTooltip()},e.prototype.getIconColor=function(){var e="";try{e=this.currentContentView&&p.default.isFunction(this.currentContentView.getIconColor)&&this.currentContentView.getIconColor()}catch(e){this.glassContext.getCoreSvc(".Logger").warn("issue getting icon color from current content view",e)}return e||(e="#1d3458"),e},e.prototype.getContentPane=function(){return this.$contentPane},e.prototype.setContentPane=function(e){this.$contentPane=e},e.prototype._updateSlideoutContainer=function(){var e=this;return new Promise((function(t){var n=e.getContentPane();if(n)try{e._slideoutController.updateRegistryContainer(n),t()}catch(r){e.glassContext.getCoreSvc(".Logger").warn("Failed to update slideout container. Slideouts stuck open in previous view. Closing and trying again...",r),e.glassContext.closeOpenWidgets().then((function(){e._slideoutController.updateRegistryContainer(n),t()})).catch((function(){e._slideoutController.updateRegistryContainer(n),t()}))}else t()}))},e.prototype.showContentView=function(e){var t=this;return this._updateSlideoutContainer().then((function(){(e=e||{}).content||(e.content=t.defaultContent);var n=e.content;return n&&!n.module&&(n.module=t.defaultContent.module),t.currentContentView?t._setContentView(e):Promise.resolve()}))},e.prototype._setContentView=function(e){var t=this;return this.currentContentView.activate&&this.currentContentView.deactivated?this.currentContentView.activate(e.content).then((function(){return t._setContentViewHelper(e)})):Promise.resolve(this._setContentViewHelper(e))},e.prototype._setContentViewHelper=function(e){return this._setCurrentContentView(this.currentContentView,e),this.currentContentView},e.prototype.onViewRendered=function(){var e=this;return new Promise((function(t,n){f.when((function(){return e.perspectiveStore.contentViewRendered}),(function(){return t(e)})),f.when((function(){return e.perspectiveStore.contentViewRenderFailed}),(function(){return n()}))}))},e.prototype.registerPlugin=function(e,t){p.default.isString(e)&&(this.registeredPlugins[e]=t)},e.prototype.performAction=function(e,t){var n=this.perspectiveModel.actions;return n?Promise.resolve(S.default.performAction(e,t,n)):Promise.reject(new d.default("Internal error: unable to find action for "+e))},e.prototype.canExecuteAction=function(e,t){var n=this.perspectiveModel.actions;return n?S.default.canExecuteAction(e,t,n):Promise.reject(new d.default("Internal error: unable to find action for "+e))},e.prototype.openSlideout=function(e){return this.glassContext.addToOptions(e),this._openSlideout("appView",e)},e.prototype.closeAllOpenedSlideouts=function(e){return this._slideoutController.closeAllOpenedSlideouts(e)},e.prototype._openSlideout=function(e,t){return t.parent&&!Object.prototype.isPrototypeOf.call(v.default,t)?t.parent.addChild(t):this._slideoutController.openSlideout(e,t)},e.prototype._setCurrentContentView=function(e,t){this.context=t,this.content=t.content,this.currentContentView=e,this.updateRenderState(!1),this.currentContentView.deactivated=!1,e.show()},e.prototype.setAsHome=function(e){var t=this;return Promise.resolve().then((function(){var n=t.getType();return p.default.isUndefined(n)?t._setAsHome({perspective:t.perspectiveModel.perspectiveName,id:t.context&&t.context.id}):C.default.getSharedResourceActionController(t.glassContext,n).then((function(r){var o={urlMap:{objRef:t.content?t.content.objRef:void 0,type:n},mode:m.default.MODES.CURRENT};return t.content.mode&&(o.urlMap.mode=t.content.mode),p.default.extend(o,e),t._url.getUrlMap(r,t.glassContext,o).then(t._setAsHome.bind(t))}))}))},e.prototype.setHomeFlag=function(e){this.context.isHomepage=!0===e},e.prototype.hasHomeFlag=function(){return!0===this.context.isHomepage},e.prototype._setAsHome=function(e){var t=this._url.getContextFromUrlMap(e),n={homePage:JSON.stringify(t)};return this.glassContext.getCoreSvc(".UserProfile").savePreferences(n).then(this.setHomeFlag.bind(this,!0))},e.prototype.getType=function(){var e=this.currentContentView;return!p.default.isUndefined(e)&&p.default.isFunction(e.getType)?e.getType():E.default[this.perspective]},e.prototype.getContent=function(e){var t,n=this.currentContentView;return!p.default.isUndefined(n)&&p.default.isFunction(n.getContent)&&(t=n.getContent(e)),t},e.prototype._updateHistory=function(e,t,n,r){if(!this.context.content.options||!this.context.content.options.ignoreInWindowHistory){e.name=e.perspective;try{!0===r||this===this.glassContext.previousAppView?window.history.replaceState(e,t,n):window.history.pushState(e,t,n)}catch(e){}}},e.prototype.updateRenderState=function(e){var t=this._getContext(),n=this.getTitle();if(this.glassContext.trackHistory&&!this.glassContext.windowPoppingState&&"login"!==this.perspective&&t.content){var r=this._getContext({mode:"bookmark"}),o=p.default.omit(r,"content");Object.assign(o,this.content);var i=Object.assign(this._url.getPublicMap({urlMap:o}),r.content);delete i.module;var s=this._url.getUrl({urlMap:i},this.glassContext);this.glassContext.previousAppView&&"login"!==this.glassContext.previousAppView.perspective?this._updateHistory(t,n,s,e):this._updateHistory(t,n,s,!0)}this._triggerTitleChange({value:n})},e.prototype._getContext=function(e){var t={perspective:this.perspective},n=this.perspectiveModel.modelId;if(n&&(t.id=n),this.currentContentView){var r=this.getContent(e)||this.content;r&&(t.content=r)}return t},e.prototype.cleanupSlideoutController=function(){this._slideoutController.cleanupSlideoutRegistry()},e.prototype.getCurrentPerspective=function(){return this.perspective},e.prototype.setFocus=function(){!p.default.isUndefined(this.currentContentView)&&p.default.isFunction(this.currentContentView.setFocus)&&this.currentContentView.setFocus()},e.prototype.$=function(e){return(0,l.default)(".appview:not(.hidden)").find(e)},e}();t.default=j},function(e,t){e.exports=A},function(e,t){e.exports=I},function(e,t){e.exports=D},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ContextMenuErrors=void 0;var s,a=i(n(97)),c=i(n(98)),u=i(n(3)),l=i(n(4));function p(e,t,n){return{msg:e,menuId:t,menuSpecs:n}}function f(e,t,n,i){return r(this,void 0,void 0,(function(){var r,a,c,u;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,e.render()];case 1:return r=o.sent(),a=(0,l.default)(r),(0,l.default)("body").append(a),function(e,t){var n=e.pageX,r=e.pageY,o=t.outerWidth()+3,i=t.outerHeight()+3,s=window.innerWidth,a=window.innerHeight;s-n<o?t.css("left",s-o):t.css("left",n),a-r<i?t.css("top",a-i):t.css("top",r)}(t,a),[3,3];case 2:throw c=o.sent(),(u=p(s.FAILURE_RENDERING_MENU,n,i)).causedBy=c,u;case 3:return[2]}}))}))}!function(e){e.INVALID_MENU_ID="Menu id is not a valid string",e.NOT_FOUND_MENU_ID="The menu was not found with the provided id",e.FAILURE_RENDERING_MENU="The menu failed to render"}(s=t.ContextMenuErrors||(t.ContextMenuErrors={})),t.default=function(e,t,n){return r(this,void 0,void 0,(function(){var r;return o(this,(function(o){switch(o.label){case 0:return c.default.hideOpenMenus(),function(e,t){if(!e||!u.default.isString(e.menuId))throw p(s.INVALID_MENU_ID,e&&e.menuId,t);if(!u.default.isArray(t))throw p(s.NOT_FOUND_MENU_ID,e.menuId,t)}(t,e),r=function(e,t){var n=e.reduce((function(e,t){return t.id&&(e[t.id]=t),e}),{});if(!n[t])throw p(s.NOT_FOUND_MENU_ID,t,e);return n}(e,t.menuId),[4,f(new a.default({itemSpec:r[t.menuId],activeObject:t.activeObject,glassContext:n,options:t.options}),t.position,t.menuId,e)];case 1:return o.sent(),[2]}}))}))}},function(e,t){e.exports=L},function(e,t){e.exports=N},function(e,t,n){"use strict";n.r(t);var r=n(3),o=n.n(r),i=n(14),s=n.n(i),a=n(7),c=n.n(a),u={};function l(e,t){var n=e[t].controller;return u[n]?Promise.resolve(u[n]):function(e){return c.a.instantiate(e)}(n).then((function(e){return u[n]=e,e}))}function p(e,t,n,r,o){var i=n+1;return i>=e.length?"canExecute"!==o||!0!==r&&!1!==r?Promise.reject(r):Promise.resolve(r):d(e,t,i,o)}function f(e,t,n,r,i){return"defaultAction"===i?function(e,t,n,r){if(o.a.isFunction(e.doAction))return Promise.resolve(e.doAction(n)).catch((function(e){return p(t,n,r,e,"defaultAction")}));var i=new s.a("doAction is not defined on the controller");return p(t,n,r,i,"defaultAction")}(e,t,n,r):"canExecute"===i?Promise.resolve(!0):Promise.resolve()}function d(e,t,n,r){return l(e,n).then((function(i){var a;return o.a.isFunction(i.canExecute)?!0===i.canExecute(t)?f(i,e,t,n,r):("defaultAction"===r?a=new s.a("Action controller can not execute this object."):"canExecute"===r&&(a=!1),p(e,t,n,a,r)):f(i,e,t,n,r)})).catch((function(o){return p(e,t,n,o,r)}))}function h(e,t,n,r){var o=r.find((function(t){return t.id===e}));return o?function(e,t,n,r){return e&&e.length>0?d(e,t,0,r):Promise.reject(new s.a("Internal error: no controller defined for ".concat(n)))}(o.items,t,e,n):Promise.reject(new s.a("Internal error: unable to find action for ".concat(e)))}function y(e,t,n,r){return r?h(e,t,n,r):Promise.reject(new s.a("No action controllers defined."))}var v={performAction:function(e,t,n){return y(e,t,"defaultAction",n)},canExecuteAction:function(e,t,n){return y(e,t,"canExecute",n)}};t.default=v},function(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.dashboard="exploration",e.authoring="report",e.classicviewer="interactiveReport",e.datasets="dataSet2",e.modeller="module",e.savedoutput="output"}(r||(r={})),t.default=r},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=n(5),i=r(n(3)),s=r(n(47)),a=r(n(40)),c=r(n(48)),u=s.default.PLUGINS_RENDER_IN_PROGRESS,l=s.default.PLUGINS_RENDER_SUCCESS,p=s.default.CONTENT_VIEW_LOAD_SUCCESS,f=s.default.CONTENT_VIEW_LOAD_FAILURE,d=s.default.CONTENT_VIEW_RENDER_SUCCESS,h=s.default.CONTENT_VIEW_RENDER_FAILURE,y=o.types.model({containerMounted:o.types.optional(o.types.boolean,!1),perspectiveModel:a.default,renderState:o.types.optional(o.types.enumeration("RenderState",i.default.values(s.default)),u),visible:o.types.optional(o.types.boolean,!1),contextMenuStore:c.default}).views((function(e){return{get viewReadyToLoadContentView(){return e.renderState===l&&e.containerMounted},get contentViewLoadedSuccessfully(){return e.renderState===p||e.renderState===d},get contentViewLoadFailed(){return e.renderState===f},get contentViewRendered(){return e.renderState===d},get contentViewRenderFailed(){return e.renderState===h},get loaded(){return e.renderState===d||e.renderState===f||e.renderState===h}}})).actions((function(e){return{setVisibility:function(t){e.visible=t},updateRenderState:function(t){e.renderState=t},setContainerMounted:function(t){e.containerMounted=t}}}));t.default=y},function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return d}));var r=n(1),o=n(0),i=n.n(o);function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=f(e);if(t){var o=f(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return p(this,n)}}function p(e,t){if(t&&("object"===s(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var d=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&u(e,t)}(i,e);var t,n,r,o=l(i);function i(){return a(this,i),o.apply(this,arguments)}return t=i,(n=[{key:"componentDidMount",value:function(){var e=this.props,t=e.htmlElement,n=e.containerRef;n&&t&&t.parentNode!==n&&n.appendChild(t)}},{key:"render",value:function(){return null}}])&&c(t.prototype,n),r&&c(t,r),Object.defineProperty(t,"prototype",{writable:!1}),i}(r.Component);d.propTypes={htmlElement:i.a.object.isRequired,containerRef:i.a.instanceOf(Element).isRequired}},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__decorate||function(e,t,n,r){var o,i=arguments.length,s=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=s(n(1)),c=n(8),u=n(9),l=s(n(3)),p=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.render=function(){var e=this.props,t=e.store,n=e.className,r=t.disabled,o=t.iconId,i=t.label,s=n+(r?" disabled":" enabled");return t.visible&&a.default.createElement("div",{className:s},o&&a.default.createElement(c.SVGIcon,{className:"svgIcon",iconId:o,size:"normal",verticalAlign:"middle"}),l.default.unescape(i))},t=i([u.observer],t)}(a.default.Component);t.default=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){this.perspectives={},this.glassStore=e}return e.prototype.add=function(e,t){this.perspectives[e]=t,this.glassStore.registerPerspective(e)},e.prototype.remove=function(e){this.glassStore.deregisterPerspective(e),delete this.perspectives[e]},e.prototype.getPerspectiveById=function(e){return this.perspectives[e]},e}();t.default=r},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};function s(e,t){var n=e;return t&&t.content&&t.content.id?n+="|"+t.content.id:t&&t.id&&(n+="|"+t.id),n}Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){function t(t){var n=e.call(this,t)||this;return n.cache={},n}return o(t,e),Object.defineProperty(t.prototype,"perspectiveViewsCache",{get:function(){return this.cache},enumerable:!1,configurable:!0}),t.prototype.cacheView=function(e,t,n){if(this.Glass.cacheAppViews&&"login"!==e){var r=s(e,t);n.cacheKey=r,this.cache[r]=n}},t.prototype.clearCache=function(){this.cache={}},t.prototype.getCacheKeys=function(){return Object.keys(this.cache)},t.prototype.getCachedPerspectives=function(){return Object.values(this.cache)},t.prototype.getCachedView=function(e){return this.cache[e]},t.prototype.getCachedViewByPerspectiveNameAndContext=function(e,t){return this.cache[s(e,t)]},t.prototype.getDirtyCachedViews=function(){var e=this,t=[];return this.getCacheKeys().forEach((function(n){var r=e.getCachedView(n);r.shouldShowCloseConfirmationDialog()&&t.push(r)})),t},t.prototype.removeCachedView=function(e){this.getCachedView(e)&&delete this.cache[e]},t.prototype.updateCache=function(e){var t=s(e.perspective,e.context);if(e.context){var n=e.context.id,r=e.context?e.context.id:void 0,o=r||n,i=void 0,a=void 0,c={};e.contentViewRemoved||(i=e.getContent(e.context.content))&&(a=i.id?i.id:r,e.context.content=i,e.content=i,a!==o&&(e.id=a),delete this.cache[t],c={id:a},this.cacheView(e.perspective,c,e))}},t}(i(n(6)).default);t.default=a},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=function(e){function t(t){var n=e.call(this,t)||this;return n.registry=[],n}return o(t,e),t.prototype.addPerspective=function(e){e&&"login"!==e.perspective&&!this.registry.includes(e)&&this.registry.push(e)},t.prototype.clearAllPerspectiveHomeFlags=function(){this.registry.forEach((function(e){e.setHomeFlag(!1)}))},t.prototype.containsPerspective=function(e){return this.registry.includes(e)},t.prototype.getIndexOfPerspective=function(e){return this.registry.indexOf(e)},t.prototype.getPerspectiveByIndex=function(e){return this.registry[e]},t.prototype.removePerspectiveAtIndex=function(e){this.registry.splice(e,1)},t.prototype.removePerspective=function(e){var t=this.getIndexOfPerspective(e);-1===t?t=0:this.registry.splice(t,1)},t.prototype.size=function(){return this.registry.length},t}(i(n(6)).default);t.default=s},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var c=a(n(6)),u=a(n(45)),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.findCollection=function(e){return i(this,void 0,void 0,(function(){var t,n,r,o,i;return s(this,(function(s){switch(s.label){case 0:return this.Glass.currentAppView&&"login"!==this.Glass.currentAppView.perspective?(t=this.Glass.currentAppView.perspectiveModel.spec).collectionContainers&&(i=t.collectionContainers.find((function(t){return t.id===e})))?[2,i.items]:[3,4]:[3,1];case 1:return n=this.Glass.getCoreSvc(".Perspective"),"generic_iframe",[4,n.getModel("generic_iframe")];case 2:return r=s.sent(),[4,this.declarePerspectiveServices(r)];case 3:if(s.sent(),(o=r.collectionContainers)&&(i=o.find((function(t){return t.id===e}))))return[2,i.items];s.label=4;case 4:return[2,null]}}))}))},t.prototype.isCollectionContainerAvailable=function(e){if(this.Glass.currentAppView){var t=this.Glass.currentAppView.perspectiveModel.spec;if(t.collectionContainers)if(t.collectionContainers.find((function(t){return t.id===e})))return!0}return!1},t.prototype.findElement=function(e){if("string"==typeof e&&this.Glass.currentAppView){var t=document.querySelector(".appview.paneColumn:not(.hidden)");if(t)return t.querySelector("#"+e)}return null},t.prototype.findPlugin=function(e){return"string"==typeof e&&this.Glass.currentAppView?this.Glass.currentAppView.registeredPlugins[e]:null},t.prototype.declarePerspectiveServices=function(e){return i(this,void 0,void 0,(function(){var t;return s(this,(function(n){switch(n.label){case 0:if(!e||!e.services)return[3,4];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,(0,u.default)(this.Glass,e.services)];case 2:return n.sent(),[3,4];case 3:return t=n.sent(),this.logger.error("Failed to load perspective services",t),[3,4];case 4:return[2]}}))}))},t}(c.default);t.default=l},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var c=a(n(6)),u=a(n(46)),l=function(e){function t(t){var n=e.call(this,t)||this;return n.slideoutRegistry=new u.default,n}return o(t,e),t.prototype.showSlideOut=function(e){var t;return this.Glass.addToOptions(e),this.Glass.currentAppView&&(t=this.Glass.currentAppView._openSlideout("application",e)),t},t.prototype.hideSlideOut=function(e){return i(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return this.Glass.currentAppView?[4,this.Glass.currentAppView.closeAllOpenedSlideouts(e)]:[3,2];case 1:return[2,t.sent()];case 2:return[2,null]}}))}))},t}(c.default);t.default=l},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s,a=i(n(6)),c=i(n(12));!function(e){e.THEME_PATH="v1/plugins/themes/current/css/palette.css",e.BASE_URL="http://ibm.com/"}(s||(s={}));var u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),Object.defineProperty(t.prototype,"defaultThemePath",{set:function(e){this.themePath=e},enumerable:!1,configurable:!0}),t.prototype.reloadTheme=function(){var e=(new Date).getTime();!function(e){var t=document.querySelector("head").getElementsByClassName("themeressource");Array.from(t).forEach((function(t){var n=new URL(t.href);n.searchParams.set("v",String(e)),t.href=n.href}))}(String(e)),this.reloadPalette(String(e))},t.prototype.reloadPalette=function(e){this.theme&&this.theme.remove();var t=document.createElement("link");t.type="text/css",t.rel="stylesheet";var n=new URL(this.themePath||s.THEME_PATH,s.BASE_URL);n.searchParams.set("v",String(e)),c.default.isFactoryMode()&&n.searchParams.set("factoryMode","true");var r=n.href.split(s.BASE_URL)[1];t.href=r,document.head.appendChild(t)},t}(a.default);t.default=u},function(e,t){e.exports=G},function(e,t,n){"use strict";n.r(t);var r=n(1),o=n.n(r),i=n(0),s=n.n(i),a=n(9),c=n(17),u=n.n(c),l=n(8),p=n(3),f=n.n(p),d=n(22),h=n.n(d);function y(e){return(y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function v(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function g(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function w(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=C(e);if(t){var o=C(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m(this,n)}}function m(e,t){if(t&&("object"===y(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function C(e){return(C=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var _=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&b(e,t)}(s,e);var t,n,r,i=w(s);function s(){var e;v(this,s);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return(e=i.call.apply(i,[this].concat(n))).wrappedRender=function(){var t=e.props.contentView,n=t.renderTimeout||20,r=new Promise((function(e,t){return setTimeout(t,1e3*n)})),i=t.render().then((function(e){if(e&&f.a.isElement(e)||o.a.isValidElement(e))return e;var n=t.el||t.$el&&t.$el[0];if(!n)throw new Error("contentview does not contain el property");if(!f.a.isElement(n))throw new Error("el property should be an html element");return n})).catch((function(e){return Promise.reject(e)}));return Promise.race([r,i])},e}return t=s,(n=[{key:"getContentViewContainer",value:function(){var e=this.props.containerRef;return e&&e.current?e.current:null}},{key:"render",value:function(){var e=this.props,t=e.contentView,n=e.failRenderCallback,r=e.postRenderCallback;return o.a.createElement(h.a,{render:t&&this.wrappedRender,failRenderCallback:n,postRenderCallback:r,containerRef:this.getContentViewContainer()})}}])&&g(t.prototype,n),r&&g(t,r),Object.defineProperty(t,"prototype",{writable:!1}),s}(r.Component);function P(e){return(P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function S(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function O(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function E(e,t){return(E=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function x(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=R(e);if(t){var o=R(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return j(this,n)}}function j(e,t){if(t&&("object"===P(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function R(e){return(R=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}_.propTypes={contentView:s.a.object,failRenderCallback:s.a.func,postRenderCallback:s.a.func,containerRef:s.a.object};var k=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&E(e,t)}(s,e);var t,n,r,i=x(s);function s(){return S(this,s),i.apply(this,arguments)}return t=s,(n=[{key:"render",value:function(){var e,t=this.props,n=t.containerRef,r=t.successContentViewRenderCallback,i=t.failureContentViewRenderCallback,s=t.getContentView,a=t.perspectiveStore,c=a.contentViewLoadedSuccessfully?s():null;return o.a.createElement(o.a.Fragment,null,o.a.createElement(_,{contentView:c,containerRef:n,postRenderCallback:r,failRenderCallback:i}),!a.loaded&&(e=o.a.createElement("div",{className:"loadingIndicatorContainer"},o.a.createElement("div",{className:"loading_indicator"},o.a.createElement(l.ProgressIndicator,{size:"large"}))),u.a.createPortal(e,document.body)))}}])&&O(t.prototype,n),r&&O(t,r),Object.defineProperty(t,"prototype",{writable:!1}),s}(r.PureComponent);k.propTypes={containerRef:s.a.object,getContentView:s.a.func,successContentViewRenderCallback:s.a.func,failureContentViewRenderCallback:s.a.func,perspectiveStore:s.a.object};var V=Object(a.observer)(k),T=n(13),M=n(2),A=n(4),I=n.n(A),D=n(7),L=n.n(D),N=n(18),G=n.n(N),F=n(16),B=n(20),U=n(21),H=o.a.createContext();function q(e){return(q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function W(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function K(e,t){return(K=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function z(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=J(e);if(t){var o=J(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Q(this,n)}}function Q(e,t){if(t&&("object"===q(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function J(e){return(J=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var $={Label:G.a,"glass/app/plugins/GlassPlugin":G.a,Button:F.a,SynchronousButton:B.a,"baglass/app/plugins-react/PersistentBannerController":U.a};var X=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&K(e,t)}(s,e);var t,n,r,i=z(s);function s(e,t){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),(n=i.call(this,e,t)).failRenderCallback=function(e){if(e){var t=n.props.itemSpec;n.context.glassContext.getCoreSvc(".Logger").error("Plugin Error","Failed to render plugin ".concat(t.id),e)}n.pluginRenderPromise.resolve()},n.postRenderCallback=function(){var e=n.props.itemSpec,t=n.state.plugin;if(f.a.isFunction(t.attachActionControllerCallbacks))try{t.attachActionControllerCallbacks()}catch(e){}var r={pluginId:e.id,plugin:t};n.pluginRenderPromise.resolve(r)},n.createPluginContainerRef=function(e){n.pluginContainer=e},(0,t.addPluginRenderToQueue)(new Promise((function(e,t){n.pluginRenderPromise={resolve:e,reject:t}}))),n}return t=s,(n=[{key:"componentDidMount",value:function(){var e=this,t=this.props.itemSpec;this.createPluginPromise=this.instantiatePlugin(t).catch((function(n){e.context.glassContext.getCoreSvc(".Logger").error(n,"Failed to instantiate plugin, ".concat(t.id)),e.pluginRenderPromise.resolve(n)}))}},{key:"getPluginOptions",value:function(){var e=this.props,t=e.appView,n=e.itemSpec;return{glassContext:this.context.glassContext,$container:I()(this.pluginContainer),appView:t,itemSpec:n}}},{key:"getBuiltInPlugin",value:function(e){var t=this.getPluginOptions(),n=new(0,$[e])(t);return Promise.resolve(n)}},{key:"instantiatePlugin",value:function(e){var t=this;return this.createPluginInstance(e[this.keywords.type]).then((function(e){return f.a.isEmpty(e)||!e.render?Promise.reject(new Error("Invalid Plugin, may be missing render method")):f.a.isFunction(e.initialize)?e.initialize().then((function(){return e})):Promise.resolve(e)})).then((function(e){return t.setState({plugin:e}),Promise.resolve()}))}},{key:"createPluginInstance",value:function(e){return function(e){return void 0!==$[e]}(e)?this.getBuiltInPlugin(e):this.dynamicallyLoadPlugin(e)}},{key:"dynamicallyLoadPlugin",value:function(e){var t=this.getPluginOptions(),n=this.keywords.pluginID[e]||e;return L.a.instantiate(n,t)}},{key:"render",value:function(){var e=this.props.itemSpec,t=(this.state||{}).plugin;return o.a.createElement("div",{className:"pluginContainer",id:"".concat(e.id,"PluginContainer"),ref:this.createPluginContainerRef},o.a.createElement(h.a,{render:t&&t.render,renderScope:t,options:this.getPluginOptions(),postRenderCallback:this.postRenderCallback,failRenderCallback:this.failRenderCallback,containerRef:this.pluginContainer}))}}])&&W(t.prototype,n),r&&W(t,r),Object.defineProperty(t,"prototype",{writable:!1}),s}(r.Component);X.contextType=H,X.prototype.keywords={type:"type",pluginID:{Menu:"baglass/app/plugins/GlassMenu"}},X.propTypes={appView:s.a.object,itemSpec:s.a.object},X.contextTypes={addPluginRenderToQueue:s.a.func,glassContext:s.a.object};var Y=n(12),Z=n.n(Y);function ee(e){return(ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function te(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ne(e,t){return(ne=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function re(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=se(e);if(t){var o=se(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return oe(this,n)}}function oe(e,t){if(t&&("object"===ee(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return ie(e)}function ie(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function se(e){return(se=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ae=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ne(e,t)}(s,e);var t,n,r,i=re(s);function s(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),(t=i.call(this,e)).createDOMReference=function(e){t.itemContainer=e},t.itemContainer=o.a.createRef(),Z.a.errorProtect(ie(t),["render"]),t}return t=s,(n=[{key:"render",value:function(){var e=this.props,t=e.position,n=e.id,r=e.plugins,i=e.appView;return o.a.createElement("div",{className:t,id:n,ref:this.createDOMReference},r&&r.map((function(e){return o.a.createElement(X,{key:f.a.uniqueId("GlassPluginContainer_"),itemSpec:e,appView:i})})))}}])&&te(t.prototype,n),r&&te(t,r),Object.defineProperty(t,"prototype",{writable:!1}),s}(r.Component);function ce(e){return(ce="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ue(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function le(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function pe(e,t){return(pe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function fe(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=he(e);if(t){var o=he(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return de(this,n)}}function de(e,t){if(t&&("object"===ce(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function he(e){return(he=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}ae.propTypes={appView:s.a.object,id:s.a.string,position:s.a.string,plugins:s.a.oneOfType([s.a.array,s.a.object])};var ye=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&pe(e,t)}(s,e);var t,n,r,i=fe(s);function s(){return ue(this,s),i.apply(this,arguments)}return t=s,(n=[{key:"render",value:function(){var e=this.props,t=e.toolItemGroups,n=e.appView;return t.map((function(e){return o.a.createElement(ae,{key:f.a.uniqueId("ToolItemGroup_"),appView:n,plugins:e[M.default.TOOL_ITEMS],position:e.position,id:e.id})}))}}])&&le(t.prototype,n),r&&le(t,r),Object.defineProperty(t,"prototype",{writable:!1}),s}(r.Component);function ve(e){return(ve="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ge(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function be(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function we(e,t){return(we=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function me(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=_e(e);if(t){var o=_e(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Ce(this,n)}}function Ce(e,t){if(t&&("object"===ve(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function _e(e){return(_e=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}ye.propTypes={toolItemGroups:s.a.array,appView:s.a.object};var Pe=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&we(e,t)}(s,e);var t,n,r,i=me(s);function s(){return ge(this,s),i.apply(this,arguments)}return t=s,(n=[{key:"getPositionMap",value:function(){var e=this.props.toolBarSpec,t=T.default.generatePositionMap(e.toolItemGroups);return t[M.default.CENTER]||(t[M.default.CENTER]=[],t[M.default.CENTER].push({id:"".concat(e.attr.id,"_").concat(M.default.CENTER),position:M.default.CENTER})),t}},{key:"getToolPaneClassNames",value:function(){var e=this.props,t=e.toolBarSpec,n=e.placement,r=n.charAt(0).toUpperCase()+n.slice(1),o="toolpane toolpane".concat(r);return t.class?"".concat(t.class," ").concat(o):o}},{key:"render",value:function(){var e=this.props,t=e.toolBarSpec,n=e.appView,r=t.toolItemGroups?this.getPositionMap():null,i=[M.default.LEADING,M.default.CENTER,M.default.TRAILING];return o.a.createElement("div",{key:"toolPaneKey".concat(t.id),id:t.id,className:this.getToolPaneClassNames(),role:t.attr?t.attr.role:"","aria-label":t.attr?t.attr["aria-label"]:void 0},r&&i.map((function(e){return r[e]&&o.a.createElement(ye,{key:f.a.uniqueId("ToolItemGroupLayout_"),toolItemGroups:r[e],appView:n})})))}}])&&be(t.prototype,n),r&&be(t,r),Object.defineProperty(t,"prototype",{writable:!1}),s}(r.Component);function Se(e){return(Se="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Oe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ee(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function xe(e,t){return(xe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function je(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ke(e);if(t){var o=ke(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Re(this,n)}}function Re(e,t){if(t&&("object"===Se(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function ke(e){return(ke=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}Pe.propTypes={toolBarSpec:s.a.object,placement:s.a.string,appView:s.a.object};var Ve=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&xe(e,t)}(s,e);var t,n,r,i=je(s);function s(){return Oe(this,s),i.apply(this,arguments)}return t=s,(n=[{key:"render",value:function(){var e=this.props,t=e.toolBars,n=e.placement,r=e.appView;return t?t.map((function(e){return o.a.createElement(Pe,{key:f.a.uniqueId("ToolBar_"),toolBarSpec:e,placement:n,appView:r})})):null}}])&&Ee(t.prototype,n),r&&Ee(t,r),Object.defineProperty(t,"prototype",{writable:!1}),s}(r.Component);function Te(e){return(Te="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Me(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ae(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ie(e,t){return(Ie=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function De(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Ne(e);if(t){var o=Ne(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Le(this,n)}}function Le(e,t){if(t&&("object"===Te(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Ne(e){return(Ne=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}Ve.propTypes={toolBars:s.a.array,placement:s.a.string,appView:s.a.object};var Ge=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ie(e,t)}(s,e);var t,n,r,i=De(s);function s(){return Me(this,s),i.apply(this,arguments)}return t=s,(n=[{key:"getClassNames",value:function(){var e=this.props.classNames;return e?"".concat("pane paneContent"," ").concat(e):"pane paneContent"}},{key:"render",value:function(){var e=this.props,t=e.containerRef,n=e.role,r=e.onScroll,i=e.children;return o.a.createElement("div",{key:f.a.uniqueId("paneContent_"),className:this.getClassNames(),ref:t,role:n,onScroll:r},i)}}])&&Ae(t.prototype,n),r&&Ae(t,r),Object.defineProperty(t,"prototype",{writable:!1}),s}(r.Component);function Fe(e){return(Fe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Be(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ue(e,t){return(Ue=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function He(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=We(e);if(t){var o=We(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return qe(this,n)}}function qe(e,t){if(t&&("object"===Fe(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function We(e){return(We=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}Ge.propTypes={classNames:s.a.string,containerRef:s.a.object,role:s.a.string,onScroll:s.a.func,children:s.a.oneOfType([s.a.arrayOf(s.a.node),s.a.node])};var Ke=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ue(e,t)}(s,e);var t,n,r,i=He(s);function s(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),(t=i.call(this,e)).onContentScroll=function(){t.contentPaneContainerRef.current&&(t.contentPaneContainerRef.current.scrollLeft=0)},t.contentPaneContainerRef=o.a.createRef(),t}return t=s,(n=[{key:"componentDidMount",value:function(){(0,this.props.onContentContainerMounted)(I()(this.contentPaneContainerRef.current))}},{key:"render",value:function(){var e=this.props,t=e.classNames,n=e.children;return o.a.createElement(Ge,{classNames:t,role:"main",containerRef:this.contentPaneContainerRef,onScroll:this.onContentScroll},n&&o.a.cloneElement(n,{containerRef:this.contentPaneContainerRef}))}}])&&Be(t.prototype,n),r&&Be(t,r),Object.defineProperty(t,"prototype",{writable:!1}),s}(r.Component);function ze(e){return(ze="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Qe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Je(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function $e(e,t){return($e=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Xe(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Ze(e);if(t){var o=Ze(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Ye(this,n)}}function Ye(e,t){if(t&&("object"===ze(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Ze(e){return(Ze=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}Ke.propTypes={classNames:s.a.string,children:s.a.element,onContentContainerMounted:s.a.func};var et=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&$e(e,t)}(s,e);var t,n,r,i=Xe(s);function s(){return Qe(this,s),i.apply(this,arguments)}return t=s,(n=[{key:"getLayoutPaneContainerClassName",value:function(){var e=this.props.paneData;return e&&e[M.default.PANE]&&e[M.default.PANE].class?e[M.default.PANE].class:""}},{key:"getContentPaneContainerClassNames",value:function(){var e=this.getLayoutPaneContainerClassName(),t="contentViewPane";return e&&(t+=" ".concat(e)),t}},{key:"render",value:function(){var e=this.props,t=e.children,n=e.paneData,r=e.appView,i=e.onContentContainerMounted,s=n&&T.default.isContentPane(n[M.default.PANE]);return o.a.createElement(o.a.Fragment,null,n&&n[M.default.LOOPS]&&n[M.default.LOOPS].map((function(e){return o.a.createElement(Ve,{key:f.a.uniqueId("ToolBarLayout_"),toolBars:n[e],placement:e,appView:r})})),s?o.a.createElement(Ke,{classNames:this.getContentPaneContainerClassNames(),onContentContainerMounted:i},t):o.a.createElement(Ge,{className:this.getLayoutPaneContainerClassName()},t))}}])&&Je(t.prototype,n),r&&Je(t,r),Object.defineProperty(t,"prototype",{writable:!1}),s}(r.Component);function tt(e){return(tt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function nt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function rt(e,t){return(rt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ot(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=st(e);if(t){var o=st(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return it(this,n)}}function it(e,t){if(t&&("object"===tt(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function st(e){return(st=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}et.propTypes={appView:s.a.object,children:s.a.oneOfType([s.a.arrayOf(s.a.node),s.a.node]),paneData:s.a.object,onContentContainerMounted:s.a.func},n.d(t,"default",(function(){return at}));var at=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&rt(e,t)}(s,e);var t,n,r,i=ot(s);function s(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),(t=i.call(this,e)).hasContentView=!1,t}return t=s,(n=[{key:"componentDidMount",value:function(){var e=this.props,t=e.onNoContentViewFound,n=e.onPerspectiveViewMounted;this.hasContentView||t(),n()}},{key:"getViewContext",value:function(){var e=this.props;return{addPluginRenderToQueue:e.addPluginRenderToQueue,glassContext:e.glassContext}}},{key:"createContentPane",value:function(){var e=this.props,t=e.successContentViewRenderCallback,n=e.failureContentViewRenderCallback,r=e.perspectiveStore,i=e.getContentView;return o.a.createElement(V,{successContentViewRenderCallback:t,failureContentViewRenderCallback:n,perspectiveStore:r,getContentView:i})}},{key:"constructNextLayoutPane",value:function(e){var t=this.props,n=t.appView,r=t.onContentContainerMounted;return T.default.isContentPane(e)?(this.hasContentView=!0,this.createContentPane()):o.a.createElement(et,{appView:n,onContentContainerMounted:r,layoutsRenderPromise:this.layoutRenderComplete,paneData:e},this.constructNextLayoutPane(e[M.default.PANE]))}},{key:"render",value:function(){var e=this.props,t=e.toolBars,n=e.appView,r=e.onContentContainerMounted,i=T.default.convertToolBarsToLayoutObject(t),s=this.getViewContext();return o.a.createElement(H.Provider,{value:s},o.a.createElement(et,{appView:n,onContentContainerMounted:r,layoutsRenderPromise:this.layoutRenderComplete,paneData:i},this.constructNextLayoutPane(i[M.default.PANE])))}}])&&nt(t.prototype,n),r&&nt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),s}(r.Component);at.propTypes={appView:s.a.object,glassContext:s.a.object,toolBars:s.a.array,perspectiveStore:s.a.object,addPluginRenderToQueue:s.a.func,onPerspectiveViewMounted:s.a.func,onContentContainerMounted:s.a.func,successContentViewRenderCallback:s.a.func,failureContentViewRenderCallback:s.a.func,getContentView:s.a.func,onNoContentViewFound:s.a.func}},function(e,t,n){"use strict";n.r(t);var r=n(32),o=n.n(r),i=n(49),s=n.n(i),a=n(29),c=n.n(a),u=n(15),l=n(18),p=n.n(l),f=n(16),d=n(20),h=n(21),y=n(27),v=n.n(y),g=n(26),b=n.n(g),w=n(28),m=n.n(w),C=n(23),_=n.n(C),P=n(25),S=n.n(P),O=n(50),E=n.n(O);n.d(t,"Glass",(function(){return o.a})),n.d(t,"AlertStore",(function(){return s.a})),n.d(t,"ToastStore",(function(){return c.a})),n.d(t,"GlassPluginController",(function(){return u.default})),n.d(t,"IconLabelPluginController",(function(){return p.a})),n.d(t,"ButtonPluginController",(function(){return f.a})),n.d(t,"SyncButtonPluginController",(function(){return d.a})),n.d(t,"PersistentBannerPluginController",(function(){return h.a})),n.d(t,"TaxonomyService",(function(){return v.a})),n.d(t,"URLEncoderService",(function(){return b.a})),n.d(t,"ToastService",(function(){return m.a})),n.d(t,"MessageDialogService",(function(){return _.a})),n.d(t,"PerspectiveLoader",(function(){return S.a})),n.d(t,"ExtendObject",(function(){return E.a}))}])}));
  10033. /**
  10034. * Licensed Materials - Property of IBM
  10035. * IBM Cognos Products: BI
  10036. * (C) Copyright IBM Corp. 2016
  10037. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  10038. */
  10039. define('baglass/core-client/js/core-client/utils/JQueryAria',['jquery'], function ($) {
  10040. /**
  10041. * Sets a JQuery object as a button with the necessary aria attributes
  10042. * @param {Object} options - aria options
  10043. * @param {Boolean} [options.haspopup] - corresponds to aria-haspopup
  10044. * @param {String} [options.label] - text content of the button
  10045. * @param {String} [options.title] - title attribute; label is used if undefined
  10046. * @param {String} [options.id] - id of the element
  10047. * @return {Jquery} The current Jquery object allowinf chaining the calls
  10048. * @example
  10049. * @example
  10050. * //Sets a div as a button
  10051. * var $element = $('<div>');
  10052. * $element.ariaButton({label: 'some label'}).addClass('some class');
  10053. */
  10054. $.fn.ariaButton = function (options) {
  10055. return this.each(function (index, element) {
  10056. var $el = $(element);
  10057. $el.attr('type', 'button');
  10058. $el.attr('role', 'button');
  10059. if (options) {
  10060. if (options.haspopup === true) {
  10061. $el.attr('aria-haspopup', 'true');
  10062. }
  10063. $el.text(options.label);
  10064. $el.attr('title', options.title ? options.title : options.label);
  10065. $el.attr('id', options.id);
  10066. }
  10067. });
  10068. };
  10069. });
  10070. //# sourceMappingURL=JQueryAria.js.map
  10071. ;
  10072. /**
  10073. * Licensed Materials - Property of IBM
  10074. * IBM Cognos Products: BI
  10075. * (C) Copyright IBM Corp. 2015, 2017
  10076. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  10077. */
  10078. define('baglass/core-client/js/core-client/utils/JQueryExt',['jquery', '../ui/KeyCodes', './EventHelper', './JQueryAria'], function ($, KeyCodes) {
  10079. // Add a custom event that will handle both click and tap. This custom event will cancel the simulated clicks on mobile
  10080. $.event.special.clicktap = {
  10081. add: function add(obj) {
  10082. var isHandled = false;
  10083. $(this).on('click.clicktap_' + obj.guid, obj.selector, function (e) {
  10084. if (isHandled) {
  10085. if (obj.data && obj.data.allowPropagationDefaultAction) {
  10086. return true;
  10087. }
  10088. // We already handled this click, so we don't call the handler.
  10089. // We also stop the propagation so other handlers don't end up being triggered.
  10090. e.stopPropagation();
  10091. isHandled = false;
  10092. return false;
  10093. } else {
  10094. return obj.handler.apply(this, arguments);
  10095. }
  10096. }).on('tap.clicktap_' + obj.guid, obj.selector, function (e) {
  10097. e.pageX = e.gesture.center.pageX; // set pageX for 'tap' event
  10098. e.pageY = e.gesture.center.pageY;
  10099. isHandled = true;
  10100. return obj.handler.apply(this, arguments);
  10101. });
  10102. },
  10103. remove: function remove(obj) {
  10104. $(this).off('.clicktap_' + obj.guid);
  10105. }
  10106. };
  10107. /**
  10108. * Add a custom event that handles click, tap and keypress of enter & space keys
  10109. * Note on the implementation:
  10110. * - cancels the simulated clicks on mobile
  10111. * - key press is ignored when the element is a button because the browser automically triggers a click for those;
  10112. * The event sequence is the following:
  10113. * Without JAWS:
  10114. * - for enter: keydown->click->keyup; in this case, the keyup event is attached to the current active element which can be
  10115. * different from the initial one.
  10116. * for example: Pressing a button in dialog which closes it and sets the focus on a div which has a button role.
  10117. * - for space: keydown->keyup->click
  10118. * With JAWS: the click event is triggered only for elements with a button role.
  10119. * Corollary: only non-button elements have their handler attached to the keydown and keyup events
  10120. * - on keydown, we flag the fact that the handler is to be invoked at keyup time; this is to handle the case where
  10121. * click and keyup events are attached to different elements.
  10122. * - limitation:
  10123. * - handler defined for non-button parent & child elements: when the propagation is stopped in the child handler,
  10124. * parent handler can be invoked on keyup only.
  10125. */
  10126. $.event.special.primaryaction = {
  10127. add: function add(obj) {
  10128. var isTapHandled = false;
  10129. var ENTERKEY = KeyCodes.ENTER;
  10130. var SPACEKEY = KeyCodes.SPACE;
  10131. var isKeytoProcess = false;
  10132. $(this).on('click.primaryaction_' + obj.guid, obj.selector, function (e) {
  10133. isKeytoProcess = false;
  10134. if (isTapHandled) {
  10135. if (obj.data && obj.data.allowPropagationDefaultAction) {
  10136. return true;
  10137. }
  10138. // We already handled this click, so we don't call the handler.
  10139. // We also stop the propagation so other handlers don't end up being triggered.
  10140. e.stopPropagation();
  10141. isTapHandled = false;
  10142. return false;
  10143. } else {
  10144. return obj.handler.apply(this, arguments);
  10145. }
  10146. }).on('tap.primaryaction_' + obj.guid, obj.selector, function (e) {
  10147. isTapHandled = true;
  10148. e.pageX = e.gesture.center.pageX;
  10149. e.pageY = e.gesture.center.pageY;
  10150. return obj.handler.apply(this, arguments);
  10151. }).on('keydown.primaryaction_' + obj.guid, obj.selector, function (e) {
  10152. var key = e.which || e.keyCode;
  10153. isKeytoProcess = (key === ENTERKEY || key === SPACEKEY) && !$(e.target).is('button');
  10154. }).on('keyup.primaryaction_' + obj.guid, obj.selector, function (e) {
  10155. var key = e.which || e.keyCode;
  10156. if ((key === ENTERKEY || key === SPACEKEY) && !$(e.target).is('button') && isKeytoProcess === true) {
  10157. isKeytoProcess = false;
  10158. return obj.handler.apply(this, arguments);
  10159. } else {
  10160. isKeytoProcess = false;
  10161. }
  10162. });
  10163. },
  10164. remove: function remove(obj) {
  10165. $(this).off('.primaryaction_' + obj.guid);
  10166. }
  10167. };
  10168. /**
  10169. * Add a custom event that will handle both escape and ctrl+[
  10170. * Note on the implementation:
  10171. * - Handler is invoked on keyup event only.
  10172. * - For escape, keyup invokes the handler regardless of any keys pressed after keydown
  10173. * - For ctrl+[, keyup invokes the handler only if the ctrl+[ keydown event had occurred just before.
  10174. * - iPad + AppleKeyboard + VoiceOver combination does not provide the expected keycodes on keyup.
  10175. * - As a result, on keyup, we only check that ctrl is held, and that the ctrl+[ keydown had occurred just before.
  10176. * - Corollary: If a key is pressed down before [, letting go of that key will invoke the handler.
  10177. * - On keydown, we flag the fact that the handler is to be invoked at keyup time; this is ensure the event can only
  10178. * happen once, and it allows us to check the keycodes in keydown, where they are available.
  10179. */
  10180. $.event.special.escapeaction = {
  10181. add: function add(obj) {
  10182. var ESCAPEKEY = KeyCodes.ESCAPE;
  10183. var SQUARE_OPEN_BRACKET = KeyCodes.OPEN_BRACKET;
  10184. var isCtrlBracketToProcess = false;
  10185. $(this).on('keydown.escapeaction_' + obj.guid, obj.selector, function (e) {
  10186. var key = e.which || e.keyCode;
  10187. isCtrlBracketToProcess = key === SQUARE_OPEN_BRACKET && e.ctrlKey;
  10188. }).on('keyup.escapeaction_' + obj.guid, obj.selector, function (e) {
  10189. var key = e.which || e.keyCode;
  10190. if (key === ESCAPEKEY) {
  10191. isCtrlBracketToProcess = false;
  10192. return obj.handler.apply(this, arguments);
  10193. }
  10194. if (e.ctrlKey && isCtrlBracketToProcess) {
  10195. isCtrlBracketToProcess = false;
  10196. return obj.handler.apply(this, arguments);
  10197. }
  10198. isCtrlBracketToProcess = false;
  10199. });
  10200. },
  10201. remove: function remove(obj) {
  10202. $(this).off('.escapeaction_' + obj.guid);
  10203. }
  10204. };
  10205. /**
  10206. * Add a custom event that handles "DELETE" and "CTRL+SECOND" key down & up events
  10207. * Note on the implementation:
  10208. * - Handler is invoked on keyup event only.
  10209. * - For DELETE, keyup invokes the handler regardless of any keys pressed after keydown
  10210. * - For CTRL+SECOND, keyup invokes the handler only if CTRL+SECOND keydown event had occurred just before.
  10211. * This key combination workarounds the issue that on IPAD+Apple Wireless keyboard+VoiceOver, the DELETE key
  10212. * event can not be captured
  10213. */
  10214. $.event.special.deleteaction = {
  10215. add: function add(obj) {
  10216. var isCtrlSecondEventKeyDowned = false;
  10217. $(this).on('keydown.deleteaction_' + obj.guid, obj.selector, function (e) {
  10218. var key = e.which || e.keyCode;
  10219. isCtrlSecondEventKeyDowned = key === KeyCodes.SECOND && e.ctrlKey;
  10220. }).on('keyup.deleteaction_' + obj.guid, obj.selector, function (e) {
  10221. var key = e.which || e.keyCode;
  10222. //invokes the handler as long as DELETE keycode is received in keyup event
  10223. if (key === KeyCodes.DELETE) {
  10224. isCtrlSecondEventKeyDowned = false;
  10225. return obj.handler.apply(this, arguments);
  10226. }
  10227. //Otherwise, invokes the handler handler if CTRL+SECOND were flagged keydown-ed
  10228. if (e.ctrlKey && isCtrlSecondEventKeyDowned) {
  10229. isCtrlSecondEventKeyDowned = false;
  10230. return obj.handler.apply(this, arguments);
  10231. }
  10232. isCtrlSecondEventKeyDowned = false;
  10233. });
  10234. },
  10235. remove: function remove(obj) {
  10236. $(this).off('.deleteaction_' + obj.guid);
  10237. }
  10238. };
  10239. return $;
  10240. });
  10241. //# sourceMappingURL=JQueryExt.js.map
  10242. ;
  10243. /**
  10244. * Licensed Materials - Property of IBM
  10245. * IBM Cognos Products: BI Glass
  10246. * (C) Copyright IBM Corp. 2015, 2021
  10247. * US Government Users Restricted Rights - Use, duplication or disclosure
  10248. * restricted by GSA ADP Schedule Contract with IBM Corp.
  10249. */
  10250. define('baglass/app/AppController',['../core-client/js/core-client/ui/core/Class', 'baglass/glass.webpack.bundle', '../core-client/js/core-client/utils/ClassFactory', '../core-client/js/core-client/utils/JQueryExt', 'jquery-ui'], function (Class, GlassWebpackBundle, ClassFactory) {
  10251. var Glass = GlassWebpackBundle.Glass,
  10252. ExtendObject = GlassWebpackBundle.ExtendObject;
  10253. /**
  10254. * @public
  10255. */
  10256. var AppController = Class.extend(
  10257. /**
  10258. * @lends AppController.prototype
  10259. */
  10260. {
  10261. _ClassFactory: ClassFactory,
  10262. /**
  10263. * @classdesc Main class giving access to method managing the perspectives
  10264. * @constructs
  10265. * @public
  10266. * @param {Object}
  10267. * options - set of initial properties
  10268. */
  10269. init: function init(options) {
  10270. AppController.inherited('init', this, arguments);
  10271. ExtendObject(this, options);
  10272. var config = {
  10273. appController: this,
  10274. trackHistory: options.trackHistory !== false && options.trackHistory !== 'false',
  10275. cacheAppViews: options.cacheAppViews !== false && options.cacheAppViews !== 'false',
  10276. installInfo: options.installInfo,
  10277. versionInfo: options.versionInfo,
  10278. authInfo: options.authInfo,
  10279. requirejs: requirejs
  10280. };
  10281. this.Glass = new Glass(config, options);
  10282. this.glassContext = this.Glass;
  10283. this.Glass.initialize();
  10284. this.Glass.getCoreSvc('.Logger').setLevelWarn();
  10285. },
  10286. /** MOVED TO GLASS */
  10287. getCurrentContentView: function getCurrentContentView() {
  10288. // this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.getCurrentContentView is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
  10289. return this.Glass.getCurrentContentView();
  10290. },
  10291. // Actions API
  10292. canExecuteAction: function canExecuteAction(id, object) {
  10293. // this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.canExecuteAction is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
  10294. return this.Glass.canExecuteAction(id, object);
  10295. },
  10296. performAction: function performAction(id, object) {
  10297. // this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.performAction is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
  10298. return this.Glass.performAction(id, object);
  10299. },
  10300. // Accessibility API
  10301. isHighContrastOn: function isHighContrastOn() {
  10302. // this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.isHighContrastOn is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
  10303. return this.Glass.isApplicationStyledForHighContrast();
  10304. },
  10305. detectAccessibilityChange: function detectAccessibilityChange(accessibilityMode) {
  10306. // this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.detectAccessibilityChange is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
  10307. return this.Glass.detectAccessibilityChange(accessibilityMode);
  10308. },
  10309. // Context Menu API
  10310. showContextMenu: function showContextMenu(args) {
  10311. // this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.showContextMenu is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
  10312. return this.Glass.showContextMenu(args);
  10313. },
  10314. // Dialog Toast API
  10315. showErrorMessage: function showErrorMessage(error, title, callback, htmlContent) {
  10316. // this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.showErrorMessage is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
  10317. return this.Glass.showErrorMessage(error, title, callback, htmlContent);
  10318. },
  10319. showMessage: function showMessage(msg, title, type, buttons, width, callback, htmlContent, className) {
  10320. // this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.showMessage is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
  10321. return this.Glass.showMessage(msg, title, type, buttons, width, callback, htmlContent, className);
  10322. },
  10323. showEmbedDialog: function showEmbedDialog(model) {
  10324. // this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController. is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
  10325. return this.Glass.showEmbedDialog(model);
  10326. },
  10327. showResetHomeDialog: function showResetHomeDialog(errMessage) {
  10328. // this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.showEmbedDialog is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
  10329. return this.Glass.showResetHomeDialog(errMessage);
  10330. },
  10331. showShareDialog: function showShareDialog(model) {
  10332. // this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.showShareDialog is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
  10333. return this.Glass.showShareDialog(model);
  10334. },
  10335. // Events API
  10336. emit: function emit(eventName, event) {
  10337. // this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.emit is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
  10338. return this.Glass.trigger(eventName, event);
  10339. },
  10340. on: function on(eventName, handler, context) {
  10341. // this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.on is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
  10342. return this.Glass.on(eventName, handler, context);
  10343. },
  10344. off: function off(eventName, handler, context) {
  10345. // this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.off is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
  10346. return this.Glass.off(eventName, handler, context);
  10347. },
  10348. trigger: function trigger(eventName, event) {
  10349. // this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.trigger is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
  10350. return this.Glass.trigger(eventName, event);
  10351. },
  10352. // Home Page API
  10353. setDefaultHomePerspective: function setDefaultHomePerspective(perspective) {
  10354. // this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.setDefaultHomePerspective is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
  10355. return this.Glass.setDefaultHomePerspective(perspective);
  10356. },
  10357. resetHome: function resetHome(isCurrentViewBroken) {
  10358. // this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.resetHome is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
  10359. return this.Glass.resetHome(isCurrentViewBroken);
  10360. },
  10361. // Perspective LifeCycle API
  10362. closeAppView: function closeAppView(perspective, id, options) {
  10363. // this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.closeAppView is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
  10364. return this.Glass.closeAppView(perspective, id, options);
  10365. },
  10366. close: function close(force, isBrowser) {
  10367. // this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.close is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
  10368. return this.Glass.close(force, isBrowser);
  10369. },
  10370. getCurrentPerspective: function getCurrentPerspective() {
  10371. // this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.getCurrentPerspective is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
  10372. return this.Glass.getCurrentPerspective();
  10373. },
  10374. isOpeningAView: function isOpeningAView() {
  10375. // this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.isOpeningAView is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
  10376. return this.Glass.isOpeningAView();
  10377. },
  10378. isLoginViewShown: function isLoginViewShown() {
  10379. // this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.isLoginViewShown is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
  10380. return this.Glass.isLoginViewShown();
  10381. },
  10382. openAppView: function openAppView(perspective, context) {
  10383. // this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.openAppView is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
  10384. return this.Glass.openAppView(perspective, context);
  10385. },
  10386. openLoginView: function openLoginView(context) {
  10387. // this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.openLoginView is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
  10388. return this.Glass.openLoginView(context);
  10389. },
  10390. openPreviousAppView: function openPreviousAppView() {
  10391. // this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.openPreviousAppView is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
  10392. return this.Glass.openPreviousAppView();
  10393. },
  10394. // Search Perspective DOM API
  10395. findCollection: function findCollection(id) {
  10396. // this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.findCollection is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
  10397. return this.Glass.findCollection(id);
  10398. },
  10399. findElement: function findElement(id) {
  10400. // this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.findElement is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
  10401. return this.Glass.findElement(id);
  10402. },
  10403. findPlugin: function findPlugin(id) {
  10404. // this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.findPlugin is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
  10405. return this.Glass.findPlugin(id);
  10406. },
  10407. // Slideout API
  10408. hideSlideOut: function hideSlideOut(excludeAppViewSlideouts) {
  10409. // this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.hideSlideOut is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
  10410. return this.Glass.hideSlideOut(excludeAppViewSlideouts);
  10411. },
  10412. showSlideOut: function showSlideOut(options) {
  10413. // this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.showSlideOut is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
  10414. return this.Glass.showSlideOut(options);
  10415. },
  10416. // Toast API
  10417. showToast: function showToast(message, options) {
  10418. // this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.showToast is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
  10419. return this.Glass.showToast(message, options);
  10420. },
  10421. // Theme API
  10422. reloadTheme: function reloadTheme() {
  10423. // this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.reloadTheme is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
  10424. return this.Glass.reloadTheme();
  10425. },
  10426. // URL API
  10427. getUrl: function getUrl(context) {
  10428. // this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.getUrl is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
  10429. return this.Glass.getUrl(context);
  10430. },
  10431. // Other
  10432. updateCurrentCachedAppView: function updateCurrentCachedAppView() {
  10433. // this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.updateCurrentCachedAppView is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
  10434. return this.Glass.updateCurrentCachedAppView();
  10435. },
  10436. /** TO BE DEPRECATED */
  10437. lockGlass: function lockGlass() {
  10438. // this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.lockGlass is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
  10439. return this.Glass.lockGlass();
  10440. },
  10441. unlockGlass: function unlockGlass() {
  10442. // this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.unlockGlass is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
  10443. return this.Glass.unlockGlass();
  10444. }
  10445. });
  10446. return AppController;
  10447. });
  10448. //# sourceMappingURL=AppController.js.map
  10449. ;
  10450. /**
  10451. * Licensed Materials - Property of IBM
  10452. *
  10453. * IBM Cognos Products: BI Titan
  10454. *
  10455. * Copyright IBM Corp. 2015, 2018
  10456. *
  10457. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  10458. */
  10459. define('baglass/core-client/js/core-client/ui/Button',['./core/View', 'jquery', 'underscore', '../utils/Utils', '../utils/JQueryExt'], function (View, $, _, utils) {
  10460. /**
  10461. * This Class is the Glass provided button widget
  10462. */
  10463. var Button = View.extend({
  10464. tagName: 'button',
  10465. events: {
  10466. 'primaryaction': '_onSelect'
  10467. },
  10468. /**
  10469. *@constructs
  10470. *@buttonSpec specification of the button
  10471. */
  10472. init: function init(args) {
  10473. Button.inherited('init', this, args.buttonSpec);
  10474. _.extend(this, args.buttonSpec);
  10475. },
  10476. /**
  10477. * Render the plugin.
  10478. * @override
  10479. */
  10480. render: function render() {
  10481. this.$el.ariaButton(this);
  10482. utils.addClass(this.$el, 'button');
  10483. utils.addClass(this.$el, this['class']);
  10484. utils.setIcon(this.$el, this.icon, this.title);
  10485. this._initializePressState();
  10486. return Promise.resolve(this.el);
  10487. },
  10488. /**
  10489. * Sets a push button in the pressed state; Does nothing if this is regular button; i.e. not a push one
  10490. * @public
  10491. */
  10492. setPressed: function setPressed() {
  10493. this.$el.addClass('pushed');
  10494. this.$el.attr('aria-pressed', 'true');
  10495. this.$el.attr('aria-checked', 'true');
  10496. },
  10497. /**
  10498. * Sets a push button in the unpressed state; Does nothing if this is regular button; i.e. not a push one
  10499. * @public
  10500. */
  10501. setUnpressed: function setUnpressed() {
  10502. this.$el.removeClass('pushed');
  10503. this.$el.blur();
  10504. this.$el.attr('aria-pressed', 'false');
  10505. this.$el.attr('aria-checked', 'false');
  10506. },
  10507. /**
  10508. * toggles the pressed state; Does nothing if this is regular button; i.e. not a push one
  10509. * @public
  10510. * @return {Boolean} the pressed state it is toggled into: true if pressed false otherwise
  10511. */
  10512. togglePressed: function togglePressed() {
  10513. if (this.isPressed() === true) {
  10514. this.setUnpressed();
  10515. } else {
  10516. this.setPressed();
  10517. }
  10518. return this.isPressed();
  10519. },
  10520. /**
  10521. * sets the button as selected; selection is different from push, as it is exclusive, for now: you can have only one
  10522. * selected button; set the selection state only if it is not a push button
  10523. *
  10524. */
  10525. setSelected: function setSelected() {
  10526. var $activeButton = $('.currentlySelected');
  10527. if ($activeButton[0]) {
  10528. $activeButton.removeClass('currentlySelected');
  10529. }
  10530. if (!this.push) {
  10531. this.$el.addClass('currentlySelected');
  10532. }
  10533. },
  10534. /**
  10535. * Gets the states of a pushed button
  10536. * @public
  10537. * @return {Boolean} true if pressed; false otherwise
  10538. */
  10539. isPressed: function isPressed() {
  10540. return this.$el.hasClass('pushed');
  10541. },
  10542. /**
  10543. * Sets a button to the disabled state
  10544. * @public
  10545. */
  10546. disable: function disable() {
  10547. this.$el.addClass('disabled');
  10548. this.$el.attr('aria-disabled', 'true');
  10549. this.$el.attr('tabindex', '-1');
  10550. },
  10551. /**
  10552. * Sets a button to the enabled state
  10553. * @public
  10554. */
  10555. enable: function enable() {
  10556. this.$el.removeClass('disabled');
  10557. this.$el.attr('aria-disabled', 'false');
  10558. this.$el.attr('tabindex', '0');
  10559. },
  10560. /**
  10561. * Gets the enabled state of a button
  10562. * @public
  10563. * @return {Boolean} true if disabled; false otherwise
  10564. */
  10565. isEnabled: function isEnabled() {
  10566. return !this.$el.hasClass('disabled');
  10567. },
  10568. /**
  10569. * @private
  10570. * callback attached to all the items
  10571. * @param the corresponding event
  10572. */
  10573. _onSelect: function _onSelect(event) {
  10574. if (this.isEnabled() === true) {
  10575. if (this.push) {
  10576. this.togglePressed();
  10577. }
  10578. if (_.isFunction(this.onSelect)) {
  10579. this.onSelect(event);
  10580. }
  10581. }
  10582. },
  10583. _initializePressState: function _initializePressState() {
  10584. if (this.push) {
  10585. this.setUnpressed();
  10586. }
  10587. },
  10588. remove: function remove() {
  10589. Button.inherited('remove', this, arguments);
  10590. }
  10591. });
  10592. return Button;
  10593. });
  10594. //# sourceMappingURL=Button.js.map
  10595. ;
  10596. /**
  10597. * Licensed Materials - Property of IBM
  10598. *
  10599. * IBM Cognos Products: BI Glass
  10600. *
  10601. * Copyright IBM Corp. 2015, 2018
  10602. *
  10603. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  10604. */
  10605. define('baglass/app/plugins/Button',['./GlassPlugin', 'jquery', 'underscore', '../../core-client/js/core-client/ui/Button', '../../api/Context', '../AppEvents'], function (GlassPlugin, $, _, CommonButton, Context, AppEvents) {
  10606. /**
  10607. * This Class is the Glass provided button widget
  10608. */
  10609. var Button = GlassPlugin.extend(
  10610. /**
  10611. * @lends GlassButton.prototype
  10612. */
  10613. {
  10614. /**
  10615. * @classdesc Represent a button in the Nav/App bars
  10616. * @constructs
  10617. * @public
  10618. * @param {Object} - itemSpec specification of the button
  10619. */
  10620. init: function init() {
  10621. Button.inherited('init', this, arguments);
  10622. },
  10623. /**
  10624. * Render the plugin.
  10625. * @override
  10626. */
  10627. render: function render() {
  10628. var buttonSpecArgs = this._updateButtonSpec();
  10629. this._createCommonButton(buttonSpecArgs);
  10630. this.registerOneTimeCallback(AppEvents.APPVIEW_LOADED);
  10631. return this.button.render();
  10632. },
  10633. /**
  10634. * create the callback the controller.onPress/execute method with the onSelect
  10635. * @override
  10636. */
  10637. attachActionControllerCallbacks: function attachActionControllerCallbacks() {
  10638. var context = this.glassContext.addToOptions({
  10639. target: {
  10640. plugin: this
  10641. }
  10642. });
  10643. var logger = this.glassContext.getCoreSvc('.Logger');
  10644. var thisPlugin = this;
  10645. var baseButton = this.getBaseButton();
  10646. baseButton.onSelect = function () {
  10647. var _this = this;
  10648. return thisPlugin.getController().then(function (controller) {
  10649. _this.setSelected();
  10650. if (_this.push) {
  10651. context.pushState = _this.isPressed();
  10652. }
  10653. if (_.isFunction(controller.onPress)) {
  10654. controller.onPress(context);
  10655. } else if (_.isFunction(controller.execute)) {
  10656. var apiContext = new Context(context.glassContext);
  10657. var apiOptions = {
  10658. options: context.target.plugin.itemSpec.options
  10659. };
  10660. controller.execute(apiContext, apiOptions);
  10661. }
  10662. }).catch(function (error) {
  10663. logger.error('failed to retrieved the actionController or invoke its method', error);
  10664. });
  10665. };
  10666. },
  10667. /**
  10668. * @override
  10669. */
  10670. changeLabel: function changeLabel(label) {
  10671. if (_.isString(label)) {
  10672. this.$el.contents().last()[0].nodeValue = label;
  10673. }
  10674. },
  10675. /**
  10676. * Set the state of the button as pressed
  10677. * Do nothing if the base button is not defined
  10678. * @public
  10679. */
  10680. setPressed: function setPressed() {
  10681. if (this.getBaseButton()) {
  10682. this.getBaseButton().setPressed();
  10683. }
  10684. },
  10685. /**
  10686. * Set the state of the button as unpressed
  10687. * Do nothing if the base button is not defined
  10688. * @public
  10689. */
  10690. setUnpressed: function setUnpressed() {
  10691. if (this.getBaseButton()) {
  10692. this.getBaseButton().setUnpressed();
  10693. }
  10694. },
  10695. /**
  10696. * getter
  10697. * @return {Button} The ui_common button which is contained in this plugin
  10698. */
  10699. getBaseButton: function getBaseButton() {
  10700. return this.button;
  10701. },
  10702. _updateButtonSpec: function _updateButtonSpec() {
  10703. var buttonSpecArgs = {
  10704. buttonSpec: {
  10705. 'id': this.itemSpec.id,
  10706. 'class': this.itemSpec['class'],
  10707. 'label': this.itemSpec.label,
  10708. 'title': this.itemSpec.title,
  10709. 'icon': this.itemSpec.icon,
  10710. 'push': this.itemSpec.push
  10711. }
  10712. };
  10713. if (this.itemSpec.label) {
  10714. if (buttonSpecArgs.buttonSpec['class']) {
  10715. buttonSpecArgs.buttonSpec['class'] = buttonSpecArgs.buttonSpec['class'] + ' labelled';
  10716. } else {
  10717. buttonSpecArgs.buttonSpec['class'] = 'labelled';
  10718. }
  10719. }
  10720. return buttonSpecArgs;
  10721. },
  10722. _createCommonButton: function _createCommonButton(buttonSpecArgs) {
  10723. this.button = new CommonButton(buttonSpecArgs);
  10724. this.$el = this.button.$el;
  10725. }
  10726. });
  10727. return Button;
  10728. });
  10729. //# sourceMappingURL=Button.js.map
  10730. ;
  10731. /**
  10732. * Licensed Materials - Property of IBM
  10733. *
  10734. * "Restricted Materials of IBM"
  10735. *
  10736. * 5746-SM2
  10737. *
  10738. * (C) Copyright IBM Corp. 2015, 2017
  10739. *
  10740. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  10741. */
  10742. define('baglass/app/plugins/ButtonActionInterface',['../../core-client/js/core-client/ui/core/Class'], function (Class) {
  10743. /**
  10744. * This class lists all the methods corresponding to the actions supported by a button
  10745. * It plays the role of an interface, consumer can extend it.
  10746. *
  10747. * @interface
  10748. */
  10749. var ButtonActionInterface = Class.extend({
  10750. /**
  10751. * method to be invoked on the press action
  10752. * @param {Object} context - The context for this item
  10753. * @param {Object} context.glassContext - The glass context.
  10754. * @param {Object} context.target - containing info on the target; one is the plugin
  10755. * @param {string} context.target.itemId - The id of the pressed item
  10756. */
  10757. onPress: function onPress(context) {
  10758. console.info('I am pressed', context.target.itemId);
  10759. },
  10760. /**
  10761. * method to be invoked when the button is rendered
  10762. * @param {Object} context - The context for this item
  10763. * @param {Object} context.glassContext - The glass context.
  10764. * @param {Object} context.target - containing info on the target; one is the plugin
  10765. * @param {string} context.target.itemId - The id of the rendered item
  10766. */
  10767. onRender: function
  10768. /* context */
  10769. onRender() {},
  10770. /**
  10771. * Method to be invoked when loading a coachmark.
  10772. * Can be used to dynamically set the coachmark's title
  10773. * or contents
  10774. * @param {Object} context - The context for this coach mark
  10775. * @param {Object} context.glassContext - The glass context.
  10776. * @param {Object} context.target - The coachMark target for which we want the spec
  10777. * @param {string} context.target.itemId - The id of the item for which we want the
  10778. * coach mark spec
  10779. * @param {Object} context.target.coachMark - The current spec of the coachMark, if any
  10780. * @returns {Object} A coach mark specification, including title and contents.
  10781. */
  10782. getCoachMarkSpec: function
  10783. /* context */
  10784. getCoachMarkSpec() {}
  10785. });
  10786. return ButtonActionInterface;
  10787. });
  10788. //# sourceMappingURL=ButtonActionInterface.js.map
  10789. ;
  10790. /*
  10791. *+------------------------------------------------------------------------+
  10792. *| Licensed Materials - Property of IBM
  10793. *| IBM Cognos Products: Content Explorer
  10794. *| (C) Copyright IBM Corp. 2015, 2016
  10795. *|
  10796. *| US Government Users Restricted Rights - Use, duplication or disclosure
  10797. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  10798. *+------------------------------------------------------------------------+
  10799. */
  10800. define('baglass/core-client/js/core-client/utils/StringMeasurementUtils',['jquery', 'underscore'], function ($, _) {
  10801. 'use strict';
  10802. var canvas = document.createElement('canvas');
  10803. var context = canvas.getContext('2d');
  10804. var charWidthCache = {};
  10805. var StringMeasurementUtils = function StringMeasurementUtils() {};
  10806. StringMeasurementUtils.prototype.getNodeFont = function ($node) {
  10807. var font = $node.css(['font-variant', 'font-weight', 'font-size', 'font-family']);
  10808. return _.values(font).join(' ');
  10809. };
  10810. StringMeasurementUtils.prototype.charWidth = function (char, font) {
  10811. if (charWidthCache[font] === undefined) {
  10812. charWidthCache[font] = {};
  10813. }
  10814. var res = charWidthCache[font][char];
  10815. if (res === undefined) {
  10816. context.font = font;
  10817. // Repeat the character n times to increase the precision of measureText on IE which returns an integer
  10818. var n = 10;
  10819. var metrics = context.measureText(Array(n + 1).join(char));
  10820. res = metrics.width / n;
  10821. charWidthCache[font][char] = res;
  10822. }
  10823. return res;
  10824. };
  10825. StringMeasurementUtils.prototype.getTextWidth = function (text, font, force) {
  10826. if (force) {
  10827. context.font = font;
  10828. return context.measureText(text).width;
  10829. }
  10830. var i = text.length;
  10831. var strLen = 0;
  10832. while (i--) {
  10833. strLen += this.charWidth(text[i], font);
  10834. }
  10835. return strLen;
  10836. };
  10837. StringMeasurementUtils.prototype.charsInWidth = function (text, font, size, maxStrLength, forward) {
  10838. var strLen = 0;
  10839. for (var i = 0; i < maxStrLength; i++) {
  10840. var char = text[forward ? i : text.length - 1 - i];
  10841. var len;
  10842. if (charWidthCache[font] !== undefined && (len = charWidthCache[font][char]) === undefined) {
  10843. len = this.charWidth(char, font);
  10844. }
  10845. strLen += len;
  10846. // In IE, the measured width precision is not 100% accurate, when we are 1px from the desired length, compute the real easurement
  10847. if (strLen >= size - 1 && strLen < size) {
  10848. var realText = forward ? text.substring(0, i + 1) : text.substring(text.length - i - 1);
  10849. var realLen = this.getTextWidth(realText, font, true);
  10850. if (realLen >= size) {
  10851. return i;
  10852. }
  10853. }
  10854. if (strLen >= size) {
  10855. return i;
  10856. }
  10857. }
  10858. return maxStrLength;
  10859. };
  10860. StringMeasurementUtils.prototype.isZoomTextOnly = function () {
  10861. var pt = 14;
  10862. var $div = $('<div>').css('font-size', pt);
  10863. var zoomTextOnly = parseInt($div.css('font-size')) !== pt;
  10864. $div.remove();
  10865. return zoomTextOnly;
  10866. };
  10867. StringMeasurementUtils.prototype.getIntCSSProp = function ($node, prop) {
  10868. return parseInt($node.css(prop));
  10869. };
  10870. StringMeasurementUtils.prototype.getLineCount = function ($node, isZoomTextOnly) {
  10871. if (isZoomTextOnly === undefined) {
  10872. isZoomTextOnly = this.isZoomTextOnly();
  10873. }
  10874. var lineCount = 1;
  10875. var lineHeight = this.getIntCSSProp($node, 'line-height');
  10876. var maxHeight = this.getIntCSSProp($node, 'max-height');
  10877. if (lineHeight > 0 && maxHeight > 0 && $node.css('white-space') !== 'nowrap' && !isZoomTextOnly) {
  10878. // If we set css line-height and white-space wrap and firefox zoom text only is zoom 100%
  10879. lineCount = Math.max(1, parseInt(maxHeight / lineHeight));
  10880. }
  10881. return lineCount;
  10882. };
  10883. StringMeasurementUtils.prototype.getAvailableWidth = function ($node, lineCount) {
  10884. if (lineCount === undefined) {
  10885. lineCount = this.getLineCount($node);
  10886. }
  10887. var nodeRect = $node[0].getBoundingClientRect();
  10888. var $nodePadding = $node.outerWidth() - $node.width();
  10889. var availableWidth = (Math.floor(nodeRect.width) - $nodePadding) * lineCount;
  10890. // Removes the width of the children nodes such as the icon in the switcher
  10891. availableWidth -= $node.children().length ? $node.children().width() : 0;
  10892. return availableWidth;
  10893. };
  10894. StringMeasurementUtils.prototype.getStringWidth = function ($node, lineCount, availableWidth) {
  10895. var isZoomTextOnly = this.isZoomTextOnly();
  10896. if (availableWidth === undefined) {
  10897. availableWidth = this.getAvailableWidth($node);
  10898. }
  10899. if (lineCount === undefined) {
  10900. lineCount = this.getLineCount($node, isZoomTextOnly);
  10901. }
  10902. var stringWidth;
  10903. var maxHeight = this.getIntCSSProp($node, 'max-height');
  10904. if (lineCount > 1 || $node.is('INPUT') || isZoomTextOnly && maxHeight > 0) {
  10905. var value = $node.val() || $node.text();
  10906. var font = this.getNodeFont($node);
  10907. stringWidth = this.getTextWidth(value, font, true);
  10908. } else {
  10909. stringWidth = availableWidth + $node[0].scrollWidth - $node[0].offsetWidth;
  10910. }
  10911. return stringWidth;
  10912. };
  10913. return new StringMeasurementUtils();
  10914. });
  10915. //# sourceMappingURL=StringMeasurementUtils.js.map
  10916. ;
  10917. /*
  10918. *+------------------------------------------------------------------------+
  10919. *| Licensed Materials - Property of IBM
  10920. *| IBM Cognos Products: Content Explorer
  10921. *| (C) Copyright IBM Corp. 2015, 2017
  10922. *|
  10923. *| US Government Users Restricted Rights - Use, duplication or disclosure
  10924. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  10925. *+------------------------------------------------------------------------+
  10926. */
  10927. define('baglass/core-client/js/core-client/utils/ContentFormatter',['jquery', 'underscore', './StringMeasurementUtils'], function ($, _, StringMeasurement) {
  10928. 'use strict';
  10929. var ELLIPSIS_STR = '…';
  10930. var NBSP = '\xA0';
  10931. var ZWSP = '\u200B';
  10932. function getFirstTextNode(nodeWithText) {
  10933. return _.find(nodeWithText.childNodes, function (node) {
  10934. return node.nodeType === Node.TEXT_NODE && node.nodeValue.length > 0;
  10935. });
  10936. }
  10937. var ContentFormatter = function ContentFormatter() {};
  10938. function stringFittingInWidth(stringValue, font, size, maxStrLength, forward) {
  10939. if (stringValue.length === 0) {
  10940. return '';
  10941. }
  10942. var len = StringMeasurement.charsInWidth(stringValue, font, Math.floor(size), maxStrLength, forward);
  10943. if (forward) {
  10944. return stringValue.substring(0, len).trim();
  10945. } else {
  10946. // Remove truncated words after the ellipsis
  10947. var cutFrom = stringValue.length - len;
  10948. var previousChars = stringValue.substring(cutFrom - 1, cutFrom + 1);
  10949. if (previousChars.indexOf(' ') === -1) {
  10950. // There are no spaces at the beginning, we must be truncating a word.
  10951. var nextWord = stringValue.indexOf(' ', cutFrom);
  10952. if (nextWord !== -1) {
  10953. cutFrom = nextWord;
  10954. }
  10955. }
  10956. return stringValue.substring(cutFrom).trim();
  10957. }
  10958. }
  10959. ContentFormatter.prototype.updateEllipsesBasedOnWidth = function (nodeWithText, lengthAvailable, stringWidth, lineCount) {
  10960. var overflowHeight = lineCount > 1 && nodeWithText.scrollHeight - 2 - nodeWithText.offsetHeight > 0;
  10961. var $nodeWithText = $(nodeWithText);
  10962. var newValue = null;
  10963. var textNode;
  10964. var isInput = $nodeWithText.is('INPUT');
  10965. var initialStringValue;
  10966. if (isInput) {
  10967. textNode = null;
  10968. initialStringValue = $nodeWithText.val();
  10969. } else {
  10970. textNode = getFirstTextNode(nodeWithText);
  10971. initialStringValue = textNode ? textNode.nodeValue : '';
  10972. }
  10973. // Checking for ELLIPSIS_STR prevent multiple string shortening to introduce ... in the title
  10974. if (initialStringValue.indexOf(ELLIPSIS_STR) === -1) {
  10975. // If we're dealing with an input, then the full text should be displayed when it gets focus. No need to
  10976. // add an aria-label since it will cause issues with reading the controls label
  10977. if (!isInput) {
  10978. $nodeWithText.attr('aria-label', initialStringValue);
  10979. }
  10980. $nodeWithText.attr('title', initialStringValue);
  10981. }
  10982. // Add a zero width space between words as in MultiPage will have an invisible space between the i and the P.
  10983. var stringValue = initialStringValue.replace(/([a-z])([a-z])([A-Z])([a-z])/g, '$1' + '$2' + ZWSP + '$3' + '$4').trim();
  10984. if (lengthAvailable > 0 && (lengthAvailable < stringWidth - 1 || overflowHeight)) {
  10985. var font = StringMeasurement.getNodeFont($nodeWithText);
  10986. var spaceWidth = StringMeasurement.getTextWidth(NBSP, font);
  10987. var ellipsisWidth = StringMeasurement.getTextWidth(ELLIPSIS_STR, font);
  10988. if (lengthAvailable > ellipsisWidth) {
  10989. var textSpaceAvailable = lengthAvailable / 2;
  10990. var leftText, rightText;
  10991. if (lineCount > 1) {
  10992. // When multiple lines, the first line contains half of the text and the ellipsis
  10993. // The second line contains the truncated second half starting on a word boundary
  10994. leftText = stringFittingInWidth(stringValue, font, textSpaceAvailable - ellipsisWidth - spaceWidth, stringValue.length, true);
  10995. rightText = stringFittingInWidth(stringValue, font, textSpaceAvailable - spaceWidth, stringValue.length - leftText.length, false);
  10996. } else {
  10997. // When single line, compute the space of the second half in order to start on a word boundary
  10998. // The first half might have a longer content to fit the space left
  10999. rightText = stringFittingInWidth(stringValue, font, textSpaceAvailable - spaceWidth, stringValue.length, false);
  11000. var rightTextWidth = StringMeasurement.getTextWidth(rightText, font);
  11001. leftText = stringFittingInWidth(stringValue, font, lengthAvailable - rightTextWidth - ellipsisWidth - spaceWidth * 2, stringValue.length - rightText.length, true);
  11002. }
  11003. if (leftText.length + rightText.length < stringValue.length) {
  11004. // Use a non-breakable space to keep the ... next to the previous letter
  11005. if (leftText.length > 0) {
  11006. leftText += NBSP;
  11007. }
  11008. if (rightText.length > 0) {
  11009. rightText = (lineCount > 1 ? ZWSP : NBSP) + rightText;
  11010. }
  11011. newValue = leftText + ELLIPSIS_STR + rightText;
  11012. } else if (leftText.length > 0 && rightText.length > 0) {
  11013. // Add a zero width space in the center of a word to fit it on the first line
  11014. newValue = leftText + ZWSP + rightText;
  11015. } else {
  11016. newValue = leftText + rightText;
  11017. }
  11018. } else {
  11019. newValue = '';
  11020. }
  11021. } else {
  11022. // Sets the newValue to stringValue in order to keep the ZWSP
  11023. if (stringValue !== initialStringValue) {
  11024. newValue = stringValue;
  11025. }
  11026. }
  11027. if (newValue !== null) {
  11028. if (isInput) {
  11029. $nodeWithText.val(newValue);
  11030. } else if (textNode) {
  11031. textNode.nodeValue = newValue;
  11032. }
  11033. }
  11034. };
  11035. ContentFormatter.prototype.middleShortenString = function (node) {
  11036. var $node = $(node);
  11037. var lineCount = StringMeasurement.getLineCount($node);
  11038. var availableWidth = StringMeasurement.getAvailableWidth($node, lineCount);
  11039. var stringWidth = StringMeasurement.getStringWidth($node, lineCount, availableWidth);
  11040. this.updateEllipsesBasedOnWidth($node[0], availableWidth, stringWidth, lineCount);
  11041. };
  11042. ContentFormatter.prototype.resizeInput = function (node) {
  11043. var $node = $(node);
  11044. if ($node.is('INPUT')) {
  11045. var availableWidth = StringMeasurement.getAvailableWidth($node) + 1;
  11046. var stringWidth = StringMeasurement.getStringWidth($node);
  11047. // Set the width of the input to the smallest needed. Needed so that the
  11048. // edit pencil shows up beside the input field.
  11049. if (stringWidth < availableWidth) {
  11050. $node.css('width', stringWidth + 10 + 'px');
  11051. } else {
  11052. $node.css('width', availableWidth + 10 + 'px');
  11053. }
  11054. }
  11055. };
  11056. return new ContentFormatter();
  11057. });
  11058. //# sourceMappingURL=ContentFormatter.js.map
  11059. ;
  11060. /* Licensed Materials - Property of IBM
  11061. *
  11062. * IBM Cognos Products: BI
  11063. *
  11064. * Copyright IBM Corp. 2015, 2017
  11065. *
  11066. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  11067. */
  11068. define('baglass/core-client/js/core-client/ui/DropDownMenu',['./core/View', 'jquery', 'underscore', './Button', './Menu', '../utils/ContentFormatter', '../utils/BidiUtil', 'bootstrap'], function (View, $, _, Button, Menu, ContentFormatter, BidiUtil) {
  11069. /**
  11070. * This Class is the Glass provided DropDownMenu widget
  11071. */
  11072. var DropDownMenu = View.extend({
  11073. /**
  11074. *@constructs
  11075. *@DropDownMenuSpec specification of the DropDownMenu
  11076. */
  11077. init: function init(args) {
  11078. DropDownMenu.inherited('init', this, args.dropDownMenuSpec);
  11079. _.extend(this, args.dropDownMenuSpec);
  11080. },
  11081. /**
  11082. * Render the plugin.
  11083. * @override
  11084. */
  11085. render: function render() {
  11086. var className = 'menu ';
  11087. if (this['class']) {
  11088. className += this['class'];
  11089. }
  11090. var spec = {
  11091. 'id': this.id,
  11092. 'title': BidiUtil.enforceTextDirection(this.title),
  11093. 'label': BidiUtil.enforceTextDirection(this.label),
  11094. 'class': className,
  11095. 'icon': this.icon,
  11096. 'haspopup': true
  11097. };
  11098. var button = this._createMenuButton(spec);
  11099. button.onSelect = this._onMenuSelect.bind(this);
  11100. return button.render().then(function (el) {
  11101. this.$el = button.$el;
  11102. this._setTitle();
  11103. this.menuButton = button;
  11104. this.menuButtonDom = el;
  11105. return el;
  11106. }.bind(this));
  11107. },
  11108. /**
  11109. * getter
  11110. * @return {Button} the button which shows the menu when is primaryactioned; undefined if the dropdown menu is not rendered
  11111. */
  11112. getButton: function getButton() {
  11113. return this.menuButton;
  11114. },
  11115. setMenuItems: function setMenuItems(shownItems, showPopover, event) {
  11116. this.items = shownItems;
  11117. if (showPopover) {
  11118. return this._onMenuSelect(event);
  11119. } else {
  11120. return Promise.resolve();
  11121. }
  11122. },
  11123. _setTitle: function _setTitle() {
  11124. if (this.$el && this.$el.length) {
  11125. if (this.title) {
  11126. $(this.$el).attr('title', this.title);
  11127. } else if (this.label) {
  11128. $(this.$el).attr('title', this.label);
  11129. }
  11130. }
  11131. },
  11132. _onMenuSelect: function _onMenuSelect() {
  11133. Menu.hideOpenMenus();
  11134. if (!this.$ddPopover) {
  11135. var $activeButton = $('.currentlySelected');
  11136. if ($activeButton[0]) {
  11137. $activeButton.removeClass('currentlySelected');
  11138. }
  11139. this.$el.addClass('currentlySelected');
  11140. this.contentMenu = this._createMenu(this.items);
  11141. return this.contentMenu.render().then(function (menuDomEl) {
  11142. this.contentMenu.whenReadyToClose = this._closePopover.bind(this);
  11143. var menuClass = 'popover glass-menu ';
  11144. if (this['class']) {
  11145. menuClass += this['class'];
  11146. }
  11147. var popoverOptions = {
  11148. placement: this.ddMenuPlacement,
  11149. trigger: 'manual',
  11150. container: 'body',
  11151. content: function content() {
  11152. return $(menuDomEl);
  11153. },
  11154. template: '<div class="' + menuClass + '" role="tooltip"><div class="arrow"></div><div class="popover-content"></div></div>',
  11155. html: true
  11156. };
  11157. this._showPopover(popoverOptions);
  11158. }.bind(this));
  11159. } else {
  11160. return Promise.resolve();
  11161. }
  11162. },
  11163. _createMenuButton: function _createMenuButton(spec) {
  11164. return new Button({
  11165. buttonSpec: spec
  11166. });
  11167. },
  11168. _createMenu: function _createMenu(itemsList) {
  11169. return new Menu({
  11170. spec: {
  11171. items: itemsList
  11172. }
  11173. });
  11174. },
  11175. _showPopover: function _showPopover(options) {
  11176. // Bootstrap empties the title when opening the pop-up, setting data-selector to true prevent bootstrap from updating the title.
  11177. // See: http://stackoverflow.com/questions/27235776/can-i-still-use-the-title-attribute-on-bootstrap-popovers
  11178. this.$el.attr('data-selector', 'true');
  11179. this.$ddPopover = this.$el.popover(options);
  11180. this.$ddPopover.popover('show');
  11181. this.popupId = this.$ddPopover.attr('aria-describedby');
  11182. this._updatePopupover();
  11183. },
  11184. _updatePopupover: function _updatePopupover() {
  11185. var $popupEl = $('#' + this.popupId);
  11186. var popupItems = $popupEl.find('.commonMenuItem');
  11187. _.each(popupItems, function (item) {
  11188. var $anchorEl = $(item).find('a');
  11189. var $iconEl = $anchorEl.find('svg');
  11190. var $spanEl = $(item).find('span');
  11191. var aWidth = $anchorEl.width();
  11192. var spanPadding = $spanEl.innerWidth() - $spanEl.width();
  11193. var maxSpanWidth = aWidth - $iconEl.outerWidth(true) - spanPadding;
  11194. if ($spanEl.length) {
  11195. ContentFormatter.updateEllipsesBasedOnWidth($spanEl[0], maxSpanWidth, $spanEl.width());
  11196. }
  11197. }, this);
  11198. },
  11199. /**
  11200. * @private
  11201. * closes the popover
  11202. */
  11203. _closePopover: function _closePopover() {
  11204. return new Promise(function (resolve, reject) {
  11205. if (this.$ddPopover) {
  11206. this.$ddPopover.on('hidden.bs.popover', function () {
  11207. this._removePopover();
  11208. resolve();
  11209. }.bind(this));
  11210. // Hack-fix for bootstrap popover not dispatching 'hidden.bs.popover' event
  11211. setTimeout(function () {
  11212. this._removePopover();
  11213. resolve();
  11214. }.bind(this), 250);
  11215. this.$el.removeClass('currentlySelected');
  11216. this.$el.blur();
  11217. this.$ddPopover.popover('hide');
  11218. } else {
  11219. reject(new Error('Failed to close popover'));
  11220. }
  11221. }.bind(this));
  11222. },
  11223. _removePopover: function _removePopover() {
  11224. if (this.$ddPopover) {
  11225. this.$ddPopover.off('hidden.bs.popover');
  11226. this.$ddPopover.popover('destroy');
  11227. this.$ddPopover = null;
  11228. $('#' + this.popupId).remove();
  11229. }
  11230. },
  11231. remove: function remove() {
  11232. this._removePopover();
  11233. DropDownMenu.inherited('remove', this, arguments);
  11234. },
  11235. closeDropDownMenu: function closeDropDownMenu(event) {
  11236. if (this.contentMenu) {
  11237. var contentMenu = this.contentMenu;
  11238. this.contentMenu = null;
  11239. return contentMenu.closeMenu(event, false);
  11240. } else {
  11241. return this._closePopover(event);
  11242. }
  11243. }
  11244. });
  11245. return DropDownMenu;
  11246. });
  11247. //# sourceMappingURL=DropDownMenu.js.map
  11248. ;
  11249. /**
  11250. * Licensed Materials - Property of IBM
  11251. *
  11252. * IBM Cognos Products: BI Titan
  11253. *
  11254. * Copyright IBM Corp. 2015, 2018
  11255. *
  11256. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  11257. */
  11258. define('baglass/app/plugins/GlassMenu',['./GlassPlugin', 'jquery', 'underscore', '../../core-client/js/core-client/utils/ClassFactory', './MenuActionControllerDispatcher', '../../core-client/js/core-client/ui/DropDownMenu', '../../core-client/js/core-client/ui/Button', '../AppEvents'], function (GlassPlugin, $, _, ClassFactory, ControllerDispatcher, DropDownMenu, Button, AppEvents) {
  11259. /**
  11260. * This Class is the Glass provided Menu widget
  11261. */
  11262. var GlassMenu = GlassPlugin.extend(
  11263. /**
  11264. * @lends GlassMenu.prototype
  11265. */
  11266. {
  11267. _ClassFactory: ClassFactory,
  11268. /**
  11269. * @classdesc class representing a menu
  11270. * @augments GlassPlugin
  11271. * @constructs
  11272. * @public
  11273. * @param {Object} options - set of initial properties
  11274. *
  11275. * */
  11276. init: function init(options) {
  11277. $.extend(true, this, options);
  11278. var spec = this.itemSpec;
  11279. if (spec.labelOnly === undefined) {
  11280. if (!spec.icon) {
  11281. spec.labelOnly = 'true';
  11282. } else if (spec.label) {
  11283. spec.labelOnly = 'false';
  11284. }
  11285. }
  11286. GlassMenu.inherited('init', this, [spec]);
  11287. },
  11288. /**
  11289. * @override
  11290. */
  11291. changeLabel: function changeLabel(label) {
  11292. if (_.isString(label)) {
  11293. this.$el.contents().last()[0].nodeValue = label;
  11294. }
  11295. },
  11296. /**
  11297. * Gets the button element of the menu.
  11298. * @public
  11299. * @example
  11300. * //Used in the item controller to pass the launch point when opening a slideout
  11301. * var options = itemSpec.options;
  11302. * options.launchPoint = context.target.plugin.getButtonElement();
  11303. * context.glassContext.showSlideOut(options);
  11304. *
  11305. * @return {JqueryObject} the button element when it is defined
  11306. */
  11307. getButtonElement: function getButtonElement() {
  11308. return this.activeObject;
  11309. },
  11310. /**
  11311. * getter
  11312. * @public
  11313. * @return {DropDownMenu} the dropdown menu object; undefined if not rendered.
  11314. */
  11315. getDropdownMenu: function getDropdownMenu() {
  11316. return this.ddMenu;
  11317. },
  11318. /**
  11319. * getter
  11320. * @public
  11321. * @return {Button} the default action button; undefined if not rendered or there is no default action
  11322. */
  11323. getDefaultActionButton: function getDefaultActionButton() {
  11324. return this.defaultButton;
  11325. },
  11326. /**
  11327. * Setting the action controller is necessary at this stage, as the action attribute needs to be set for each item
  11328. * @override
  11329. */
  11330. render: function render() {
  11331. this.registerOneTimeCallback(AppEvents.APPVIEW_LOADED);
  11332. this._createMenu();
  11333. return this.ddMenu.render().then(function (menu) {
  11334. this.$el = $(menu);
  11335. this.activeObject = this.ddMenu.$el;
  11336. if (this.defaultButton) {
  11337. this.$el = $('<div id = "' + this.id + '" >');
  11338. return this.defaultButton.render().then(function
  11339. /* el */
  11340. () {
  11341. this.$el.append(this.defaultButton.$el);
  11342. this.$el.append(this.ddMenu.menuButton.$el);
  11343. this.$el.addClass('inlineFlex');
  11344. return this.$el[0];
  11345. }.bind(this));
  11346. } else {
  11347. return this.$el[0];
  11348. }
  11349. }.bind(this));
  11350. },
  11351. /**
  11352. * create the callback the controller.onPress/execute method with the onSelect
  11353. * @override
  11354. */
  11355. attachActionControllerCallbacks: function attachActionControllerCallbacks() {
  11356. this.ddMenu.menuButton.onSelect = this._handleMenuClick.bind(this);
  11357. if (this.defaultButton) {
  11358. this.defaultButton.onSelect = this._handleDefaultAction.bind(this);
  11359. }
  11360. },
  11361. /**
  11362. * get the controller dispatcher
  11363. */
  11364. getController: function getController() {
  11365. var aModulePromises = [];
  11366. var aFeatures = [];
  11367. var oControllerMap = {};
  11368. if (!this._loadingController) {
  11369. this._loadingController = new Promise(function (resolve) {
  11370. _.each(this.itemSpec.actionControllers, function (module, key) {
  11371. aModulePromises.push(this._loadController(module, key));
  11372. aFeatures.push(key);
  11373. }.bind(this));
  11374. resolve(Promise.all(aModulePromises).then(function (controllers) {
  11375. _.each(controllers, function (item, index) {
  11376. oControllerMap[aFeatures[index]] = item;
  11377. });
  11378. this._controller = this._createControllerDispatcher(oControllerMap);
  11379. return this._controller;
  11380. }.bind(this)));
  11381. }.bind(this));
  11382. }
  11383. return this._loadingController;
  11384. },
  11385. _loadController: function _loadController(module, key) {
  11386. return this._ClassFactory.instantiate(module).then(function (controller) {
  11387. if (_.isFunction(controller.initialize)) {
  11388. var oEventContext = {
  11389. glassContext: this.glassContext,
  11390. target: {
  11391. plugin: this,
  11392. itemId: this.itemSpec.id
  11393. },
  11394. controllerConfig: this.itemSpec.controllerConfig && this.itemSpec.controllerConfig[key]
  11395. };
  11396. return Promise.resolve(controller.initialize.apply(controller, [oEventContext])).then(function () {
  11397. return controller;
  11398. });
  11399. } else {
  11400. return controller;
  11401. }
  11402. }.bind(this));
  11403. },
  11404. /**
  11405. * Creates the menu and the default action menu if required
  11406. */
  11407. _createMenu: function _createMenu() {
  11408. var menuButtonSpec;
  11409. var defaultActionItem = this._findDefaultActionItem();
  11410. if (defaultActionItem) {
  11411. var defaultButtonSpec;
  11412. menuButtonSpec = {
  11413. dropDownMenuSpec: {
  11414. 'id': this.id + '.menu',
  11415. 'title': this.title,
  11416. 'icon': 'common-dropdown',
  11417. 'class': 'button menu comboBox',
  11418. 'ddMenuPlacement': this.ddMenuPlacement,
  11419. 'items': []
  11420. }
  11421. };
  11422. var title = _.isUndefined(defaultActionItem.title) ? defaultActionItem.label : defaultActionItem.title;
  11423. defaultButtonSpec = {
  11424. 'id': this.id + '.default',
  11425. 'title': title,
  11426. 'icon': this.icon,
  11427. 'class': this['class'] + ' menu defaultButton',
  11428. 'item': defaultActionItem
  11429. };
  11430. this.defaultButton = new Button({
  11431. buttonSpec: defaultButtonSpec
  11432. });
  11433. } else {
  11434. if (this.label) {
  11435. if (_.isUndefined(this['class'])) {
  11436. this['class'] = 'dropDownImage';
  11437. } else {
  11438. this['class'] += ' dropDownImage';
  11439. }
  11440. }
  11441. menuButtonSpec = {
  11442. dropDownMenuSpec: {
  11443. 'id': this.id,
  11444. 'label': this.label,
  11445. 'title': this.title,
  11446. 'icon': this.icon,
  11447. 'class': this['class'],
  11448. 'ddMenuPlacement': this.ddMenuPlacement,
  11449. 'items': []
  11450. }
  11451. };
  11452. }
  11453. this.ddMenu = this._createDropDownMenu(menuButtonSpec);
  11454. },
  11455. _handleMenuClick: function _handleMenuClick(event) {
  11456. var logger = this.glassContext.getCoreSvc('.Logger');
  11457. return this._updateMenuItemsList().then(function (shownItems) {
  11458. this.ddMenu.setMenuItems(shownItems, true, event);
  11459. }.bind(this)).catch(function (error) {
  11460. logger.error('failure in the onSelect callback', error);
  11461. });
  11462. },
  11463. /**
  11464. * Creates the controller dispatcher providing the controller Map
  11465. * @private
  11466. * @param controllerMap
  11467. * @return Instance of the controller Dispatcher
  11468. */
  11469. _createControllerDispatcher: function _createControllerDispatcher(controllerMap) {
  11470. return new ControllerDispatcher(controllerMap);
  11471. },
  11472. _createDropDownMenu: function _createDropDownMenu(menuSpec) {
  11473. return new DropDownMenu(menuSpec);
  11474. },
  11475. _handleDefaultAction: function
  11476. /* event */
  11477. _handleDefaultAction() {
  11478. var _this = this;
  11479. var logger = this.glassContext.getCoreSvc('.Logger');
  11480. return this.getController().then(function (controller) {
  11481. var featureController = controller.getControllerMap()[_this.defaultButton.item.featureId];
  11482. var context = {
  11483. glassContext: _this.glassContext,
  11484. target: {
  11485. plugin: _this,
  11486. itemId: _this.defaultButton.item.id,
  11487. specItemIndex: _this.defaultButton.item.index,
  11488. index: 0
  11489. }
  11490. };
  11491. if (featureController && _.isFunction(featureController.onSelectItem)) {
  11492. featureController.onSelectItem.call(featureController, context);
  11493. }
  11494. }).catch(function (error) {
  11495. logger.error('failed to call the default action', error);
  11496. });
  11497. },
  11498. _findDefaultActionItem: function _findDefaultActionItem() {
  11499. var defaultActionItem;
  11500. var itemIndex;
  11501. if (_.isString(this.defaultAction)) {
  11502. defaultActionItem = _.find(this.itemSpec.items, function (item, index) {
  11503. itemIndex = index;
  11504. return item.id === this.defaultAction;
  11505. }.bind(this));
  11506. }
  11507. if (defaultActionItem) {
  11508. defaultActionItem.index = itemIndex;
  11509. }
  11510. return defaultActionItem;
  11511. },
  11512. _updateMenuItemsList: function _updateMenuItemsList() {
  11513. var _this2 = this;
  11514. var oEventContext = {
  11515. glassContext: this.glassContext,
  11516. target: {
  11517. plugin: this,
  11518. itemId: this.itemSpec.id
  11519. }
  11520. };
  11521. return this.getController().then(function (controller) {
  11522. return controller.onOpen(oEventContext).then(function () {
  11523. var shownItems = [];
  11524. controller.buildItemMap(this.itemSpec.items);
  11525. var idx = 0;
  11526. _.each(this.itemSpec.items, function (item, index) {
  11527. var oEventContext = {
  11528. glassContext: this.glassContext,
  11529. target: {
  11530. plugin: this,
  11531. itemId: item.id,
  11532. specItemIndex: index
  11533. }
  11534. };
  11535. var isVisible = controller.isItemVisible(oEventContext);
  11536. if (isVisible) {
  11537. oEventContext.target.index = idx++;
  11538. var uiItem = {};
  11539. $.extend(true, uiItem, item);
  11540. uiItem.name = item.id;
  11541. uiItem.onSelect = function ($menuItem) {
  11542. oEventContext.target.activeObject = $menuItem;
  11543. controller.onSelectItem.call(controller, oEventContext);
  11544. }.bind(this);
  11545. uiItem.onRemove = function ($menuItem) {
  11546. oEventContext.target.activeObject = $menuItem;
  11547. return controller.onRemoveItem.call(controller, oEventContext);
  11548. }.bind(this);
  11549. uiItem.onRender = function ($menuItem) {
  11550. oEventContext.target.activeObject = $menuItem;
  11551. controller.onRenderItem.call(controller, oEventContext);
  11552. }.bind(this);
  11553. var customLabel = controller.getLabel(oEventContext);
  11554. if (!_.isUndefined(customLabel)) {
  11555. uiItem.label = customLabel;
  11556. }
  11557. var isSelected = controller.isItemSelected(oEventContext);
  11558. if (isSelected) {
  11559. uiItem.selected = true;
  11560. }
  11561. shownItems.push(uiItem);
  11562. }
  11563. }, this);
  11564. return shownItems;
  11565. }.bind(_this2));
  11566. });
  11567. },
  11568. closeGlassMenu: function closeGlassMenu() {
  11569. return new Promise(function (resolve, reject) {
  11570. this.ddMenu.closeDropDownMenu({}).then(resolve, reject);
  11571. }.bind(this));
  11572. }
  11573. });
  11574. GlassMenu.errors = {
  11575. FAILURE_CREATING_CONTROLLER: 'Failure creating one of the menu controllers'
  11576. };
  11577. return GlassMenu;
  11578. });
  11579. //# sourceMappingURL=GlassMenu.js.map
  11580. ;
  11581. /**
  11582. * Licensed Materials - Property of IBM
  11583. *
  11584. * IBM Cognos Products: BI Glass
  11585. *
  11586. * Copyright IBM Corp. 2018
  11587. *
  11588. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  11589. */
  11590. define('baglass/app/plugins/SynchronousButton',['underscore', './Button', '../../api/Context'], function (_, Button, Context) {
  11591. /**
  11592. * A special type of button that calls its controller synchronously on click.
  11593. * This is required for native/browser functions that are not permitted to be
  11594. * executed from an asynchronous callback.
  11595. *
  11596. * Example: Requesting HTML5/FullScreen
  11597. *
  11598. */
  11599. var SynchronousButton = Button.extend({
  11600. initialize: function initialize() {
  11601. return this.getController();
  11602. },
  11603. getControllerSync: function getControllerSync() {
  11604. if (!this._controller) {
  11605. throw new Error('Controller has not been registered');
  11606. } else {
  11607. return this._controller;
  11608. }
  11609. },
  11610. /**
  11611. * create the callback the controller.onPress/execute method with the onSelect
  11612. * @override
  11613. */
  11614. attachActionControllerCallbacks: function attachActionControllerCallbacks() {
  11615. var context = this.glassContext.addToOptions({
  11616. target: {
  11617. plugin: this
  11618. }
  11619. });
  11620. var logger = this.glassContext.getCoreSvc('.Logger');
  11621. var thisPlugin = this;
  11622. var baseButton = this.getBaseButton();
  11623. baseButton.onSelect = function () {
  11624. try {
  11625. var result;
  11626. var controller = thisPlugin.getControllerSync();
  11627. this.setSelected();
  11628. if (this.push) {
  11629. context.pushState = this.isPressed();
  11630. }
  11631. if (_.isFunction(controller.onPress)) {
  11632. result = controller.onPress(context);
  11633. } else if (_.isFunction(controller.execute)) {
  11634. var apiContext = new Context(context.glassContext);
  11635. var apiOptions = {
  11636. options: context.target.plugin.itemSpec.options
  11637. };
  11638. result = controller.execute(apiContext, apiOptions);
  11639. }
  11640. return Promise.resolve(result).catch(function (err) {
  11641. logger.error(err);
  11642. });
  11643. } catch (err) {
  11644. logger.error(err);
  11645. return Promise.resolve();
  11646. }
  11647. };
  11648. }
  11649. });
  11650. return SynchronousButton;
  11651. });
  11652. //# sourceMappingURL=SynchronousButton.js.map
  11653. ;
  11654. /**
  11655. * Licensed Materials - Property of IBM
  11656. * IBM Cognos Products: BI Glass
  11657. * (C) Copyright IBM Corp. 2015, 2017
  11658. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  11659. */
  11660. define('baglass/app/plugins/all',['./Button', './ButtonActionInterface', './GlassMenu', './SynchronousButton'], function () {});
  11661. //# sourceMappingURL=all.js.map
  11662. ;
  11663. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  11664. /**
  11665. * Licensed Materials - Property of IBM
  11666. * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2015, 2017
  11667. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  11668. */
  11669. define('baglass/core-client/js/core-client/ui/dialogs/BaseDialog',['../AccessibleView', 'jquery', 'underscore', '../../nls/StringResources', '../Button', '../../utils/Utils'], function (AccessibleView, $, _, stringResources, Button, Utils) {
  11670. 'use strict';
  11671. var BaseDialog = AccessibleView.extend({
  11672. _buttons: ['ok', 'cancel'],
  11673. _showCloseX: true,
  11674. _width: null,
  11675. init: function init(options) {
  11676. this._dialogId = _.uniqueId('modalDialog_');
  11677. this._queryId = '#' + this._dialogId;
  11678. this._footerButtons = [];
  11679. /**
  11680. * Flag to indicate whether to render the header in the dialog.
  11681. * The header will be rendered by default if options.showHeader is undefined.
  11682. */
  11683. this._showHeader = true;
  11684. // set dialog options
  11685. this.setDialogOptions(options);
  11686. this.enableTabLooping = true;
  11687. //force a default id if none was set
  11688. if (!this.id) {
  11689. this.id = 'com-ibm-ca-dialogDefaultId';
  11690. }
  11691. BaseDialog.inherited('init', this, arguments);
  11692. },
  11693. setDialogOptions: function setDialogOptions(options) {
  11694. // process options
  11695. if (options) {
  11696. // set width as necessary
  11697. if (options.width) {
  11698. this._width = options.width;
  11699. }
  11700. // set closeX button option
  11701. if (options.showCloseX === false) {
  11702. this._showCloseX = options.showCloseX;
  11703. }
  11704. // Check for buttons passed in and override defaults.
  11705. if (options.buttons) {
  11706. this._buttons = options.buttons;
  11707. }
  11708. this.titleAriaLabel = options.titleAriaLabel;
  11709. this._showHeader = options.showHeader === undefined ? true : options.showHeader;
  11710. }
  11711. },
  11712. destroy: function destroy() {
  11713. $(this._queryId).remove();
  11714. $('body').removeClass('openedDialog');
  11715. },
  11716. remove: function remove() {
  11717. this.destroy();
  11718. },
  11719. hide: function hide() {
  11720. this._setFocusToLaunchPoint();
  11721. $(this._queryId).removeClass('show');
  11722. this.destroy();
  11723. },
  11724. open: function open() {
  11725. this.showBlocker();
  11726. this.show();
  11727. },
  11728. showBlocker: function showBlocker() {
  11729. var nBlocker = $(this._queryId);
  11730. if (!nBlocker.length) {
  11731. nBlocker = $('<div>', {
  11732. 'id': this._dialogId,
  11733. 'class': 'dialogBlocker show'
  11734. });
  11735. if (this.blockerClass) {
  11736. nBlocker.addClass(this.blockerClass);
  11737. }
  11738. if (this.className) {
  11739. nBlocker.addClass(this.className);
  11740. }
  11741. // set the blocker height (works with scrollbars)
  11742. nBlocker.height($(document).height());
  11743. var nBlockerCell = $('<div>', {
  11744. 'id': this._dialogId + 'Container',
  11745. 'class': 'dialogBlockerCell'
  11746. });
  11747. $('body').append(nBlocker.append(nBlockerCell.text(stringResources.get('loading'))));
  11748. nBlocker.on('keydown', this.onKey.bind(this));
  11749. }
  11750. this._container().parent().on('primaryaction', null, { allowPropagationDefaultAction: true }, function (event) {
  11751. Utils.setEventProperty(event, Utils.EVENT_DIALOG, true);
  11752. });
  11753. },
  11754. show: function show() {
  11755. var nContainer = this._container();
  11756. // set width as necessary
  11757. if (this._width) {
  11758. nContainer.css('max-width', this._width);
  11759. }
  11760. // build dialog as necessary
  11761. if (nContainer.length) {
  11762. nContainer.empty();
  11763. // assemble dialog
  11764. var $contentDiv = $('<div>', {
  11765. 'class': 'modalDialog',
  11766. 'role': 'dialog',
  11767. 'aria-labelledby': this.getId(),
  11768. 'aria-describedby': this.getContentId()
  11769. });
  11770. if (this._showHeader === true) {
  11771. var header;
  11772. header = $('<div>', { 'class': 'dialogHeader' });
  11773. var title = this.renderTitle($('<header>', {
  11774. 'class': 'dialogTitle',
  11775. 'aria-label': this.titleAriaLabel || this.title,
  11776. 'role': 'banner',
  11777. 'id': this.getId()
  11778. }));
  11779. var closeX = this.renderCloseX();
  11780. // pop the title and closeX into the header
  11781. header.append(title, closeX);
  11782. $contentDiv.append(header);
  11783. }
  11784. var content = this.renderContent($('<div>', {
  11785. 'class': 'dialogContent',
  11786. 'id': this.getContentId()
  11787. }));
  11788. var footer = this.renderFooter($('<footer>'));
  11789. $contentDiv.append(content, footer);
  11790. nContainer.append($contentDiv);
  11791. this.enableLooping($contentDiv);
  11792. this.setFocus();
  11793. $('body').addClass('openedDialog');
  11794. }
  11795. },
  11796. /**
  11797. * @public
  11798. * Returns the contentId attribute. The contentId is placed on the dialog content and aria-describedby on the dialog.
  11799. */
  11800. getContentId: function getContentId() {
  11801. return this.contentId;
  11802. },
  11803. /**
  11804. * @public
  11805. * Returns the id attribute. The id is placed on the dialog title and aria-labelledby on the dialog.
  11806. */
  11807. getId: function getId() {
  11808. return this.id;
  11809. },
  11810. /**
  11811. * @public
  11812. * Sets the focus on a dialog element. The default is set to
  11813. */
  11814. setFocus: function setFocus() {
  11815. var footer = this._container().find('footer');
  11816. var firstBtn = footer.find('.dialogButton')[0];
  11817. if (firstBtn) {
  11818. firstBtn.focus();
  11819. }
  11820. },
  11821. renderContent: function renderContent(n) {
  11822. n.text('Dialog Content');
  11823. return n;
  11824. },
  11825. renderTitle: function renderTitle(n) {
  11826. n.text('Dialog Title');
  11827. return n;
  11828. },
  11829. /**
  11830. * This function adds a CSS class that will cause the dialog to be centered vertically.
  11831. * This could potentially be affected by additional styles in extended dialog classes.
  11832. **/
  11833. verticalAlignDialog: function verticalAlignDialog() {
  11834. this._container().addClass('dialogVerticalAlign');
  11835. },
  11836. renderCloseX: function renderCloseX() {
  11837. // only render if required
  11838. if (!this._showCloseX) {
  11839. return null;
  11840. }
  11841. // create button
  11842. var closeX = $('<div>', {
  11843. 'class': 'dialogCloseX',
  11844. 'title': stringResources.get('close'),
  11845. 'aria-label': stringResources.get('close'),
  11846. 'role': 'button',
  11847. 'tabIndex': '0'
  11848. });
  11849. Utils.setIcon(closeX, 'dismiss_16');
  11850. closeX.on('primaryaction', this.cancel.bind(this));
  11851. return closeX;
  11852. },
  11853. findFooterButton: function findFooterButton(buttonId) {
  11854. var button = _.find(this._footerButtons, function (button) {
  11855. return button.id === buttonId;
  11856. });
  11857. return button;
  11858. },
  11859. renderFooter: function renderFooter(n) {
  11860. var footerContainer = $('<div>', { 'class': 'footerContainer' });
  11861. // loop though button collection and process
  11862. for (var i = 0, iLen = this._buttons.length; i < iLen; i++) {
  11863. var btnSpec = this._getButtonDef(this._buttons[i]);
  11864. var button = new Button({
  11865. buttonSpec: {
  11866. 'class': 'dialogButton ' + btnSpec.type,
  11867. 'label': btnSpec.text,
  11868. 'onSelect': btnSpec.handler.bind(this),
  11869. 'id': btnSpec.defaultId
  11870. }
  11871. });
  11872. if (typeof btnSpec.style === 'string' && btnSpec.style !== '') {
  11873. button.$el[0].style.cssText = btnSpec.style;
  11874. }
  11875. this._footerButtons.push(button);
  11876. button.render();
  11877. footerContainer.append(button.$el);
  11878. }
  11879. n.append(footerContainer);
  11880. return n;
  11881. },
  11882. /**
  11883. * This function takes a given button id or partial definition and updates it to return a complete definition.
  11884. *
  11885. * A button can be an id such as: "ok", "cancel", or "close" OR
  11886. * a button can be an object containing one or more of the following options:
  11887. * {
  11888. * text: String label to display
  11889. * handler: Callback function
  11890. * defaultId: If specified this will use the spec specified by the id (i.e. "ok") for missing info
  11891. * type: "primary" or "secondary" will set the class and visuals accordingly. "destructive"
  11892. * is not currently supportted but might be in the future
  11893. * }
  11894. *
  11895. * @param button Button id or partial spec object
  11896. * @returns Object Complete button spec.
  11897. **/
  11898. _getButtonDef: function _getButtonDef(button) {
  11899. // define the default button spec
  11900. var buttonsDef = {
  11901. 'ok': { 'text': stringResources.get('ok'), 'handler': this.ok, 'type': 'primary', defaultId: 'ok' },
  11902. 'cancel': { 'text': stringResources.get('cancel'), 'handler': this.cancel, 'type': 'secondary', defaultId: 'cancel' },
  11903. 'close': { 'text': stringResources.get('close'), 'handler': this.cancel, 'type': 'primary', defaultId: 'close' }
  11904. };
  11905. // if object is passed then fill in missing otherwise lookup and return
  11906. if ((typeof button === 'undefined' ? 'undefined' : _typeof(button)) === 'object') {
  11907. // check for defaultId
  11908. if (button.defaultId) {
  11909. // default text if necessary
  11910. if (!button.text) {
  11911. button.text = buttonsDef[button.defaultId].text;
  11912. }
  11913. // default handler if necesssary
  11914. if (!button.handler) {
  11915. button.handler = buttonsDef[button.defaultId].handler;
  11916. }
  11917. // default type if necesssary
  11918. if (!button.type) {
  11919. button.type = buttonsDef[button.defaultId].type;
  11920. }
  11921. }
  11922. // return
  11923. return button;
  11924. }
  11925. return buttonsDef[button];
  11926. },
  11927. onKey: function onKey(evt) {
  11928. var keyCode = evt.keyCode;
  11929. if (keyCode === 27) {
  11930. this.cancel();
  11931. return false;
  11932. }
  11933. return true;
  11934. },
  11935. ok: function ok() {
  11936. this.hide();
  11937. },
  11938. cancel: function cancel() {
  11939. this.hide();
  11940. },
  11941. /**
  11942. *
  11943. */
  11944. enableOk: function enableOk(bEnabled) {
  11945. var btn = $('.dialogButton', this._container()).eq(0);
  11946. btn.toggleClass('disabled', bEnabled === false); // if bEnabled is undefined, it means true.
  11947. if (bEnabled === false) {
  11948. btn.attr('disabled', 'disabled');
  11949. } else {
  11950. btn.removeAttr('disabled');
  11951. }
  11952. },
  11953. disableOk: function disableOk() {
  11954. this.enableOk(false);
  11955. },
  11956. _container: function _container() {
  11957. return $(this._queryId + 'Container');
  11958. }
  11959. });
  11960. return BaseDialog;
  11961. });
  11962. //# sourceMappingURL=BaseDialog.js.map
  11963. ;
  11964. /**
  11965. * Licensed Materials - Property of IBM
  11966. * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2015, 2017
  11967. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  11968. */
  11969. define('baglass/core-client/js/core-client/ui/dialogs/GenericViewDialog',['./BaseDialog', 'underscore'], function (BaseDialog, _) {
  11970. var Dialog = null;
  11971. Dialog = BaseDialog.extend({
  11972. _buttons: ['ok', 'cancel'],
  11973. _okCallback: null,
  11974. _cancelCallback: null,
  11975. init: function init(options) {
  11976. this.id = options.id || this.id;
  11977. this.title = options.title;
  11978. this.view = new options.viewClass(options.viewOptions);
  11979. this._okCallback = options.okCallback;
  11980. this._cancelCallback = options.cancelCallback;
  11981. Dialog.inherited('init', this, arguments);
  11982. },
  11983. destroy: function destroy() {
  11984. if (this.view) {
  11985. this.view.remove();
  11986. }
  11987. Dialog.inherited('destroy', this, arguments);
  11988. },
  11989. renderContent: function renderContent(n) {
  11990. var result = this.view.render();
  11991. if (_.isFunction(this.view.setFocus)) {
  11992. this.setFocus = function () {
  11993. if (result && result.done) {
  11994. result.done(function () {
  11995. this.view.setFocus();
  11996. }.bind(this));
  11997. } else {
  11998. this.view.setFocus();
  11999. }
  12000. }.bind(this, result);
  12001. }
  12002. n.append(this.view.$el);
  12003. return n;
  12004. },
  12005. renderTitle: function renderTitle(n) {
  12006. n.text(this.title);
  12007. return n;
  12008. },
  12009. ok: function ok() {
  12010. Dialog.inherited('ok', this, arguments);
  12011. if (this._okCallback) {
  12012. return this._okCallback();
  12013. }
  12014. },
  12015. cancel: function cancel(event) {
  12016. if (event && event.gesture) {
  12017. event.gesture.preventDefault();
  12018. }
  12019. Dialog.inherited('cancel', this, arguments);
  12020. if (this._cancelCallback) {
  12021. return this._cancelCallback();
  12022. }
  12023. },
  12024. open: function open() {
  12025. Dialog.inherited('open', this, arguments);
  12026. if (this.view.onOpen) {
  12027. this.view.onOpen();
  12028. }
  12029. },
  12030. /**
  12031. * Call the view onHide after hide baseclass.
  12032. */
  12033. hide: function hide() {
  12034. Dialog.inherited('hide', this, arguments);
  12035. if (_.isFunction(this.view.onHide)) {
  12036. this.view.onHide();
  12037. }
  12038. }
  12039. });
  12040. return Dialog;
  12041. });
  12042. //# sourceMappingURL=GenericViewDialog.js.map
  12043. ;
  12044. /**
  12045. * Licensed Materials - Property of IBM
  12046. *
  12047. * IBM Cognos Products: BI UI Commons
  12048. *
  12049. * Copyright IBM Corp. 2016, 2017
  12050. *
  12051. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  12052. */
  12053. define('baglass/common/views/PreviewView',['../../core-client/js/core-client/ui/View', 'jquery'], function (BaseView, $) {
  12054. /**
  12055. * Preview view. This class renders a preview of a perspective in an iFrame.
  12056. *
  12057. * @param {Object} options
  12058. * @param {Object} options.glassContext - Glass context object
  12059. * @param {Object} options.urlMap - A map of key/value pairs to be converted into a queryString. See: Url.getUrl
  12060. * }
  12061. */
  12062. var PreviewView = BaseView.extend({
  12063. events: {},
  12064. init: function init(options) {
  12065. PreviewView.inherited('init', this, arguments);
  12066. $.extend(this, options);
  12067. },
  12068. render: function render() {
  12069. return new Promise(function (resolve, reject) {
  12070. try {
  12071. var urlMap = $.extend({
  12072. ui_preview: true,
  12073. factoryMode: null
  12074. }, this.urlMap);
  12075. if (urlMap.perspective === 'login') {
  12076. urlMap.perspective = 'IBMlogin';
  12077. }
  12078. var src = this.glassContext.getUrl({
  12079. urlMap: urlMap
  12080. }); // Negative tab-index prevents keyboard navigation to the iFrame
  12081. var $iFrame = $('<iframe>', {
  12082. frameBorder: 0,
  12083. src: src,
  12084. tabindex: '-1'
  12085. }).css({
  12086. width: '100%',
  12087. flex: '1 1 auto'
  12088. });
  12089. var overlay = $('<div>').addClass('previewDialogOverlay');
  12090. this.$el = $iFrame.add(overlay); // Prevent the login perspective from focusing the user on the user name field
  12091. $iFrame.on('load', function () {
  12092. $(document.activeElement).on('blur', function (e) {
  12093. setTimeout(function () {
  12094. // using 'setTimeout' to let the event pass the run loop
  12095. if (document.activeElement === $iFrame[0]) {
  12096. // return the focus on the previous element when the iFrame tries to steal focus
  12097. $(e.target).focus();
  12098. }
  12099. }, 0);
  12100. });
  12101. resolve(this.el);
  12102. }.bind(this));
  12103. } catch (err) {
  12104. reject(err);
  12105. }
  12106. }.bind(this));
  12107. }
  12108. });
  12109. return PreviewView;
  12110. });
  12111. //# sourceMappingURL=PreviewView.js.map
  12112. ;
  12113. /**
  12114. * Licensed Materials - Property of IBM
  12115. * IBM Cognos Products: BI
  12116. * (C) Copyright IBM Corp. 2016, 2017
  12117. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  12118. */
  12119. define('baglass/common/ui/PreviewDialog',['../../core-client/js/core-client/ui/dialogs/GenericViewDialog', '../../nls/StringResources', '../views/PreviewView'], function (GenericViewDialog, StringResources, PreviewView) {
  12120. 'use strict';
  12121. var PreviewDialog = GenericViewDialog.extend({
  12122. /**
  12123. * @classdesc Class that displays a preview of a perspective in a modal dialog.
  12124. * @constructs PreviewDialog
  12125. * @public
  12126. * @param {Object} glassContext // Glass context object.
  12127. * @param {String} urlMap // A map of key/value pairs to be converted into a queryString. See: Url.getUrl
  12128. *
  12129. * @example :
  12130. * var dialog = new PreviewDialog({ glassContext: glassContext, urlMap: {perspective: 'home'} });
  12131. * dialog.open();
  12132. */
  12133. init: function init(options) {
  12134. this.options = options;
  12135. var dialogOptions = {
  12136. buttons: ['close'],
  12137. viewClass: PreviewView,
  12138. title: StringResources.get('previewDialogTitle'),
  12139. className: 'previewDialog',
  12140. viewOptions: {
  12141. glassContext: options.glassContext,
  12142. urlMap: options.urlMap
  12143. }
  12144. };
  12145. PreviewDialog.inherited('init', this, [dialogOptions]);
  12146. }
  12147. });
  12148. return PreviewDialog;
  12149. });
  12150. //# sourceMappingURL=PreviewDialog.js.map
  12151. ;
  12152. /*
  12153. * Licensed Materials - Property of IBM
  12154. * IBM Cognos Products: BI
  12155. * (C) Copyright IBM Corp. 2015, 2017
  12156. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  12157. */
  12158. define('baglass/common/ui/SlideoutView',['../../core-client/js/core-client/ui/View'], function (BaseView) {
  12159. /**
  12160. * @public
  12161. */
  12162. var SlideoutView = BaseView.extend(
  12163. /**
  12164. * @lends SlideoutView.prototype
  12165. */
  12166. {
  12167. /**
  12168. *
  12169. *@classdesc Abstract Base class used by {@link Slideout} to show the content of the panel.
  12170. * It corresponds to the object created from the content.module property passed when instantiating a slideout.
  12171. * Contributor should extend this class.
  12172. *@constructs
  12173. *@public
  12174. */
  12175. init: function init() {
  12176. BaseView.inherited('init', this, arguments);
  12177. },
  12178. /**
  12179. * Invokes by {@link Slideout} in order to populate the content of a panel
  12180. * @public
  12181. * @abstract
  12182. * @returns {Promise} Promise which passes the dom element when resolved
  12183. */
  12184. render: function render() {
  12185. return Promise.resolve(this.el);
  12186. },
  12187. /**
  12188. * Set the focus to an element within the view.
  12189. * The default behaviour is to set theh focus to the root element
  12190. * @public
  12191. */
  12192. setFocus: function setFocus() {
  12193. this.$el.focus();
  12194. },
  12195. /**
  12196. * Decides whether or not the containing slideout can be hidden/closed; invoked in the {@link Slideout#hide} method
  12197. * @public
  12198. * @param {Object} - set of options
  12199. * @param {Boolean} [options.isEscape=false] - true when it is an escaped hiding; See the parmaters in {@link Slideout#hide}
  12200. * @return {Boolean|promise} true/false or promise; rejected promise is equivalent to false; The default implementation returns true
  12201. */
  12202. canHide: function
  12203. /* options */
  12204. canHide() {
  12205. return true;
  12206. }
  12207. });
  12208. return SlideoutView;
  12209. });
  12210. //# sourceMappingURL=SlideoutView.js.map
  12211. ;
  12212. define('text!baglass/common/ui/properties/templates/DoubleLineWithInput.html',[],function () { return '<div class="inputRow flex property_{{=it.id}}">\n\t{{? it.label}}\n\t<div class="propertyName singleLine hide l_{{=it.name}}" id="row_{{=it.id}}">{{=it.label}}</div>\n\t{{?}}\n</div>\n<div class="inputRow flex property_{{=it.id}}">\n\t\t<input type="{{=it.inputType || \'password\'}}" aria-labelledby="row_{{=it.id}} com-ibm-ca-confirmPassword" placeholder="{{?it.placeholder}} {{=it.placeholder}} {{?}}"\n\t\t\tclass="propertyValue toggleEdit{{=it.id}} {{? it.editable === true}}editable{{=it.id}}{{?}} handleReturnKey v_{{=it.name}}" />\n</div>\n';});
  12213. /*
  12214. *+------------------------------------------------------------------------+
  12215. *| Licensed Materials - Property of IBM
  12216. *| IBM Cognos Products: Content Explorer
  12217. *| (C) Copyright IBM Corp. 2015, 2016, 2017
  12218. *|
  12219. *| US Government Users Restricted Rights - Use, duplication or disclosure
  12220. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  12221. *+------------------------------------------------------------------------+
  12222. */
  12223. define('baglass/common/ui/properties/DoubleLineWithInput',['../../../core-client/js/core-client/ui/View', 'text!./templates/DoubleLineWithInput.html', 'jquery', 'doT'], function (View, template, $, dot) {
  12224. 'use strict';
  12225. var DoubleLineWithInput = View.extend({
  12226. ellipses: true,
  12227. /**
  12228. * Creates a property with single line and read-only link.
  12229. * @param {object} options - properties
  12230. * @param {string} options.name - property name
  12231. * @param {string} options.label - property label
  12232. * @param {string} options.placeholder - property placeholder
  12233. * @param {string} options.value - first row property value
  12234. * @param {string} options.id - unique id
  12235. * @param {function} [options.editCallback] - callback to the onkeyup action
  12236. * @param {function} [options.editClick] - callback to the edit click action
  12237. */
  12238. init: function init(options) {
  12239. if (options.editable || options.editCallback) {
  12240. if (!this.events) {
  12241. this.events = {};
  12242. }
  12243. this.events['keyup .editable' + options.id] = '_handleEditKeyup';
  12244. this.events['clicktap .toggleEdit' + options.id] = '_handleEditClick';
  12245. }
  12246. DoubleLineWithInput.inherited('init', this, arguments);
  12247. $.extend(this, options);
  12248. },
  12249. render: function render() {
  12250. var sHtml = dot.template(template)({
  12251. 'label': this.label,
  12252. 'editable': this.editCallback || this.editable ? true : false,
  12253. 'inputType': this.inputType,
  12254. 'placeholder': this.placeholder,
  12255. 'value': this.value,
  12256. 'id': this.id,
  12257. 'name': this.name
  12258. });
  12259. this.$el.append(sHtml);
  12260. },
  12261. _handleEditClick: function _handleEditClick() {
  12262. if (this.editClick) {
  12263. this.editClick(this.name);
  12264. }
  12265. },
  12266. _handleEditKeyup: function _handleEditKeyup() {
  12267. if (this.editCallback) {
  12268. this.editCallback(this.name);
  12269. }
  12270. },
  12271. setFocus: function setFocus() {
  12272. this.$el.find('input').first().focus();
  12273. }
  12274. });
  12275. return DoubleLineWithInput;
  12276. });
  12277. //# sourceMappingURL=DoubleLineWithInput.js.map
  12278. ;
  12279. /**
  12280. * Licensed Materials - Property of IBM
  12281. * IBM Cognos Products: BI
  12282. * (C) Copyright IBM Corp. 2015, 2017
  12283. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  12284. */
  12285. define('baglass/common/ui/SubmitPasswordDialog',['../../core-client/js/core-client/ui/dialogs/GenericViewDialog', '../../nls/StringResources', '../../core-client/js/core-client/utils/ClassFactory', '../ui/properties/DoubleLineWithInput', 'jquery'], function (GenericViewDialog, StringResources, ClassFactory, DoubleLineWithInput, $) {
  12286. 'use strict'; //NOSONAR: meant to be strict
  12287. var SubmitPasswordDialog = GenericViewDialog.extend({
  12288. _ClassFactory: ClassFactory,
  12289. /**
  12290. * constructor
  12291. * @options {object}
  12292. */
  12293. init: function
  12294. /* dialogOptions */
  12295. init() {},
  12296. openSubmitPasswordDialog: function openSubmitPasswordDialog(dialogOptions) {
  12297. this.oldPasswordName = 'oldPassword';
  12298. this.newPasswordName = 'newPassword';
  12299. this.confirmPasswordName = 'confirmNewPassword';
  12300. var deferred = $.Deferred();
  12301. this._ClassFactory.loadModule('../ui/properties/PropertyUIControl').done(function (dialogPropertyUIControl) {
  12302. dialogOptions.id = 'submitPasswordDialogTitle';
  12303. dialogOptions.viewClass = dialogPropertyUIControl;
  12304. var inputToFocus;
  12305. if (dialogOptions.viewOptions.displayPrompts) {
  12306. dialogOptions.viewOptions.items = this._getCreateCredentialItems(dialogOptions.viewOptions.displayPrompts);
  12307. inputToFocus = dialogOptions.viewOptions.displayPrompts[0].name;
  12308. } else {
  12309. dialogOptions.viewOptions.items = this._getUpdatePasswordItems();
  12310. inputToFocus = this.oldPasswordName;
  12311. }
  12312. this._ClassFactory.instantiate('../ui/dialogs/GenericViewDialog', dialogOptions).then(function (oDialog) {
  12313. this.dialog = oDialog;
  12314. this.dialog.view.setFocus = function () {
  12315. dialogPropertyUIControl.prototype.setFocus.call(this, inputToFocus);
  12316. }.bind(this.dialog.view);
  12317. this.dialog.view.$el.addClass('submitPasswordDialog');
  12318. this.dialog.open();
  12319. $('.dialogButton.primary').addClass('disabled');
  12320. $('.dialogBlockerCell').addClass('inputDialog');
  12321. }.bind(this), deferred.reject);
  12322. deferred.resolve(this);
  12323. }.bind(this), deferred.reject);
  12324. return deferred.promise();
  12325. },
  12326. _showPassword: function _showPassword(propertyName, propertyValue) {
  12327. if (propertyValue) {
  12328. this.dialog.view.$el.find('input:password').each(function (key, value) {
  12329. $(value).attr('type', 'text');
  12330. });
  12331. } else {
  12332. var $passwordInputs = $('input[class*="' + this.oldPasswordName + '"],input[class*="' + this.newPasswordName + '"],input[class*="' + this.confirmPasswordName + '"]');
  12333. $passwordInputs.each(function (key, value) {
  12334. $(value).attr('type', 'password');
  12335. });
  12336. }
  12337. },
  12338. _addSelectedClassAndLabel: function _addSelectedClassAndLabel(className) {
  12339. var $editingClass = $('.editing');
  12340. if ($editingClass[0]) {
  12341. $editingClass.removeClass('editing');
  12342. }
  12343. var $label = $('div[class*="' + className + '"]');
  12344. $label.addClass('editing');
  12345. var $separator = $label.parent().nextAll('.separator:first');
  12346. if ($separator[0]) {
  12347. $separator.addClass('editing');
  12348. }
  12349. },
  12350. _enableOk: function _enableOk(bEnabled) {
  12351. var btn = $('.dialogButton').eq(0); // if bEnabled is undefined, it means true.
  12352. btn.toggleClass('disabled', bEnabled === false);
  12353. if (bEnabled === false) {
  12354. btn.attr('disabled', 'disabled');
  12355. } else {
  12356. btn.removeAttr('disabled');
  12357. }
  12358. },
  12359. _checkPasswordMatch: function _checkPasswordMatch() {
  12360. var $confirmPW = $('input[class*="' + this.confirmPasswordName + '"]');
  12361. var password = $('input[class*="' + this.newPasswordName + '"]').val();
  12362. var confirmPassword = $confirmPW.val();
  12363. var $lastSeparator = $confirmPW.parent().next('.separator');
  12364. var $message;
  12365. if (password !== confirmPassword) {
  12366. this._enableOk(false);
  12367. $message = $('.confirm');
  12368. if ($message[0]) {
  12369. $message.removeClass('confirm');
  12370. $message.addClass('warning');
  12371. $message.html(StringResources.get('passwordNotMatch'));
  12372. } else if ($('.warning').length === 0) {
  12373. $message = $('<div class="inputRow"><div id="com-ibm-ca-confirmPassword" class="warning" aria-live="assertive">' + StringResources.get('passwordNotMatch') + '</div></div>');
  12374. $message.insertAfter($lastSeparator);
  12375. }
  12376. } else if (password && confirmPassword && password === confirmPassword) {
  12377. this._enableOk(true);
  12378. $message = $('.warning');
  12379. if ($message[0]) {
  12380. $message.removeClass('warning');
  12381. $message.addClass('confirm');
  12382. $message.html(StringResources.get('passwordMatch'));
  12383. }
  12384. } else {
  12385. this._enableOk(false);
  12386. $('.warning').parent().remove();
  12387. $('.confirm').parent().remove();
  12388. }
  12389. },
  12390. _getCreateCredentialItems: function _getCreateCredentialItems(displayPrompts) {
  12391. var credentialsTextItems = [];
  12392. var credentialsNoEchoItems = [];
  12393. $.each(displayPrompts, function (key, prompt) {
  12394. if (prompt.type === 'text') {
  12395. credentialsTextItems.push({
  12396. module: DoubleLineWithInput,
  12397. name: prompt.name,
  12398. placeholder: prompt.caption + ' ' + (prompt.value || ''),
  12399. inputType: 'text'
  12400. }, {
  12401. type: 'Separator'
  12402. });
  12403. } else if (prompt.type === 'textnoecho') {
  12404. this.newPasswordName = prompt.name;
  12405. credentialsNoEchoItems.push({
  12406. module: DoubleLineWithInput,
  12407. name: this.newPasswordName,
  12408. label: StringResources.get('password'),
  12409. placeholder: StringResources.get('password'),
  12410. editClick: this._addSelectedClassAndLabel.bind(this),
  12411. editCallback: this._checkPasswordMatch.bind(this)
  12412. }, {
  12413. type: 'Separator'
  12414. }, {
  12415. module: DoubleLineWithInput,
  12416. name: this.confirmPasswordName,
  12417. editCallback: this._checkPasswordMatch.bind(this),
  12418. label: StringResources.get('confirmPassword'),
  12419. placeholder: StringResources.get('confirmPassword'),
  12420. editClick: this._addSelectedClassAndLabel.bind(this)
  12421. }, {
  12422. type: 'Separator'
  12423. }, {
  12424. type: 'CheckBox',
  12425. name: 'showPassword',
  12426. label: StringResources.get('showPassword'),
  12427. controlOnLeft: true,
  12428. checked: false,
  12429. onChange: this._showPassword.bind(this)
  12430. });
  12431. }
  12432. }.bind(this));
  12433. return credentialsTextItems.concat(credentialsNoEchoItems);
  12434. },
  12435. _getUpdatePasswordItems: function
  12436. /* displayPrompts */
  12437. _getUpdatePasswordItems() {
  12438. return [{
  12439. 'module': DoubleLineWithInput,
  12440. 'name': this.oldPasswordName,
  12441. 'editable': true,
  12442. 'label': StringResources.get(this.oldPasswordName),
  12443. 'placeholder': StringResources.get(this.oldPasswordName),
  12444. 'editClick': this._addSelectedClassAndLabel.bind(this)
  12445. }, {
  12446. 'type': 'Separator'
  12447. }, {
  12448. 'module': DoubleLineWithInput,
  12449. 'name': this.newPasswordName,
  12450. 'label': StringResources.get(this.newPasswordName),
  12451. 'placeholder': StringResources.get(this.newPasswordName),
  12452. 'editCallback': this._checkPasswordMatch.bind(this),
  12453. 'editClick': this._addSelectedClassAndLabel.bind(this)
  12454. }, {
  12455. 'type': 'Separator'
  12456. }, {
  12457. 'module': DoubleLineWithInput,
  12458. 'name': this.confirmPasswordName,
  12459. 'editCallback': this._checkPasswordMatch.bind(this),
  12460. 'label': StringResources.get(this.confirmPasswordName),
  12461. 'placeholder': StringResources.get(this.confirmPasswordName),
  12462. 'editClick': this._addSelectedClassAndLabel.bind(this)
  12463. }, {
  12464. 'type': 'Separator'
  12465. }, {
  12466. 'type': 'CheckBox',
  12467. 'name': 'showPassword',
  12468. 'label': StringResources.get('showPassword'),
  12469. 'controlOnLeft': true,
  12470. 'checked': false,
  12471. 'onChange': this._showPassword.bind(this)
  12472. }];
  12473. }
  12474. });
  12475. return SubmitPasswordDialog;
  12476. });
  12477. //# sourceMappingURL=SubmitPasswordDialog.js.map
  12478. ;
  12479. /**
  12480. * Licensed Materials - Property of IBM
  12481. * IBM Cognos Products: BI Glass
  12482. * (C) Copyright IBM Corp. 2017
  12483. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  12484. */
  12485. define('baglass/common/ui/all',['./PreviewDialog', './SlideoutView', './SubmitPasswordDialog'], function () {});
  12486. //# sourceMappingURL=all.js.map
  12487. ;
  12488. /**
  12489. * Licensed Materials - Property of IBM
  12490. * IBM Cognos Products: BI Glass
  12491. * (C) Copyright IBM Corp. 2017
  12492. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  12493. */
  12494. define('baglass/common/views/all',['./PreviewView'], function () {});
  12495. //# sourceMappingURL=all.js.map
  12496. ;
  12497. /**
  12498. * Licensed Materials - Property of IBM
  12499. * IBM Cognos Products: Cognos Analytics
  12500. * (C) Copyright IBM Corp. 2016, 2018
  12501. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  12502. */
  12503. define('baglass/utils/ThemeUtils',[], function () {
  12504. return {
  12505. DEFAULT_BRAND_TEXT: 'IBM Cognos Analytics',
  12506. DEFAULT_BRAND_TEXT_SMALL: 'IBM Cognos Analytics',
  12507. DEFAULT_BRAND_ICON: 'common-CA_Avatar_Colour_64',
  12508. DEFAULT_BRAND_ICON_SMALL: 'common-CA_Avatar_Black_24',
  12509. THEME_URL: 'v1/plugins/themes/current/spec.json',
  12510. /**
  12511. * Returns current theme value from server
  12512. * If the request fails, default values will be provided
  12513. *
  12514. * @public
  12515. * @param {GlassContext} glassContext
  12516. * @returns Resolved promise with current theme value
  12517. */
  12518. getCurrentThemeValues: function getCurrentThemeValues(glassContext) {
  12519. return glassContext.getCoreSvc('.Ajax').ajax({
  12520. url: this.THEME_URL,
  12521. type: 'GET'
  12522. }).then(function (result) {
  12523. return result.data;
  12524. }).catch(function () {
  12525. return {
  12526. brandText: this.DEFAULT_BRAND_TEXT,
  12527. brandTextSmall: this.DEFAULT_BRAND_TEXT_SMALL,
  12528. images: {
  12529. brandIcon: this.DEFAULT_BRAND_ICON,
  12530. brandIconSmall: this.DEFAULT_BRAND_ICON_SMALL
  12531. }
  12532. };
  12533. }.bind(this));
  12534. }
  12535. };
  12536. });
  12537. //# sourceMappingURL=ThemeUtils.js.map
  12538. ;
  12539. /*
  12540. *+------------------------------------------------------------------------+
  12541. *| Licensed Materials - Property of IBM
  12542. *| IBM Cognos Products: BI Glass
  12543. *| (C) Copyright IBM Corp. 2017
  12544. *|
  12545. *| US Government Users Restricted Rights - Use, duplication or disclosure
  12546. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  12547. *+------------------------------------------------------------------------+
  12548. */
  12549. define('baglass/core-client/js/core-client/utils/UrlUtils',[], function () {
  12550. var UrlUtils = function UrlUtils() {};
  12551. UrlUtils.prototype.base64Encode = function (urlString) {
  12552. if (!urlString) {
  12553. return null;
  12554. }
  12555. var b64String = btoa(urlString);
  12556. return b64String.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');
  12557. };
  12558. UrlUtils.prototype.base64Decode = function (urlString) {
  12559. if (!urlString) {
  12560. return null;
  12561. }
  12562. var encodedString = urlString.replace(/-/g, '+').replace(/_/g, '/');
  12563. var remainder = encodedString.length % 4;
  12564. if (remainder === 2) {
  12565. encodedString += '==';
  12566. } else if (remainder === 3) {
  12567. encodedString += '=';
  12568. }
  12569. return atob(encodedString);
  12570. };
  12571. return new UrlUtils();
  12572. });
  12573. //# sourceMappingURL=UrlUtils.js.map
  12574. ;
  12575. /**
  12576. * Licensed Materials - Property of IBM
  12577. * IBM Cognos Products: BI Glass
  12578. * (C) Copyright IBM Corp. 2017, 2022
  12579. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  12580. */
  12581. /* global navigator */
  12582. define('caglass/ajax/CAAuthentication',['underscore', 'jquery', 'baglass/utils/Utils', 'baglass/core-client/js/core-client/utils/Utils', 'baglass/core-client/js/core-client/utils/BrowserUtils', 'baglass/core-client/js/core-client/utils/Deferred', 'baglass/core-client/js/core-client/utils/UrlUtils', 'baglass/nls/StringResources', 'baglass/core-client/js/core-client/errors/BaseError'], function (_, $, GlassUtils, Utils, BrowserUtils, Deferred, urlUtils, StringResources, BaseError) {
  12583. var CAAuthentication = function CAAuthentication() {};
  12584. /**
  12585. * Entry point API for CA login called in bi-commons component re: Entry.js.
  12586. * @public
  12587. * @param [glassContext] - the global glassContext object
  12588. * @param origin {initialLogin: true} for initial login
  12589. * {relogin: true} for relogin
  12590. * @return successful login to set up glassContext.authInfo object
  12591. * or open a LoginView page to ask credentials until successful.
  12592. */
  12593. CAAuthentication.prototype.login = function (glassContext, origin) {
  12594. var _this = this;
  12595. var originInfo = origin || {
  12596. initialLogin: true
  12597. };
  12598. if (_.isUndefined(originInfo.initialLogin)) {
  12599. originInfo.initialLogin = true;
  12600. }
  12601. if (originInfo.skipCALogin === true) {
  12602. var error = new Error();
  12603. error.redirectUrl = originInfo.redirectUrl;
  12604. error.state = {
  12605. skipCALogin: true
  12606. };
  12607. return this._promptForExternalLogin(glassContext, error, {
  12608. relogin: true
  12609. });
  12610. } else {
  12611. return this._isLoggedIn(glassContext, originInfo)["catch"](function (error) {
  12612. return _this._promptForLogin(glassContext, error, originInfo);
  12613. });
  12614. }
  12615. };
  12616. CAAuthentication.prototype._isLoggedIn = function (glassContext, origin) {
  12617. var _this2 = this;
  12618. return new Promise(function (resolve, reject) {
  12619. _this2._getAuthInfo(glassContext, origin).then(function (authInfo) {
  12620. _this2._processSuccessfulLogin(glassContext, authInfo, origin).then(function () {
  12621. resolve(authInfo);
  12622. });
  12623. }, function (error) {
  12624. reject(_this2._processAuthenticationError(glassContext, error.jqXHR, origin));
  12625. });
  12626. });
  12627. };
  12628. /**
  12629. * Retrieves the authInfo to check if a user is already logged in
  12630. * Note: in the case of a initialo login, the queryString is checked to see
  12631. * if CAMNamespace is specified. this allows to check the login against a dedicated namespace
  12632. * @private
  12633. * @param {Object} glassContext
  12634. * @param {Object} origin
  12635. * @return {Promise} resolved with the authInfo when already logged-in, rejected otherwise
  12636. */
  12637. CAAuthentication.prototype._getAuthInfo = function (glassContext, origin) {
  12638. var url = CAAuthentication.LOGIN_URL;
  12639. if (origin && origin.relogin === true && glassContext.authInfo.isAnonymous !== true) {
  12640. url += '?h_CAM_action=logonAs';
  12641. } else {
  12642. if (origin && origin.initialLogin === true && origin.queryString) {
  12643. url = this._buildURLWithQueryString(url, origin.queryString, glassContext);
  12644. }
  12645. }
  12646. return glassContext.getCoreSvc('.Ajax').ajax({
  12647. type: origin.requestMethod,
  12648. url: url,
  12649. contentType: 'application/json; charset=utf-8',
  12650. dataType: 'json',
  12651. skipErrorHandling: true
  12652. }).then(function (response) {
  12653. return response.data;
  12654. });
  12655. };
  12656. CAAuthentication.prototype._buildURLWithQueryString = function (url, queryString, glassContext) {
  12657. var definedNamespace = queryString.CAMNamespace;
  12658. if (!_.isString(definedNamespace) && !_.isUndefined(definedNamespace)) {
  12659. glassContext.getCoreSvc('.Logger').info('There can only be 1 namespace in the queryString. Ignoring.');
  12660. }
  12661. var allowedParameters = GlassUtils.getFilteredLoginParameters(glassContext, queryString);
  12662. var urlParams = allowedParameters.map(function (param) {
  12663. var name = encodeURIComponent(param.name);
  12664. var value = encodeURIComponent(param.value);
  12665. return "".concat(name, "=").concat(value);
  12666. }).join('&');
  12667. if (urlParams) {
  12668. url += "?".concat(urlParams);
  12669. }
  12670. return url;
  12671. };
  12672. /**
  12673. * Login for legacy application
  12674. * @param {Object} glassContext - glass context
  12675. * @param {Object} origin - info of origin calling prompt for login
  12676. */
  12677. CAAuthentication.prototype.legacyLogin = function (glassContext, origin) {
  12678. return this.submitCredentials(glassContext, {})["catch"](function (error) {
  12679. return this._promptForLogin(glassContext, error, origin);
  12680. }.bind(this));
  12681. };
  12682. /**
  12683. * Perform a secondary login
  12684. * @param {GlassContext} glassContext
  12685. */
  12686. CAAuthentication.prototype.secondaryLogin = function (glassContext, processedError) {
  12687. var originInfo = {
  12688. secondaryLogin: true,
  12689. newWindow: true
  12690. };
  12691. if (processedError) {
  12692. originInfo.authError = processedError;
  12693. }
  12694. return this.submitCredentials(glassContext, {}).then(function (authInfo) {
  12695. Utils.getCurrentWindow().location.reload();
  12696. return authInfo;
  12697. })["catch"](function (error) {
  12698. return this._promptForLogin(glassContext, error, originInfo);
  12699. }.bind(this));
  12700. };
  12701. /**
  12702. * Perform an external login
  12703. * @param {GlassContext} glassContext
  12704. * @param {Object} error - error describing how to prompt
  12705. * @param {Object} origin - info of origin calling prompt for login
  12706. * @return a promise when opening a new window tab otherwise no promise returned because of the current page reloaded
  12707. */
  12708. CAAuthentication.prototype.externalLogin = function (glassContext, error, origin) {
  12709. var originInfo = origin ? origin : {};
  12710. if (!originInfo.redirectUrl) {
  12711. originInfo.redirectUrl = Utils.getCurrentWindow().location.href;
  12712. }
  12713. return this._promptForLogin(glassContext, error, originInfo);
  12714. };
  12715. CAAuthentication.prototype._promptForLogin = function (glassContext, error, origin) {
  12716. var promise;
  12717. var ssoLoginUrl = glassContext.getSSOLoginURL();
  12718. if (ssoLoginUrl && !GlassUtils.isFactoryMode()) {
  12719. promise = this._promptWithSSOLoginUrl(ssoLoginUrl);
  12720. } else {
  12721. if (error.isExternalLogin === true) {
  12722. promise = this._promptForExternalLogin(glassContext, error, origin);
  12723. } else {
  12724. promise = this._promptForInternalLogin(glassContext, error, origin);
  12725. }
  12726. }
  12727. return promise;
  12728. };
  12729. CAAuthentication.prototype._promptWithSSOLoginUrl = function (ssoLoginUrl) {
  12730. var currentWindow = Utils.getCurrentWindow();
  12731. if (!currentWindow.__ca_ssologin_in_progress__) {
  12732. var builtUrl = GlassUtils.buildRedirectURL(ssoLoginUrl, currentWindow.location.href);
  12733. currentWindow.location.assign(builtUrl);
  12734. currentWindow.__ca_ssologin_in_progress__ = new Promise(function () {});
  12735. }
  12736. return currentWindow.__ca_ssologin_in_progress__;
  12737. };
  12738. CAAuthentication.prototype._promptForInternalLogin = function (glassContext, error, origin) {
  12739. var curWindow = Utils.getCurrentWindow();
  12740. if (!curWindow.__ca_login_in_progress__) {
  12741. curWindow.__ca_login_in_progress__ = new Deferred();
  12742. var originInfo = _.extend(origin) || {};
  12743. originInfo.authInfo = glassContext.authInfo;
  12744. $(curWindow).one('ca.loginSuccessful', this._onLoginSuccessful.bind(this, glassContext, originInfo));
  12745. $(curWindow).on('popstate.ca_login', this._onPopStateFromLogin.bind(this, glassContext, originInfo));
  12746. var context = {
  12747. content: {
  12748. origin: originInfo
  12749. }
  12750. };
  12751. glassContext.appController.openLoginView(context);
  12752. }
  12753. return curWindow.__ca_login_in_progress__.promise;
  12754. }; // jshint ignore:line
  12755. CAAuthentication.prototype._onPopStateFromLogin = function (glassContext, originInfo) {
  12756. if (Utils.getCurrentWindow().__ca_login_in_progress__) {
  12757. var context = {
  12758. content: {
  12759. origin: originInfo
  12760. }
  12761. };
  12762. if (originInfo.secondaryLogin) {
  12763. var error = new BaseError('Login was cancelled by the user.');
  12764. Utils.getCurrentWindow().__ca_login_in_progress__.reject(error);
  12765. Utils.getCurrentWindow().__ca_login_in_progress__ = undefined;
  12766. } else if (originInfo.initialLogin) {
  12767. glassContext.appController.openLoginView(context);
  12768. }
  12769. }
  12770. }; // jshint ignore:line
  12771. CAAuthentication.prototype._onLoginSuccessful = function (glassContext, origin, event, result) {
  12772. var isMobile = navigator.userAgent.indexOf('CAMOBILE') != -1;
  12773. var mobileService = glassContext.getSvcSync('.MobileCompleteAuthentication');
  12774. if (isMobile && mobileService) {
  12775. mobileService.onSuccess();
  12776. return;
  12777. }
  12778. Utils.getCurrentWindow().__ca_login_in_progress__.resolve(result);
  12779. Utils.getCurrentWindow().__ca_login_in_progress__ = undefined;
  12780. $(Utils.getCurrentWindow()).off('popstate.ca_login');
  12781. if (result && result.stayAnonymous === true) {
  12782. glassContext.appController.openPreviousAppView();
  12783. } else if (origin.relogin === true && glassContext.authInfo.differentAccountLogin !== true) {
  12784. if (!glassContext.appController.isOpeningAView()) {
  12785. glassContext.appController.openPreviousAppView();
  12786. }
  12787. } else if (origin.legacyLogin !== true && origin.initialLogin !== true && origin.secondaryLogin !== true) {
  12788. this._reloadPage();
  12789. }
  12790. };
  12791. CAAuthentication.prototype._promptForExternalLogin = function (glassContext, error, origin) {
  12792. var curWindow = glassContext.window || Utils.getCurrentWindow();
  12793. var loginUrl = error.redirectUrl;
  12794. var state = error.state;
  12795. state.isMobile = navigator.userAgent.indexOf('CAMOBILE') != -1;
  12796. if (!curWindow.__ca_external_login_in_progress__) {
  12797. curWindow.__ca_external_login_in_progress__ = new Deferred();
  12798. if (Utils.isInIframe(curWindow) || origin && (origin.relogin === true || origin.authtc === true)) {
  12799. if (state.skipCALogin === true && origin.authtc !== true) {
  12800. loginUrl += '?state=' + urlUtils.base64Encode(JSON.stringify(state));
  12801. } else {
  12802. state = _.extend(state, _.omit(origin, 'authInfo'));
  12803. state.newWindow = true;
  12804. loginUrl += '&state=' + urlUtils.base64Encode(JSON.stringify(state));
  12805. }
  12806. if (BrowserUtils.isIE() && Utils.isInIframe(curWindow)) {
  12807. // Post-Message events between the child window and parent iframe don't work
  12808. // on IE11 in a cross-domain scenario.
  12809. //
  12810. // This solution uses localStorage / StorageEvents to detect when the log-in
  12811. // was successful.
  12812. try {
  12813. curWindow.localStorage.removeItem('externalLoginResult');
  12814. var storageEventHandler = function storageEventHandler(evt) {
  12815. var externalLoginResult;
  12816. if (evt.key && evt.key === 'externalLoginResult') {
  12817. externalLoginResult = evt.newValue;
  12818. }
  12819. if (externalLoginResult) {
  12820. curWindow.removeEventListener('storage', storageEventHandler);
  12821. var data = JSON.parse(externalLoginResult);
  12822. curWindow.localStorage.removeItem('externalLoginResult');
  12823. curWindow.postMessage(data, curWindow.location.origin);
  12824. }
  12825. };
  12826. curWindow.addEventListener('storage', storageEventHandler);
  12827. } catch (err) {
  12828. glassContext.getCoreSvc('.Logger').error(err);
  12829. }
  12830. }
  12831. curWindow.addEventListener('message', this._onExternalLoginComplete.bind(this, glassContext), {
  12832. once: true
  12833. });
  12834. this._externalWindow = curWindow.open(loginUrl, '');
  12835. } else {
  12836. if (origin && origin.redirectUrl) {
  12837. state = _.extend(_.clone(state), _.omit(origin, ['authInfo', 'authError']));
  12838. state.redirectUrl = origin.redirectUrl;
  12839. } else {
  12840. state.redirectUrl = curWindow.location.href;
  12841. }
  12842. loginUrl += '&state=' + urlUtils.base64Encode(JSON.stringify(state));
  12843. curWindow.location.assign(loginUrl, true);
  12844. }
  12845. }
  12846. return curWindow.__ca_external_login_in_progress__.promise;
  12847. };
  12848. /**
  12849. * Event handler for onExternalLoginComplete from a second browser tab
  12850. * @private
  12851. * @param [glassContext] - the global glassContext object
  12852. * @param [event] - event handler triggered by a window.postMessage from a second browser tab
  12853. */
  12854. CAAuthentication.prototype._onExternalLoginComplete = function (glassContext, event) {
  12855. Utils.getCurrentWindow().__ca_external_login_in_progress__.resolve(event.data);
  12856. delete Utils.getCurrentWindow().__ca_external_login_in_progress__;
  12857. if (!event.data) {
  12858. Utils.getCurrentWindow().location.assign(event.origin);
  12859. }
  12860. if (this._externalWindow) {
  12861. this._externalWindow.close();
  12862. this._externalWindow = null;
  12863. }
  12864. };
  12865. /**
  12866. * Submit user credentials to UPS/CAM for authentication
  12867. * @public
  12868. * @param [glassContext] - the global glassContext object
  12869. * @param [loginPrompts] - the login prompts JSON object originally returned from UPS/CAM
  12870. * @param [origin] - location origin object used to pass on queryString
  12871. */
  12872. CAAuthentication.prototype.submitCredentials = function (glassContext, loginPrompts, origin) {
  12873. var _this3 = this;
  12874. return new Promise(function (resolve, reject) {
  12875. var ajaxOptions = {
  12876. type: 'POST',
  12877. url: CAAuthentication.LOGIN_URL,
  12878. data: JSON.stringify(loginPrompts),
  12879. contentType: 'application/json; charset=utf-8',
  12880. dataType: 'json',
  12881. skipErrorHandling: true
  12882. };
  12883. glassContext.getCoreSvc('.Ajax').ajax(ajaxOptions).then(function (response) {
  12884. var authInfo = response.data;
  12885. _this3._processSuccessfulLogin(glassContext, authInfo, origin).then(function () {
  12886. resolve(authInfo);
  12887. });
  12888. }, function (error) {
  12889. reject(_this3._processAuthenticationError(glassContext, error.jqXHR, origin));
  12890. });
  12891. });
  12892. };
  12893. /**
  12894. * Submit login tokens to UPS/CAM for authentication
  12895. * Once we attempt a login to bi/v1/login, we handle any errors returned.
  12896. * Expected errors include 441 responses with displayObjects. Otherwise something went horribly wrong and we'll return the error itself to the caller.
  12897. * @public
  12898. * @param [glassContext] - the global glassContext object
  12899. * @param [tokens] - the query strings returned from external provide such as IBM BlueID
  12900. * @return authentication info object when successful or an Error object when failed.
  12901. */
  12902. CAAuthentication.prototype.submitLoginTokens = function (glassContext, tokens) {
  12903. var _this4 = this;
  12904. var ajaxOptions = {
  12905. type: 'GET',
  12906. url: CAAuthentication.LOGIN_URL,
  12907. data: tokens,
  12908. skipErrorHandling: true
  12909. };
  12910. return glassContext.getCoreSvc('.Ajax').ajax(ajaxOptions)["catch"](function (error) {
  12911. return _this4.recoverFromCamError(glassContext, error, tokens);
  12912. });
  12913. };
  12914. CAAuthentication.prototype.recoverFromCamError = function (glassContext, error, origin) {
  12915. var processedError = this._processAuthenticationError(glassContext, error.jqXHR);
  12916. if (processedError.displayObjects && processedError.displayObjects.length > 0) {
  12917. var originInfo = _.extend(origin) || {};
  12918. originInfo.authError = processedError;
  12919. return this._promptForLogin(glassContext, processedError, originInfo);
  12920. }
  12921. return Promise.reject(error);
  12922. };
  12923. CAAuthentication.prototype._reloadPage = function () {
  12924. var currentWindow = Utils.getCurrentWindow();
  12925. if (currentWindow.external && currentWindow.external.HasOnClose) {
  12926. return currentWindow.external.OnClose(0);
  12927. }
  12928. currentWindow.location = currentWindow.location.pathname;
  12929. };
  12930. CAAuthentication.prototype._isDifferentPrimaryUser = function (oldAccountId, accountInfo) {
  12931. return oldAccountId && accountInfo && accountInfo.id !== oldAccountId;
  12932. };
  12933. CAAuthentication.prototype._processSuccessfulLogin = function (glassContext, authInfo, origin) {
  12934. if (glassContext.authInfo && glassContext.authInfo.isAnonymous === true) {
  12935. return Promise["try"](function () {
  12936. if (origin && origin.relogin === true) {
  12937. return authInfo;
  12938. } else {
  12939. this._reloadPage();
  12940. }
  12941. }.bind(this));
  12942. } else {
  12943. var oldAccountId = glassContext && glassContext.profile && glassContext.profile.account && glassContext.profile.account.id;
  12944. var userProfileSvc = glassContext.getCoreSvc('.UserProfile');
  12945. return Promise["try"](function () {
  12946. return userProfileSvc.getAccountInfo(authInfo);
  12947. }).then(function (accountInfo) {
  12948. if (this._isDifferentPrimaryUser(oldAccountId, accountInfo)) {
  12949. this._reloadPage();
  12950. }
  12951. }.bind(this))["catch"](function (e) {
  12952. glassContext.getCoreSvc('.Logger').error('Failed to get user account', e);
  12953. }).then(function () {
  12954. glassContext.authInfo = authInfo;
  12955. glassContext.appController.reloadTheme();
  12956. if (userProfileSvc.updatePreferences) {
  12957. return userProfileSvc.updatePreferences(!oldAccountId);
  12958. }
  12959. });
  12960. }
  12961. };
  12962. /**
  12963. * Store user credentials to UPS/CAM for authentication
  12964. * @public
  12965. * @param {Object} glassContext the global glassContext object
  12966. * @return {Object} authentication info object when successful or throws Error object when failed.
  12967. */
  12968. CAAuthentication.prototype.storeCredentials = function (glassContext) {
  12969. var _this5 = this;
  12970. var url = CAAuthentication.LOGIN_URL;
  12971. var ajaxOptions = {
  12972. data: {
  12973. h_CAM_action: 'generateTC'
  12974. },
  12975. type: 'GET',
  12976. url: url,
  12977. contentType: 'application/json; charset=utf-8',
  12978. dataType: 'json',
  12979. skipErrorHandling: true
  12980. };
  12981. return glassContext.getCoreSvc('.Ajax').ajax(ajaxOptions).fail(function (error) {
  12982. var authErr = _this5._processAuthenticationError(glassContext, error.jqXHR);
  12983. if (authErr.isExternalLogin === true) {
  12984. var origin = {
  12985. redirectUrl: authErr.redirectUrl,
  12986. authtc: true
  12987. };
  12988. return _this5.externalLogin(glassContext, authErr, origin).fail(function (loginErr) {
  12989. glassContext.appController.showToast(loginErr, {
  12990. 'type': 'error'
  12991. });
  12992. throw loginErr;
  12993. });
  12994. } else {
  12995. throw authErr;
  12996. }
  12997. });
  12998. };
  12999. CAAuthentication.prototype.processAuthenticationError = function (glassContext, jqXHR, origin) {
  13000. return this._processAuthenticationError(glassContext, jqXHR, origin);
  13001. };
  13002. CAAuthentication.prototype._processAuthenticationError = function (glassContext, jqXHR, origin) {
  13003. var error = new Error();
  13004. error.httpCode = jqXHR.status;
  13005. error.jqXHR = jqXHR;
  13006. try {
  13007. this._processAuthDisplayObjects(error, jqXHR);
  13008. this._processAuthErrorCodeAndMessage(glassContext, error, jqXHR);
  13009. this._processLoginParameters(glassContext, error, origin);
  13010. } catch (e) {
  13011. error.code = CAAuthentication.LOGIN_FATAL;
  13012. error.message = StringResources.get('invalidLoginResponse');
  13013. }
  13014. return error;
  13015. };
  13016. CAAuthentication.prototype._processAuthDisplayObjects = function (error, jqXHR) {
  13017. error.displayObjects = [];
  13018. if (jqXHR.responseJSON.promptInfo && jqXHR.responseJSON.promptInfo.displayObjects) {
  13019. error.displayObjects = jqXHR.responseJSON.promptInfo.displayObjects;
  13020. var state = {};
  13021. var dispObjects = error.displayObjects;
  13022. for (var i = 0; i < dispObjects.length; i++) {
  13023. if (dispObjects[i].name === CAAuthentication.CAM_REDIRECT_URL_NAME) {
  13024. error.isExternalLogin = true;
  13025. error.redirectUrl = dispObjects[i].value;
  13026. } else {
  13027. state[dispObjects[i].name] = dispObjects[i].value;
  13028. }
  13029. }
  13030. if (error.isExternalLogin === true) {
  13031. error.state = state;
  13032. }
  13033. }
  13034. };
  13035. CAAuthentication.prototype._processAuthErrorCodeAndMessage = function (glassContext, error, jqXHR) {
  13036. this._processAuthErrorCode(error, jqXHR);
  13037. this._processAuthErrorMessage(glassContext, error, jqXHR);
  13038. if (error.code === CAAuthentication.LOGIN_UNKNOWN_LOGIN_ERROR && error.message === '') {
  13039. error.message = StringResources.get('credentialSubmitError');
  13040. }
  13041. };
  13042. CAAuthentication.prototype._processAuthErrorCode = function (error, jqXHR) {
  13043. var code = jqXHR.responseJSON.errorCodeString;
  13044. if (code === 'camAuthUserRecoverable') {
  13045. error.code = CAAuthentication.LOGIN_INVALID_CREDENTIALS;
  13046. } else if (code === 'camAuthUnrecoverable') {
  13047. error.code = CAAuthentication.LOGIN_DEADEND;
  13048. } else {
  13049. error.code = CAAuthentication.LOGIN_UNKNOWN_LOGIN_ERROR;
  13050. }
  13051. };
  13052. CAAuthentication.prototype._processAuthErrorMessage = function (glassContext, error, jqXHR) {
  13053. if (jqXHR.responseJSON.messages.length > 0) {
  13054. var camMessages = jqXHR.responseJSON.messages;
  13055. var messageNbr = camMessages.length;
  13056. if (jqXHR.status !== glassContext.ajaxCodes.UNAUTHORIZED) {
  13057. error.message = camMessages[0].messageString ? camMessages[0].messageString : camMessages[0];
  13058. } else {
  13059. var camMessageString = camMessages[messageNbr - 1].messageString ? camMessages[messageNbr - 1].messageString : camMessages[messageNbr - 1];
  13060. if (camMessageString.search('CAM-AAA-0036') !== -1 || camMessageString.search('CAM-AAA-0125') !== -1) {
  13061. error.message = StringResources.get('invalidLogin');
  13062. } else {
  13063. error.message = camMessageString;
  13064. }
  13065. }
  13066. } else {
  13067. error.message = '';
  13068. }
  13069. };
  13070. /**
  13071. * Processes LoginParameters passed in by the queryString and attaches them to the CAM response object for the next login request if they are configured as allowed.
  13072. * @private
  13073. * @param [glassContext] - glassContext object
  13074. * @param [error] - error object from CAM Response
  13075. * @param [origin] - origin request object that includes any urlLoginParameters in the queryString
  13076. */
  13077. CAAuthentication.prototype._processLoginParameters = function (glassContext, error, origin) {
  13078. var queryString = '';
  13079. if (origin) {
  13080. queryString = origin.queryString;
  13081. var allowedParameters = GlassUtils.getFilteredLoginParameters(glassContext, queryString);
  13082. if (error.state) {
  13083. for (var i = 0; i < allowedParameters.length; i++) {
  13084. error.state[allowedParameters[i].name] = allowedParameters[i].value;
  13085. }
  13086. }
  13087. this._appendLoginParams(error, allowedParameters);
  13088. }
  13089. };
  13090. /**
  13091. * Appends passed in loginParameters if they do not already exist as a hidden display object on the passed in error.
  13092. * @private
  13093. * @param [error] - error object from CAM Response
  13094. * @param [loginParameters] - allowed login parameters configure in glass that exist in the queryString
  13095. */
  13096. CAAuthentication.prototype._appendLoginParams = function (error, loginParameters) {
  13097. var displayObjectNames = [];
  13098. if (error.displayObjects) {
  13099. _.each(error.displayObjects, function (displayObj) {
  13100. if (displayObjectNames.indexOf(displayObj.name) == -1) {
  13101. displayObjectNames.push(displayObj.name);
  13102. }
  13103. });
  13104. _.each(loginParameters, function (loginParam) {
  13105. var objectIndex = displayObjectNames.indexOf(loginParam.name);
  13106. if (objectIndex == -1) {
  13107. loginParam.type = 'hidden';
  13108. error.displayObjects.push(loginParam);
  13109. } else {
  13110. if (error.displayObjects[objectIndex].type == null) {
  13111. error.displayObjects[objectIndex].type = 'hidden';
  13112. }
  13113. }
  13114. });
  13115. }
  13116. };
  13117. CAAuthentication.BASE_URL = 'v1';
  13118. CAAuthentication.LOGIN_URL = CAAuthentication.BASE_URL + '/login';
  13119. CAAuthentication.CAM_REDIRECT_URL_NAME = 'camRedirectURL';
  13120. CAAuthentication.LOGIN_FATAL = 'LOGIN_FATAL';
  13121. CAAuthentication.LOGIN_DEADEND = 'LOGIN_DEADEND';
  13122. CAAuthentication.LOGIN_UNKNOWN_LOGIN_ERROR = 'LOGIN_UNKNOWN_LOGIN_ERROR';
  13123. CAAuthentication.LOGIN_INVALID_CREDENTIALS = 'LOGIN_INVALID_CREDENTIALS';
  13124. return CAAuthentication;
  13125. });
  13126. //# sourceMappingURL=CAAuthentication.js.map
  13127. ;
  13128. /**
  13129. * Licensed Materials - Property of IBM
  13130. * IBM Cognos Products: BI Glass
  13131. * (C) Copyright IBM Corp. 2018
  13132. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  13133. */
  13134. define('caglass/ajax/CASimpleAuthentication',['./CAAuthentication'], function (BaseAuthentication) {
  13135. /**
  13136. * Temporary classes which simplifies the login flow based
  13137. */
  13138. var CAAuthentication = function CAAuthentication() {};
  13139. CAAuthentication.prototype = Object.create(new BaseAuthentication());
  13140. CAAuthentication.prototype._processSuccessfulLogin = function (glassContext, authInfo, origin) {
  13141. var _this = this;
  13142. glassContext.authInfo = authInfo;
  13143. return Promise.resolve(authInfo).then(function () {
  13144. if (origin && origin.relogin && !origin.newWindow) {
  13145. if (authInfo.updatedco) {
  13146. return glassContext.getCoreSvc('.DigitalContext').initialize().then(function () {
  13147. return _this._reloadIfDifferentUserLogin(glassContext, authInfo);
  13148. });
  13149. }
  13150. return _this._reloadIfDifferentUserLogin(glassContext, authInfo);
  13151. }
  13152. });
  13153. };
  13154. CAAuthentication.prototype._reloadIfDifferentUserLogin = function (glassContext, authInfo) {
  13155. var _this2 = this;
  13156. var oldAccountId = glassContext && glassContext.profile && glassContext.profile.account && glassContext.profile.account.id;
  13157. var userProfileSvc = glassContext.getCoreSvc('.UserProfile');
  13158. return Promise["try"](function () {
  13159. return userProfileSvc.getAccountInfo(authInfo);
  13160. }).then(function (accountInfo) {
  13161. if (_this2._isDifferentPrimaryUser(oldAccountId, accountInfo)) {
  13162. _this2._reloadPage();
  13163. authInfo.differentAccountLogin = true;
  13164. return authInfo;
  13165. }
  13166. })["catch"](function (e) {
  13167. glassContext.getCoreSvc('.Logger').error('Failed to get user account', e);
  13168. });
  13169. };
  13170. return CAAuthentication;
  13171. });
  13172. //# sourceMappingURL=CASimpleAuthentication.js.map
  13173. ;
  13174. /**
  13175. * Licensed Materials - Property of IBM
  13176. *
  13177. * IBM Cognos Products: BI Glass
  13178. *
  13179. * Copyright IBM Corp. 2015
  13180. *
  13181. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  13182. */
  13183. define('caglass/nls/GlassResources',{
  13184. 'root': true,
  13185. 'cs': true,
  13186. 'da': true,
  13187. 'de': true,
  13188. 'es': true,
  13189. 'fi': true,
  13190. 'fr': true,
  13191. 'hr': true,
  13192. 'hu': true,
  13193. 'it': true,
  13194. 'ja': true,
  13195. 'kk': true,
  13196. 'ko': true,
  13197. 'no': true,
  13198. 'nb': true,
  13199. 'nl': true,
  13200. 'pl': true,
  13201. 'pt': true,
  13202. 'pt-br': true,
  13203. 'ro': true,
  13204. 'ru': true,
  13205. 'sl': true,
  13206. 'sv': true,
  13207. 'th': true,
  13208. 'tr': true,
  13209. 'zh': true,
  13210. 'zh-cn': true,
  13211. 'zh-tw': true
  13212. });
  13213. //# sourceMappingURL=GlassResources.js.map
  13214. ;
  13215. /**
  13216. * Licensed Materials - Property of IBM
  13217. *
  13218. * IBM Cognos Products: BI Glass
  13219. *
  13220. * (C) Copyright IBM Corp. 2015, 2017
  13221. *
  13222. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  13223. */
  13224. define('caglass/nls/root/GlassResources',{
  13225. "credentialCreate": "Create",
  13226. "communicationErrorMessage": "A network error has occurred. Http code: %{code}",
  13227. "maintenanceLink": "More info",
  13228. "credentialChange": "Renew",
  13229. "maintenanceTitle": "Maintenance",
  13230. "credentialRenewed": "Your credentials were renewed with your current user ID and password.",
  13231. "communicationErrorTitle": "Communication Error",
  13232. "ok": "OK",
  13233. "credentialCreateSuccess": "You have successfully created your credentials",
  13234. "secondaryLoginRefresh": "Refresh the page now?",
  13235. "secondaryLoginSuccess": "Successfully logged into an additional Namespace. The page must be refreshed to use your new capabilities.",
  13236. "errLoadingView": "The specified view is no longer available. The default home view is being displayed instead.",
  13237. "wrongPassword": "Unable to authenticate",
  13238. "error404NotFound": "Error 404 resource not found"
  13239. });
  13240. //# sourceMappingURL=GlassResources.js.map
  13241. ;
  13242. /**
  13243. * Licensed Materials - Property of IBM
  13244. *
  13245. * IBM Cognos Products: BI Glass
  13246. *
  13247. * Copyright IBM Corp. 2015
  13248. *
  13249. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  13250. */
  13251. define('caglass/nls/StringResources',['i18n!caglass/nls/GlassResources', 'baglass/core-client/js/core-client/utils/Lexicon'], function (GlassResources, Lexicon) {
  13252. 'use strict';
  13253. var lexicon = new Lexicon({
  13254. data: GlassResources,
  13255. allowMissing: true,
  13256. verbose: false
  13257. });
  13258. return {
  13259. /**
  13260. * Get the string resource for the given key and interpolation options
  13261. *
  13262. * @param key The key of the string to return
  13263. * @param interpolationOptions Optional interpolation options (see poly.t documentation for details)
  13264. * @returns The string to display
  13265. */
  13266. get: function get(key, interpolationOptions) {
  13267. var translated = lexicon.translate(key, interpolationOptions);
  13268. if (translated !== key) {
  13269. return translated;
  13270. }
  13271. return Lexicon.NOT_TRANSLATED + '(' + key + ')';
  13272. }
  13273. };
  13274. });
  13275. //# sourceMappingURL=StringResources.js.map
  13276. ;
  13277. /**
  13278. * Licensed Materials - Property of IBM
  13279. * IBM Cognos Products: BI Glass
  13280. * (C) Copyright IBM Corp. 2016, 2017
  13281. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  13282. */
  13283. define('caglass/ajax/CAErrorHandler',['baglass/core-client/js/core-client/ui/core/Class', './CAAuthentication', 'jquery', 'caglass/nls/StringResources'], function (Class, CAAuthentication, $, StringResources) {
  13284. var CAErrorHandler = Class.extend({
  13285. init: function init(options) {
  13286. this.CAM_LOCATION = 'X-CAM-Location';
  13287. this.isOpeningLoginView = false;
  13288. $.extend(this, options);
  13289. },
  13290. handleError: function handleError(ajaxResponse, options, glassContext) {
  13291. var jqxhrStatus = ajaxResponse.jqXHR.status;
  13292. return Promise.resolve().then(function () {
  13293. if (jqxhrStatus === glassContext.ajaxCodes.UNAUTHORIZED) {
  13294. return this._getCAAuthentication().login(glassContext, {
  13295. relogin: true
  13296. }).then(function () {
  13297. return {
  13298. retry: true
  13299. };
  13300. });
  13301. } else if (jqxhrStatus === glassContext.ajaxCodes.AUTH_DENIED) {
  13302. var jsonObj = JSON.parse(ajaxResponse.jqXHR.responseText);
  13303. if (jsonObj.origin === 'siteminder' && jsonObj.redirectUrl) {
  13304. return this._getCAAuthentication().login(glassContext, {
  13305. relogin: true,
  13306. skipCALogin: true,
  13307. redirectUrl: jsonObj.redirectUrl
  13308. }).then(function () {
  13309. return {
  13310. retry: true
  13311. };
  13312. });
  13313. }
  13314. }
  13315. if (jqxhrStatus === 503) {
  13316. this._showError(jqxhrStatus, glassContext);
  13317. }
  13318. return {
  13319. retry: false
  13320. };
  13321. }.bind(this));
  13322. },
  13323. _getCAAuthentication: function _getCAAuthentication() {
  13324. return new CAAuthentication();
  13325. },
  13326. _showError: function _showError(jqxhrStatus, glassContext) {
  13327. glassContext.appController.showErrorMessage(StringResources.get('communicationErrorMessage', {
  13328. code: jqxhrStatus
  13329. }), StringResources.get('communicationErrorTitle'));
  13330. }
  13331. });
  13332. return CAErrorHandler;
  13333. });
  13334. //# sourceMappingURL=CAErrorHandler.js.map
  13335. ;
  13336. /**
  13337. * Licensed Materials - Property of IBM
  13338. * IBM Watson Analytics (C) Copyright IBM Corp. 2017
  13339. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  13340. */
  13341. define('caglass/ajax/HandleError',['./CAErrorHandler'], function (CAErrorHandler) {
  13342. var HandleError = function HandleError(glassContext) {
  13343. this.glassContext = glassContext;
  13344. this.caErrorHandler = new CAErrorHandler();
  13345. };
  13346. HandleError.prototype.handleError = function (request, error) {
  13347. if (request.params.skipErrorHandling === true) {
  13348. return Promise.reject(error);
  13349. } else {
  13350. return this._getErrorHandler().handleError(error, {}, this.glassContext).then(function (result) {
  13351. if (result.retry === true) {
  13352. return this.glassContext.getCoreSvc('.Ajax').ajax(request.params);
  13353. } else {
  13354. return Promise.reject(error);
  13355. }
  13356. }.bind(this), function (handleError) {
  13357. this.glassContext.getCoreSvc('.Logger').error('error while processing the initial error', error);
  13358. return Promise.reject(handleError);
  13359. }.bind(this));
  13360. }
  13361. };
  13362. HandleError.prototype._getErrorHandler = function () {
  13363. return this.caErrorHandler;
  13364. };
  13365. return HandleError;
  13366. });
  13367. //# sourceMappingURL=HandleError.js.map
  13368. ;
  13369. /**
  13370. * Licensed Materials - Property of IBM
  13371. * IBM Watson Analytics (C) Copyright IBM Corp. 2017
  13372. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  13373. */
  13374. define('caglass/ajax/HandleResponse',[], function () {
  13375. var HandleResponse = function HandleResponse(glassContext) {
  13376. this.glassContext = glassContext;
  13377. };
  13378. HandleResponse.prototype.handleResponse = function (request) {
  13379. return Promise["try"](function () {
  13380. if (this.glassContext.services.exists('.Notification')) {
  13381. this.glassContext.getSvc('.Notification').then(function (notificationSvc) {
  13382. notificationSvc.pollForNewNotifications(request.params);
  13383. });
  13384. }
  13385. }.bind(this))["catch"](function () {});
  13386. };
  13387. return HandleResponse;
  13388. });
  13389. //# sourceMappingURL=HandleResponse.js.map
  13390. ;
  13391. /**
  13392. * Licensed Materials - Property of IBM
  13393. * IBM Watson Analytics (C) Copyright IBM Corp. 2017
  13394. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  13395. */
  13396. define('caglass/ajax/PrepareRequest',['baglass/utils/Utils'], function (GlassUtils) {
  13397. var PrepareRequest = function PrepareRequest(glassContext) {
  13398. this.glassContext = glassContext;
  13399. };
  13400. PrepareRequest.prototype.prepareRequest = function (request) {
  13401. this._addDefaultHeaders(request);
  13402. if (this._isServiceUrl(request.params.url)) {
  13403. request.params.url = this._screenUrl(request.params.url);
  13404. }
  13405. };
  13406. PrepareRequest.prototype._addDefaultHeaders = function (request) {
  13407. var params = request.params;
  13408. params.headers = params.headers || {};
  13409. params.headers['X-XSRF-TOKEN'] = GlassUtils.getCookieValue('XSRF-TOKEN');
  13410. if (GlassUtils.isFactoryMode()) {
  13411. params.headers.X_BI_UI_FACTORYMODE = 'true';
  13412. }
  13413. if (this._shouldAddOverrideHeader(request.params.type || request.params.method)) {
  13414. this._addOverrideHeader(request, request.params.type || request.params.method);
  13415. }
  13416. return Promise.resolve();
  13417. };
  13418. PrepareRequest.prototype._shouldAddOverrideHeader = function (requestType) {
  13419. var configService = this.glassContext.getCoreSvc('.Config');
  13420. var xssCheckingEnabled = configService.getXSSChecking();
  13421. if (this.MASKED_METHODS.indexOf(requestType) >= 0 && xssCheckingEnabled) {
  13422. return true;
  13423. }
  13424. return false;
  13425. };
  13426. PrepareRequest.prototype._addOverrideHeader = function (request, requestType) {
  13427. request.params.headers['X-Http-Method-Override'] = requestType;
  13428. request.params.type = 'POST';
  13429. request.params.method = 'POST';
  13430. };
  13431. PrepareRequest.prototype._screenUrl = function (url) {
  13432. //url component needs update not the query component
  13433. var urlComponents = url.split('?');
  13434. urlComponents[0] = urlComponents[0].replace('/.', '/_dot_');
  13435. urlComponents[0] = urlComponents[0].replace(/~/g, '_tilde_');
  13436. url = urlComponents.join('?');
  13437. return url;
  13438. };
  13439. PrepareRequest.prototype._isServiceUrl = function (url) {
  13440. return url && url.indexOf('v1/') >= 0;
  13441. };
  13442. PrepareRequest.prototype.MASKED_METHODS = ['PUT', 'DELETE'];
  13443. return PrepareRequest;
  13444. });
  13445. //# sourceMappingURL=PrepareRequest.js.map
  13446. ;
  13447. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  13448. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  13449. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  13450. /**
  13451. * Licensed Materials - Property of IBM
  13452. * IBM Cognos Products: Glass
  13453. * (C) Copyright IBM Corp. 2019
  13454. * US Government Users Restricted Rights - Use, duplication or disclosure
  13455. * restricted by GSA ADP Schedule Contract with IBM Corp.
  13456. */
  13457. define('caglass/ajax/PrepareRequestURL',['underscore', 'baglass/app/services/ConfigService', 'baglass/utils/Utils'], function (_, ConfigService, GlassUtils) {
  13458. var PrepareRequestURL = /*#__PURE__*/function () {
  13459. function PrepareRequestURL(glassContext) {
  13460. _classCallCheck(this, PrepareRequestURL);
  13461. this.glassContext = glassContext;
  13462. }
  13463. _createClass(PrepareRequestURL, [{
  13464. key: "prepareRequest",
  13465. value: function prepareRequest(request) {
  13466. if (this._isGET(request) && this.glassContext.getCoreSvc('.Config').getXSSChecking() === true) {
  13467. this._CAFEncode(request);
  13468. }
  13469. }
  13470. }, {
  13471. key: "_CAFEncode",
  13472. value: function _CAFEncode(request) {
  13473. var encodingService = this.glassContext.getCoreSvc('.CAFEncoding');
  13474. var currentDataObject = this._getDataObject(request.params.data);
  13475. if (request.params.url) {
  13476. var queryString = this._getQueryString(request.params.url);
  13477. var qsObject = GlassUtils.deparam(queryString, false);
  13478. _.extend(currentDataObject, qsObject);
  13479. request.params.url = request.params.url.replace('?' + queryString, '');
  13480. }
  13481. this._encodeObject(currentDataObject, encodingService);
  13482. request.params.data = currentDataObject;
  13483. request.params.headers[PrepareRequestURL.XSS_ENCODING_HEADER] = true;
  13484. }
  13485. }, {
  13486. key: "_isGET",
  13487. value: function _isGET(request) {
  13488. return request.params.method && request.params.method.toUpperCase() === 'GET' || request.params.type && request.params.type.toUpperCase() === 'GET' || request.params.method === undefined && request.params.type === undefined;
  13489. }
  13490. }, {
  13491. key: "_encodeObject",
  13492. value: function _encodeObject(objToEncode, encodingService) {
  13493. for (var item in objToEncode) {
  13494. if (_.isObject(objToEncode[item])) {
  13495. this._encodeObject(objToEncode[item], encodingService);
  13496. } else if (_.isString(objToEncode[item])) {
  13497. objToEncode[item] = encodingService.encode(objToEncode[item]);
  13498. }
  13499. }
  13500. }
  13501. }, {
  13502. key: "_getQueryString",
  13503. value: function _getQueryString(url) {
  13504. return url.indexOf('?') !== -1 ? url.substring(url.indexOf('?') + 1) : '';
  13505. }
  13506. }, {
  13507. key: "_getDataObject",
  13508. value: function _getDataObject(data) {
  13509. var result = {};
  13510. if (!_.isUndefined(data)) {
  13511. if (_.isString(data)) {
  13512. _.extend(result, this._parseDataString(data));
  13513. } else if (_.isObject(data)) {
  13514. _.extend(result, data);
  13515. }
  13516. }
  13517. return result;
  13518. }
  13519. }, {
  13520. key: "_parseDataString",
  13521. value: function _parseDataString(str) {
  13522. try {
  13523. return JSON.parse(str);
  13524. } catch (e) {
  13525. return GlassUtils.deparam(str, false);
  13526. }
  13527. }
  13528. }]);
  13529. return PrepareRequestURL;
  13530. }();
  13531. PrepareRequestURL.XSS_ENCODING_HEADER = 'X-CA-XSSEncoded';
  13532. return PrepareRequestURL;
  13533. });
  13534. //# sourceMappingURL=PrepareRequestURL.js.map
  13535. ;
  13536. /**
  13537. * Licensed Materials - Property of IBM
  13538. * IBM Cognos Products: BI Glass
  13539. * (C) Copyright IBM Corp. 2017, 2018
  13540. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  13541. */
  13542. define('caglass/ajax/all',['./CASimpleAuthentication', './CAErrorHandler', './HandleError', './HandleResponse', './PrepareRequest', './PrepareRequestURL'], function () {});
  13543. //# sourceMappingURL=all.js.map
  13544. ;
  13545. /*
  13546. *+------------------------------------------------------------------------+
  13547. *| Licensed Materials - Property of IBM
  13548. *| IBM Cognos Products: Content Explorer
  13549. *| (C) Copyright IBM Corp. 2016, 2018
  13550. *|
  13551. *| US Government Users Restricted Rights - Use, duplication or disclosure
  13552. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  13553. *+------------------------------------------------------------------------+
  13554. */
  13555. define('baglass/api/BaseOpener',['../core-client/js/core-client/ui/core/Class', '../nls/StringResources', '../core-client/js/core-client/errors/BaseError'], function (BaseClass, StringResources, BaseError) {
  13556. 'use strict'; //NOSONAR
  13557. var BaseOpener = BaseClass.extend({
  13558. _context: null,
  13559. /**
  13560. * Handler if the action handler is invoked from a menu item.
  13561. */
  13562. onSelectItem: function onSelectItem(context) {
  13563. this.getCustomSpec = this._getMenuItemCustomSpec;
  13564. this.onPress(context);
  13565. },
  13566. /**
  13567. * Keyboard press handler to open object.
  13568. *
  13569. * @public
  13570. * @param {object} context-glass context
  13571. */
  13572. onPress: function onPress(context) {
  13573. this._context = context;
  13574. return this._sendRequest().then(function (data) {
  13575. return this._openObject(data);
  13576. }.bind(this));
  13577. },
  13578. /**
  13579. * A function that returns options defined in a perspective's contibution.json
  13580. *
  13581. * @public
  13582. * @returns {object} an item spec from contribution
  13583. */
  13584. getCustomSpec: function getCustomSpec() {
  13585. var oItemSpec = this._context.target.plugin.itemSpec;
  13586. return oItemSpec;
  13587. },
  13588. _getMenuItemCustomSpec: function _getMenuItemCustomSpec() {
  13589. var oItemSpec = this._context.target.plugin.itemSpec.items[this._context.target.specItemIndex];
  13590. return oItemSpec;
  13591. },
  13592. /**
  13593. * A function to return a custom list of parameters to be used
  13594. * during REST call for the object itself
  13595. *
  13596. * @public
  13597. * @returns {string} comma separated list of parameters
  13598. */
  13599. getRequestParameters: function getRequestParameters() {
  13600. return 'ancestors,owner,modificationTime,permissions,defaultName';
  13601. },
  13602. _openObject: function _openObject(oData) {
  13603. return Promise.resolve(this.getActionId(oData)).then(function (actionId) {
  13604. if (!actionId) {
  13605. throw new BaseError('Undefined actionId');
  13606. }
  13607. return this._context.glassContext.performAction(actionId, this._buildPayload(oData, actionId));
  13608. }.bind(this)).then(function () {
  13609. return this._context.glassContext.getSvc('.Content');
  13610. }.bind(this)).then(function (contentSvc) {
  13611. // We've succesfully done a defaultAction, try adding the object to the MRU list
  13612. return contentSvc.addToMRU(oData);
  13613. }).catch(function (e) {
  13614. this._showToastOnLaunchError(oData);
  13615. throw e;
  13616. }.bind(this));
  13617. },
  13618. _sendRequest: function _sendRequest() {
  13619. return this._buildRequestURL().then(function (url) {
  13620. return this._context.glassContext.getCoreSvc('.Ajax').ajax({
  13621. url: url,
  13622. type: 'GET',
  13623. dataType: 'json',
  13624. data: {
  13625. 'fields': this.getRequestParameters()
  13626. }
  13627. });
  13628. }.bind(this)).then(function (response) {
  13629. return response.data.data[0];
  13630. }).catch(function (error) {
  13631. var jqXHR = error.requestInfo.jqXHR;
  13632. var messages = '';
  13633. var responseJSON = jqXHR.responseJSON;
  13634. if (responseJSON) {
  13635. if (responseJSON.messages) {
  13636. messages = jqXHR.responseJSON.messages.join('\n');
  13637. } else if (responseJSON.cause) {
  13638. try {
  13639. var cause = JSON.parse(responseJSON.cause);
  13640. messages = cause.messages.join('\n');
  13641. } catch (e) {
  13642. //if we get here, 'cause' is not a json object
  13643. messages = responseJSON.cause;
  13644. }
  13645. }
  13646. } else {
  13647. messages = jqXHR.responseText;
  13648. if (messages === '' && error.code === 404) {
  13649. messages = StringResources.get('error404NotFound');
  13650. }
  13651. }
  13652. this._context.glassContext.showErrorMessage(messages, 'Error');
  13653. }.bind(this));
  13654. },
  13655. _buildRequestURL: function _buildRequestURL() {
  13656. var customSpec = this.getCustomSpec();
  13657. return this._context.glassContext.getSvc('.Content').then(function (contentSvc) {
  13658. if (customSpec.options.id) {
  13659. return contentSvc.getBaseObjectsURL() + '/' + encodeURIComponent(customSpec.options.id);
  13660. } else {
  13661. return contentSvc.getPathUrl(customSpec.options.path);
  13662. }
  13663. }.bind(this));
  13664. },
  13665. _buildPayload: function _buildPayload(oData, actionId) {
  13666. return {
  13667. 'glassContext': this._context.glassContext,
  13668. 'target': {
  13669. 'activeObject': {
  13670. 'aSelectedContext': [oData]
  13671. },
  13672. 'itemId': actionId
  13673. }
  13674. };
  13675. },
  13676. _showToastOnLaunchError: function _showToastOnLaunchError(oData) {
  13677. var objName = oData['defaultName'];
  13678. this._context.glassContext.showToast(StringResources.get('openPerspectiveFailed', {
  13679. 'name': objName
  13680. }), {
  13681. 'type': 'error'
  13682. });
  13683. },
  13684. /**
  13685. * An action Id getter function.
  13686. *
  13687. * @public
  13688. * @returns {string} the action id of module used to open this object
  13689. */
  13690. getActionId: function getActionId(data) {
  13691. return 'com.ibm.bi.contentApps.defaultAction.' + data.type;
  13692. }
  13693. });
  13694. return BaseOpener;
  13695. });
  13696. //# sourceMappingURL=BaseOpener.js.map
  13697. ;
  13698. /*
  13699. *+------------------------------------------------------------------------+
  13700. *| Licensed Materials - Property of IBM
  13701. *| IBM Cognos Products: Content Explorer
  13702. *| (C) Copyright IBM Corp. 2016, 2017
  13703. *|
  13704. *| US Government Users Restricted Rights - Use, duplication or disclosure
  13705. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  13706. *+------------------------------------------------------------------------+
  13707. */
  13708. define('caglass/api/DashboardOpener',['baglass/api/BaseOpener'], function (BaseOpener) {
  13709. 'use strict';
  13710. var DashboardOpener = BaseOpener.extend({});
  13711. return DashboardOpener;
  13712. });
  13713. //# sourceMappingURL=DashboardOpener.js.map
  13714. ;
  13715. /**
  13716. * Licensed Materials - Property of IBM
  13717. *
  13718. * IBM Cognos Products: BI Glass
  13719. *
  13720. * Copyright IBM Corp. 2016, 2017
  13721. *
  13722. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  13723. */
  13724. define('caglass/api/ExtensionViewAdaptor',['baglass/api/ExtensionViewAdaptor', 'jquery', '../ajax/CAAuthentication', 'baglass/utils/Utils', 'baglass/core-client/js/core-client/utils/Utils', 'baglass/core-client/js/core-client/utils/ClassFactory', 'underscore'], function (ExtensionViewAdaptor, $, CAAuthentication, Utils, CoreUtils) {
  13725. /**
  13726. * 2.0 ExtensionView adaptor
  13727. *
  13728. */
  13729. var ContentView = ExtensionViewAdaptor.extend({
  13730. /**
  13731. * @typedef {Object} LoginError
  13732. * @property {string} message - error message
  13733. */
  13734. /**
  13735. * @override
  13736. * @public
  13737. * @param {Object[]} loginPrompts - object containing the login prompts
  13738. * @param {string} loginPrompts[].name - name of the login prompt
  13739. * @param {string} loginPrompts[].value - value of the login prompt
  13740. * @return {Promise<undefined|LoginError>} - promise resolved with no object when the login is successful, rejected with an error when it fails,
  13741. *
  13742. */
  13743. signin: function signin(loginPrompts) {
  13744. return this._getCAAuthentication().submitCredentials(this.glassContext, {
  13745. parameters: loginPrompts
  13746. }).then(function (authInfo) {
  13747. $(CoreUtils.getCurrentWindow()).trigger('ca.loginSuccessful', authInfo);
  13748. return;
  13749. });
  13750. },
  13751. /**
  13752. * @override
  13753. * @public
  13754. * @return {Promise} - promise resolved with no object when the login is successful, rejected with an error when it fails,
  13755. *
  13756. */
  13757. render: function render() {
  13758. var _this = this;
  13759. if (this.origin && this.origin.queryString && this.origin.queryString.CAMUsername && this.origin.queryString.CAMPassword) {
  13760. var queryString = this.origin.queryString;
  13761. var loginParams = Utils.getFilteredLoginParameters(this.glassContext, queryString);
  13762. return this.signin(loginParams).then(function () {
  13763. return Promise.resolve();
  13764. })["catch"](function () {
  13765. return _this._openLoginView();
  13766. });
  13767. } else {
  13768. return this._openLoginView();
  13769. }
  13770. },
  13771. _openLoginView: function _openLoginView() {
  13772. return this.doRender();
  13773. },
  13774. _getCAAuthentication: function _getCAAuthentication() {
  13775. return new CAAuthentication();
  13776. }
  13777. });
  13778. return ContentView;
  13779. });
  13780. //# sourceMappingURL=ExtensionViewAdaptor.js.map
  13781. ;
  13782. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  13783. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  13784. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  13785. /*
  13786. * Licensed Materials - Property of IBM
  13787. *
  13788. * IBM Cognos Products: GLASS
  13789. *
  13790. * (C) Copyright IBM Corp. 2019
  13791. *
  13792. * US Government Users Restricted Rights - Use, duplication or disclosure
  13793. * restricted by GSA ADP Schedule Contract with IBM Corp.
  13794. */
  13795. define('baglass/app/NavbarButtonSlideoutController',['../core-client/js/core-client/ui/core/Class', 'jquery', 'underscore'], function (BaseClass, $, _) {
  13796. 'use strict';
  13797. /**
  13798. * This Class is Glass Push-able navigation bar button slideout ontroller
  13799. */
  13800. var NavbarButtonSlideoutController = BaseClass.extend(
  13801. /**
  13802. * @lends NavbarButtonSlideoutController.prototype
  13803. */
  13804. {
  13805. /**
  13806. * @classdesc class representing a menu
  13807. * @augments Class
  13808. * @constructs
  13809. * @public
  13810. *
  13811. * @param {object}
  13812. * options The options object
  13813. * @param {object}
  13814. * options.glasscontext The glass context
  13815. * @param {boolean}
  13816. * options.isAppviewScope Whether the slideout is Application or AppView scope. Default=false
  13817. */
  13818. init: function init(options) {
  13819. $.extend(true, this, options);
  13820. },
  13821. _slideout: null,
  13822. /**
  13823. * Keyboard press handler for pushable button.
  13824. * push/unpush the button opens/hides slideout
  13825. *
  13826. * @public
  13827. * @param {object} context-glass context
  13828. */
  13829. onPress: function onPress(context) {
  13830. if (context.pushState === true) {
  13831. this._onPush(context);
  13832. } else {
  13833. this._onUnpush(context);
  13834. }
  13835. },
  13836. _onPush: function _onPush(context) {
  13837. var slideout = this._pushHandler(context);
  13838. this.onShowCallback(context, slideout);
  13839. },
  13840. /**
  13841. * @private
  13842. * @returns {object} a glass slideout object
  13843. */
  13844. _pushHandler: function _pushHandler(context) {
  13845. var itemSpec = this.getCustomSpec(context);
  13846. var slideout = this._openSlideout(context, itemSpec.options);
  13847. slideout.on('show', function (plugin) {
  13848. if (_.isFunction(plugin.setPressed)) {
  13849. plugin.setPressed();
  13850. }
  13851. }.bind(this, context.target.plugin));
  13852. slideout.on('hide', function (plugin) {
  13853. // there is a case when a menu item of GlassMenu triggers onSelectItem() function of FolderOpener controller
  13854. // thus, plugin is GlassMenu which, in turn, doesn't have a definition of setUnpressed() function
  13855. if (_.isFunction(plugin.setUnpressed)) {
  13856. plugin.setUnpressed();
  13857. }
  13858. }.bind(this, context.target.plugin));
  13859. slideout.setLaunchPoint(context.target.plugin.getRootElement());
  13860. this._slideout = slideout;
  13861. return slideout;
  13862. },
  13863. _openSlideout: function _openSlideout(context, options) {
  13864. this._sendInstrumentationEvt(context, options);
  13865. if (this.isAppviewScope) {
  13866. return context.glassContext.currentAppView.openSlideout(options);
  13867. } else {
  13868. return context.glassContext.showSlideOut(options);
  13869. }
  13870. },
  13871. _onUnpush: function _onUnpush(context) {
  13872. this.onHideCallback(context);
  13873. },
  13874. /**
  13875. * A getter function that returns the class member variable '_slideout'
  13876. * @public
  13877. * @returns {object} slideout object
  13878. */
  13879. getSlideout: function getSlideout() {
  13880. return this._slideout;
  13881. },
  13882. /**
  13883. * A setter function that sets a slideout object to the class member variable '_slideout'
  13884. * @private
  13885. * @param {object} slideout - slideout object such as object returned by glass context application controller's showSlideout method
  13886. */
  13887. _setSlideout: function _setSlideout(slideout) {
  13888. this._slideout = slideout;
  13889. },
  13890. /**
  13891. * A function that returns a predefined slideout object itemspec
  13892. * @public
  13893. * @param {object} context - glass context
  13894. * @returns {object} a Slideout item spec
  13895. */
  13896. getCustomSpec: function getCustomSpec(context) {
  13897. var oItemSpec = context.target.plugin.itemSpec;
  13898. if (oItemSpec.options && oItemSpec.options.content) {
  13899. oItemSpec.options.id = oItemSpec.id + '.' + oItemSpec.options.content.module + '.global';
  13900. }
  13901. return oItemSpec;
  13902. },
  13903. /**
  13904. * A function that sends an instrumentation event
  13905. * @private
  13906. * @param {object} context - glass context
  13907. * @param {object} options - options defined in the itemSpec
  13908. */
  13909. _sendInstrumentationEvt: function _sendInstrumentationEvt(context, options) {
  13910. var instrumentationService = context.glassContext.getCoreSvc('.Instrumentation');
  13911. if (instrumentationService.enabled && options && options.instrumentation && options.instrumentation.enabled) {
  13912. instrumentationService.track(_objectSpread({
  13913. type: options.instrumentation.type,
  13914. objectType: options.instrumentation.objectType,
  13915. action: options.instrumentation.action,
  13916. uiElement: options.instrumentation.uiElement,
  13917. milestoneName: options.instrumentation.action + '_' + options.instrumentation.objectType + '_' + options.instrumentation.uiElement
  13918. }, options.instrumentation.CTA && {
  13919. CTA: options.instrumentation.CTA
  13920. }));
  13921. }
  13922. },
  13923. /**
  13924. * A function that is triggered after a slideout opens
  13925. * subclass can override it for its own purpose
  13926. * @param {object} context - glass context
  13927. */
  13928. onShowCallback: function onShowCallback() {//Override when necessary
  13929. },
  13930. /**
  13931. * A function that works as a callback after a slideout is hidden
  13932. * subclass can override it for its own purpose
  13933. * @param {object} context - glass context
  13934. */
  13935. onHideCallback: function onHideCallback() {//Override when necessary
  13936. }
  13937. });
  13938. return NavbarButtonSlideoutController;
  13939. });
  13940. //# sourceMappingURL=NavbarButtonSlideoutController.js.map
  13941. ;
  13942. /*
  13943. *+------------------------------------------------------------------------+
  13944. *| Licensed Materials - Property of IBM
  13945. *| IBM Cognos Products: Content Explorer
  13946. *| (C) Copyright IBM Corp. 2016, 2017
  13947. *|
  13948. *| US Government Users Restricted Rights - Use, duplication or disclosure
  13949. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  13950. *+------------------------------------------------------------------------+
  13951. */
  13952. define('caglass/api/FolderOpener',['underscore', 'baglass/app/NavbarButtonSlideoutController'], function (_, NavbarButtonSlideoutController) {
  13953. 'use strict';
  13954. var FolderOpener = NavbarButtonSlideoutController.extend({
  13955. _getDefaultItemSpec: function _getDefaultItemSpec() {
  13956. return {
  13957. 'hideOnly': true,
  13958. 'position': 'left',
  13959. 'width': '400px',
  13960. 'perspective': 'home',
  13961. 'label': 'Untitled Label',
  13962. 'resizable': true,
  13963. 'content': {
  13964. 'module': 'bi/content_apps/GenericFolderWideView',
  13965. 'trackBreadcrumbs': true,
  13966. 'showFilter': true,
  13967. 'showAddFolder': true,
  13968. 'showBreadcrumbs': true,
  13969. 'showSort': true
  13970. }
  13971. };
  13972. },
  13973. /**
  13974. * A function that returns an itemSpec for slideout
  13975. *
  13976. * @public
  13977. * @param {object} context - glass context
  13978. * @returns {object} a Slideout item spec
  13979. */
  13980. getCustomSpec: function getCustomSpec(context) {
  13981. var oItemSpec;
  13982. if (_.isNumber(context.target.specItemIndex) && _.isArray(context.target.plugin.itemSpec.items)) {
  13983. oItemSpec = context.target.plugin.itemSpec.items[context.target.specItemIndex];
  13984. } else {
  13985. oItemSpec = context.target.plugin.itemSpec;
  13986. }
  13987. var oTargetOptionSpec = this._getDefaultItemSpec();
  13988. if (oItemSpec.options) {
  13989. if (oItemSpec.options.id) {
  13990. oTargetOptionSpec.content.id = 'folder.' + oItemSpec.options.id;
  13991. oTargetOptionSpec.content.folder = oItemSpec.options.id;
  13992. } else if (oItemSpec.options.path) {
  13993. oTargetOptionSpec.content.id = 'folder.' + oItemSpec.options.path;
  13994. oTargetOptionSpec.content.folder = oItemSpec.options.path;
  13995. }
  13996. if (oItemSpec.options.showNewItem !== undefined || (oItemSpec.options.content && oItemSpec.options.content.showNewItem) !== undefined) {
  13997. oTargetOptionSpec.content.showNewItem = oItemSpec.options.showNewItem || oItemSpec.options.content && oItemSpec.options.content.showNewItem; //don't show the addFolder button if we have a new button as it will contain its own.
  13998. if (oTargetOptionSpec.content.showNewItem === true) {
  13999. oTargetOptionSpec.content.showAddFolder = false;
  14000. }
  14001. }
  14002. oTargetOptionSpec.id = oItemSpec.id + '.' + oTargetOptionSpec.content.module + '.global';
  14003. if (oItemSpec.label) {
  14004. oTargetOptionSpec.label = oItemSpec.label;
  14005. }
  14006. if (_.isBoolean(oItemSpec.options.skipAncestors)) {
  14007. oTargetOptionSpec.content.skipAncestors = oItemSpec.options.skipAncestors;
  14008. }
  14009. }
  14010. oItemSpec.options = oTargetOptionSpec;
  14011. return oItemSpec;
  14012. },
  14013. /**
  14014. * Called when the context menu item is selected.
  14015. *
  14016. * @public
  14017. * @param {context} which contains the following:
  14018. * <ul>
  14019. * <li>glassContext</li>
  14020. * <li>target: object containing info on the target including plugin and itemId</li>
  14021. * </ul>
  14022. */
  14023. onSelectItem: function onSelectItem(context) {
  14024. context.pushState = true;
  14025. this.onPress(context);
  14026. }
  14027. });
  14028. return FolderOpener;
  14029. });
  14030. //# sourceMappingURL=FolderOpener.js.map
  14031. ;
  14032. /*
  14033. *+------------------------------------------------------------------------+
  14034. *| Licensed Materials - Property of IBM
  14035. *| IBM Cognos Products: Content Explorer
  14036. *| (C) Copyright IBM Corp. 2016, 2017
  14037. *|
  14038. *| US Government Users Restricted Rights - Use, duplication or disclosure
  14039. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  14040. *+------------------------------------------------------------------------+
  14041. */
  14042. define('caglass/api/ReportOpener',['baglass/api/BaseOpener'], function (BaseOpener) {
  14043. 'use strict'; //NOSONAR: Meant to be strict
  14044. var ReportOpener = BaseOpener.extend({
  14045. getRequestParameters: function getRequestParameters() {
  14046. return 'ancestors,owner,modificationTime,permissions,defaultName,runInAdvancedViewer';
  14047. }
  14048. });
  14049. return ReportOpener;
  14050. });
  14051. //# sourceMappingURL=ReportOpener.js.map
  14052. ;
  14053. /**
  14054. * Licensed Materials - Property of IBM
  14055. * IBM Cognos Products: BI Glass
  14056. * (C) Copyright IBM Corp. 2017
  14057. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  14058. */
  14059. define('caglass/api/all',['./DashboardOpener', './ExtensionViewAdaptor', './FolderOpener', './ReportOpener'], function () {});
  14060. //# sourceMappingURL=all.js.map
  14061. ;
  14062. /**
  14063. * Licensed Materials - Property of IBM
  14064. * IBM Business Analytics (C) Copyright IBM Corp. 2019
  14065. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  14066. */
  14067. define('baglass/common/ui/OfflineOnlineDialog',['ca-ui-toolkit-core', 'react', 'react-dom', 'prop-types', '../../nls/StringResources'], function (uiToolkit, React, ReactDOM, PropTypes, StringResources) {
  14068. var Dialog = uiToolkit.Dialog,
  14069. ProgressIndicator = uiToolkit.ProgressIndicator;
  14070. function OfflineOnlineDialog(props) {
  14071. var refreshButtonCallback = function refreshButtonCallback() {
  14072. window.location.reload();
  14073. };
  14074. var dialogTitle = StringResources.get('offlineErrorTitle');
  14075. var dialogContent = StringResources.get('offlineErrorMessage');
  14076. var refreshButton = StringResources.get('refreshButton');
  14077. var dialogProps = {
  14078. size: 'small',
  14079. minWidth: '400px',
  14080. maxWidth: '500px',
  14081. clickaway: false,
  14082. startingFocusIndex: -1
  14083. };
  14084. var progressIndicatorProps = {
  14085. tabIndex: -1,
  14086. variant: 'bar',
  14087. size: 'normal',
  14088. determinate: false
  14089. };
  14090. if (!props.online) {
  14091. return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Dialog, dialogProps, /*#__PURE__*/React.createElement(Dialog.Header, null, dialogTitle), /*#__PURE__*/React.createElement(Dialog.Body, null, dialogContent), /*#__PURE__*/React.createElement(ProgressIndicator, progressIndicatorProps), /*#__PURE__*/React.createElement(Dialog.Footer, null, /*#__PURE__*/React.createElement(Dialog.Button, {
  14092. label: refreshButton,
  14093. onClick: refreshButtonCallback
  14094. }))));
  14095. }
  14096. return null;
  14097. }
  14098. OfflineOnlineDialog.propTypes = {
  14099. online: PropTypes.bool
  14100. };
  14101. return OfflineOnlineDialog;
  14102. });
  14103. //# sourceMappingURL=OfflineOnlineDialog.js.map
  14104. ;
  14105. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14106. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  14107. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  14108. /**
  14109. * Licensed Materials - Property of IBM
  14110. * IBM Business Analytics (C) Copyright IBM Corp. 2019
  14111. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  14112. */
  14113. define('baglass/services/OfflineOnlineService',['react', 'react-dom', '../common/ui/OfflineOnlineDialog'], function (React, ReactDOM, OfflineOnlineDialog) {
  14114. var OfflineOnlineService = /*#__PURE__*/function () {
  14115. function OfflineOnlineService() {
  14116. var _this = this;
  14117. _classCallCheck(this, OfflineOnlineService);
  14118. /**TODO :
  14119. * when state management is introduced abstract offline/online
  14120. * event listeners from OfflineModule into this service
  14121. */
  14122. window.addEventListener('offline', function () {
  14123. _this.renderDialog(false);
  14124. });
  14125. window.addEventListener('online', function () {
  14126. _this.renderDialog(true);
  14127. });
  14128. var offlineOnlineContainer = document.createElement('div');
  14129. offlineOnlineContainer.id = 'offlineOnlineDialogContainer';
  14130. document.getElementById('main').appendChild(offlineOnlineContainer);
  14131. }
  14132. _createClass(OfflineOnlineService, [{
  14133. key: "renderDialog",
  14134. value: function renderDialog(onlineStatus) {
  14135. var container = document.getElementById('offlineOnlineDialogContainer');
  14136. ReactDOM.render( /*#__PURE__*/React.createElement(OfflineOnlineDialog, {
  14137. online: onlineStatus
  14138. }), container);
  14139. }
  14140. }]);
  14141. return OfflineOnlineService;
  14142. }();
  14143. return OfflineOnlineService;
  14144. });
  14145. //# sourceMappingURL=OfflineOnlineService.js.map
  14146. ;
  14147. /**
  14148. * Licensed Materials - Property of IBM
  14149. * IBM Cognos Products: BI Glass
  14150. * (C) Copyright IBM Corp. 2017,2019
  14151. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  14152. */
  14153. define('caglass/app/services/CAUserProfileService',['baglass/app/services/UserProfileService', 'underscore', 'baglass/core-client/js/core-client/errors/BaseError', 'baglass/core-client/js/core-client/utils/BidiUtil', 'jquery', 'baglass/utils/Utils'], function (UserProfileService, _, BaseError, BidiUtil, $, GlassUtils) {
  14154. /**
  14155. * This Class exposes a JavaScript API for the userProfile REST service
  14156. */
  14157. var CAUserProfileService = UserProfileService.extend({
  14158. /**
  14159. * Initialize the CAUserProfileService with seeded values and updates glassContext
  14160. */
  14161. initialize: function initialize(context) {
  14162. if (_.isObject(context)) {
  14163. if (context.authInfo && context.capabilities && context.userAccount) {
  14164. _.extend(this, _.pick(context, 'userAccount', 'tenants', 'credentials', 'userProfileSettings', 'capabilities', 'authInfo', 'preferences'));
  14165. if (this.preferences) {
  14166. var biDirectionalFeaturesEnabled = this.preferences.biDirectionalFeaturesEnabled || false;
  14167. var textDirection = this.preferences.baseTextDirection || '';
  14168. this._setBidiPrefs(textDirection, biDirectionalFeaturesEnabled.toString(), this.preferences.contentLocale || 'en');
  14169. }
  14170. return this.glassContext.getCoreSvc('.Config').getLegacyLaunchable().then(function (legacyLaunchable) {
  14171. return this._updateContextWithAccountInfo(this.userAccount, this.capabilities, legacyLaunchable, this.authInfo);
  14172. }.bind(this)).then(function (account) {
  14173. if (this.userAccount && (this.userAccount.isSystemAdmin || this.userAccount.isTenantAdmin)) {
  14174. this._setUserTenantName(account, this.tenants);
  14175. this._bindToAdminEvent();
  14176. }
  14177. return account;
  14178. }.bind(this));
  14179. } else {
  14180. return Promise.reject(new Error('Context must contain authInfo, capabilities and userAccount properties'));
  14181. }
  14182. } else {
  14183. return Promise.reject(new Error('Invalid context'));
  14184. }
  14185. },
  14186. logout: function logout() {
  14187. this._clearCache();
  14188. this.glassContext.profile = {};
  14189. return this.glassContext.getCoreSvc('.Ajax').ajax({
  14190. url: CAUserProfileService.LOGIN_URL,
  14191. type: 'DELETE'
  14192. });
  14193. },
  14194. updatePreferences: function updatePreferences(isFirstLogin) {
  14195. return this._catchLogReturn(this._getPreferences(isFirstLogin
  14196. /* useCache - yes on first login; no otherwise */
  14197. ), {}).then(function (preferences) {
  14198. this._setPreferences(preferences);
  14199. }.bind(this));
  14200. },
  14201. _clearCache: function _clearCache() {
  14202. //assuming that the user profile settings endpoint always returns the settings for the primary user. Confirm this with serge and test it.
  14203. CAUserProfileService.inherited('updateContext', this, [{
  14204. userProfileSettings: null,
  14205. capabilities: null,
  14206. preferences: null,
  14207. tenants: null,
  14208. userAccount: null,
  14209. credentials: null,
  14210. authInfo: null
  14211. }]);
  14212. this.glassContext.getCoreSvc('.Config').clearConfigs();
  14213. },
  14214. disableLoggingSession: function disableLoggingSession() {
  14215. return this.glassContext.getCoreSvc('.Ajax').ajax({
  14216. type: 'DELETE',
  14217. url: CAUserProfileService.SESSIONLOGGING_URL
  14218. });
  14219. },
  14220. getUserAccount: function getUserAccount(useCache) {
  14221. if (!_.isEmpty(this.userAccount) && useCache === true) {
  14222. return Promise.resolve(this.userAccount);
  14223. } else {
  14224. return this.glassContext.getCoreSvc('.Ajax').ajax({
  14225. url: CAUserProfileService.USER_ACCOUNT_URL,
  14226. type: 'GET'
  14227. }).then(function (data) {
  14228. this.userAccount = data.data;
  14229. return this.userAccount;
  14230. }.bind(this))["catch"](function (error) {
  14231. var errObj = new BaseError('Internal error retrieving user account:' + error.message, error);
  14232. this.glassContext.getCoreSvc('.Logger').warn(errObj);
  14233. throw errObj;
  14234. }.bind(this));
  14235. }
  14236. },
  14237. getPortalPages: function getPortalPages() {
  14238. return this.glassContext.getCoreSvc('.Ajax').ajax({
  14239. url: CAUserProfileService.USER_PORTALPAGES_URL,
  14240. type: 'GET'
  14241. }).then(function (data) {
  14242. return data.data;
  14243. });
  14244. },
  14245. addPortalPage: function addPortalPage(id) {
  14246. return this.glassContext.getCoreSvc('.Ajax').ajax({
  14247. headers: {
  14248. Accept: 'application/json',
  14249. 'Content-Type': 'application/json'
  14250. },
  14251. url: CAUserProfileService.USER_PORTALPAGES_URL,
  14252. type: 'POST',
  14253. data: JSON.stringify({
  14254. target: id
  14255. })
  14256. });
  14257. },
  14258. deletePortalPage: function deletePortalPage(id) {
  14259. return this.glassContext.getCoreSvc('.Ajax').ajax({
  14260. url: CAUserProfileService.USER_PORTALPAGES_URL + '/' + encodeURIComponent(id),
  14261. type: 'DELETE'
  14262. });
  14263. },
  14264. resetHome: function resetHome() {
  14265. var homePagePref = {
  14266. 'homePage': ''
  14267. };
  14268. return this.savePreferences(homePagePref);
  14269. },
  14270. savePreferences: function savePreferences(preferences) {
  14271. return this._saveEmail({
  14272. 'email': preferences.email
  14273. }).then(this._savePreferences.bind(this, preferences)).then(this._setPreferences.bind(this, preferences));
  14274. },
  14275. _savePreferences: function _savePreferences(preferences) {
  14276. if (preferences && !$.isEmptyObject(preferences)) {
  14277. // Update the rest of the preferences through ups.
  14278. var jsonData = JSON.stringify(_.omit(preferences, 'email'));
  14279. return this.glassContext.getCoreSvc('.Ajax').ajax({
  14280. url: CAUserProfileService.PREFERENCES_URL,
  14281. type: 'PUT',
  14282. 'headers': {
  14283. 'Accept': 'application/json',
  14284. 'Content-Type': 'application/json'
  14285. },
  14286. data: jsonData
  14287. });
  14288. }
  14289. },
  14290. _saveEmail: function _saveEmail(preferences) {
  14291. return Promise["try"](function () {
  14292. if (preferences.email !== undefined && this.glassContext.profile.account._meta && this.glassContext.profile.account._meta.schemaInfo.email.modifiable) {
  14293. return this.glassContext.getCoreSvc('.Ajax').ajax({
  14294. url: 'v1/users_ex/' + this.glassContext.getCoreSvc('.UserProfile').preferences.id,
  14295. type: 'PUT',
  14296. headers: {
  14297. 'Accept': 'application/json',
  14298. 'Content-Type': 'application/json'
  14299. },
  14300. data: JSON.stringify({
  14301. 'email': preferences.email
  14302. })
  14303. }).then(function (response) {
  14304. if (response.data.errorCode === 1) {
  14305. // Request is failed.
  14306. this.glassContext.getCoreSvc('.Logger').error('Update email failed');
  14307. } else {
  14308. this.glassContext.profile.account.email = preferences.email;
  14309. this.userAccount.email = preferences.email;
  14310. }
  14311. }.bind(this));
  14312. }
  14313. }.bind(this));
  14314. },
  14315. /*
  14316. * @param {Object} dataSourceCredential - mandatory : set of mandatory passed in arguments
  14317. * {
  14318. * @param {boolean} dataSourceCredential.perm : true when permanent credential, false when credential lasts only for user session
  14319. * @param {String} dataSourceCredential.dataSourceName: "GoSales",
  14320. * @param {String} dataSourceCredential.dataSourceConnectionName: "GoSales_connection",
  14321. * @param {Object} dataSourceCredential.credentials:
  14322. * {
  14323. * "value": [{
  14324. * "userName": "gosales",
  14325. * "password": "Cognos_1"
  14326. * }]
  14327. * }
  14328. * @return ajax response
  14329. */
  14330. saveDataSourceCredential: function saveDataSourceCredential(dataSourceCredential) {
  14331. return this.glassContext.getCoreSvc('.Ajax').ajax({
  14332. url: CAUserProfileService.DATASOURCE_CREDENTIAL_PATH,
  14333. type: 'POST',
  14334. 'headers': {
  14335. 'Accept': 'application/json',
  14336. 'Content-Type': 'application/json'
  14337. },
  14338. data: JSON.stringify(dataSourceCredential)
  14339. }).then(function (response) {
  14340. return response.data;
  14341. });
  14342. },
  14343. _saveCredentials: function _saveCredentials() {
  14344. return this.glassContext.getCoreSvc('.Ajax').ajax({
  14345. url: CAUserProfileService.CREDENTIALS_URL,
  14346. type: 'POST',
  14347. 'headers': {
  14348. 'Accept': 'application/json',
  14349. 'Content-Type': 'application/json'
  14350. },
  14351. data: '{}',
  14352. skipErrorHandling: true
  14353. }).then(function (response) {
  14354. return response && response.data;
  14355. })["catch"](function (err) {
  14356. throw err.jqXHR;
  14357. });
  14358. },
  14359. resetCredentials: function resetCredentials() {
  14360. return this._saveCredentials();
  14361. },
  14362. getAccountInfo: function getAccountInfo(authInfo) {
  14363. return Promise["try"](this._getAccountInfo.bind(this, authInfo));
  14364. },
  14365. _getAccountInfo: function _getAccountInfo(authInfo) {
  14366. var configSvc = this.glassContext.getCoreSvc('.Config');
  14367. var reqAccount = this.getUserAccount();
  14368. var reqCredentials = this._getCredentials().catchReturn();
  14369. var reqDefaultHome = this._catchLogReturn(configSvc.getDefaultHome(), {});
  14370. var reqUserProfileSettings = this._catchLogReturn(this._getUserProfileSettings(), {});
  14371. var reqCapabilites = this._catchLogReturn(this.getCapabilities(), {});
  14372. var reqLegacyLaunchable = this._catchLogReturn(configSvc.getLegacyLaunchable(), {});
  14373. return Promise.all([reqAccount, reqCredentials, reqUserProfileSettings, reqCapabilites, reqLegacyLaunchable, reqDefaultHome]).spread(function (accountInfo, credentials, userProfileSettings, capabilities, legacyLaunchable) {
  14374. return this._updateContextWithAccountInfo(accountInfo, capabilities, legacyLaunchable, authInfo);
  14375. }.bind(this)).then(function (account) {
  14376. if (this.userAccount && (this.userAccount.isSystemAdmin || this.userAccount.isTenantAdmin)) {
  14377. return this.fetchTenants().then(function (tenants) {
  14378. this.tenants = tenants;
  14379. this._setUserTenantName(account, tenants);
  14380. this._bindToAdminEvent();
  14381. return account;
  14382. }.bind(this))["catch"](function (err) {
  14383. this.glassContext.getCoreSvc('.Logger').warn(err);
  14384. this.tenants = undefined;
  14385. return account;
  14386. }.bind(this));
  14387. } else {
  14388. return account;
  14389. }
  14390. }.bind(this));
  14391. },
  14392. updateIdentity: function updateIdentity(useCache) {
  14393. this.glassContext.getCoreSvc('.Logger').warn('The `updateIdentity` method of CAUserProfileService has been deprecated, to update the isSystemAdmin or isTenantAdmin data please use `getUserAccount` method instead.');
  14394. return this.getUserAccount(useCache);
  14395. },
  14396. /**
  14397. * Sets the tenantName in the account object when a tenantID is set
  14398. * @param {Object} account - account object
  14399. * @param {Array} tenants - array of tenants
  14400. */
  14401. _setUserTenantName: function _setUserTenantName(account, tenants) {
  14402. if (account.tenantID) {
  14403. var tenant = _.findWhere(tenants, {
  14404. tenantID: account.tenantID
  14405. });
  14406. if (tenant && tenant.defaultName) {
  14407. account.tenantName = tenant.defaultName;
  14408. } else {
  14409. this.glassContext.getCoreSvc('.Logger').error('tenant name not set for ' + account.tenantID + ', the id is used to set the tenant name');
  14410. account.tenantName = account.tenantID;
  14411. }
  14412. } else {
  14413. this.glassContext.getCoreSvc('.Logger').debug('user is not part of a tenant: no tenant name is set in the account object');
  14414. }
  14415. },
  14416. _getPreferences: function _getPreferences(useCache) {
  14417. if (!_.isEmpty(this.preferences) && useCache === true) {
  14418. return Promise.resolve(this.preferences);
  14419. } else {
  14420. return this.glassContext.getCoreSvc('.Ajax').ajax({
  14421. url: CAUserProfileService.PREFERENCES_URL,
  14422. type: 'GET'
  14423. }).then(function (data) {
  14424. this.preferences = data.data;
  14425. return this.preferences;
  14426. }.bind(this));
  14427. }
  14428. },
  14429. _getCredentials: function _getCredentials(useCache) {
  14430. if (!_.isEmpty(this.credentials) && useCache === true) {
  14431. return Promise.resolve(this.credentials);
  14432. } else {
  14433. return this.glassContext.getCoreSvc('.Ajax').ajax({
  14434. url: CAUserProfileService.CREDENTIALS_URL,
  14435. type: 'GET'
  14436. }).then(function (data) {
  14437. this.credentials = data.data;
  14438. return this.credentials;
  14439. }.bind(this));
  14440. }
  14441. },
  14442. _getUserProfileSettings: function _getUserProfileSettings() {
  14443. if (!this.userProfileSettings) {
  14444. return this.glassContext.getCoreSvc('.Ajax').ajax({
  14445. url: CAUserProfileService.USER_PROFILE_SETTINGS,
  14446. type: 'GET',
  14447. dataType: 'json'
  14448. }).then(function (settings) {
  14449. this.userProfileSettings = settings.data;
  14450. return this.userProfileSettings;
  14451. }.bind(this))["catch"](function (err) {
  14452. this.glassContext.getCoreSvc('.Logger').error('Internal error retrieving user profile settings:' + err.message);
  14453. this.userProfileSettings = CAUserProfileService.defaultUserSettings;
  14454. return this.userProfileSettings;
  14455. }.bind(this));
  14456. } else {
  14457. return Promise.resolve(this.userProfileSettings);
  14458. }
  14459. },
  14460. getCapabilities: function getCapabilities() {
  14461. if (!this.capabilities) {
  14462. return this.glassContext.getCoreSvc('.Ajax').ajax({
  14463. url: CAUserProfileService.CAPABILITIES_PATH,
  14464. type: 'GET'
  14465. }).then(function (results) {
  14466. this.capabilities = results.data.userCapabilities;
  14467. return this.capabilities;
  14468. }.bind(this))["catch"](function (error) {
  14469. throw new BaseError('Internal error retrieving capabilities:' + error.textStatus, error);
  14470. });
  14471. } else {
  14472. return Promise.resolve(this.capabilities);
  14473. }
  14474. },
  14475. _updateContextWithAccountInfo: function _updateContextWithAccountInfo(accountInfo, capabilities, legacyLaunchable, authInfo) {
  14476. this.hasCredentials = this.credentials ? true : false;
  14477. this.glassContext.primaryUserChanged = false;
  14478. this.glassContext.profile.account = accountInfo;
  14479. var extraAccountInfo = {
  14480. 'displayName': accountInfo.defaultName,
  14481. 'isAnonymous': authInfo ? authInfo.isAnonymous : undefined,
  14482. 'showLogIn': authInfo ? authInfo.canCallLogon : undefined
  14483. };
  14484. _.extend(this.glassContext.profile.account, extraAccountInfo);
  14485. this.glassContext.legacyLaunchable = legacyLaunchable === 1;
  14486. if (authInfo) {
  14487. this.glassContext.cafContextId = authInfo.cafContextId;
  14488. }
  14489. return accountInfo;
  14490. },
  14491. _setPreferences: function _setPreferences(preferences) {
  14492. if (!this.preferences) {
  14493. this.preferences = {};
  14494. }
  14495. $.extend(true, this.preferences, preferences);
  14496. var biDirectionalFeaturesEnabled = preferences && preferences.biDirectionalFeaturesEnabled || false;
  14497. this._setBidiPrefs(preferences && preferences.baseTextDirection || '', biDirectionalFeaturesEnabled.toString(), preferences && preferences.contentLocale || 'en');
  14498. },
  14499. _setBidiPrefs: function _setBidiPrefs(textDir, bidiSupport, contentLocale) {
  14500. BidiUtil.setUserPreferredTextDir(textDir, bidiSupport);
  14501. BidiUtil.setUserPreferredContentLocale(contentLocale);
  14502. },
  14503. fetchTenants: function fetchTenants(useCache) {
  14504. var _this = this;
  14505. if (!_.isEmpty(this.tenants) && useCache === true) {
  14506. return Promise.resolve(this.tenants);
  14507. }
  14508. return this.glassContext.getCoreSvc('.Ajax').ajax({
  14509. url: CAUserProfileService.TENANTS_PATH,
  14510. type: 'GET'
  14511. }).then(function (response) {
  14512. _this.tenants = response.data.data;
  14513. return _this.tenants;
  14514. })["catch"](function (err) {
  14515. throw new BaseError('Internal error retrieving tenants:' + err.message, err);
  14516. });
  14517. },
  14518. updateTenants: function updateTenants() {
  14519. return this.fetchTenants().then(function (tenants) {
  14520. this.tenants = tenants;
  14521. return tenants;
  14522. }.bind(this))["catch"](function (errObj) {
  14523. this.glassContext.getCoreSvc('.Logger').warn(errObj);
  14524. }.bind(this));
  14525. },
  14526. isSysAdmin: function isSysAdmin() {
  14527. return this.getUserAccount(true).then(function (userAccount) {
  14528. return userAccount.isSystemAdmin;
  14529. }.bind(this));
  14530. },
  14531. isTenantAdmin: function isTenantAdmin() {
  14532. return this.getUserAccount(true).then(function (userAccount) {
  14533. return userAccount.isTenantAdmin;
  14534. }.bind(this));
  14535. },
  14536. getHomePage: function getHomePage() {
  14537. var home = this._getMutableHomePage();
  14538. return this._buildHomePageObject(home);
  14539. },
  14540. getFactoryHomePage: function getFactoryHomePage() {
  14541. return this._buildHomePageObject(CAUserProfileService.defaultUserSettings.ui_homePage);
  14542. },
  14543. _getMutableHomePage: function _getMutableHomePage() {
  14544. if (GlassUtils.isFactoryMode()) {
  14545. return CAUserProfileService.defaultUserSettings.ui_homePage;
  14546. }
  14547. if (this.preferences && !_.isEmpty(this.preferences.homePage)) {
  14548. try {
  14549. return JSON.parse(this.preferences.homePage);
  14550. } catch (err) {
  14551. this.glassContext.getCoreSvc('.Logger').error('error parsing home page', err);
  14552. return CAUserProfileService.defaultUserSettings.ui_homePage;
  14553. }
  14554. }
  14555. if (this.userProfileSettings && this.userProfileSettings.ui_homePage) {
  14556. var home = this.userProfileSettings.ui_homePage;
  14557. if (home && home.content && home.content.action === 'run') {
  14558. delete home.content.action;
  14559. }
  14560. return home;
  14561. }
  14562. return CAUserProfileService.defaultUserSettings.ui_homePage;
  14563. },
  14564. _buildHomePageObject: function _buildHomePageObject(home) {
  14565. var context = {
  14566. content: {
  14567. isHomePage: true
  14568. }
  14569. };
  14570. return $.extend(true, context, home);
  14571. },
  14572. getProductLocale: function getProductLocale() {
  14573. return this.preferences && this.preferences.productLocale;
  14574. },
  14575. getAccountID: function getAccountID() {
  14576. return this.userAccount && this.userAccount.id;
  14577. },
  14578. // TODO: This is awful.
  14579. // Admin needs to either use the .Events service to send this message, or
  14580. // better yet - "glassContext.getCoreSvc('.UserProfile').updateTenants()"
  14581. _bindToAdminEvent: function _bindToAdminEvent() {
  14582. $(document).on('com.ibm.cognos.bi.admin.updatetenantlist', this.updateTenants.bind(this));
  14583. },
  14584. _catchLogReturn: function _catchLogReturn(promise, returned) {
  14585. return Promise.resolve(promise)["catch"](function (err) {
  14586. this.glassContext.getCoreSvc('.Logger').error(err.message || err);
  14587. return returned;
  14588. }.bind(this));
  14589. }
  14590. });
  14591. CAUserProfileService.BASE_URL = 'v1';
  14592. CAUserProfileService.LOGIN_URL = CAUserProfileService.BASE_URL + '/login';
  14593. CAUserProfileService.PREFERENCES_URL = CAUserProfileService.BASE_URL + '/users/~/preferences';
  14594. CAUserProfileService.USER_ACCOUNT_URL = CAUserProfileService.BASE_URL + '/users/~/account';
  14595. CAUserProfileService.USER_PORTALPAGES_URL = CAUserProfileService.BASE_URL + '/users/~/my_portalPages';
  14596. CAUserProfileService.CREDENTIALS_URL = CAUserProfileService.BASE_URL + '/users/~/credentials';
  14597. CAUserProfileService.CAPABILITIES_PATH = CAUserProfileService.BASE_URL + '/users/~/capabilities';
  14598. CAUserProfileService.TENANTS_PATH = CAUserProfileService.BASE_URL + '/tenants';
  14599. CAUserProfileService.DATASOURCE_CREDENTIAL_PATH = CAUserProfileService.BASE_URL + '/users/~/credentials/datasources';
  14600. CAUserProfileService.USER_PROFILE_SETTINGS = CAUserProfileService.BASE_URL + '/users/~/user_profile_settings';
  14601. CAUserProfileService.SESSIONLOGGING_URL = CAUserProfileService.BASE_URL + '/glug/sessions/current';
  14602. CAUserProfileService.defaultUserSettings = {
  14603. ui_excludedFeatures: {},
  14604. ui_homePage: {
  14605. perspective: 'home'
  14606. },
  14607. ui_theme: 'IBM'
  14608. };
  14609. return CAUserProfileService;
  14610. });
  14611. //# sourceMappingURL=CAUserProfileService.js.map
  14612. ;
  14613. /**
  14614. * Licensed Materials - Property of IBM
  14615. * IBM Cognos Products: BI Glass
  14616. * (C) Copyright IBM Corp. 2017, 2018
  14617. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule
  14618. * Contract with IBM Corp.
  14619. */
  14620. define('caglass/app/services/LogoutService',['baglass/core-client/js/core-client/utils/Utils', 'underscore'], function (Utils, _) {
  14621. var LogoutService = function LogoutService() {
  14622. this._preLogoutActions = [];
  14623. this._postLogoutActions = [];
  14624. };
  14625. /**
  14626. *
  14627. * logs out and shows the custom logout page or the CA login page
  14628. * @public
  14629. * @param {Object} context
  14630. *
  14631. */
  14632. LogoutService.prototype.logOut = function (context) {
  14633. return this._preLogout(context.glassContext)["finally"](function () {
  14634. var redirectToLogin = function () {
  14635. var ssoLogout = context.glassContext.getSSOLogoutURL();
  14636. if (ssoLogout) {
  14637. this._redirectBrowser(ssoLogout);
  14638. } else {
  14639. this._redirectBrowser(window.location.pathname);
  14640. }
  14641. }.bind(this);
  14642. this.registerPostLogout(redirectToLogin);
  14643. return context.glassContext.services.userProfile.logout();
  14644. }.bind(this)).then(this._postLogout.bind(this, context.glassContext));
  14645. };
  14646. /**
  14647. *
  14648. * Registers a pre logout action
  14649. * the actions are invoked in the order of registration
  14650. * a failure does not stop the logout process
  14651. * @public
  14652. * @param {Function} action - method invoked before logout
  14653. */
  14654. LogoutService.prototype.registerPreLogout = function (action) {
  14655. if (_.isFunction(action)) {
  14656. this._preLogoutActions.push(action);
  14657. } else {
  14658. throw new Error(action + ' is not a function');
  14659. }
  14660. };
  14661. /**
  14662. *
  14663. * Registers a post logout action
  14664. * the actions are invoked in the order of registration
  14665. * a failure does not stop the logout process
  14666. * @public
  14667. * @param {Function} action - method invoked before logout
  14668. */
  14669. LogoutService.prototype.registerPostLogout = function (action) {
  14670. if (_.isFunction(action)) {
  14671. this._postLogoutActions.push(action);
  14672. } else {
  14673. throw new Error(action + ' is not a function');
  14674. }
  14675. };
  14676. /**
  14677. * Redirects to the passed url
  14678. * @private
  14679. * @param {String} url - url to redirect once logout is complete
  14680. */
  14681. LogoutService.prototype._redirectBrowser = function (url) {
  14682. Utils.getCurrentWindow().location = url;
  14683. };
  14684. /**
  14685. * invokes all the preLogout actions in order of registration
  14686. * @private
  14687. * @return {Object} promise resolved when all the actions are executed, resolved or rejected
  14688. */
  14689. LogoutService.prototype._preLogout = function (glassContext) {
  14690. return this._invokeActions(glassContext, this._preLogoutActions, 'preLogout');
  14691. };
  14692. /**
  14693. * invokes all the postLogout actions in order of registration
  14694. * @private
  14695. * @return {Object} promise resolved when all the actions are executed, resolved or rejected
  14696. */
  14697. LogoutService.prototype._postLogout = function (glassContext) {
  14698. return this._invokeActions(glassContext, this._postLogoutActions, 'postLogout');
  14699. };
  14700. /**
  14701. * invokes the passed array of actions
  14702. * @private
  14703. * @param {Object} glassContext - glassContext
  14704. * @param {Function[]} actions - actions to invoke
  14705. * @param {String} type - type of actions, preLogout or postLogout
  14706. * @returns {Promise} - promised resolved once all the actions are invoked whether they fail or not
  14707. */
  14708. LogoutService.prototype._invokeActions = function (glassContext, actions, type) {
  14709. var reducer = function reducer(previous, current) {
  14710. return previous.then(function () {
  14711. return current(glassContext);
  14712. })["catch"](function (error) {
  14713. glassContext.getCoreSvc('.Logger').error('failure while executing an action of type ' + type, error);
  14714. });
  14715. };
  14716. return actions.reduce(reducer, Promise.resolve());
  14717. };
  14718. return LogoutService;
  14719. });
  14720. //# sourceMappingURL=LogoutService.js.map
  14721. ;
  14722. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  14723. function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  14724. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  14725. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
  14726. /**
  14727. * Licensed Materials - Property of IBM
  14728. * IBM Cognos Products: BI
  14729. * (C) Copyright IBM Corp. 2018
  14730. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  14731. */
  14732. define('caglass/utils/CAUtils',['jquery'], function ($) {
  14733. var CAUtils = function CAUtils() {};
  14734. /**
  14735. * Parses the supplied href and returns a string scrubbed of any `CAMNamespace=...` key, value that appears before an anchor `#`
  14736. * @public
  14737. * @param {String} - href string
  14738. * @returns {String} - href string sans CAMNamespace=... key value
  14739. */
  14740. CAUtils.prototype.removeCAMNamespaceHref = function (href) {
  14741. var regExp = /([?&])(CAMNamespace=\w*[^#&]*&?)/g;
  14742. var queryString = href.substring(0, href.indexOf('#'));
  14743. if (queryString.length > 0) {
  14744. return queryString.replace(regExp, '$1').concat(href.substring(href.indexOf('#')));
  14745. }
  14746. return href.replace(regExp, '$1');
  14747. };
  14748. /**
  14749. * Parses redirectUrl and correctly appends updatedco=true
  14750. * @public
  14751. * @param {String} - href string
  14752. * @returns {String} - href string including updatedco=true key value
  14753. */
  14754. CAUtils.prototype.addUpdateDcoToQuerystring = function (href, updateDco) {
  14755. var questionMarkParamsRegExp = /([?])(.*)/;
  14756. var updatedcoRegExp = /updatedco=\w+/;
  14757. var queryString = href.substring(0, href.indexOf('#'));
  14758. if (queryString.length > 0) {
  14759. return queryString.replace(questionMarkParamsRegExp, "?updatedco=".concat(updateDco, "&$2")).concat(href.substring(href.indexOf('#')));
  14760. } else if (questionMarkParamsRegExp.test(href)) {
  14761. return href.replace(questionMarkParamsRegExp, "?updatedco=".concat(updateDco, "&$2"));
  14762. }
  14763. return updatedcoRegExp.test(href) ? href : href.concat("?updatedco=".concat(updateDco));
  14764. };
  14765. /**
  14766. * Removes the loading spinner initially shown on start up of the application
  14767. * @public
  14768. */
  14769. CAUtils.prototype.removeLoadingSpinner = function (glassContext) {
  14770. $('#ba-splash-styles').remove();
  14771. $('.ba-splash').remove();
  14772. glassContext.getCoreSvc('.Events').off('appView:loaded', undefined, 'removeLoadingSpinnerFunction');
  14773. };
  14774. CAUtils.prototype.preventWritesToObject = function (obj) {
  14775. var propNames = Object.getOwnPropertyNames(obj);
  14776. var _iterator = _createForOfIteratorHelper(propNames),
  14777. _step;
  14778. try {
  14779. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  14780. var name = _step.value;
  14781. var value = obj[name];
  14782. obj[name] = value && _typeof(value) == 'object' ? this.preventWritesToObject(value) : value;
  14783. }
  14784. } catch (err) {
  14785. _iterator.e(err);
  14786. } finally {
  14787. _iterator.f();
  14788. }
  14789. return Object.freeze(obj);
  14790. };
  14791. return new CAUtils();
  14792. });
  14793. //# sourceMappingURL=CAUtils.js.map
  14794. ;
  14795. define('caglass/ba-instrumentation/dist/bundle',[],function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){var i,r;i=[n,e,n(1),n(6)],void 0===(r=function(t,e,n,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InstrumentationService=n.default,e.BluemixAnalytics=i}.apply(e,i))||(t.exports=r)},function(t,e,n){var i,r,o=this&&this.__assign||function(){return(o=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},a=this&&this.__rest||function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&(n[i[r]]=t[i[r]])}return n};i=[n,e,n(2)],void 0===(r=function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(){this.analyticsKey="_analytics",this.bluemixKey="bluemixAnalytics",this.instrumentationKey="instrumentation",this.bluemixLoaded=!1,this.category="Offering Interface",this.digitalDataKey="digitalData",this.segmentApiKey="analytics"}return t.prototype.initialize=function(t,e){var i=this;if(this.glassContext=t,this.configBuilder=new n.default(e),this.eventQueue=[],this._logger=this.glassContext.getCoreSvc(".Logger"),!0===e.enabled&&""!==e.key)return this.configureAnalytics(),this.requireBluemixScript(this.configBuilder.config.scriptURL).then(function(){var t=i.configBuilder.buildTraits(),e=i.configBuilder.buildContext();i.bluemixLoaded=!0,window[i.bluemixKey].identify(t,e),i.configBuilder.config.autoSPAEnabled||i.registerPageEventListener()}).catch(function(t){i.configBuilder.disableService();i.logger.error("InstrumentationService is not enabled, Bluemix script failed to load",t)});var r="InstrumentationService was not enabled. Config: "+JSON.stringify(this.configBuilder.config);return Promise.resolve(r)},Object.defineProperty(t.prototype,"config",{get:function(){return this.configBuilder.config},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"logger",{get:function(){return this._logger||console},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){return!0===this.bluemixLoaded&&void 0!==window[this.analyticsKey]&&this.configBuilder.config.enabled},enumerable:!0,configurable:!0}),t.prototype.resetAnalyticsCookie=function(){var t=this;return new Promise(function(e,n){if(t.enabled&&Object.prototype.hasOwnProperty.call(window,t.segmentApiKey))try{return window[t.segmentApiKey].reset(),e()}catch(e){t.logger.error(e),n()}})},t.prototype.track=function(t){try{if(this.enabled){var e=this.configBuilder.trackEventPayload(),n=this.configBuilder.buildContext();t.productTitle=this.configBuilder.config.productTitle;var i=t.type,r=a(t,["type"]),s=o({},r,e);this.callAction(window[this.bluemixKey].trackEvent,i,s,n)}}catch(t){this.logger.warn("Failed to call a trackEvent as instrumentation is disabled")}},t.prototype.page=function(t){try{if(this.enabled){var e=this.configBuilder.pageEventPayload(),n=this.configBuilder.buildContext();this.callAction(window[this.bluemixKey].pageEvent,this.category,t,e,n)}}catch(e){this.logger.warn("Failed to call a pageEvent for '"+t+"' as instrumentation is disabled")}},t.prototype.isBluemixAnalyticsLoaded=function(){return!!window[this.bluemixKey]},t.prototype.sendQueuedEvents=function(){for(;this.eventQueue.length>0;){var t=this.eventQueue.shift(),e=t.fn,n=t.args;e.apply(void 0,n)}},t.prototype.callAction=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];this.isBluemixAnalyticsLoaded()?t.apply(void 0,e):this.eventQueue.push({fn:t,args:e})},t.prototype.configureAnalytics=function(){this.category=this.configBuilder.config.category||this.category,window[this.analyticsKey]=this.configBuilder.buildAnalyticsKey(),window[this.digitalDataKey]=this.configBuilder.buildDigitalDataKey(this.category),window[this.instrumentationKey]=this.configBuilder.buildDDO()},t.prototype.requireBluemixScript=function(t){var e=this;return new Promise(function(n,i){var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src=t,r.addEventListener("load",function(){if(e.isBluemixAnalyticsLoaded())return e.sendQueuedEvents(),n();i("The bluemix script loaded but did not successfully initialize: window.bluemixAnalytics was not created.")}),r.addEventListener("error",function(){i("Error loading script '"+t+"'")}),r.addEventListener("abort",function(){i("Script loading aborted '"+t+"'")}),document.head.appendChild(r)})},t.prototype.registerPageEventListener=function(){var t=this;try{this.glassContext.getCoreSvc(".Events").on("appView:loaded",function(e){var n=e.context.content.perspective;t.page(n)})}catch(t){this.logger.warn("Failed to register page listener for instrumentation on core service .Events 'appView:loaded'")}},t}();e.default=i}.apply(e,i))||(t.exports=r)},function(t,e,n){var i,r,o=this&&this.__assign||function(){return(o=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};i=[n,e,n(3)],void 0===(r=function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,r,a=new n.default;!function(t){t.accountId="accountId",t.accountIdType="accountIdType",t.browserLanguage="browserLanguage",t.capabilities="capabilities",t.gbt10="GBT10",t.gbt15="GBT15",t.gbt17="GBT17",t.gbt20="GBT20",t.gbtlvlcd="GBTLVLCD",t.isIBMer="isIBMer",t.isTestUser="isTestUser",t.isTrial="isTrial",t.productVersion="productVersion",t.partIds="partNumber",t.productID="productId",t.productTitle="productTitle",t.roles="user.role",t.tenantId="tenantId",t.url="url"}(i=e.SegmentKeys||(e.SegmentKeys={})),function(t){t.IBM="ibm.com",t.YOPMAIL="yopmail.com",t.MAILINATOR="mailinator.com",t.COGNOS="cognos.com"}(r=e.EmailDomains||(e.EmailDomains={}));var s=function(){function t(t){this.serviceConfig={enabled:!(!t||!0!==t.enabled),key:t&&t.key&&"string"==typeof t.key?t.key:"",scriptURL:t&&t.scriptURL&&"string"==typeof t.scriptURL?t.scriptURL:"",productTitle:t&&t.productTitle&&"string"==typeof t.productTitle?t.productTitle:"",productID:t&&t.productID&&"string"==typeof t.productID?t.productID:"",versionNumber:t&&t.versionNumber&&"string"==typeof t.versionNumber?t.versionNumber:"",tenantId:t&&t.tenantId&&"string"==typeof t.tenantId?t.tenantId:"",accountId:t&&t.accountId&&"string"==typeof t.accountId?t.accountId:"",accountIdType:t&&t.accountIdType&&"string"==typeof t.accountIdType?t.accountIdType:"",whitelistedValues:t&&t.whitelistedValues&&Array.isArray(t.whitelistedValues)?t.whitelistedValues:[""],digitalContextEnable:!(!t||!t.digitalContextEnable||"boolean"!=typeof t.digitalContextEnable)&&t.digitalContextEnable,whitelist:!(!t||!0!==t.whitelist),autoSPAEnabled:!(!t||!0!==t.autoSPAEnabled),email:t&&t.email&&"string"==typeof t.email?t.email:"",creationTime:t&&t.creationTime&&"string"==typeof t.creationTime?t.creationTime:"",productLocale:t&&t.productLocale&&"string"==typeof t.productLocale?t.productLocale:"",gbt10:t&&t.gbt10&&"string"==typeof t.gbt10?t.gbt10:"",gbt15:t&&t.gbt15&&"string"==typeof t.gbt15?t.gbt15:"",gbt17:t&&t.gbt17&&"string"==typeof t.gbt17?t.gbt17:"",gbt20:t&&t.gbt20&&"string"==typeof t.gbt20?t.gbt20:"",gbtlvlcd:t&&t.gbtlvlcd&&"string"==typeof t.gbtlvlcd?t.gbtlvlcd:"",category:t&&t.category&&"string"==typeof t.category?t.category:null,environment:t&&t.environment&&"string"==typeof t.environment?t.environment:null,partIds:t&&t.partIds&&Array.isArray(t.partIds)?t.partIds.sort():[""],capabilities:t&&t.capabilities&&Array.isArray(t.capabilities)?t.capabilities.sort():[""],isTrial:!t||!0!==t.isTrial&&!1!==t.isTrial?void 0:t.isTrial,roles:t&&t.roles&&Array.isArray(t.roles)?t.roles.sort():[""]}}return Object.defineProperty(t.prototype,"config",{get:function(){return this.serviceConfig},enumerable:!0,configurable:!0}),t.prototype.disableService=function(){this.config.enabled=!1},t.prototype.buildTraits=function(){var t,e=null;return this.isEnabled&&((t={})[i.productVersion]=this.version,t[i.partIds]=this.partIdsString,t[i.tenantId]=this.tenantId,t[i.accountId]=this.accountId,t[i.isIBMer]=this.isIBMer(this.email),t[i.isTestUser]=this.isTestUser(this.email),t.url=a.getSanitizedURL(this.url,this.whitelistedValues,this.whitelist),t.createdAt=this.creationTime,e=t),e},t.prototype.buildContext=function(){var t=null;return this.isEnabled?t={context:{isIBMer:this.isIBMer(this.email),isTestUser:this.isTestUser(this.email),page:this.commonHrefProps}}:console.warn("Instrumentation.ConfigBuilder.buildContext(): Instrumentation is disabled."),t},t.prototype.buildAnalyticsKey=function(){var t;return this.isEnabled&&""!==this.key&&(t={skipIdentify:!0,autoPageEventSpa:this.isAutoSPAEnabled,autoPageView:this.isAutoSPAEnabled,segment:!0,segment_key:this.key,coremetrics:!1,optimizely:!1,nps:!1}),t},t.prototype.buildDigitalDataKey=function(t){var e,n;return this.isEnabled&&""!==this.key&&(n={pageInfo:(e={},e[i.productTitle]=this.productTitle,e.analytics={category:t},e)},this.environment&&(n.appInfo={plan:this.environment})),n},t.prototype.buildDDO=function(){var t,e,n,r,a,s,c,u,l,d={};return this.isEnabled&&(d=o({},this.capabilities&&""!==this.capabilitiesString&&((t={})[i.capabilities]=this.capabilities,t),this.version&&((e={})[i.productVersion]=this.version,e),this.url&&((n={})[i.url]=this.url,n),this.partIds&&""!==this.partIdsString&&((r={})[i.partIds]=this.partIds,r),this.accountIdType&&((a={})[i.accountIdType]=this.accountIdType,a),this.accountId&&((s={})[i.accountId]=this.accountId,s),this.tenantId&&((c={})[i.tenantId]=this.tenantId,c),this.productID&&((u={})[i.productID]=this.productID,u),this.isTrial&&((l={})[i.isTrial]=this.isTrial,l))),d},t.prototype.pageEventPayload=function(){var t,e={};if(this.isEnabled){var n=((t={name:a.getPerspectiveName(this.url),path:this.pathname})[i.browserLanguage]=this.productLocale,t);e=o({},this.commonEvtProps,n,this.commonHrefProps)}return e},t.prototype.trackEventPayload=function(){var t={};if(this.isEnabled){var e={url:a.getSanitizedURL(this.url,this.whitelistedValues,this.whitelist)};t=o({},this.commonEvtProps,e)}return t},Object.defineProperty(t.prototype,"isEnabled",{get:function(){var t=!1;return this.config&&this.config.enabled?t=!0:console.warn("Instrumentation.ConfigBuilder: Instrumentation is disabled."),t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"commonHrefProps",{get:function(){return{referrer:a.getSanitizedURL(this.referrer,this.whitelistedValues,this.whitelist),search:a.getSanitizedQueryParams(this.search,this.whitelistedValues,this.whitelist),title:a.getPerspectiveName(this.url),url:a.getSanitizedURL(this.url,this.whitelistedValues,this.whitelist)}},enumerable:!0,configurable:!0}),t.prototype.isIBMer=function(t){var e=!1;this.isEnabled&&(this.validateEmail(t)?e=t.split("@")[1].includes(r.IBM):console.warn("Instrumentation.ConfigBuilder.isIBMer: Invalid email passed as parameter "+t));return e},t.prototype.isTestUser=function(t){var e=!1;if(this.isEnabled)if(this.validateEmail(t)){var n=t.split("@")[1];e=n.includes(r.YOPMAIL)||n.includes(r.MAILINATOR)||n.includes(r.COGNOS)}else console.warn("Instrumentation.ConfigBuilder.isTestUser: Invalid email passed as parameter "+t);return e},t.prototype.validateEmail=function(t){var e=RegExp(/\S+@\S+\.\S+/);return t&&e.test(t)},Object.defineProperty(t.prototype,"commonEvtProps",{get:function(){var t;return(t={})[i.productVersion]=this.version,t[i.productTitle]=this.productTitle,t[i.partIds]=this.partIdsString,t[i.productID]=this.productID,t[i.tenantId]=this.tenantId,t[i.accountId]=this.accountId,t[i.accountIdType]=this.accountIdType,t[i.gbt10]=this.gbt10,t[i.gbt15]=this.gbt15,t[i.gbt17]=this.gbt17,t[i.gbt20]=this.gbt20,t[i.gbtlvlcd]=this.gbtlvlcd,t["custom.capabilities"]=this.capabilitiesString,t[i.roles]=this.rolesString,t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"email",{get:function(){return this.config.email},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"creationTime",{get:function(){return this.config.creationTime},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"productLocale",{get:function(){return this.config.productLocale},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"url",{get:function(){return window.location.href},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"search",{get:function(){return window.location.search},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pathname",{get:function(){return window.location.pathname},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"referrer",{get:function(){return window.document.referrer||" "},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"whitelist",{get:function(){return this.config.whitelist},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"whitelistedValues",{get:function(){return this.config.whitelistedValues},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"key",{get:function(){return this.config.key},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"environment",{get:function(){return this.config.environment},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"version",{get:function(){return this.config.versionNumber},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"productID",{get:function(){return this.config.productID},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"productTitle",{get:function(){return this.config.productTitle},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"tenantId",{get:function(){return this.config.tenantId},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"accountId",{get:function(){return this.config.accountId},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"accountIdType",{get:function(){return this.config.accountIdType},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"gbt10",{get:function(){return this.config.gbt10},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"gbt15",{get:function(){return this.config.gbt15},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"gbt17",{get:function(){return this.config.gbt17},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"gbt20",{get:function(){return this.config.gbt20},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"gbtlvlcd",{get:function(){return this.config.gbtlvlcd},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"partIds",{get:function(){return this.config.partIds},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"partIdsString",{get:function(){return this.partIds.join()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isAutoSPAEnabled",{get:function(){return this.config.autoSPAEnabled},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"capabilities",{get:function(){return this.config.capabilities},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"capabilitiesString",{get:function(){return this.capabilities.join()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isTrial",{get:function(){return this.config.isTrial},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"roles",{get:function(){return this.config.roles},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rolesString",{get:function(){return this.roles.join()},enumerable:!0,configurable:!0}),t}();e.default=s}.apply(e,i))||(t.exports=r)},function(t,e,n){var i,r;i=[n,e,n(4)],void 0===(r=function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){}return t.prototype.getSanitizedURL=function(t,e,n){var i="",r="";return t&&e?t.includes("?")?e.some(function(e){return t.includes(e)})&&(r=t.substring(t.indexOf("?"),t.length),i=t.substring(0,t.indexOf("?"))+this.getSanitizedQueryParams(r,e,n)):i=t:console.warn("Instrumentation.URLSanitizer.getSanitizedURL(): Cannot sanitize. Missing url: "+t+" or whitelisted arguments "+e+"."),i},t.prototype.getSanitizedQueryParams=function(t,e,n){var i=new URLSearchParams,r="";if(t)if(!e||0===e.length||null===n&&void 0===n)console.warn("Instrumentation.URLSanitizer.getSanitizedQueryParams(): Missing list of values: "+e+" or whitelist flag is undefined: "+n);else if("?"===t.substring(0,1)){for(var o=new URLSearchParams(t.substring(1)),a=0;a<e.length;a++)o.has(e[a])&&(i.append(e[a],o.get(e[a])),o.delete(e[a]));""!==(r+=n?i.toString():o.toString())&&(r="?"+r)}else console.warn("Instrumentation.URLSanitizer.getSanitizedQueryParams(): Passed argument "+t+" is not valid.");else console.warn("Instrumentation.URLSanitizer.getSanitizedQueryParams(): Cannot sanitize. Missing search string: "+t);return r},t.prototype.getPerspectiveName=function(t){var e="",n=[];if(t){if((n=t.split("?")).length>1){var i=new URLSearchParams(n[1]);i.has("perspective")?e=i.get("perspective"):console.warn("Instrumentation.URLSanitizer.getPerspectiveName(): No perspective name found in the url.")}}else console.warn("Instrumentation.URLSanitizer.getPerspectiveName(): Cannot return perspective name. Missing a valid url: "+t);return e},t}();e.default=n}.apply(e,i))||(t.exports=r)},function(t,e,n){(function(t){function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}!function(t){"use strict";var n=t.URLSearchParams?t.URLSearchParams:null,i=n&&"a=1"===new n({a:1}).toString(),r=n&&"+"===new n("s=%2B").get("s"),o="__URLSearchParams__",a=l.prototype,s=!(!t.Symbol||!t.Symbol.iterator);if(!(n&&i&&r)){a.append=function(t,e){h(this[o],t,e)},a.delete=function(t){delete this[o][t]},a.get=function(t){var e=this[o];return t in e?e[t][0]:null},a.getAll=function(t){var e=this[o];return t in e?e[t].slice(0):[]},a.has=function(t){return t in this[o]},a.set=function(t,e){this[o][t]=[""+e]},a.toString=function(){var t,e,n,i,r=this[o],a=[];for(e in r)for(n=d(e),t=0,i=r[e];t<i.length;t++)a.push(n+"="+d(i[t]));return a.join("&")};var c=!!r&&n&&!i&&t.Proxy;t.URLSearchParams=c?new Proxy(n,{construct:function(t,e){return new t(new l(e[0]).toString())}}):l;var u=t.URLSearchParams.prototype;u.polyfill=!0,u.forEach=u.forEach||function(t,e){var n=g(this.toString());Object.getOwnPropertyNames(n).forEach(function(i){n[i].forEach(function(n){t.call(e,n,i,this)},this)},this)},u.sort=u.sort||function(){var t,e,n,i=g(this.toString()),r=[];for(t in i)r.push(t);for(r.sort(),e=0;e<r.length;e++)this.delete(r[e]);for(e=0;e<r.length;e++){var o=r[e],a=i[o];for(n=0;n<a.length;n++)this.append(o,a[n])}},u.keys=u.keys||function(){var t=[];return this.forEach(function(e,n){t.push(n)}),p(t)},u.values=u.values||function(){var t=[];return this.forEach(function(e){t.push(e)}),p(t)},u.entries=u.entries||function(){var t=[];return this.forEach(function(e,n){t.push([n,e])}),p(t)},s&&(u[t.Symbol.iterator]=u[t.Symbol.iterator]||u.entries)}function l(t){((t=t||"")instanceof URLSearchParams||t instanceof l)&&(t=t.toString()),this[o]=g(t)}function d(t){var e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'\(\)~]|%20|%00/g,function(t){return e[t]})}function f(t){return decodeURIComponent(t.replace(/\+/g," "))}function p(e){var n={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return s&&(n[t.Symbol.iterator]=function(){return n}),n}function g(t){var n={};if("object"===e(t))for(var i in t)t.hasOwnProperty(i)&&h(n,i,t[i]);else{0===t.indexOf("?")&&(t=t.slice(1));for(var r=t.split("&"),o=0;o<r.length;o++){var a=r[o],s=a.indexOf("=");-1<s?h(n,f(a.slice(0,s)),f(a.slice(s+1))):a&&h(n,f(a),"")}}return n}function h(t,e,n){var i="string"==typeof n?n:null!=n&&"function"==typeof n.toString?n.toString():JSON.stringify(n);e in t?t[e].push(i):t[e]=[i]}}(void 0!==t?t:"undefined"!=typeof window?window:this)}).call(this,n(5))},function(t,e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(t){"object"===("undefined"==typeof window?"undefined":n(window))&&(i=window)}t.exports=i},function(t,e,n){var i,r,o=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});void 0===(i=function(t,e){"use strict";var n;Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.CreatedObject="Created Object",t.ReadObject="Read Object",t.UpdatedObject="Updated Object",t.DeletedObject="Deleted Object",t.SearchedObject="Searched Object",t.RanProcess="Ran Process",t.StartedProcess="Started Process",t.EndedProcess="Ended Process",t.CustomEvent="Custom Event",t.ServiceLogin="Service Login",t.ServiceLogout="Service Logout",t.HybridRatedUsage="Hybrid Rated Usage",t.VideoPlaybackStarted="Video Playback Started",t.VideoPlaybackCompleted="Video Playback Completed",t.ObjectInteraction="Object Interaction"}(n=e.AnalyticsEventType||(e.AnalyticsEventType={}));var i=function(){return function(t,e){this.customName1="action",this.type=t,this.customValue1=e}}();e.AnalyticsEvent=i;var r=function(t){function e(e,n){return t.call(this,e,n)||this}return o(e,t),e}(i),a=function(t){function e(e){return t.call(this,n.CreatedObject,e)||this}return o(e,t),e}(r);e.CreatedObjectEvent=a;var s=function(t){function e(e){return t.call(this,n.ReadObject,e)||this}return o(e,t),e}(r);e.ReadObjectEvent=s;var c=function(t){function e(e){return t.call(this,n.UpdatedObject,e)||this}return o(e,t),e}(r);e.UpdatedObjectEvent=c;var u=function(t){function e(e){return t.call(this,n.DeletedObject,e)||this}return o(e,t),e}(r);e.DeletedObjectEvent=u;var l=function(t){function e(e){return t.call(this,n.SearchedObject,e)||this}return o(e,t),e}(r);e.SearchedObjectEvent=l;var d=function(t){function e(e,n){var i=t.call(this,e,n)||this;return i.processType=n,i}return o(e,t),e}(i),f=function(t){function e(e){return t.call(this,n.RanProcess,e)||this}return o(e,t),e}(d);e.RanProcessEvent=f;var p=function(t){function e(e){return t.call(this,n.StartedProcess,e)||this}return o(e,t),e}(d);e.StartedProcessEvent=p;var g=function(t){function e(e){return t.call(this,n.EndedProcess,e)||this}return o(e,t),e}(d);e.EndedProcessEvent=g;var h=function(t){function e(e){var i=t.call(this,n.CreatedObject,"")||this;return i.action=e,i}return o(e,t),e}(r);e.CustomEvent=h;var b=function(t){function e(e,n){return t.call(this,e,n)||this}return o(e,t),e}(i),y=function(t){function e(e){return t.call(this,n.ServiceLogin,e)||this}return o(e,t),e}(b);e.ServiceLoginEvent=y;var v=function(t){function e(e){return t.call(this,n.ServiceLogout,e)||this}return o(e,t),e}(b);e.ServiceLogoutEvent=v;var m=function(t){function e(e){return t.call(this,n.HybridRatedUsage,e)||this}return o(e,t),e}(i);e.HybridRatedUsageEvent=m;var P=function(t){function e(e,n,i){var r=t.call(this,e,n)||this;return r.customName2="videoUrl",r.customValue2=i,r}return o(e,t),e}(i),S=function(t){function e(e,i){return t.call(this,n.VideoPlaybackStarted,e,i)||this}return o(e,t),e}(P);e.VideoPlaybackStartedEvent=S;var I=function(t){function e(e,i){return t.call(this,n.VideoPlaybackCompleted,e,i)||this}return o(e,t),e}(P);e.VideoPlaybackCompletedEvent=I}.apply(e,[n,e]))||(t.exports=i)}])});
  14796. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14797. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  14798. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  14799. /**
  14800. * Licensed Materials - Property of IBM
  14801. * IBM Cognos Products: Glass
  14802. * (C) Copyright IBM Corp. 2019
  14803. * US Government Users Restricted Rights - Use, duplication or disclosure
  14804. * restricted by GSA ADP Schedule Contract with IBM Corp.
  14805. */
  14806. define('caglass/app/services/CAFEncodingService',['underscore', 'jquery'], function (_, $) {
  14807. /**
  14808. * URLEncodingService implementation utilizing CAF encoding algorithm
  14809. * Described in depth here: https://developer.ibm.com/answers/questions/163966/how-do-i-enable-xss-and-csrf-protection-in-ibm-cog/
  14810. */
  14811. var CAFEncodingService = /*#__PURE__*/function () {
  14812. function CAFEncodingService(glassContext, xssChars) {
  14813. _classCallCheck(this, CAFEncodingService);
  14814. this.glassContext = glassContext;
  14815. this._xssChars = xssChars || '';
  14816. }
  14817. _createClass(CAFEncodingService, [{
  14818. key: "cafEncodeQSValue",
  14819. value: function cafEncodeQSValue(value) {
  14820. var xssEncode = this.glassContext.getCoreSvc('.Config').getXSSChecking();
  14821. if (xssEncode === true) {
  14822. if (_.isObject(value)) {
  14823. var encodedValue = $.extend(true, {}, value);
  14824. this._encodeObjectWithTags(encodedValue);
  14825. return encodedValue;
  14826. } else if (_.isString(value)) {
  14827. return this.encodeWithTags(value);
  14828. }
  14829. }
  14830. return value;
  14831. }
  14832. }, {
  14833. key: "_encodeObjectWithTags",
  14834. value: function _encodeObjectWithTags(objToEncode) {
  14835. for (var item in objToEncode) {
  14836. if (_.isObject(objToEncode[item])) {
  14837. this._encodeObjectWithTags(objToEncode[item]);
  14838. } else if (_.isString(objToEncode[item])) {
  14839. objToEncode[item] = this.encodeWithTags(objToEncode[item]);
  14840. }
  14841. }
  14842. }
  14843. }, {
  14844. key: "encodeWithTags",
  14845. value: function encodeWithTags(data) {
  14846. return 'XSSSTART' + this.encode(data) + 'XSSEND';
  14847. }
  14848. }, {
  14849. key: "encode",
  14850. value: function encode(data) {
  14851. var res = '',
  14852. c = '';
  14853. var str = '' + data; // ensure param is string
  14854. for (var i = 0; i < str.length; i++) {
  14855. c = str.charAt(i);
  14856. if (c == '"') {
  14857. res += '_22';
  14858. } else if (c == '%') {
  14859. res += '*';
  14860. } else if (c == '*') {
  14861. res += '_2a';
  14862. } else if (c == '_') {
  14863. res += '_5f';
  14864. } else {
  14865. res += this._getXSSChar(c);
  14866. }
  14867. }
  14868. return res;
  14869. }
  14870. }, {
  14871. key: "_getXSSChar",
  14872. value: function _getXSSChar(charToTest) {
  14873. var result = '',
  14874. isXSSChar = false;
  14875. for (var j = 0; j < this._xssChars.length; ++j) {
  14876. if (charToTest == this._xssChars.charAt(j)) {
  14877. isXSSChar = true;
  14878. break;
  14879. }
  14880. }
  14881. if (isXSSChar) {
  14882. result += '_';
  14883. var h1 = Math.floor(charToTest.charCodeAt(0) / 16);
  14884. var h2 = charToTest.charCodeAt(0) - h1 * 16;
  14885. result += CAFEncodingService.HEX_CHARS.charAt(h1);
  14886. result += CAFEncodingService.HEX_CHARS.charAt(h2);
  14887. } else {
  14888. result += charToTest;
  14889. }
  14890. return result;
  14891. }
  14892. }]);
  14893. return CAFEncodingService;
  14894. }();
  14895. CAFEncodingService.HEX_CHARS = '0123456789abcdef';
  14896. return CAFEncodingService;
  14897. });
  14898. //# sourceMappingURL=CAFEncodingService.js.map
  14899. ;
  14900. !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("caglass/nls/StringResources"),require("baglass/core-client/js/core-client/utils/UrlUtils"),require("baglass/core-client/js/core-client/utils/BrowserUtils"),require("baglass/core-client/js/core-client/utils/Utils"));else if("function"==typeof define&&define.amd)define('caglass/caglass.webpack.bundle',["caglass/nls/StringResources","baglass/core-client/js/core-client/utils/UrlUtils","baglass/core-client/js/core-client/utils/BrowserUtils","baglass/core-client/js/core-client/utils/Utils"],t);else{var n="object"==typeof exports?t(require("caglass/nls/StringResources"),require("baglass/core-client/js/core-client/utils/UrlUtils"),require("baglass/core-client/js/core-client/utils/BrowserUtils"),require("baglass/core-client/js/core-client/utils/Utils")):t(e["caglass/nls/StringResources"],e["baglass/core-client/js/core-client/utils/UrlUtils"],e["baglass/core-client/js/core-client/utils/BrowserUtils"],e["baglass/core-client/js/core-client/utils/Utils"]);for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(window,(function(e,t,n,r){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=3)}([function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.postSecondaryLogin=t.SecondaryLoginConstants=void 0;var o,s=r(n(5)),i=r(n(6)),a=r(n(7)),c=r(n(8));!function(e){e.path="/login",e.parameters="secondaryLogin=true",e.successMessageKey="secondaryLoginSuccess",e.refreshMessageKey="secondaryLoginRefresh"}(o=t.SecondaryLoginConstants||(t.SecondaryLoginConstants={}));var l=o.path+"?"+o.parameters;function u(e){e.appController.showMessage(s.default.get(o.successMessageKey),s.default.get(o.refreshMessageKey),"info",["ok","cancel"],"500px",(function(t){"ok"===t.btn&&setTimeout((function(){e.close().then((function(){var e=c.default.getCurrentWindow();e.location=e.location.pathname}))}),1)}),!0,"ANSDialog")}t.postSecondaryLogin=function(e,t){return a.default.isIE()?e.localStorage.secondaryLoginResult=JSON.stringify(t):e.opener?e.opener.postMessage(t):e.close(),t},t.default=function(e,t){var n=e.gateway?e.gateway:"/bi",r=window.location.origin+n+l;t&&(r+="&state="+i.default.base64Encode(JSON.stringify(t)));var o=window.open(r,"");return c.default.getCurrentWindow().onbeforeunload=function(){o&&o.close()},new Promise((function(t,n){try{o&&(o.onbeforeunload=function(){n(new Error("SecondaryLogin cancelled"))}),a.default.isIE()?(window.localStorage.removeItem("secondaryLoginResult"),function(e,t,n){var r=function(o){var s;if(o.key&&"secondaryLoginResult"===o.key&&(s=o.newValue),s&&e){window.removeEventListener("storage",r),window.localStorage.removeItem("secondaryLoginResult");var i=JSON.parse(s);n(i),e.close(),u(t)}};window.addEventListener("storage",r)}(o,e,t)):function(e,t,n){window.addEventListener("message",(function(r){e&&r.source===e&&(n(r.data),e.close(),u(t))}),{once:!0})}(o,e,t)}catch(e){n(e)}})).catch((function(){return e.appController.unlockGlass(),Promise.reject()}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){this.getNavBar=function(){var e=document.querySelector(".appview.paneColumn:not(.hidden)").getElementsByClassName("navbar");return e&&e.length>0?e[0]:null}}return e.prototype.canExecute=function(e){if(e.glassContext.appController.currentAppView){var t=e.glassContext.appController.currentAppView.hasHomeFlag();return null!==this.getNavBar()&&!t}return!1},e.prototype.doAction=function(){var e=this.getNavBar();null!==e&&e.classList.add("narrow")},e}();t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){this.getNavBar=function(){var e=document.querySelector(".appview.paneColumn:not(.hidden)").getElementsByClassName("navbar");return e&&e.length>0?e[0]:null}}return e.prototype.canExecute=function(e){return!!e.glassContext.appController.currentAppView&&null!==this.getNavBar()},e.prototype.doAction=function(){var e=this.getNavBar();null!==e&&e.classList.remove("narrow")},e}();t.default=r},function(e,t,n){e.exports=n(4)},function(e,t,n){"use strict";n.r(t);var r=n(1),o=n.n(r);n.d(t,"HideNavBarItemLabelsAction",(function(){return o.a}));var s=n(2),i=n.n(s);n.d(t,"ShowNavBarItemLabelsAction",(function(){return i.a}));var a=n(0),c=n.n(a);n.d(t,"secondaryLogin",(function(){return c.a})),n.d(t,"postSecondaryLogin",(function(){return a.postSecondaryLogin}))},function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t){e.exports=n},function(e,t){e.exports=r}])}));
  14901. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14902. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  14903. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  14904. /**
  14905. * Licensed Materials - Property of IBM
  14906. * IBM Cognos Products: Glass
  14907. * (C) Copyright IBM Corp. 2020
  14908. * US Government Users Restricted Rights - Use, duplication or disclosure
  14909. * restricted by GSA ADP Schedule Contract with IBM Corp.
  14910. */
  14911. define('caglass/app/services/CredentialDialogBuilder',['baglass/common/ui/SubmitPasswordDialog', 'caglass/nls/StringResources', 'jquery'], function (SubmitPasswordDialog, StringResources, $) {
  14912. var CredentialDialogBuilder = /*#__PURE__*/function () {
  14913. function CredentialDialogBuilder(glassContext, endpoint) {
  14914. _classCallCheck(this, CredentialDialogBuilder);
  14915. this.glassContext = glassContext;
  14916. this.endpoint = endpoint;
  14917. }
  14918. _createClass(CredentialDialogBuilder, [{
  14919. key: "openRenewCredentialDialog",
  14920. value: function openRenewCredentialDialog(oDisplayObjects) {
  14921. return this._openCredentialDialog(oDisplayObjects, StringResources.get('credentialChange'), 'renewCredential');
  14922. }
  14923. }, {
  14924. key: "_openCredentialDialog",
  14925. value: function _openCredentialDialog(oDisplayObjects, title, defaultId) {
  14926. var displayPrompts = this._buildParameters(oDisplayObjects);
  14927. var viewItems = {
  14928. 'glassContext': this.glassContext,
  14929. 'displayPrompts': displayPrompts
  14930. };
  14931. var dialogOptions = {
  14932. 'buttons': [{
  14933. 'text': StringResources.get('ok'),
  14934. 'handler': this._submitCredential.bind(this),
  14935. 'type': 'primary',
  14936. 'defaultId': defaultId
  14937. }, 'cancel'],
  14938. title: title,
  14939. viewOptions: viewItems,
  14940. cancelCallback: function () {
  14941. this._credentialDialogObj.dialog.hide();
  14942. }.bind(this)
  14943. };
  14944. return SubmitPasswordDialog.prototype.openSubmitPasswordDialog(dialogOptions).then(function (credentialDialogObj) {
  14945. this._credentialDialogObj = credentialDialogObj;
  14946. return Promise.resolve();
  14947. }.bind(this), function () {
  14948. return Promise.reject('Failed to open submit-password dialog');
  14949. }.bind(this));
  14950. }
  14951. }, {
  14952. key: "_buildParameters",
  14953. value: function _buildParameters(oDisplayObjects) {
  14954. this.credentialParameters = [];
  14955. var displayParameters = [];
  14956. $.each(oDisplayObjects, function (key, prompt) {
  14957. this.credentialParameters.push(prompt);
  14958. if ('hidden' !== prompt.type && 'display' !== prompt.type) {
  14959. displayParameters.push(prompt);
  14960. }
  14961. }.bind(this));
  14962. return displayParameters;
  14963. }
  14964. }, {
  14965. key: "_submitCredential",
  14966. value: function _submitCredential() {
  14967. $.each(this.credentialParameters, function (key, prompt) {
  14968. var displayObject = $('input[class*="' + prompt.name + '"]');
  14969. if (displayObject.length) {
  14970. var value = displayObject.val();
  14971. if (value) {
  14972. prompt.value = value;
  14973. }
  14974. }
  14975. }.bind(this));
  14976. var options = {
  14977. type: 'POST',
  14978. 'headers': {
  14979. 'Accept': 'application/json',
  14980. 'Content-Type': 'application/json'
  14981. },
  14982. url: this.endpoint,
  14983. data: JSON.stringify({
  14984. 'parameters': this.credentialParameters
  14985. }),
  14986. skipErrorHandling: true
  14987. };
  14988. return this.glassContext.services.ajax.ajax(options).then(function
  14989. /* response */
  14990. () {
  14991. this._submitSuccessHandler();
  14992. return Promise.resolve();
  14993. }.bind(this), function (dfd, jqXHR, textStatus, errorThrown) {
  14994. if (jqXHR.status === this.glassContext.ajaxCodes.UNAUTHORIZED && jqXHR.responseJSON && jqXHR.responseJSON.errorCodeString === 'camAuthUserRecoverable') {
  14995. this._submitErrorHandler(jqXHR, errorThrown, false);
  14996. } else {
  14997. this._submitErrorHandler(jqXHR, errorThrown, true);
  14998. }
  14999. return Promise.reject("Failed to renew credential: ".concat(errorThrown));
  15000. }.bind(this));
  15001. }
  15002. }, {
  15003. key: "_submitSuccessHandler",
  15004. value: function _submitSuccessHandler() {
  15005. this._credentialDialogObj.dialog.hide();
  15006. this.glassContext.appController.showToast(StringResources.get('credentialCreateSuccess'));
  15007. }
  15008. }, {
  15009. key: "_submitErrorHandler",
  15010. value: function _submitErrorHandler(jqXHR, errorThrown, authorized) {
  15011. if (!authorized) {
  15012. // Request failed with incorrect password.
  15013. this.glassContext.appController.showToast(StringResources.get('wrongPassword'), {
  15014. 'type': 'error'
  15015. }); // Rebuild the parameters so the password already read is refreshed.
  15016. this._buildParameters(jqXHR.responseJSON.promptInfo.displayObjects);
  15017. } else {
  15018. this.glassContext.appController.showToast(errorThrown, {
  15019. 'type': 'error'
  15020. });
  15021. this._credentialDialogObj.dialog.hide();
  15022. }
  15023. }
  15024. }]);
  15025. return CredentialDialogBuilder;
  15026. }();
  15027. return CredentialDialogBuilder;
  15028. });
  15029. //# sourceMappingURL=CredentialDialogBuilder.js.map
  15030. ;
  15031. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  15032. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  15033. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  15034. /**
  15035. * Licensed Materials - Property of IBM
  15036. * IBM Cognos Products: Glass
  15037. * (C) Copyright IBM Corp. 2019
  15038. * US Government Users Restricted Rights - Use, duplication or disclosure
  15039. * restricted by GSA ADP Schedule Contract with IBM Corp.
  15040. */
  15041. define('caglass/app/services/LoginService',['caglass/ajax/CAAuthentication', 'caglass/caglass.webpack.bundle', 'caglass/nls/StringResources', 'caglass/app/services/CredentialDialogBuilder'], function (CAAuthentication, CAGlassBundle, StringResources, CredentialDialogBuilder) {
  15042. var secondarySignOn = CAGlassBundle.secondaryLogin;
  15043. var LoginService = /*#__PURE__*/function () {
  15044. function LoginService(glassContext) {
  15045. _classCallCheck(this, LoginService);
  15046. this.glassContext = glassContext;
  15047. this.caAuth = new CAAuthentication();
  15048. }
  15049. _createClass(LoginService, [{
  15050. key: "secondaryLogin",
  15051. value: function secondaryLogin(camError) {
  15052. var _this = this;
  15053. return secondarySignOn(this.glassContext, camError)["catch"](function (error) {
  15054. _this.glassContext.getCoreSvc('.Logger').error('Secondary login failed', error);
  15055. });
  15056. }
  15057. }, {
  15058. key: "renewCredential",
  15059. value: function renewCredential() {
  15060. var _this2 = this;
  15061. return this.caAuth.storeCredentials(this.glassContext).then(function () {
  15062. return _this2.glassContext.appController.showToast(StringResources.get('credentialRenewed'));
  15063. }, function (error) {
  15064. if (error && error.displayObjects) {
  15065. var dialog = new CredentialDialogBuilder(_this2.glassContext, LoginService.CREDENTIALS_URL);
  15066. return dialog.openRenewCredentialDialog(error.displayObjects);
  15067. } else {
  15068. _this2.glassContext.getCoreSvc('.Logger').error('Missing displayObjects while opening crendential dialog', error);
  15069. return Promise.reject();
  15070. }
  15071. });
  15072. }
  15073. }, {
  15074. key: "recoverFromCamError",
  15075. value: function recoverFromCamError(error) {
  15076. if (!error || error.errorCodeString != 'camAuthUserRecoverable') {
  15077. return Promise.reject(error);
  15078. }
  15079. return this._recoverFromError(error);
  15080. }
  15081. }, {
  15082. key: "_recoverFromError",
  15083. value: function _recoverFromError(error) {
  15084. var jqXHR = {
  15085. responseJSON: error
  15086. };
  15087. var processedError = this.caAuth.processAuthenticationError(this.glassContext, jqXHR);
  15088. if (processedError.displayObjects && processedError.displayObjects.length > 0) {
  15089. return this.secondaryLogin(processedError);
  15090. }
  15091. return Promise.reject(error);
  15092. }
  15093. }]);
  15094. return LoginService;
  15095. }();
  15096. LoginService.CREDENTIALS_URL = 'v1/users/~/credentials';
  15097. return LoginService;
  15098. });
  15099. //# sourceMappingURL=LoginService.js.map
  15100. ;
  15101. /**
  15102. * Licensed Materials - Property of IBM
  15103. *
  15104. * IBM Cognos Products: BI Glass
  15105. *
  15106. * Copyright IBM Corp. 2019, 2020
  15107. *
  15108. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  15109. */
  15110. define('caglass/utils/EntitlementObject',[], function () {
  15111. var constants = {};
  15112. constants.ENTITLEMENTS = {
  15113. enabled: true,
  15114. display_name: 'display_name',
  15115. entitled_organization: {
  15116. country_code: 'country_code',
  15117. name: 'name',
  15118. other_identifier: {
  15119. org_id: 'org_id',
  15120. sap_sold_to_site_number: 'string',
  15121. ibm_customer_number: 'ibm_customer_number'
  15122. }
  15123. },
  15124. entitled_user: {
  15125. family_name: 'string',
  15126. email_address: 'user@example.com',
  15127. given_name: 'string',
  15128. language: 'string',
  15129. ibm_unique_id: 'string'
  15130. },
  15131. third_party_marketplace: {
  15132. route_indicator: '3PM'
  15133. },
  15134. entitled_parts: [{
  15135. part_number: 'part_number',
  15136. display_name: 'TRIAL_PART',
  15137. type: 'trial',
  15138. offering: 'CA',
  15139. subscription_id: '2',
  15140. expiration_date: '2020-05-29T23:59:59.000Z',
  15141. abilities: [{
  15142. type: 'CAPABILITY',
  15143. value: 'value1'
  15144. }, {
  15145. type: 'GROUP',
  15146. value: 'value2'
  15147. }]
  15148. }, {
  15149. part_number: 'part_number',
  15150. display_name: 'BASE_PART',
  15151. type: 'base',
  15152. offering: 'CA',
  15153. subscription_id: '3',
  15154. expiration_date: '2019-03-29T23:59:59.000Z',
  15155. abilities: [{
  15156. type: 'GROUP',
  15157. value: 'value1'
  15158. }]
  15159. }, {
  15160. part_number: 'part_number',
  15161. display_name: 'BASE_PART',
  15162. type: 'something else',
  15163. offering: 'CA',
  15164. subscription_id: '4',
  15165. expiration_date: '2019-03-29T23:59:59.000Z',
  15166. abilities: [{
  15167. type: 'GROUP',
  15168. value: 'value1'
  15169. }]
  15170. }],
  15171. tenant_id: 'tenant_id',
  15172. user_id: 'user_id',
  15173. account_id: 'account_id',
  15174. subscription_id: '1',
  15175. product_deployment: {
  15176. product_deployment_location: 'multitenant1.dal10.us-south',
  15177. instance_url: 'https://ca1.analytics.ibm.com',
  15178. offering: 'CA',
  15179. description: 'CA on DAL10 US-South'
  15180. }
  15181. };
  15182. return constants;
  15183. });
  15184. //# sourceMappingURL=EntitlementObject.js.map
  15185. ;
  15186. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  15187. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  15188. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  15189. /**
  15190. * Licensed Materials - Property of IBM
  15191. * IBM Cognos Products: BI Glass
  15192. * Copyright IBM Corp. 2019, 2020
  15193. * US Government Users Restricted Rights - Use, duplication or disclosure
  15194. * restricted by GSA ADP Schedule Contract with IBM Corp.
  15195. */
  15196. define('caglass/app/services/DigitalContextService',['underscore', 'caglass/utils/EntitlementObject', 'caglass/utils/CAUtils', 'baglass/utils/Utils'], function (_, EntitlementObject, CAUtils, GlassUtils) {
  15197. /**
  15198. * A service for presenting a Digital Context Object describing entitlement details for cloud users
  15199. * @class
  15200. */
  15201. var DigitalContextService = /*#__PURE__*/function () {
  15202. function DigitalContextService(glassContext) {
  15203. _classCallCheck(this, DigitalContextService);
  15204. this._glassContext = glassContext;
  15205. this._setLogger(glassContext);
  15206. }
  15207. _createClass(DigitalContextService, [{
  15208. key: "initialize",
  15209. value: function initialize() {
  15210. if (this.isEnabled()) {
  15211. if (GlassUtils.getCookieValue(DigitalContextService.DCO_COOKIE) == undefined) {
  15212. return this.fetchEntitlements();
  15213. } else {
  15214. var parsedJsonObject = this.parseJsonFromDcoCookie(GlassUtils.getCookieValue(DigitalContextService.DCO_COOKIE));
  15215. if (parsedJsonObject) {
  15216. this.digitalContext = parsedJsonObject;
  15217. return Promise.resolve(parsedJsonObject);
  15218. }
  15219. }
  15220. }
  15221. return Promise.resolve();
  15222. }
  15223. }, {
  15224. key: "fetchEntitlements",
  15225. value: function fetchEntitlements() {
  15226. var _this = this;
  15227. return this._glassContext.getCoreSvc('.Ajax').ajax({
  15228. url: DigitalContextService.DIGITAL_CONTEXT_URL,
  15229. type: 'POST'
  15230. }).then(function (result) {
  15231. if (result.data && result.data.enabled !== false) {
  15232. _this.digitalContext = result.data;
  15233. CAUtils.preventWritesToObject(_this.digitalContext);
  15234. } else _this._getLogger().error('DigitalContextService Retrieved Entitlement data invalid ');
  15235. })["catch"](function (error) {
  15236. _this._getLogger().error('DigitalContextService Communication error with digitalcontext API', error);
  15237. });
  15238. }
  15239. }, {
  15240. key: "isInitialized",
  15241. value: function isInitialized() {
  15242. return this.digitalContext ? true : false;
  15243. }
  15244. }, {
  15245. key: "isEnabled",
  15246. value: function isEnabled() {
  15247. return this._glassContext.getCoreSvc('.Config').getConfigValueSync('Glass.digitalContextEnabled');
  15248. }
  15249. }, {
  15250. key: "getAccountId",
  15251. value: function getAccountId() {
  15252. if (this.digitalContext && this.digitalContext[DigitalContextService.ACCOUNT_ID]) {
  15253. return this.digitalContext[DigitalContextService.ACCOUNT_ID];
  15254. }
  15255. }
  15256. }, {
  15257. key: "getSubscriptionId",
  15258. value: function getSubscriptionId() {
  15259. var parts = this.getEntitledParts();
  15260. var sbsId = this._findBasePartSbsId(parts);
  15261. if (sbsId) return sbsId;
  15262. var trialSbsId = this._findTrialPartSbsId();
  15263. if (trialSbsId) return trialSbsId;
  15264. return this.digitalContext[DigitalContextService.SUBSCRIPTION_ID];
  15265. }
  15266. }, {
  15267. key: "_findBasePartSbsId",
  15268. value: function _findBasePartSbsId(parts) {
  15269. return parts.map(function (part) {
  15270. return part.type && part.type.toLowerCase() === DigitalContextService.BASE && part[DigitalContextService.SUBSCRIPTION_ID];
  15271. }).filter(function (validPart) {
  15272. return validPart !== false;
  15273. })[0];
  15274. }
  15275. }, {
  15276. key: "_findTrialPartSbsId",
  15277. value: function _findTrialPartSbsId() {
  15278. var trialPart = this.getTrialPart();
  15279. return trialPart && trialPart[DigitalContextService.SUBSCRIPTION_ID];
  15280. }
  15281. }, {
  15282. key: "getValueByKey",
  15283. value: function getValueByKey(key) {
  15284. if (this.digitalContext && this.digitalContext[key]) {
  15285. return this.digitalContext[key];
  15286. }
  15287. }
  15288. }, {
  15289. key: "getTrialPart",
  15290. value: function getTrialPart() {
  15291. var eParts = this.getEntitledParts();
  15292. if (eParts && eParts.length > 0) {
  15293. return this._getTrialParts(eParts);
  15294. }
  15295. }
  15296. }, {
  15297. key: "_getTrialParts",
  15298. value: function _getTrialParts(eParts) {
  15299. var trialPart;
  15300. _.each(eParts, function (part) {
  15301. if (part[DigitalContextService.PART_TYPE] && part[DigitalContextService.PART_TYPE].toLowerCase() == DigitalContextService.TRIAL) {
  15302. trialPart = part;
  15303. return false;
  15304. }
  15305. });
  15306. if (trialPart) {
  15307. return trialPart;
  15308. }
  15309. }
  15310. }, {
  15311. key: "isTrial",
  15312. value: function isTrial() {
  15313. return this.getTrialPart() ? true : false;
  15314. }
  15315. }, {
  15316. key: "getTieredParts",
  15317. value: function getTieredParts() {
  15318. var eParts = this.getEntitledParts();
  15319. if (eParts && eParts.length > 0) {
  15320. return this._getTieredParts(eParts);
  15321. }
  15322. return eParts;
  15323. }
  15324. }, {
  15325. key: "_getTieredParts",
  15326. value: function _getTieredParts(eParts) {
  15327. var tieredParts = [];
  15328. _.each(eParts, function (part) {
  15329. if (part[DigitalContextService.PART_TYPE] && part[DigitalContextService.PART_TYPE].toLowerCase() !== DigitalContextService.TRIAL && part[DigitalContextService.PART_TYPE].toLowerCase() !== DigitalContextService.BASE && part[DigitalContextService.PART_NUMBER] && part[DigitalContextService.PART_NUMBER].toLowerCase() == DigitalContextService.PART_NUMBER) {
  15330. tieredParts.push(part);
  15331. }
  15332. });
  15333. return tieredParts;
  15334. }
  15335. }, {
  15336. key: "getEntitledOrganization",
  15337. value: function getEntitledOrganization() {
  15338. return this.getValueByKey(DigitalContextService.ENTITLED_ORGANIZATION);
  15339. }
  15340. }, {
  15341. key: "getEntitledParts",
  15342. value: function getEntitledParts() {
  15343. if (this.digitalContext && this.digitalContext[DigitalContextService.ENTITLED_PARTS]) {
  15344. return this.digitalContext[DigitalContextService.ENTITLED_PARTS];
  15345. }
  15346. return [];
  15347. }
  15348. }, {
  15349. key: "getEntitledUser",
  15350. value: function getEntitledUser() {
  15351. return this.getValueByKey(DigitalContextService.ENTITLED_USER);
  15352. }
  15353. }, {
  15354. key: "getThirdPartyMarketplace",
  15355. value: function getThirdPartyMarketplace() {
  15356. return this.getValueByKey(DigitalContextService.THIRD_PARTY_MARKETPLACE);
  15357. }
  15358. }, {
  15359. key: "isThirdPartyMarketplace",
  15360. value: function isThirdPartyMarketplace() {
  15361. var thirdPartyMarket = this.getThirdPartyMarketplace();
  15362. return _.isEmpty(thirdPartyMarket) || thirdPartyMarket.route_indicator !== DigitalContextService.THIRD_PARTY_MARKETPLACE_ID ? false : true;
  15363. }
  15364. }, {
  15365. key: "getUserOtherIdentifiers",
  15366. value: function getUserOtherIdentifiers() {
  15367. var entitled_user = this.getEntitledOrganization();
  15368. return entitled_user && entitled_user[DigitalContextService.OTHER_IDENTIFIER];
  15369. }
  15370. }, {
  15371. key: "getICN",
  15372. value: function getICN() {
  15373. var other_identifier = this.getUserOtherIdentifiers();
  15374. return other_identifier && other_identifier[DigitalContextService.ICN];
  15375. }
  15376. }, {
  15377. key: "getOrgId",
  15378. value: function getOrgId() {
  15379. var other_identifier = this.getUserOtherIdentifiers();
  15380. return other_identifier && other_identifier[DigitalContextService.ORG_ID];
  15381. }
  15382. }, {
  15383. key: "getTenantId",
  15384. value: function getTenantId() {
  15385. if (this.digitalContext && this.digitalContext[DigitalContextService.TENANT_ID]) {
  15386. return this.digitalContext[DigitalContextService.TENANT_ID];
  15387. }
  15388. } // partIds are called part_number in PSNext and come from an entitled_part object in the entitled_parts array
  15389. }, {
  15390. key: "getPartIds",
  15391. value: function getPartIds() {
  15392. var eParts = this.getEntitledParts();
  15393. var partIds = [];
  15394. if (eParts && eParts.length > 0) {
  15395. _.each(eParts, function (part) {
  15396. partIds.push(part[DigitalContextService.PART_NUMBER]);
  15397. });
  15398. }
  15399. return partIds;
  15400. }
  15401. }, {
  15402. key: "_getLogger",
  15403. value: function _getLogger() {
  15404. return this._logger;
  15405. }
  15406. }, {
  15407. key: "_setLogger",
  15408. value: function _setLogger(glassContext) {
  15409. if (glassContext && glassContext.getCoreSvc('.Logger')) {
  15410. this._logger = glassContext.getCoreSvc('.Logger');
  15411. } else {
  15412. this._logger = console;
  15413. }
  15414. }
  15415. }, {
  15416. key: "getDigitalContextObject",
  15417. value: function getDigitalContextObject() {
  15418. return this.digitalContext;
  15419. }
  15420. }, {
  15421. key: "getDigitalContextObjectMock",
  15422. value: function getDigitalContextObjectMock() {
  15423. return EntitlementObject.ENTITLEMENTS;
  15424. }
  15425. }, {
  15426. key: "killDcoCookie",
  15427. value: function killDcoCookie() {
  15428. if (this.isEnabled()) {
  15429. return this._glassContext.getCoreSvc('.Ajax').ajax({
  15430. type: 'DELETE',
  15431. url: DigitalContextService.DIGITAL_CONTEXT_URL
  15432. });
  15433. } else return Promise.resolve();
  15434. }
  15435. }, {
  15436. key: "parseJsonFromDcoCookie",
  15437. value: function parseJsonFromDcoCookie(cookie) {
  15438. var parsedJson;
  15439. var splits = cookie.split('_json_');
  15440. try {
  15441. parsedJson = JSON.parse(splits[1]);
  15442. } catch (syntaxException) {
  15443. this._getLogger().error('DigitalContextService Not initialized with an invalid cookie');
  15444. }
  15445. return parsedJson;
  15446. }
  15447. }]);
  15448. return DigitalContextService;
  15449. }();
  15450. DigitalContextService.ACCOUNT_ID = 'account_id';
  15451. DigitalContextService.BASE = 'base';
  15452. DigitalContextService.BASE_URL = 'v1';
  15453. DigitalContextService.DCO_COOKIE = 'dco';
  15454. DigitalContextService.DIGITAL_CONTEXT_ENABLED_CONF = 'Glass.digitalContextEnabled';
  15455. DigitalContextService.DIGITAL_CONTEXT_URL = DigitalContextService.BASE_URL + '/digitalcontext';
  15456. DigitalContextService.ENTITLED_USER = 'entitled_user';
  15457. DigitalContextService.ENTITLED_PARTS = 'entitled_parts';
  15458. DigitalContextService.ENTITLED_ORGANIZATION = 'entitled_organization';
  15459. DigitalContextService.ICN = 'ibm_customer_number';
  15460. DigitalContextService.IS_ENABLED = 'enabled';
  15461. DigitalContextService.PART_NUMBER = 'part_number';
  15462. DigitalContextService.PART_TYPE = 'type';
  15463. DigitalContextService.ORG_ID = 'org_id';
  15464. DigitalContextService.OTHER_IDENTIFIER = 'other_identifier';
  15465. DigitalContextService.SUBSCRIPTION_ID = 'subscription_id';
  15466. DigitalContextService.THIRD_PARTY_MARKETPLACE = 'third_party_marketplace';
  15467. DigitalContextService.THIRD_PARTY_MARKETPLACE_ID = '3PM';
  15468. DigitalContextService.TENANT_ID = 'tenant_id';
  15469. DigitalContextService.TIERED_PART_NUMBER = 'tiered_part_number';
  15470. DigitalContextService.TRIAL = 'trial';
  15471. return DigitalContextService;
  15472. });
  15473. //# sourceMappingURL=DigitalContextService.js.map
  15474. ;
  15475. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  15476. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  15477. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  15478. /**
  15479. * Licensed Materials - Property of IBM
  15480. * IBM Cognos Products: CA Glass
  15481. * Copyright IBM Corp. 2019
  15482. * US Government Users Restricted Rights - Use, duplication or disclosure
  15483. * restricted by GSA ADP Schedule Contract with IBM Corp.
  15484. */
  15485. define('caglass/app/services/InstrumentationConfigBuilder',[], function () {
  15486. var ACCOUNT_ID_TYPE = 'ssmHubId';
  15487. return /*#__PURE__*/_createClass(function InstrumentationConfigBuilder(glassContext) {
  15488. _classCallCheck(this, InstrumentationConfigBuilder);
  15489. if (glassContext) {
  15490. var configService = glassContext.getCoreSvc('.Config');
  15491. var ups = glassContext.getCoreSvc('.UserProfile');
  15492. var dcs = glassContext.getCoreSvc('.DigitalContext');
  15493. var iConfig = configService.getInstrumentationConfig();
  15494. if (iConfig && iConfig.enabled) {
  15495. iConfig.whitelistedValues = iConfig.whitelistedValues.split(',');
  15496. if (configService) {
  15497. iConfig.versionNumber = configService.getVersion();
  15498. }
  15499. if (ups && ups.userAccount && ups.preferences) {
  15500. iConfig.email = ups.userAccount.email;
  15501. iConfig.capabilities = ups.capabilities;
  15502. iConfig.creationTime = ups.userAccount.creationTime;
  15503. iConfig.productLocale = ups.preferences.productLocale;
  15504. }
  15505. if (dcs && dcs.isInitialized()) {
  15506. iConfig.tenantId = dcs.getTenantId();
  15507. iConfig.accountId = dcs.getOrgId();
  15508. iConfig.accountIdType = ACCOUNT_ID_TYPE;
  15509. iConfig.partIds = dcs.getPartIds();
  15510. iConfig.isTrial = dcs.isTrial();
  15511. }
  15512. }
  15513. return iConfig;
  15514. }
  15515. });
  15516. });
  15517. //# sourceMappingURL=InstrumentationConfigBuilder.js.map
  15518. ;
  15519. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  15520. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  15521. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  15522. /**
  15523. * Licensed Materials - Property of IBM
  15524. * IBM Cognos Products: BI (C) Copyright IBM Corp. 2019
  15525. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  15526. */
  15527. define('baglass/utils/Notifier',[], function () {
  15528. return /*#__PURE__*/function () {
  15529. function Notifier() {
  15530. _classCallCheck(this, Notifier);
  15531. this.cache = {};
  15532. }
  15533. _createClass(Notifier, [{
  15534. key: "register",
  15535. value: function register(ids, callback) {
  15536. var _this = this;
  15537. if (!Array.isArray(ids)) {
  15538. ids = [ids];
  15539. }
  15540. ids.forEach(function (id) {
  15541. return _this.cache[id] = callback;
  15542. });
  15543. }
  15544. }, {
  15545. key: "notify",
  15546. value: function notify(id) {
  15547. var _this2 = this;
  15548. var promise;
  15549. if (this.cache.hasOwnProperty(id)) {
  15550. try {
  15551. promise = this.cache[id](id);
  15552. } catch (e) {
  15553. return Promise.reject(e);
  15554. }
  15555. promise = promise || Promise.resolve();
  15556. return promise.then(function () {
  15557. _this2.remove(id);
  15558. });
  15559. }
  15560. return Promise.reject("Notifier::notify '".concat(id, "' not found"));
  15561. }
  15562. }, {
  15563. key: "remove",
  15564. value: function remove(id) {
  15565. delete this.cache[id];
  15566. }
  15567. }]);
  15568. return Notifier;
  15569. }();
  15570. });
  15571. //# sourceMappingURL=Notifier.js.map
  15572. ;
  15573. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  15574. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  15575. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  15576. /**
  15577. * Licensed Materials - Property of IBM
  15578. * IBM Cognos Products: BI (C) Copyright IBM Corp. 2019
  15579. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  15580. */
  15581. define('baglass/services/AlertBannerService',['../utils/Notifier', 'baglass/glass.webpack.bundle', 'baglass/app/services/ConfigService'], function (Notifier, GlassWebpackBundle, ConfigService) {
  15582. var AlertStore = GlassWebpackBundle.AlertStore;
  15583. var AlertBannerService = /*#__PURE__*/function () {
  15584. function AlertBannerService(glassContext) {
  15585. _classCallCheck(this, AlertBannerService);
  15586. this.glassContext = glassContext;
  15587. this.store = AlertStore.create({
  15588. disabled: this._isDisabled()
  15589. });
  15590. this.notifier = new Notifier();
  15591. }
  15592. _createClass(AlertBannerService, [{
  15593. key: "_isDisabled",
  15594. value: function _isDisabled() {
  15595. var config = this.glassContext.getCoreSvc('.Config');
  15596. var disabled = config.getConfigValueSync(ConfigService.DISABLE_ALERTBANNER);
  15597. return disabled;
  15598. }
  15599. }, {
  15600. key: "getDisabled",
  15601. value: function getDisabled() {
  15602. return this.store.disabled;
  15603. }
  15604. }, {
  15605. key: "addAlerts",
  15606. value: function addAlerts(alerts, onDismiss) {
  15607. if (!Array.isArray(alerts)) {
  15608. alerts = [alerts];
  15609. }
  15610. if (onDismiss) {
  15611. this.notifier.register(alerts.map(function (alert) {
  15612. return alert.id;
  15613. }), onDismiss);
  15614. }
  15615. this.store.addAlerts(alerts);
  15616. }
  15617. }, {
  15618. key: "removeAlert",
  15619. value: function removeAlert(index) {
  15620. var _this = this;
  15621. var alert = this.store.getAlertAt(index);
  15622. var updateStore = function updateStore() {
  15623. _this.store.removeAlert(index);
  15624. };
  15625. return this.notifier.notify(alert.id).then(function () {
  15626. updateStore();
  15627. }).catch(function () {
  15628. //if no onDismiss callback was registered for this alert an error is thrown from the notifier.
  15629. //this is a valid case, we can remove the alert from the store without an onDismiss callback.
  15630. //catch is needed to suppress this exception
  15631. updateStore();
  15632. });
  15633. }
  15634. }, {
  15635. key: "getStore",
  15636. value: function getStore() {
  15637. return this.store;
  15638. }
  15639. }]);
  15640. return AlertBannerService;
  15641. }();
  15642. return AlertBannerService;
  15643. });
  15644. //# sourceMappingURL=AlertBannerService.js.map
  15645. ;
  15646. /**
  15647. * Licensed Materials - Property of IBM
  15648. * IBM Cognos Products: BI
  15649. * (C) Copyright IBM Corp. 2019, 2022
  15650. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  15651. */
  15652. define('caglass/app/StartupCA',['jquery', 'baglass/app/AppController', 'baglass/services/OfflineOnlineService', 'baglass/nls/StringResources', 'baglass/core-client/js/core-client/utils/PerfUtils', 'baglass/core-client/js/core-client/utils/Utils', 'baglass/utils/Utils', 'caglass/app/services/CAUserProfileService', 'caglass/app/services/LogoutService', 'caglass/ajax/PrepareRequest', 'caglass/ajax/HandleError', 'caglass/ajax/HandleResponse', 'caglass/utils/CAUtils', 'underscore', 'caglass/ba-instrumentation/dist/bundle', 'caglass/app/services/CAFEncodingService', 'caglass/ajax/PrepareRequestURL', 'caglass/app/services/LoginService', 'caglass/app/services/DigitalContextService', 'caglass/app/services/InstrumentationConfigBuilder', 'baglass/services/AlertBannerService', 'jquery-ui', 'jquery-bbq'], function ($, AppController, OfflineOnlineService, StringResources, PerfUtils, CoreUtils, GlassUtils, CAUserProfileService, LogoutService, PrepareRequest, HandleError, HandleResponse, CAUtils, _, InstrumentationBundle, CAFEncodingService, PrepareRequestURL, LoginService, DigitalContextService, InstrumentationConfigBuilder, AlertBannerService) {
  15653. return function (inlineContext) {
  15654. PerfUtils.createPerformanceMark({
  15655. 'component': 'glass-foundation',
  15656. 'name': 'entry',
  15657. 'state': 'start'
  15658. });
  15659. var appController = new AppController({
  15660. '$rootPane': $('#main'),
  15661. installInfo: inlineContext.configuration.installInfo,
  15662. versionInfo: inlineContext.versionInfo,
  15663. authInfo: inlineContext.authInfo,
  15664. perspectives: inlineContext.perspectives
  15665. });
  15666. window.__glassAppController = appController;
  15667. var glassContext = appController.glassContext;
  15668. var configService = glassContext.getCoreSvc('.Config');
  15669. configService.initialize(inlineContext.configuration);
  15670. glassContext.getCoreSvc('.Taxonomy').initialize(inlineContext.taxonomy);
  15671. var cafEncodingService = new CAFEncodingService(glassContext, "<'>");
  15672. glassContext.registerCoreService('.CAFEncoding', cafEncodingService);
  15673. glassContext.getCoreSvc('.URLEncoder').registerQSValueEncoder(cafEncodingService.cafEncodeQSValue.bind(cafEncodingService));
  15674. var ajaxSrv = glassContext.getCoreSvc('.Ajax');
  15675. ajaxSrv.addRequestHandler(new PrepareRequest(glassContext));
  15676. ajaxSrv.addRequestHandler(new PrepareRequestURL(glassContext));
  15677. ajaxSrv.setErrorHandler(new HandleError(glassContext));
  15678. ajaxSrv.addResponseHandler(new HandleResponse(glassContext));
  15679. glassContext.registerCoreService('.Login', new LoginService(glassContext));
  15680. var logoutService = new LogoutService();
  15681. glassContext.services.register('.Logout', logoutService);
  15682. var userProfileService = new CAUserProfileService({
  15683. glassContext: glassContext
  15684. });
  15685. glassContext.services.userProfile = userProfileService;
  15686. glassContext.services.register('.UserProfile', userProfileService);
  15687. var digitalContextService = new DigitalContextService(glassContext);
  15688. glassContext.registerCoreService('.DigitalContext', digitalContextService);
  15689. var instrumentationService = new InstrumentationBundle.InstrumentationService();
  15690. glassContext.registerCoreService('.Instrumentation', instrumentationService);
  15691. var offlineOnlineService = new OfflineOnlineService();
  15692. glassContext.registerCoreService('.OfflineOnline', offlineOnlineService);
  15693. var alertBannerService = new AlertBannerService(glassContext);
  15694. glassContext.registerCoreService('.Message', alertBannerService);
  15695. glassContext.gateway = window.location.pathname.substr(0, window.location.pathname.lastIndexOf('/'));
  15696. appController.detectAccessibilityChange();
  15697. var queryString = _.unescape($('#queryString_data').text());
  15698. var content = GlassUtils.getAppContent(queryString, $.param.fragment(), glassContext);
  15699. var perspective = content.perspective;
  15700. var objRef = content.objRef;
  15701. var context = {
  15702. perspective: perspective,
  15703. content: content
  15704. };
  15705. if (objRef) {
  15706. context.id = objRef;
  15707. context.content.objRef = objRef; //Provide a way for the content views to get the id (in their constructor)
  15708. }
  15709. delete context.content.module;
  15710. glassContext.getCoreSvc('.Events').on('appView:loaded', CAUtils.removeLoadingSpinner.bind(this, glassContext), 'removeLoadingSpinnerFunction');
  15711. $(document).ready(function () {
  15712. if (window.cssVars) {
  15713. window.cssVars();
  15714. }
  15715. var currentWindow = CoreUtils.getCurrentWindow();
  15716. $(currentWindow).on('beforeunload', function () {
  15717. return appController.close(false, true);
  15718. }.bind(this));
  15719. $(currentWindow).on('unload', function () {
  15720. appController.close(true);
  15721. }.bind(this));
  15722. }.bind(this));
  15723. return Promise.all([userProfileService.initialize(inlineContext), digitalContextService.initialize()])["catch"](function (error) {
  15724. glassContext.getCoreSvc('.Logger').error('Error loading UPS and DCS', error);
  15725. return Promise.resolve();
  15726. }).then(function () {
  15727. var instrumentationConfig = new InstrumentationConfigBuilder(glassContext);
  15728. return instrumentationService.initialize(glassContext, instrumentationConfig).then(function () {
  15729. if (instrumentationService.enabled) {
  15730. instrumentationService.track({
  15731. type: 'Service Login'
  15732. });
  15733. }
  15734. return Promise.resolve;
  15735. })["catch"](function (error) {
  15736. glassContext.getCoreSvc('.Logger').error('Error loading the InstrumentationService', error);
  15737. return Promise.resolve(); // handle gracefully - this should not stop the app from rendering
  15738. });
  15739. }).then(function () {
  15740. return appController.openAppView(perspective, context);
  15741. })["catch"](function (error) {
  15742. glassContext.getCoreSvc('.Logger').error('error while showing showing the home page', error);
  15743. CAUtils.removeLoadingSpinner(glassContext);
  15744. return appController.showErrorMessage(StringResources.get('errLoadingView'), StringResources.get('CAInitTitle'));
  15745. });
  15746. };
  15747. });
  15748. //# sourceMappingURL=StartupCA.js.map
  15749. ;
  15750. !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define('caglass/icons/ba-login-icon-bundle',[],e);else{var n=e();for(var r in n)("object"==typeof exports?exports:t)[r]=n[r]}}(window,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},n.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}({0:function(t,e,n){n("f69f3cc35d9d7e069ab8"),n("c7e74f3ded7b2423ac05"),n("502bc6fc6b5a47d78dca"),n("dd7a6562fd2654d2c026"),n("ade9a0280e3f1ee6338b"),n("3849399a2893e2397738"),t.exports=n("2ea9df5638a4b723c072")},"2b419eb9b5086dc822ae":function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},"2ea9df5638a4b723c072":function(t,e,n){"use strict";n.r(e);var r=n("9689a9c94ae38b47fa2c"),o=n.n(r),i=n("9ce58a7deea14f49ef01"),a=n.n(i),s=new o.a({id:"login-TheOldPassword",use:"login-TheOldPassword-usage",viewBox:"0 0 32 32",content:'<symbol xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 32 32" id="login-TheOldPassword">\r\n<g>\r\n\t<path d="M25,1L12.611,13.388C11.785,13.138,10.908,13,10,13c-4.971,0-9,4.029-9,9s4.029,9,9,9s9-4.029,9-9\r\n\t\tc0-0.909-0.138-1.785-0.389-2.612L21,17v-2h2l8-8V1H25z M29,6.171L22.172,13H21h-2v2v1.171l-1.803,1.802l-0.848,0.848l0.348,1.147\r\n\t\tC16.898,20.63,17,21.313,17,22c0,3.86-3.141,7-7,7s-7-3.14-7-7s3.141-7,7-7c0.686,0,1.37,0.102,2.031,0.302l1.146,0.348\r\n\t\tl0.848-0.848L25.828,3H29V6.171z" />\r\n\t<circle cx="8" cy="24" r="2" />\r\n\t<rect x="19.757" y="7.5" transform="matrix(-0.7071 0.7071 -0.7071 -0.7071 46.6274 -3.3137)" width="8.485" height="1" />\r\n</g>\r\n</symbol>'});a.a.add(s);e.default=s},"3849399a2893e2397738":function(t,e,n){"use strict";n.r(e);var r=n("9689a9c94ae38b47fa2c"),o=n.n(r),i=n("9ce58a7deea14f49ef01"),a=n.n(i),s=new o.a({id:"login-TheNewPassword",use:"login-TheNewPassword-usage",viewBox:"0 0 32 32",content:'<symbol xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 32 32" id="login-TheNewPassword">\r\n<g>\r\n\t<path d="M25,1L12.611,13.388C11.785,13.138,10.908,13,10,13c-4.971,0-9,4.029-9,9s4.029,9,9,9s9-4.029,9-9\r\n\t\tc0-0.909-0.138-1.785-0.389-2.612L21,17v-2h2l8-8V1H25z M29,6.171L22.172,13H21h-2v2v1.171l-1.803,1.802l-0.848,0.848l0.348,1.147\r\n\t\tC16.898,20.63,17,21.313,17,22c0,3.86-3.141,7-7,7s-7-3.14-7-7s3.141-7,7-7c0.686,0,1.37,0.102,2.031,0.302l1.146,0.348\r\n\t\tl0.848-0.848L25.828,3H29V6.171z" />\r\n\t<circle cx="8" cy="24" r="2" />\r\n\t<rect x="19.757" y="7.5" transform="matrix(-0.7071 0.7071 -0.7071 -0.7071 46.6274 -3.3137)" width="8.485" height="1" />\r\n</g>\r\n</symbol>'});a.a.add(s);e.default=s},"502bc6fc6b5a47d78dca":function(t,e,n){"use strict";n.r(e);var r=n("9689a9c94ae38b47fa2c"),o=n.n(r),i=n("9ce58a7deea14f49ef01"),a=n.n(i),s=new o.a({id:"login-CAMPassword",use:"login-CAMPassword-usage",viewBox:"0 0 32 32",content:'<symbol xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 32 32" id="login-CAMPassword">\r\n<g>\r\n\t<path d="M25,1L12.611,13.388C11.785,13.138,10.908,13,10,13c-4.971,0-9,4.029-9,9s4.029,9,9,9s9-4.029,9-9\r\n\t\tc0-0.909-0.138-1.785-0.389-2.612L21,17v-2h2l8-8V1H25z M29,6.171L22.172,13H21h-2v2v1.171l-1.803,1.802l-0.848,0.848l0.348,1.147\r\n\t\tC16.898,20.63,17,21.313,17,22c0,3.86-3.141,7-7,7s-7-3.14-7-7s3.141-7,7-7c0.686,0,1.37,0.102,2.031,0.302l1.146,0.348\r\n\t\tl0.848-0.848L25.828,3H29V6.171z" />\r\n\t<circle cx="8" cy="24" r="2" />\r\n\t<rect x="19.757" y="7.5" transform="matrix(-0.7071 0.7071 -0.7071 -0.7071 46.6274 -3.3137)" width="8.485" height="1" />\r\n</g>\r\n</symbol>'});a.a.add(s);e.default=s},"9689a9c94ae38b47fa2c":function(t,e,n){(function(e){!function(e,n){t.exports=n()}(0,function(){"use strict";var t=function(t){var e=t.id,n=t.viewBox,r=t.content;this.id=e,this.viewBox=n,this.content=r};t.prototype.stringify=function(){return this.content},t.prototype.toString=function(){return this.stringify()},t.prototype.destroy=function(){var t=this;["id","viewBox","content"].forEach(function(e){return delete t[e]})};"undefined"!=typeof window?window:void 0!==e||"undefined"!=typeof self&&self;function n(t,e){return t(e={exports:{}},e.exports),e.exports}var r=n(function(t,e){t.exports=function(){function t(t){var e=t&&"object"==typeof t;return e&&"[object RegExp]"!==Object.prototype.toString.call(t)&&"[object Date]"!==Object.prototype.toString.call(t)}function e(e,n){var o=n&&!0===n.clone;return o&&t(e)?r(function(t){return Array.isArray(t)?[]:{}}(e),e,n):e}function n(n,o,i){var a=n.slice();return o.forEach(function(o,s){void 0===a[s]?a[s]=e(o,i):t(o)?a[s]=r(n[s],o,i):-1===n.indexOf(o)&&a.push(e(o,i))}),a}function r(o,i,a){var s=Array.isArray(i),c=a||{arrayMerge:n},u=c.arrayMerge||n;return s?Array.isArray(o)?u(o,i,a):e(i,a):function(n,o,i){var a={};return t(n)&&Object.keys(n).forEach(function(t){a[t]=e(n[t],i)}),Object.keys(o).forEach(function(s){t(o[s])&&n[s]?a[s]=r(n[s],o[s],i):a[s]=e(o[s],i)}),a}(o,i,a)}return r.all=function(t,e){if(!Array.isArray(t)||t.length<2)throw new Error("first argument should be an array with at least two elements");return t.reduce(function(t,n){return r(t,n,e)})},r}()}),o=n(function(t,e){e.default={svg:{name:"xmlns",uri:"http://www.w3.org/2000/svg"},xlink:{name:"xmlns:xlink",uri:"http://www.w3.org/1999/xlink"}},t.exports=e.default}),i=o.svg,a=o.xlink,s={};s[i.name]=i.uri,s[a.name]=a.uri;var c=function(t,e){return void 0===t&&(t=""),"<svg "+function(t){return Object.keys(t).map(function(e){return e+'="'+t[e].toString().replace(/"/g,"&quot;")+'"'}).join(" ")}(r(s,e||{}))+">"+t+"</svg>"};return function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={isMounted:{}};return n.isMounted.get=function(){return!!this.node},e.createFromExistingNode=function(t){return new e({id:t.getAttribute("id"),viewBox:t.getAttribute("viewBox"),content:t.outerHTML})},e.prototype.destroy=function(){this.isMounted&&this.unmount(),t.prototype.destroy.call(this)},e.prototype.mount=function(t){if(this.isMounted)return this.node;var e="string"==typeof t?document.querySelector(t):t,n=this.render();return this.node=n,e.appendChild(n),n},e.prototype.render=function(){var t=this.stringify();return function(t){var e=!!document.importNode,n=(new DOMParser).parseFromString(t,"image/svg+xml").documentElement;return e?document.importNode(n,!0):n}(c(t)).childNodes[0]},e.prototype.unmount=function(){this.node.parentNode.removeChild(this.node)},Object.defineProperties(e.prototype,n),e}(t)})}).call(this,n("2b419eb9b5086dc822ae"))},"9ce58a7deea14f49ef01":function(t,e,n){(function(e){!function(e,n){t.exports=n()}(0,function(){"use strict";"undefined"!=typeof window?window:void 0!==e||"undefined"!=typeof self&&self;function t(t,e){return t(e={exports:{}},e.exports),e.exports}var n=t(function(t,e){t.exports=function(){function t(t){var e=t&&"object"==typeof t;return e&&"[object RegExp]"!==Object.prototype.toString.call(t)&&"[object Date]"!==Object.prototype.toString.call(t)}function e(e,n){var o=n&&!0===n.clone;return o&&t(e)?r(function(t){return Array.isArray(t)?[]:{}}(e),e,n):e}function n(n,o,i){var a=n.slice();return o.forEach(function(o,s){void 0===a[s]?a[s]=e(o,i):t(o)?a[s]=r(n[s],o,i):-1===n.indexOf(o)&&a.push(e(o,i))}),a}function r(o,i,a){var s=Array.isArray(i),c=a||{arrayMerge:n},u=c.arrayMerge||n;return s?Array.isArray(o)?u(o,i,a):e(i,a):function(n,o,i){var a={};return t(n)&&Object.keys(n).forEach(function(t){a[t]=e(n[t],i)}),Object.keys(o).forEach(function(s){t(o[s])&&n[s]?a[s]=r(n[s],o[s],i):a[s]=e(o[s],i)}),a}(o,i,a)}return r.all=function(t,e){if(!Array.isArray(t)||t.length<2)throw new Error("first argument should be an array with at least two elements");return t.reduce(function(t,n){return r(t,n,e)})},r}()});var r=t(function(t,e){e.default={svg:{name:"xmlns",uri:"http://www.w3.org/2000/svg"},xlink:{name:"xmlns:xlink",uri:"http://www.w3.org/1999/xlink"}},t.exports=e.default}),o=r.svg,i=r.xlink,a={};a[o.name]=o.uri,a[i.name]=i.uri;var s,c=function(t,e){return void 0===t&&(t=""),"<svg "+function(t){return Object.keys(t).map(function(e){return e+'="'+t[e].toString().replace(/"/g,"&quot;")+'"'}).join(" ")}(n(a,e||{}))+">"+t+"</svg>"},u=r.svg,d=r.xlink,f={attrs:(s={style:["position: absolute","width: 0","height: 0"].join("; ")},s[u.name]=u.uri,s[d.name]=d.uri,s)},l=function(t){this.config=n(f,t||{}),this.symbols=[]};l.prototype.add=function(t){var e=this.symbols,n=this.find(t.id);return n?(e[e.indexOf(n)]=t,!1):(e.push(t),!0)},l.prototype.remove=function(t){var e=this.symbols,n=this.find(t);return!!n&&(e.splice(e.indexOf(n),1),n.destroy(),!0)},l.prototype.find=function(t){return this.symbols.filter(function(e){return e.id===t})[0]||null},l.prototype.has=function(t){return null!==this.find(t)},l.prototype.stringify=function(){var t=this.config.attrs,e=this.symbols.map(function(t){return t.stringify()}).join("");return c(e,t)},l.prototype.toString=function(){return this.stringify()},l.prototype.destroy=function(){this.symbols.forEach(function(t){return t.destroy()})};var p=function(t){var e=t.id,n=t.viewBox,r=t.content;this.id=e,this.viewBox=n,this.content=r};p.prototype.stringify=function(){return this.content},p.prototype.toString=function(){return this.stringify()},p.prototype.destroy=function(){var t=this;["id","viewBox","content"].forEach(function(e){return delete t[e]})};var h=function(t){var e=!!document.importNode,n=(new DOMParser).parseFromString(t,"image/svg+xml").documentElement;return e?document.importNode(n,!0):n},g=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={isMounted:{}};return n.isMounted.get=function(){return!!this.node},e.createFromExistingNode=function(t){return new e({id:t.getAttribute("id"),viewBox:t.getAttribute("viewBox"),content:t.outerHTML})},e.prototype.destroy=function(){this.isMounted&&this.unmount(),t.prototype.destroy.call(this)},e.prototype.mount=function(t){if(this.isMounted)return this.node;var e="string"==typeof t?document.querySelector(t):t,n=this.render();return this.node=n,e.appendChild(n),n},e.prototype.render=function(){var t=this.stringify();return h(c(t)).childNodes[0]},e.prototype.unmount=function(){this.node.parentNode.removeChild(this.node)},Object.defineProperties(e.prototype,n),e}(p),m={autoConfigure:!0,mountTo:"body",syncUrlsWithBaseTag:!1,listenLocationChangeEvent:!0,locationChangeEvent:"locationChange",locationChangeAngularEmitter:!1,usagesToUpdate:"use[*|href]",moveGradientsOutsideSymbol:!1},y=function(t){return Array.prototype.slice.call(t,0)},v=navigator.userAgent,w={isChrome:/chrome/i.test(v),isFirefox:/firefox/i.test(v),isIE:/msie/i.test(v)||/trident/i.test(v),isEdge:/edge/i.test(v)},x=function(t){var e=[];return y(t.querySelectorAll("style")).forEach(function(t){t.textContent+="",e.push(t)}),e},b=function(t){return(t||window.location.href).split("#")[0]},M=function(t){angular.module("ng").run(["$rootScope",function(e){e.$on("$locationChangeSuccess",function(e,n,r){!function(t,e){var n=document.createEvent("CustomEvent");n.initCustomEvent(t,!1,!1,e),window.dispatchEvent(n)}(t,{oldUrl:r,newUrl:n})})}])},_=function(t,e){return void 0===e&&(e="linearGradient, radialGradient, pattern"),y(t.querySelectorAll("symbol")).forEach(function(t){y(t.querySelectorAll(e)).forEach(function(e){t.parentNode.insertBefore(e,t)})}),t};var E=r.xlink.uri,S="xlink:href",O=/[{}|\\\^\[\]`"<>]/g;function C(t){return t.replace(O,function(t){return"%"+t[0].charCodeAt(0).toString(16).toUpperCase()})}var A,B=["clipPath","colorProfile","src","cursor","fill","filter","marker","markerStart","markerMid","markerEnd","mask","stroke","style"],N=B.map(function(t){return"["+t+"]"}).join(","),j=function(t,e,n,r){var o=C(n),i=C(r);(function(t,e){return y(t).reduce(function(t,n){if(!n.attributes)return t;var r=y(n.attributes),o=e?r.filter(e):r;return t.concat(o)},[])})(t.querySelectorAll(N),function(t){var e=t.localName,n=t.value;return-1!==B.indexOf(e)&&-1!==n.indexOf("url("+o)}).forEach(function(t){return t.value=t.value.replace(o,i)}),function(t,e,n){y(t).forEach(function(t){var r=t.getAttribute(S);if(r&&0===r.indexOf(e)){var o=r.replace(e,n);t.setAttributeNS(E,S,o)}})}(e,o,i)},k={MOUNT:"mount",SYMBOL_MOUNT:"symbol_mount"},T=function(t){function e(e){var r=this;void 0===e&&(e={}),t.call(this,n(m,e));var o=function(t){return t=t||Object.create(null),{on:function(e,n){(t[e]||(t[e]=[])).push(n)},off:function(e,n){t[e]&&t[e].splice(t[e].indexOf(n)>>>0,1)},emit:function(e,n){(t[e]||[]).map(function(t){t(n)}),(t["*"]||[]).map(function(t){t(e,n)})}}}();this._emitter=o,this.node=null;var i=this.config;if(i.autoConfigure&&this._autoConfigure(e),i.syncUrlsWithBaseTag){var a=document.getElementsByTagName("base")[0].getAttribute("href");o.on(k.MOUNT,function(){return r.updateUrls("#",a)})}var s=this._handleLocationChange.bind(this);this._handleLocationChange=s,i.listenLocationChangeEvent&&window.addEventListener(i.locationChangeEvent,s),i.locationChangeAngularEmitter&&M(i.locationChangeEvent),o.on(k.MOUNT,function(t){i.moveGradientsOutsideSymbol&&_(t)}),o.on(k.SYMBOL_MOUNT,function(t){i.moveGradientsOutsideSymbol&&_(t.parentNode),(w.isIE||w.isEdge)&&x(t)})}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={isMounted:{}};return r.isMounted.get=function(){return!!this.node},e.prototype._autoConfigure=function(t){var e=this.config;void 0===t.syncUrlsWithBaseTag&&(e.syncUrlsWithBaseTag=void 0!==document.getElementsByTagName("base")[0]),void 0===t.locationChangeAngularEmitter&&(e.locationChangeAngularEmitter="angular"in window),void 0===t.moveGradientsOutsideSymbol&&(e.moveGradientsOutsideSymbol=w.isFirefox)},e.prototype._handleLocationChange=function(t){var e=t.detail,n=e.oldUrl,r=e.newUrl;this.updateUrls(n,r)},e.prototype.add=function(e){var n=t.prototype.add.call(this,e);return this.isMounted&&n&&(e.mount(this.node),this._emitter.emit(k.SYMBOL_MOUNT,e.node)),n},e.prototype.attach=function(t){var e=this,n=this;if(n.isMounted)return n.node;var r="string"==typeof t?document.querySelector(t):t;return n.node=r,this.symbols.forEach(function(t){t.mount(n.node),e._emitter.emit(k.SYMBOL_MOUNT,t.node)}),y(r.querySelectorAll("symbol")).forEach(function(t){var e=g.createFromExistingNode(t);e.node=t,n.add(e)}),this._emitter.emit(k.MOUNT,r),r},e.prototype.destroy=function(){var t=this.config,e=this.symbols,n=this._emitter;e.forEach(function(t){return t.destroy()}),n.off("*"),window.removeEventListener(t.locationChangeEvent,this._handleLocationChange),this.isMounted&&this.unmount()},e.prototype.mount=function(t,e){void 0===t&&(t=this.config.mountTo),void 0===e&&(e=!1);if(this.isMounted)return this.node;var n="string"==typeof t?document.querySelector(t):t,r=this.render();return this.node=r,e&&n.childNodes[0]?n.insertBefore(r,n.childNodes[0]):n.appendChild(r),this._emitter.emit(k.MOUNT,r),r},e.prototype.render=function(){return h(this.stringify())},e.prototype.unmount=function(){this.node.parentNode.removeChild(this.node)},e.prototype.updateUrls=function(t,e){if(!this.isMounted)return!1;var n=document.querySelectorAll(this.config.usagesToUpdate);return j(this.node,n,b(t)+"#",b(e)+"#"),!0},Object.defineProperties(e.prototype,r),e}(l),L=t(function(t){
  15751. /*!
  15752. * domready (c) Dustin Diaz 2014 - License MIT
  15753. */
  15754. t.exports=function(){var t,e=[],n=document,r=(n.documentElement.doScroll?/^loaded|^c/:/^loaded|^i|^c/).test(n.readyState);return r||n.addEventListener("DOMContentLoaded",t=function(){for(n.removeEventListener("DOMContentLoaded",t),r=1;t=e.shift();)t()}),function(t){r?setTimeout(t,0):e.push(t)}}()});!!window.__SVG_SPRITE__?A=window.__SVG_SPRITE__:(A=new T({attrs:{id:"__SVG_SPRITE_NODE__"}}),window.__SVG_SPRITE__=A);var U=function(){var t=document.getElementById("__SVG_SPRITE_NODE__");t?A.attach(t):A.mount(document.body,!0)};return document.body?U():L(U),A})}).call(this,n("2b419eb9b5086dc822ae"))},ade9a0280e3f1ee6338b:function(t,e,n){"use strict";n.r(e);var r=n("9689a9c94ae38b47fa2c"),o=n.n(r),i=n("9ce58a7deea14f49ef01"),a=n.n(i),s=new o.a({id:"login-tenantid",use:"login-tenantid-usage",viewBox:"0 0 32 32",content:'<symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" id="login-tenantid">\n<path d="M16 21c5.523 0 10-4.477 10-10S21.523 1 16 1 6 5.477 6 11s4.477 10 10 10zm0-18c4.411 0 8 3.589 8 8s-3.589 8-8 8-8-3.589-8-8 3.589-8 8-8zm8 20H8a4 4 0 0 0-4 4v4h24v-4a4 4 0 0 0-4-4z" />\n</symbol>'});a.a.add(s);e.default=s},c7e74f3ded7b2423ac05:function(t,e,n){"use strict";n.r(e);var r=n("9689a9c94ae38b47fa2c"),o=n.n(r),i=n("9ce58a7deea14f49ef01"),a=n.n(i),s=new o.a({id:"login-CAMNamespace",use:"login-CAMNamespace-usage",viewBox:"0 0 32 32",content:'<symbol xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 32 32" id="login-CAMNamespace">\n<g>\n\t<g>\n\t\t<g>\n\t\t\t<path d="M24,19c-2.419,0-4.435,1.718-4.899,4h-6.201c-0.13-0.638-0.384-1.23-0.731-1.754l9.078-9.077\n\t\t\t\tC22.036,12.692,22.981,13,24,13c2.762,0,5-2.238,5-5s-2.238-5-5-5c-2.419,0-4.435,1.718-4.899,4h-6.201\n\t\t\t\tC12.436,4.718,10.419,3,8,3C5.238,3,3,5.238,3,8s2.238,5,5,5c2.419,0,4.436-1.718,4.899-4h6.201\n\t\t\t\tc0.13,0.638,0.384,1.23,0.731,1.754l-9.078,9.077C9.964,19.308,9.019,19,8,19c-2.762,0-5,2.238-5,5s2.238,5,5,5\n\t\t\t\tc2.419,0,4.436-1.718,4.899-4h6.201c0.464,2.282,2.481,4,4.899,4c2.762,0,5-2.238,5-5S26.762,19,24,19z M24,5\n\t\t\t\tc1.657,0,3,1.343,3,3s-1.343,3-3,3s-3-1.343-3-3S22.343,5,24,5z M8,11c-1.657,0-3-1.343-3-3s1.343-3,3-3s3,1.343,3,3\n\t\t\t\tS9.657,11,8,11z M8,27c-1.657,0-3-1.343-3-3s1.343-3,3-3s3,1.343,3,3S9.657,27,8,27z" />\n\t\t</g>\n\t</g>\n</g>\n</symbol>'});a.a.add(s);e.default=s},dd7a6562fd2654d2c026:function(t,e,n){"use strict";n.r(e);var r=n("9689a9c94ae38b47fa2c"),o=n.n(r),i=n("9ce58a7deea14f49ef01"),a=n.n(i),s=new o.a({id:"login-CAMUsername",use:"login-CAMUsername-usage",viewBox:"0 0 32 32",content:'<symbol xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 32 32" id="login-CAMUsername">\r\n<g>\r\n\t<path d="M16,21c5.523,0,10-4.477,10-10S21.523,1,16,1S6,5.477,6,11S10.477,21,16,21z M16,3c4.411,0,8,3.589,8,8s-3.589,8-8,8\r\n\t\ts-8-3.589-8-8S11.589,3,16,3z" />\r\n\t<path d="M24,23H8c-2.209,0-4,1.791-4,4v4h24v-4C28,24.791,26.209,23,24,23z" />\r\n</g>\r\n</symbol>'});a.a.add(s);e.default=s},f69f3cc35d9d7e069ab8:function(t,e,n){"use strict";n.r(e);var r=n("9689a9c94ae38b47fa2c"),o=n.n(r),i=n("9ce58a7deea14f49ef01"),a=n.n(i),s=new o.a({id:"error_24",use:"error_24-usage",viewBox:"0 0 24 24",content:'<symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" id="error_24"><path d="M12 1C5.9 1 1 5.9 1 12s4.9 11 11 11 11-4.9 11-11S18.1 1 12 1zm1 16h-2v-2h2v2zm0-4h-2V6h2v7z" /></symbol>'});a.a.add(s);e.default=s}})});
  15755. /**
  15756. * Licensed Materials - Property of IBM
  15757. * IBM Cognos Products: BI
  15758. * (C) Copyright IBM Corp. 2018, 2022
  15759. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  15760. */
  15761. define('caglass/app/LoginCA',['jquery', 'underscore', 'baglass/app/AppController', 'caglass/ajax/CAAuthentication', 'baglass/nls/StringResources', 'baglass/core-client/js/core-client/utils/PerfUtils', 'baglass/core-client/js/core-client/utils/Utils', 'baglass/core-client/js/core-client/utils/UrlUtils', 'baglass/core-client/js/core-client/utils/BrowserUtils', 'baglass/utils/Utils', 'caglass/app/services/LogoutService', 'caglass/ajax/PrepareRequest', 'caglass/ajax/HandleError', 'caglass/utils/CAUtils', 'caglass/caglass.webpack.bundle', 'jquery-ui', 'jquery-bbq', '../icons/ba-login-icon-bundle'], function ($, _, AppController, CAAuthentication, StringResources, PerfUtils, CoreUtils, UrlUtils, BrowserUtils, GlassUtils, LogoutService, PrepareRequest, HandleError, CAUtils, CAGlassBundle) {
  15762. var postSecondaryLogin = CAGlassBundle.postSecondaryLogin;
  15763. return function (inlineContext) {
  15764. PerfUtils.createPerformanceMark({
  15765. 'component': 'bi_commons',
  15766. 'name': 'entry',
  15767. 'state': 'start'
  15768. });
  15769. var appController = new AppController({
  15770. '$rootPane': $('#main'),
  15771. installInfo: inlineContext.configuration.installInfo,
  15772. versionInfo: inlineContext.versionInfo,
  15773. perspectives: inlineContext.perspectives
  15774. });
  15775. window.__glassAppController = appController;
  15776. var glassContext = appController.glassContext;
  15777. var configService = glassContext.getCoreSvc('.Config');
  15778. configService.initialize(inlineContext.configuration);
  15779. var ajaxSrv = glassContext.getCoreSvc('.Ajax');
  15780. ajaxSrv.addRequestHandler(new PrepareRequest(glassContext));
  15781. ajaxSrv.setErrorHandler(new HandleError(glassContext));
  15782. var logoutService = new LogoutService();
  15783. glassContext.services.register('.Logout', logoutService);
  15784. var currentWindow = glassContext.window || CoreUtils.getCurrentWindow();
  15785. glassContext.gateway = currentWindow.location.pathname.substr(0, currentWindow.location.pathname.lastIndexOf('/'));
  15786. appController.detectAccessibilityChange();
  15787. var queryString = _.unescape($('#queryString_data').text());
  15788. var content = GlassUtils.getAppContent(queryString, $.param.fragment(), glassContext);
  15789. glassContext.getCoreSvc('.Events').on('appView:loaded', CAUtils.removeLoadingSpinner.bind(this, glassContext), 'removeLoadingSpinnerFunction');
  15790. var requestMethod = inlineContext.requestMethod || 'GET';
  15791. var caAuthentication = new CAAuthentication();
  15792. var loginComplete;
  15793. if (content.legacyLogin) {
  15794. var origin = {
  15795. legacyLogin: true,
  15796. redirectUrl: content.legacyLogin
  15797. };
  15798. loginComplete = caAuthentication.legacyLogin(glassContext, origin).then(function () {
  15799. currentWindow.location = content.legacyLogin;
  15800. });
  15801. } else if (content.secondaryLogin) {
  15802. var state;
  15803. if (content.state) {
  15804. state = JSON.parse(UrlUtils.base64Decode(content.state));
  15805. }
  15806. loginComplete = caAuthentication.secondaryLogin(glassContext, state).then(function (result) {
  15807. return postSecondaryLogin(currentWindow, result);
  15808. })["catch"](function (error) {
  15809. glassContext.getCoreSvc('.Logger').error('Error showing the login prompt', error);
  15810. return appController.showErrorMessage(StringResources.get('unableLogin'), StringResources.get('CAInitTitle'));
  15811. });
  15812. } else {
  15813. loginComplete = caAuthentication.login(glassContext, {
  15814. initialLogin: true,
  15815. requestMethod: requestMethod,
  15816. queryString: $.deparam(queryString)
  15817. }).then(function () {
  15818. if (currentWindow.external && currentWindow.external.HasOnClose) {
  15819. return currentWindow.external.OnClose(0);
  15820. }
  15821. if (requestMethod === 'POST') {
  15822. currentWindow.location.assign(currentWindow.location.pathname + '?' + CAUtils.removeCAMNamespaceHref(queryString));
  15823. } else {
  15824. var currentUrl = new window.URL(currentWindow.location.href);
  15825. var currentPerspective = currentUrl.searchParams.get('perspective');
  15826. if (glassContext.isLoginViewShown() && currentPerspective === glassContext.getCurrentPerspective()) {
  15827. currentUrl.searchParams["delete"]('perspective');
  15828. }
  15829. currentUrl.pathname = currentUrl.pathname.replace('/login', '');
  15830. if (content.CAMNamespace) {
  15831. currentUrl.href = CAUtils.removeCAMNamespaceHref(currentUrl.href);
  15832. }
  15833. currentWindow.location.assign(currentUrl.pathname + currentUrl.search + currentUrl.hash);
  15834. }
  15835. })["catch"](function (error) {
  15836. glassContext.getCoreSvc('.Logger').error('Cannot login', error);
  15837. return appController.showErrorMessage(StringResources.get('unableLogin'), StringResources.get('CAInitTitle'));
  15838. });
  15839. }
  15840. return loginComplete;
  15841. };
  15842. });
  15843. //# sourceMappingURL=LoginCA.js.map
  15844. ;
  15845. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  15846. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  15847. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  15848. /**
  15849. * Licensed Materials - Property of IBM
  15850. * IBM Cognos Products: CA Glass
  15851. * Copyright IBM Corp. 2019
  15852. * US Government Users Restricted Rights - Use, duplication or disclosure
  15853. * restricted by GSA ADP Schedule Contract with IBM Corp.
  15854. */
  15855. /**
  15856. * A simple perspective service responsible for pulling the glass banner message from the config service
  15857. * and adding it as an alert to the whats new banner.
  15858. * @function
  15859. */
  15860. define('caglass/app/services/CloudMaintenanceBannerService',['caglass/nls/StringResources'], function (StringResources) {
  15861. var GLASS_MAINTENANCE_MESSAGE = 'Glass.maintenanceMessage';
  15862. var GLASS_MAINTENANCE_LINK = 'Glass.maintenanceLink';
  15863. var MAINTENANCE_ID = 'MaintenanceMessage';
  15864. var MAINTENANCE_TITLE = 'maintenanceTitle';
  15865. var MAINTENANCE_LINK = 'maintenanceLink';
  15866. return /*#__PURE__*/function () {
  15867. function CloudMaintenanceBannerService() {
  15868. _classCallCheck(this, CloudMaintenanceBannerService);
  15869. }
  15870. _createClass(CloudMaintenanceBannerService, [{
  15871. key: "initialize",
  15872. value: function initialize(glassContext) {
  15873. if (glassContext) {
  15874. var configuration = glassContext.getCoreSvc('.Config');
  15875. if (configuration[GLASS_MAINTENANCE_MESSAGE]) {
  15876. var maintenanceAlert = {
  15877. id: MAINTENANCE_ID,
  15878. title: StringResources.get(MAINTENANCE_TITLE),
  15879. message: configuration[GLASS_MAINTENANCE_MESSAGE]
  15880. };
  15881. if (configuration[GLASS_MAINTENANCE_LINK]) {
  15882. maintenanceAlert['action'] = {
  15883. id: GLASS_MAINTENANCE_LINK,
  15884. label: StringResources.get(MAINTENANCE_LINK),
  15885. url: configuration[GLASS_MAINTENANCE_LINK]
  15886. };
  15887. }
  15888. var whatsNewService = glassContext.getCoreSvc('.Message');
  15889. if (whatsNewService) {
  15890. whatsNewService.addAlerts([maintenanceAlert]);
  15891. }
  15892. }
  15893. }
  15894. }
  15895. }]);
  15896. return CloudMaintenanceBannerService;
  15897. }();
  15898. });
  15899. //# sourceMappingURL=CloudMaintenanceBannerService.js.map
  15900. ;
  15901. /**
  15902. * Licensed Materials - Property of IBM
  15903. * IBM Cognos Products: BI Glass
  15904. * (C) Copyright IBM Corp. 2019
  15905. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  15906. */
  15907. define('caglass/app/services/all',['./CAFEncodingService', './CAUserProfileService', './CloudMaintenanceBannerService', './CredentialDialogBuilder', './DigitalContextService', './InstrumentationConfigBuilder', './LoginService', './LogoutService'], function () {});
  15908. //# sourceMappingURL=all.js.map
  15909. ;
  15910. /**
  15911. * Licensed Materials - Property of IBM
  15912. * IBM Cognos Products: BI Glass
  15913. * (C) Copyright IBM Corp. 2018
  15914. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  15915. */
  15916. define('caglass/app/all',['./StartupCA', './LoginCA', './services/all'], function () {});
  15917. //# sourceMappingURL=all.js.map
  15918. ;
  15919. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  15920. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  15921. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  15922. /**
  15923. * Licensed Materials - Property of IBM
  15924. * IBM Cognos Products: BI (C) Copyright IBM Corp. 2019
  15925. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  15926. */
  15927. define('caglass/common/services/WhatsNewService',['underscore', 'baglass/app/services/ConfigService'], function (_, ConfigService) {
  15928. var WhatsNewService = /*#__PURE__*/function () {
  15929. function WhatsNewService() {
  15930. var _this = this;
  15931. _classCallCheck(this, WhatsNewService);
  15932. this._loadMessage = function (event) {
  15933. if (!_this._perspectivesLoaded[event.perspective]) {
  15934. _this._perspectivesLoaded[event.perspective] = true;
  15935. _this._getWhatsNewMessages(event.perspective);
  15936. }
  15937. };
  15938. this.dismissMessage = function (id) {
  15939. window.localStorage.setItem(_this._getDismissalID(id), true);
  15940. };
  15941. }
  15942. _createClass(WhatsNewService, [{
  15943. key: "initialize",
  15944. value: function initialize(glassContext) {
  15945. this.glassContext = glassContext;
  15946. this._perspectivesLoaded = {};
  15947. this.messageService = this.glassContext.getCoreSvc('.Message');
  15948. if (this._isDisabled()) {
  15949. return;
  15950. }
  15951. glassContext.getCoreSvc('.Events').on('appView:loaded', this._loadMessage);
  15952. this._getWhatsNewMessages();
  15953. }
  15954. }, {
  15955. key: "_isDisabled",
  15956. value: function _isDisabled() {
  15957. var config = this.glassContext.getCoreSvc('.Config');
  15958. var isWhatsNewDisabled = config.getConfigValueSync(ConfigService.DISABLE_WHATSNEWSERVICE);
  15959. var isMessageServiceDisabled = this.messageService ? this.messageService.getDisabled() : true;
  15960. return isMessageServiceDisabled || isWhatsNewDisabled;
  15961. }
  15962. }, {
  15963. key: "_getWhatsNewMessages",
  15964. value: function _getWhatsNewMessages(currentPerspective) {
  15965. var _this2 = this;
  15966. return this._getMessagesAjax(currentPerspective).then(function (result) {
  15967. var messages = result.data;
  15968. if (messages && _.isArray(messages) && messages.length > 0) {
  15969. messages = messages.filter(function (message) {
  15970. return !_this2.isMessageDismissed(message.id);
  15971. });
  15972. if (_this2.messageService) {
  15973. _this2.messageService.addAlerts(messages, _this2.dismissMessage);
  15974. }
  15975. }
  15976. });
  15977. }
  15978. }, {
  15979. key: "_getMessagesAjax",
  15980. value: function _getMessagesAjax(perspective) {
  15981. return this.glassContext.getCoreSvc('.Ajax').ajax({
  15982. url: perspective ? WhatsNewService.ENDPOINT_PATH + perspective : WhatsNewService.ENDPOINT_PATH,
  15983. headers: {
  15984. 'accept-language': this.glassContext.getCoreSvc('.UserProfile').getProductLocale()
  15985. }
  15986. });
  15987. }
  15988. }, {
  15989. key: "isMessageDismissed",
  15990. value: function isMessageDismissed(id) {
  15991. return window.localStorage.getItem(this._getDismissalID(id)) != null;
  15992. }
  15993. }, {
  15994. key: "_getDismissalID",
  15995. value: function _getDismissalID(id) {
  15996. return id + '-' + this.glassContext.getCoreSvc('.UserProfile').getAccountID();
  15997. }
  15998. }]);
  15999. return WhatsNewService;
  16000. }();
  16001. WhatsNewService.ENDPOINT_PATH = 'v1/whatsnew/';
  16002. return WhatsNewService;
  16003. });
  16004. //# sourceMappingURL=WhatsNewService.js.map
  16005. ;
  16006. /**
  16007. * Licensed Materials - Property of IBM
  16008. * IBM Cognos Products: BI (C) Copyright IBM Corp. 2019
  16009. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  16010. */
  16011. define('caglass/common/services/all',['./WhatsNewService'], function () {});
  16012. //# sourceMappingURL=all.js.map
  16013. ;
  16014. /**
  16015. * Licensed Materials - Property of IBM
  16016. * IBM Cognos Products: BI (C) Copyright IBM Corp. 2019
  16017. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  16018. */
  16019. define('caglass/common/all',['./services/all'], function () {});
  16020. //# sourceMappingURL=all.js.map
  16021. ;
  16022. /**
  16023. * Licensed Materials - Property of IBM
  16024. * IBM Cognos Products: BI Glass
  16025. * (C) Copyright IBM Corp. 2019
  16026. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  16027. */
  16028. define('caglass/utils/all',['./CAUtils', './EntitlementObject'], function () {});
  16029. //# sourceMappingURL=all.js.map
  16030. ;
  16031. /*
  16032. * Licensed Materials - Property of IBM
  16033. *
  16034. * IBM Cognos Products: admin
  16035. *
  16036. * (C) Copyright IBM Corp. 2017
  16037. *
  16038. * US Government Users Restricted Rights - Use, duplication or disclosure
  16039. * restricted by GSA ADP Schedule Contract with IBM Corp.
  16040. */
  16041. define('baglass/core-client/js/core-client/utils/Promise',['bluebird'], function (Promise) {
  16042. Promise.prototype.fail = Promise.prototype.catch;
  16043. Promise.prototype.done = Promise.prototype.then;
  16044. // By default, BlueBird uses MutationObservers to ensure async callbacks.
  16045. // We have seen cases on IE where mutation events are delayed or fail
  16046. // completely, resulting in hung promises that have actually resolved.
  16047. // As a workaround, we can set the scheduler to use setTimeout for IE
  16048. // until we drop support for IE11.
  16049. if (/\b(MSIE|Trident|Edge)\b/.test(navigator.userAgent)) {
  16050. Promise.setScheduler(function (fn) {
  16051. setTimeout(fn, 0);
  16052. });
  16053. }
  16054. Object.defineProperty(window, 'Promise', {
  16055. get: function get() {
  16056. return Promise;
  16057. },
  16058. set: function set() {
  16059. try {
  16060. throw new Error('Tried to override the global Promise object');
  16061. } catch (err) {
  16062. console.warn(err);
  16063. }
  16064. }
  16065. });
  16066. return Promise;
  16067. });
  16068. //# sourceMappingURL=Promise.js.map
  16069. ;
  16070. /**
  16071. * Licensed Materials - Property of IBM
  16072. *
  16073. * IBM Cognos Products: BI
  16074. *
  16075. * Copyright IBM Corp. 2015, 2018
  16076. *
  16077. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  16078. */
  16079. define('baglass/core-client/js/core-client/ui/ProgressToast',['./View', 'underscore', 'jquery', 'toastr', '../utils/Utils', '../nls/StringResources', './ToastMessage', '../utils/JQueryExt', 'jquery-ui'], function (View, _, $, toastr, utils, StringResources, ToastMessage) {
  16080. /**
  16081. * @augments ToastMessage
  16082. */
  16083. var ProgressToast = ToastMessage.extend(
  16084. /**
  16085. * @lends ProgressToast.prototype
  16086. */
  16087. {
  16088. open: false,
  16089. hide: false,
  16090. currentBar: null,
  16091. progressPercentage: null,
  16092. statusBars: null,
  16093. _onComplete: null,
  16094. REMOVE_DELAY: 3000,
  16095. DEFAULT_DURATION: 500,
  16096. /**
  16097. * @classdesc Class allowing to create a progress toast
  16098. * @constructs
  16099. * @public
  16100. * @param {Object} [options] Options to override the behaviour of the toast.
  16101. * @param {String} [options.showMethod] : How the toast will show up (show, fadeIn, slideDown)
  16102. * @param {String} [options.hideMethod] : How the toast will hide (hide, fadeOut,slideUp)
  16103. * @param {Function} [options.onHidden] : Override the default callback when the toast is hidden
  16104. * @param {Function} [options.onShown] : Override the default callback when the toast is shown
  16105. * @param {Function} [options.onDetails] : Set the callback for the details btn and display it
  16106. * @param {Boolean} [options.noHideBtn] Hide the hide button
  16107. * @param {Boolean} [options.noCancelBtn] Hide the cancel button
  16108. * @param {Boolean} [options.noDetailsBtn] Hide the details button
  16109. * @example var progress = new Progress();
  16110. * @returns a progress object
  16111. * */
  16112. defaultOptions: {
  16113. 'newestOnTop': true,
  16114. 'tapToDismiss': false,
  16115. 'positionClass': 'toast-top-center',
  16116. 'preventDuplicates': false,
  16117. 'hideDuration': 500,
  16118. 'showEasing': 'swing',
  16119. 'hideEasing': 'linear',
  16120. 'showMethod': 'slideDown',
  16121. 'hideMethod': 'slideUp',
  16122. 'onClick': function onClick() {},
  16123. 'iconClasses': {
  16124. success: 'toast-progress'
  16125. }
  16126. },
  16127. btns: {
  16128. hide: {
  16129. class: 'hide-action',
  16130. i18n: 'progressHideBtn',
  16131. callback: function callback(e) {
  16132. $(e.target).blur();
  16133. this.remove(0);
  16134. this.setNextTabFocus(this.$el);
  16135. }
  16136. },
  16137. cancel: {
  16138. class: 'cancel',
  16139. i18n: 'cancel',
  16140. callback: function callback(e) {
  16141. $(e.target).blur();
  16142. this.remove(0);
  16143. this.setNextTabFocus(this.$el);
  16144. }
  16145. },
  16146. details: {
  16147. class: 'details',
  16148. i18n: 'details'
  16149. }
  16150. },
  16151. render: function render(message) {
  16152. var $btnWrapper = $('<div></div>', {
  16153. style: 'float:right;padding-right:16px;'
  16154. });
  16155. _.each(this.btns, function (btn, name) {
  16156. var $btn = $('<button type="button" tabIndex="0" class="toast-close-button ' + btn.class + '" role="button">' + StringResources.get(btn.i18n) + '</button>');
  16157. btn.$btn = $btn;
  16158. var capName = name.charAt(0).toUpperCase() + name.slice(1);
  16159. var callback = btn.callback || this.toastrOptions['on' + capName];
  16160. if (_.isUndefined(callback) || this.toastrOptions['no' + capName + 'Btn'] === true) {
  16161. this.hideButton(name);
  16162. }
  16163. if (_.isFunction(callback)) {
  16164. this['on' + capName](callback.bind(this));
  16165. }
  16166. $btnWrapper.append($btn);
  16167. }.bind(this));
  16168. var pMessage = _.isUndefined(message) ? StringResources.get('defaultProgressMessage') : message;
  16169. this.$el = toastr.success(_.escape(pMessage));
  16170. /*
  16171. * Remove applicable container aria attributes added by Toastr
  16172. * micro library which causes all visible toasts to be read again.
  16173. */
  16174. this.$el.parent().removeAttr('role aria-live');
  16175. this.setMessage(pMessage);
  16176. var toastId = this._getUniqueId();
  16177. var toastMsgId = toastId + 'Msg';
  16178. this.$el.attr({
  16179. 'id': toastId,
  16180. 'aria-labelledby': toastMsgId
  16181. });
  16182. this.$el.find('div.toast-close-button').attr('class', 'toast-buttons');
  16183. var $barWrapper = $('<div>', {
  16184. 'class': 'linear-bar-wrapper'
  16185. });
  16186. var $loadingBar = $('<div>');
  16187. var $loadingIndefMeter = $('<div>', {
  16188. 'class': 'loading-indef-meter hidden'
  16189. });
  16190. var $indicator = $('<div>', {
  16191. 'class': 'loading-indicator'
  16192. });
  16193. var $loadingMeter = $('<div>', {
  16194. 'class': 'loading-meter'
  16195. });
  16196. var $loadingComplete = $('<div>', {
  16197. 'class': 'loading-complete hidden'
  16198. });
  16199. var $loadingMeteorPause = $('<div>', {
  16200. 'class': 'loading-pause-grey hidden'
  16201. });
  16202. var $loadingBarPause = $('<div>', {});
  16203. var $loadingMeteorFail = $('<div>', {
  16204. 'class': 'loading-fail-grey hidden'
  16205. });
  16206. $loadingBar.append($indicator);
  16207. $loadingMeter.append($loadingBar);
  16208. $barWrapper.append($loadingMeter);
  16209. $loadingMeteorPause.append($loadingBarPause);
  16210. $barWrapper.append($loadingMeteorPause);
  16211. $barWrapper.append($loadingMeteorFail);
  16212. $barWrapper.append($loadingIndefMeter);
  16213. $barWrapper.append($loadingComplete);
  16214. this.currentBar = $loadingMeter;
  16215. this.statusBars = {
  16216. 'progress': $loadingMeter,
  16217. 'indefinite': $loadingIndefMeter,
  16218. 'pause': $loadingMeteorPause,
  16219. 'fail': $loadingMeteorFail,
  16220. 'complete': $loadingComplete
  16221. };
  16222. this.progressPercentage = 0;
  16223. this.$el.append($btnWrapper);
  16224. this.$el.append($barWrapper);
  16225. $(this.$el).unbind('mouseenter mouseleave');
  16226. this.$el.find('.toast-message').attr('id', toastMsgId);
  16227. return this.$el;
  16228. },
  16229. /**
  16230. * Show the progress toast on the screen
  16231. * @public
  16232. * @param {String} [message] : Message of the progress toast
  16233. * @example progress.show('Uploading started');
  16234. * */
  16235. show: function show(message) {
  16236. if (!this.open) {
  16237. this.open = true;
  16238. toastr.options = this.toastrOptions;
  16239. return this.render(message);
  16240. }
  16241. },
  16242. /**
  16243. * Hide a button
  16244. * @public
  16245. * @param {String} [button] : Button that you want to hide, (hide, cancel, or details)
  16246. * @example progress.hideButton('cancel');
  16247. * */
  16248. hideButton: function hideButton(button) {
  16249. if (_.isString(button)) {
  16250. var name = button.toLowerCase();
  16251. var $btn = this.btns[name].$btn;
  16252. if ($btn) {
  16253. $btn.addClass('hidden');
  16254. }
  16255. }
  16256. },
  16257. /**
  16258. * Show a button
  16259. * @public
  16260. * @param {String} [button] : Button that you want to show, (hide, cancel, or details)
  16261. * @example progress.showButton('cancel');
  16262. * */
  16263. showButton: function showButton(button) {
  16264. if (_.isString(button)) {
  16265. var name = button.toLowerCase();
  16266. var $btn = this.btns[name].$btn;
  16267. if ($btn) {
  16268. $btn.removeClass('hidden');
  16269. }
  16270. }
  16271. },
  16272. /**
  16273. * Change the progress bar to definite progress
  16274. * @public
  16275. * @param {String} [message] : Message of the progress toast
  16276. * @example progress.progress('message');
  16277. * */
  16278. progress: function progress(message) {
  16279. var finalMessage = _.isUndefined(message) ? StringResources.get('defaultProgressMessage') : message;
  16280. this.setMessage(finalMessage);
  16281. this._setStatusToBar('progress');
  16282. this._changeBorderColor('progress');
  16283. this._setBarToNormal();
  16284. },
  16285. /**
  16286. * Change the progress bar to fail
  16287. * @public
  16288. * @param {String} [message] : Message of the progress toast
  16289. * @example progress.fail('message');
  16290. * */
  16291. fail: function fail(message) {
  16292. var finalMessage = _.isUndefined(message) ? StringResources.get('defaultFailMessage') : message;
  16293. this.setMessage(finalMessage);
  16294. this._setStatusToBar('fail');
  16295. this._changeBorderColor('fail');
  16296. },
  16297. /**
  16298. * Change the progress bar to pause
  16299. * @public
  16300. * @param {String} [message] : Message of the progress toast
  16301. * @example progress.pause('message');
  16302. * */
  16303. pause: function pause(message) {
  16304. var finalMessage = _.isUndefined(message) ? StringResources.get('defaultPauseMessage') : message;
  16305. this.setMessage(finalMessage);
  16306. this._setStatusToBar('pause');
  16307. this.currentBar.children().css('width', this.progressPercentage + '%');
  16308. },
  16309. /**
  16310. * Change the progress bar to indefinite progress
  16311. * @public
  16312. * @param {String} [message] : Message of the progress toast
  16313. * @example progress.indefinite('message');
  16314. * */
  16315. indefinite: function indefinite(message) {
  16316. var finalMessage = _.isUndefined(message) ? StringResources.get('defaultIndefiniteMessage') : message;
  16317. this.setMessage(finalMessage);
  16318. this._changeBorderColor('indefinite');
  16319. this._setStatusToBar('indefinite');
  16320. },
  16321. /**
  16322. * Change the current message
  16323. * @public
  16324. * @param {String} [message] : Message of the progress toast
  16325. * @example progress.setMessage('new message');
  16326. * */
  16327. setMessage: function setMessage(message) {
  16328. if (message) {
  16329. this.$el.find('.toast-message').text(message);
  16330. utils.activateAriaAlert(message);
  16331. }
  16332. },
  16333. /**
  16334. * Override callback when cancel button is clicked
  16335. * @public
  16336. * @param {Function} [callback] : The callback
  16337. * @example progress.onCancel(function(){alert('cancel called');});
  16338. * */
  16339. onCancel: function onCancel(callback) {
  16340. this.btns['cancel'].$btn.on('primaryaction', function (e) {
  16341. callback(e);
  16342. this.open = false;
  16343. }.bind(this));
  16344. },
  16345. /**
  16346. * Override callback when hide button is clicked
  16347. * @public
  16348. * @param {Function} [callback] : The callback
  16349. * @example progress.onHide(function(){alert('hide called');});
  16350. * */
  16351. onHide: function onHide(callback) {
  16352. this.btns['hide'].$btn.on('primaryaction', function (e) {
  16353. callback(e);
  16354. this.hide = true;
  16355. }.bind(this));
  16356. },
  16357. /**
  16358. * Override callback when details button is clicked
  16359. * @public
  16360. * @param {Function} [callback] : The callback
  16361. * @example progress.onDetails(function(){alert('details called');});
  16362. * */
  16363. onDetails: function onDetails(callback) {
  16364. this.btns['details'].$btn.on('primaryaction', function (e) {
  16365. callback(e);
  16366. }.bind(this));
  16367. },
  16368. /**
  16369. * Reset the progress bar to 0
  16370. * @public
  16371. * @example progress.reset();
  16372. * */
  16373. reset: function reset() {
  16374. this.statusBars.progress.find('> div').css('width', 0);
  16375. this.progress();
  16376. this.progressPercentage = 0;
  16377. if (this.open) {
  16378. this.open = false;
  16379. }
  16380. },
  16381. /**
  16382. * Get current progress
  16383. * @public
  16384. * @example progress.getCurrentProgress();
  16385. * @return {Integer} Value of the current progress.
  16386. * */
  16387. getCurrentProgress: function getCurrentProgress() {
  16388. return this.progressPercentage;
  16389. },
  16390. /**
  16391. * Remove toast
  16392. * @public
  16393. * @param {Integer} [delay] : Delay for the progress to be removed
  16394. * @example progress.getCurrentProgress();
  16395. * */
  16396. remove: function remove(delay) {
  16397. if (this.open) {
  16398. var $currentProgress = $('#' + this.$el.attr('id'));
  16399. delay = _.isUndefined(delay) ? this.REMOVE_DELAY : delay;
  16400. return new Promise(function (resolve) {
  16401. setTimeout(function () {
  16402. toastr.clear($currentProgress);
  16403. resolve();
  16404. }.bind(this), delay);
  16405. });
  16406. }
  16407. },
  16408. /**
  16409. * Set the progress bar to a certain percent
  16410. * @public
  16411. * @param {Integer} [percent] : The percentage of the bar [0-100]
  16412. * @param {Object} [options] : Options to override the animation
  16413. * @param {Integer} [options.duration] : Duration of the animation
  16414. * @param {String} [options.completeMsg] : Message when the progress is complete
  16415. * @param {Function} [options.onComplete] : Callback when the progress is complete
  16416. * @param {Integer} [options.removeDelay] : Delay for the progress to remove itself (-1 to not remove it)
  16417. * @param {Boolean} [options.isComplete] : Set the bar to complete state when true
  16418. * @example
  16419. * progress.setComplete(100, {'duration': 5000, 'onComplete':function(){alert('complete');}}
  16420. * @return {Boolean} If the animation worked or not
  16421. * */
  16422. setComplete: function setComplete(percent, options) {
  16423. var usedDuration;
  16424. if (_.isUndefined(percent)) {
  16425. return false;
  16426. }
  16427. if (!this.currentBar.hasClass('loading-meter')) {
  16428. this.progress();
  16429. }
  16430. if (!this.open || this.progressPercentage > percent || percent > 100) {
  16431. return false;
  16432. }
  16433. if (!_.isUndefined(options)) {
  16434. usedDuration = _.isUndefined(options.duration) ? this.DEFAULT_DURATION : options.duration;
  16435. }
  16436. var usedWidth = percent + '%';
  16437. this.progressPercentage = percent;
  16438. var animationOptions = {
  16439. width: usedWidth
  16440. };
  16441. var animationProperties = {
  16442. duration: usedDuration,
  16443. easing: 'swing'
  16444. };
  16445. animationProperties.complete = function () {
  16446. var completeFct = false;
  16447. var completeMessage;
  16448. var delay;
  16449. var isComplete;
  16450. if (!_.isUndefined(options)) {
  16451. if (!_.isUndefined(options.completeMsg)) {
  16452. completeMessage = options.completeMsg;
  16453. }
  16454. if (_.isFunction(options.onComplete)) {
  16455. completeFct = true;
  16456. }
  16457. isComplete = options.isComplete;
  16458. delay = _.isUndefined(options.removeDelay) ? this.REMOVE_DELAY : options.removeDelay;
  16459. }
  16460. if (isComplete) {
  16461. if (_.isUndefined(completeMessage)) {
  16462. completeMessage = StringResources.get('defaultCompleteMessage');
  16463. }
  16464. if (!this.hide) {
  16465. if (delay >= 0) {
  16466. this.remove(delay).then(function () {
  16467. this.open = false;
  16468. }.bind(this));
  16469. }
  16470. this._setBarToComplete(completeMessage);
  16471. this._changeBorderColor('complete');
  16472. } else {
  16473. var toast = new ToastMessage();
  16474. toast.show(completeMessage);
  16475. }
  16476. }
  16477. if (completeMessage) {
  16478. this.setMessage(completeMessage);
  16479. }
  16480. if (completeFct) {
  16481. options.onComplete();
  16482. }
  16483. }.bind(this);
  16484. this.$el.find('.loading-meter > div').animate(animationOptions, animationProperties);
  16485. return true;
  16486. },
  16487. /****Private functions****/
  16488. _getUniqueId: function _getUniqueId() {
  16489. return this.viewId + _.uniqueId('_progress');
  16490. },
  16491. _setStatusToBar: function _setStatusToBar(status) {
  16492. this.currentBar.addClass('hidden');
  16493. this.statusBars[status].removeClass('hidden');
  16494. this.currentBar = this.statusBars[status];
  16495. },
  16496. _setBarToComplete: function _setBarToComplete() {
  16497. this._setStatusToBar('complete');
  16498. this.btns['cancel'].$btn.addClass('hidden');
  16499. },
  16500. _changeBorderColor: function _changeBorderColor(status) {
  16501. this.$el.removeClass('progress indefinite fail complete');
  16502. this.$el.addClass(status);
  16503. },
  16504. _setBarToNormal: function _setBarToNormal() {
  16505. this._setStatusToBar('progress');
  16506. this.btns['cancel'].$btn.removeClass('hidden');
  16507. }
  16508. });
  16509. return ProgressToast;
  16510. });
  16511. //# sourceMappingURL=ProgressToast.js.map
  16512. ;
  16513. /**
  16514. * Licensed Materials - Property of IBM
  16515. * IBM Cognos Products: BI
  16516. * (C) Copyright IBM Corp. 2016, 2017
  16517. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  16518. */
  16519. define('baglass/core-client/js/core-client/utils/DatasetExecutionManager',['../ui/core/Events', '../nls/StringResources', '../ui/ProgressToast', './Deferred', 'underscore'], function (Events, StringResources, ProgressToast, Deferred, _) {
  16520. 'use strict';
  16521. var DatasetExecutionManager = Events.extend({
  16522. init: function init() {
  16523. DatasetExecutionManager.inherited('init', this, arguments);
  16524. this._backgroundExecutions = {};
  16525. // We want to ping a lot at the start and then slow down if the dataset take a long time
  16526. this._pingTimeouts = [300, 600, 1000, 1500, 2000, 4000, 6000, 10000];
  16527. this._defaultOptions = {
  16528. 'showToastWhenDone': true
  16529. };
  16530. },
  16531. /**
  16532. Will execute a dataset in the background. If the dataset is already running,
  16533. then it will be canceled before the new run is triggered.
  16534. @param options.id {string} - store ID of the dataset to run
  16535. @param options.name {stirng} - the name of the data set to execute. Will be shown in the toast
  16536. @param options.showToastWhenDone {boolean} - default is true, set to false if you don't want a toast to be displayed when the dataset is done running
  16537. @param options.glassContext {object} - the glassContext object
  16538. @param options.isRefresh {boolean} - default false. Set to true if doing a refresh from the context menu
  16539. **/
  16540. execute: function execute(options) {
  16541. var deferred = new Deferred();
  16542. _.defaults(options, this._defaultOptions);
  16543. // If we're already running the dataset then cancel it before we start another run
  16544. if (this.isExecuting(options.id)) {
  16545. this.cancel(options, false);
  16546. }
  16547. var timestamp = Date.now();
  16548. options.timestamp = timestamp;
  16549. this._backgroundExecutions[options.id] = {
  16550. 'status': 'executing',
  16551. 'timestamp': timestamp,
  16552. 'isRefresh': options.isRefresh
  16553. };
  16554. if (options.showToastWhenDone) {
  16555. this._createProgressToast(options);
  16556. }
  16557. var data = JSON.stringify({
  16558. 'options': {
  16559. 'delivery': {
  16560. 'save': {
  16561. 'notify': false
  16562. }
  16563. }
  16564. }
  16565. });
  16566. options.glassContext.services.ajax.post('v1/datasets/' + options.id + '/executions', {
  16567. 'headers': {
  16568. 'Content-Type': 'application/vnd.ibm.bi.platform.execution+json; charset=UTF-8',
  16569. 'Accept': 'application/json'
  16570. },
  16571. 'datatype': 'json',
  16572. 'data': data
  16573. }).then(function (result, status, xhr) {
  16574. this._backgroundExecutions[options.id].executionURL = xhr.getResponseHeader('location');
  16575. this._backgroundExecutions[options.id].eventID = result.eventID;
  16576. deferred.resolve();
  16577. this._pingForStatus(options);
  16578. }.bind(this), function () {
  16579. this._rejectDeferredObjects(options, 'failed');
  16580. deferred.reject();
  16581. }.bind(this));
  16582. return deferred.promise;
  16583. },
  16584. /**
  16585. Will create the progress toast to show the user that the data set is being loaded
  16586. **/
  16587. _createProgressToast: function _createProgressToast(options) {
  16588. var progressToast = new ProgressToast();
  16589. progressToast.show(this._getToastMessage(options));
  16590. progressToast.indefinite(this._getToastMessage(options));
  16591. progressToast.onCancel(function (options) {
  16592. this.cancel(options, true);
  16593. }.bind(this, options));
  16594. progressToast.onHide(function (options) {
  16595. this._hideProgressToast(options.id);
  16596. }.bind(this, options));
  16597. this._backgroundExecutions[options.id].progressToast = progressToast;
  16598. },
  16599. /**
  16600. Hide the progress toast
  16601. **/
  16602. _hideProgressToast: function _hideProgressToast(id) {
  16603. var execution = this._backgroundExecutions[id];
  16604. if (execution && execution.progressToast) {
  16605. execution.progressToast.remove(0);
  16606. execution.progressToast = null;
  16607. }
  16608. },
  16609. _showErrorToast: function _showErrorToast(options) {
  16610. var execution = this._backgroundExecutions[options.id];
  16611. if (options.showToastWhenDone) {
  16612. if (execution && execution.progressToast) {
  16613. // We don't want the error progress toast to get cleaned up, so null it out here
  16614. // so our cleanup code doesn't know to hide it. Sneaky sneaky.
  16615. var progressToast = execution.progressToast;
  16616. execution.progressToast = null;
  16617. progressToast.fail(this._getToastMessage(options));
  16618. progressToast.hideButton('cancel');
  16619. } else {
  16620. options.glassContext.appController.showToast(this._getToastMessage(options), {
  16621. 'type': 'error'
  16622. });
  16623. }
  16624. }
  16625. },
  16626. _showCancelledRefreshToast: function _showCancelledRefreshToast(options) {
  16627. options.glassContext.appController.showToast(this._getToastMessage(options), {
  16628. 'type': 'info'
  16629. });
  16630. },
  16631. /**
  16632. Will query the server for the status of the execution every once in a while until the status of the execution is complete|failed. This method
  16633. will query a lot at the begining and slow down the longer the dataset is executing.
  16634. @param options.id {string} - store ID of the dataset to run
  16635. @param options.type {string} - type of the object being executed
  16636. @param options.showToastWhenDone {boolean} - default is true, set to false if you don't want a toast to be displayed when the dataset is done running
  16637. @param options.glassContext {object} - the glassContext object
  16638. **/
  16639. _pingForStatus: function _pingForStatus(options) {
  16640. var execution = this._backgroundExecutions[options.id];
  16641. // If the timestamp in the options doesn't match the timestamp on the execution object then another execution for the same dataset
  16642. // has started and the one we're currently pinging for has been cancelled.
  16643. if (!execution || options.timestamp !== execution.timestamp || !execution.executionURL || execution.status === 'cancelled') {
  16644. return;
  16645. } else if (execution.status === 'failed') {
  16646. this._rejectDeferredObjects(options, 'failed');
  16647. this._cleanupAfterExecutionFinished(options.id);
  16648. return;
  16649. } else if (!this.isExecuting(options.id)) {
  16650. this._processExecutionStatus(execution.status, options);
  16651. return;
  16652. }
  16653. options.glassContext.services.ajax.get(execution.executionURL, {
  16654. 'headers': {
  16655. 'Content-Type': 'application/vnd.ibm.bi.platform.execution+json; charset=UTF-8',
  16656. 'Accept': 'application/json'
  16657. },
  16658. 'datatype': 'json'
  16659. }).then(function (response) {
  16660. execution.status = response.status;
  16661. this._processExecutionStatus(execution.status, options);
  16662. }.bind(this), function () {
  16663. // The ping failed, not much we can do
  16664. this._rejectDeferredObjects(options, 'statusPingFailed');
  16665. });
  16666. },
  16667. /**
  16668. Deal with the status of the execution
  16669. **/
  16670. _processExecutionStatus: function _processExecutionStatus(status, options) {
  16671. var execution = this._backgroundExecutions[options.id];
  16672. switch (status) {
  16673. case 'complete':
  16674. case 'succeeded':
  16675. // We could get a status of complete back for a cancelled execution. Double check here to make sure we didn't cancel anything
  16676. if (execution.status === 'cancelled') {
  16677. this._rejectDeferredObjects(options, 'cancelled');
  16678. } else {
  16679. this._resolveDefferedObjects(options.id);
  16680. if (options.showToastWhenDone) {
  16681. options.glassContext.appController.showToast(this._getToastMessage(options));
  16682. }
  16683. this.trigger('loadComplete', { id: options.id });
  16684. }
  16685. this._cleanupAfterExecutionFinished(options.id);
  16686. break;
  16687. case 'cancelled':
  16688. this._rejectDeferredObjects(options, 'cancelled');
  16689. this._cleanupAfterExecutionFinished(options.id);
  16690. break;
  16691. case 'failed':
  16692. this._rejectDeferredObjects(options, 'failed');
  16693. this._cleanupAfterExecutionFinished(options.id);
  16694. break;
  16695. case 'executing':
  16696. case 'pending':
  16697. var pingTimeoutIndex = options.pingTimeoutIndex || 0;
  16698. pingTimeoutIndex += 1;
  16699. if (pingTimeoutIndex >= this._pingTimeouts.length) {
  16700. pingTimeoutIndex = this._pingTimeouts.length - 1;
  16701. }
  16702. options.pingTimeoutIndex = pingTimeoutIndex;
  16703. setTimeout(function () {
  16704. this._pingForStatus(options);
  16705. }.bind(this), this._pingTimeouts[pingTimeoutIndex]);
  16706. break;
  16707. default:
  16708. this._cleanupAfterExecutionFinished(options.id);
  16709. console.log('Unknown status returned by ' + execution.executionURL + '. Status of: ' + status);
  16710. }
  16711. },
  16712. /**
  16713. Will reject all deferred objects associated to a running dataset. This will let the callers know that
  16714. something went wrong - request got cancelled or a fault happened.
  16715. **/
  16716. _rejectDeferredObjects: function _rejectDeferredObjects(options, status) {
  16717. var execution = this._backgroundExecutions[options.id];
  16718. if (!execution) {
  16719. return;
  16720. }
  16721. execution.status = status;
  16722. if (status === 'failed') {
  16723. this._showErrorToast(options);
  16724. }
  16725. // Reject any deferred objects that were waiting until the request was complete
  16726. if (execution.deferredObjects) {
  16727. execution.deferredObjects.forEach(function (deferred) {
  16728. deferred.reject({
  16729. 'status': status
  16730. });
  16731. }.bind(this));
  16732. }
  16733. },
  16734. /**
  16735. Will resolve all deferred objects associated to a running dataset.
  16736. **/
  16737. _resolveDefferedObjects: function _resolveDefferedObjects(id) {
  16738. var execution = this._backgroundExecutions[id];
  16739. // Reject any deferred objects that were waiting until the request was complete
  16740. if (execution.deferredObjects) {
  16741. execution.deferredObjects.forEach(function (deferred) {
  16742. deferred.resolve();
  16743. }.bind(this));
  16744. }
  16745. },
  16746. _cleanupAfterExecutionFinished: function _cleanupAfterExecutionFinished(id) {
  16747. this._hideProgressToast(id);
  16748. this._backgroundExecutions[id] = {
  16749. 'status': this._backgroundExecutions[id].status
  16750. };
  16751. },
  16752. /**
  16753. Cancels a currently running dataset. There's no reason to wait for the cancel to finish, so this method will simply return right after it sends the request.
  16754. @param options.id {string} - store ID of the dataset to run
  16755. @param options.glassContext {object} - the glassContext object
  16756. @param showCancelToast {boolean} - default true, should we show a toast after the cancel
  16757. **/
  16758. cancel: function cancel(options, showCancelToast) {
  16759. this._hideProgressToast(options.id);
  16760. var execution = this._backgroundExecutions[options.id];
  16761. if (!execution || !this.isExecuting(options.id)) {
  16762. return;
  16763. }
  16764. execution.status = 'cancelled';
  16765. if (showCancelToast !== false) {
  16766. this._showCancelledRefreshToast(options);
  16767. }
  16768. // Reject all deferred object waiting for the completion since we're being asked to cancel
  16769. this._rejectDeferredObjects(options, 'cancelled');
  16770. if (execution.executionURL) {
  16771. options.glassContext.services.ajax.delete(execution.executionURL, {
  16772. 'headers': {
  16773. 'Content-Type': 'application/vnd.ibm.bi.platform.execution+json; charset=UTF-8',
  16774. 'Accept': 'application/json'
  16775. },
  16776. 'datatype': 'json'
  16777. });
  16778. }
  16779. },
  16780. /**
  16781. @param id {string} - store ID of the dataset
  16782. @returns {promise}
  16783. - will be resolved when the dataset specified by options.id is complete.
  16784. - will be rejected if the dataset execution fails or gets canceled. The reason returns will be an object
  16785. reason.status {string} : the status of request (fault | cancelled)
  16786. reason.msg {string}: In the case of a fault, the error message
  16787. **/
  16788. whenComplete: function whenComplete(id) {
  16789. var status = this.getStatus(id);
  16790. var execution = this._backgroundExecutions[id];
  16791. // If the dataset is already done then resolve the promise right away
  16792. if (!execution || status === 'complete') {
  16793. return Promise.resolve();
  16794. } else if (status === 'failed' || status === 'cancelled') {
  16795. // The dataset already failed, reject the promise
  16796. var err = new Error();
  16797. err.status = status;
  16798. return Promise.reject(err);
  16799. } else {
  16800. if (!execution.deferredObjects) {
  16801. execution.deferredObjects = [];
  16802. }
  16803. var deferred = new Deferred();
  16804. execution.deferredObjects.push(deferred);
  16805. return deferred.promise;
  16806. }
  16807. },
  16808. /**
  16809. Will return the last known status for the id provided
  16810. @param id {string} - store ID of the dataset
  16811. @return {string} - complete | pending | executing | failed | null (if id isn't found)
  16812. **/
  16813. getStatus: function getStatus(id) {
  16814. return this._backgroundExecutions[id] ? this._backgroundExecutions[id].status : null;
  16815. },
  16816. /**
  16817. The UI doesn't distinguish between pending and executing, so treat both of them as 'executing'
  16818. **/
  16819. isExecuting: function isExecuting(id) {
  16820. var status = this.getStatus(id);
  16821. return status === 'pending' || status === 'executing';
  16822. },
  16823. _getToastMessage: function _getToastMessage(options) {
  16824. var execution = this._backgroundExecutions[options.id];
  16825. if (!execution) {
  16826. return '';
  16827. }
  16828. var stringId = '';
  16829. if (execution.isRefresh) {
  16830. switch (execution.status) {
  16831. case 'executing':
  16832. case 'pending':
  16833. stringId = 'datasetRefreshing';
  16834. break;
  16835. case 'complete':
  16836. case 'succeeded':
  16837. stringId = 'datasetFinishedRefreshing';
  16838. break;
  16839. case 'failed':
  16840. stringId = 'datasetRefreshFailed';
  16841. break;
  16842. case 'cancelled':
  16843. stringId = 'datasetRefreshCancelled';
  16844. break;
  16845. }
  16846. } else {
  16847. switch (execution.status) {
  16848. case 'executing':
  16849. case 'pending':
  16850. stringId = 'datasetLoading';
  16851. break;
  16852. case 'complete':
  16853. case 'succeeded':
  16854. stringId = 'datasetFinishedLoading';
  16855. break;
  16856. case 'failed':
  16857. stringId = 'datasetLoadingFailed';
  16858. break;
  16859. case 'cancelled':
  16860. stringId = 'datasetLoadingCancelled';
  16861. break;
  16862. }
  16863. }
  16864. return StringResources.get(stringId, {
  16865. 'name': options.name
  16866. });
  16867. }
  16868. });
  16869. return new DatasetExecutionManager();
  16870. });
  16871. //# sourceMappingURL=DatasetExecutionManager.js.map
  16872. ;
  16873. /**
  16874. * Licensed Materials - Property of IBM
  16875. * IBM Cognos Products: Cognos Analytics
  16876. * Copyright IBM Corp. 2016
  16877. * US Government Users Restricted Rights - Use, duplication or disclosure
  16878. * restricted by GSA ADP Schedule Contract with IBM Corp.
  16879. */
  16880. define('baglass/core-client/js/core-client/utils/Downloader',['../ui/core/Class', 'jquery', 'underscore'], function (Class, $, _) {
  16881. 'use strict'; //NOSONAR: meant to be strict
  16882. var Downloader = Class.extend({
  16883. /**
  16884. * Download a file
  16885. * @options.url {string} - hyperlink for download
  16886. * @options.name {string} - download name, not preserved when using fallback
  16887. * @options.fallback {boolean} - when html5 download is not supported should we fall back to using an iFrame, defaults true
  16888. */
  16889. init: function init(options) {
  16890. this.fallback = true; // default
  16891. Downloader.inherited('init', this, arguments);
  16892. _.extend(this, options);
  16893. },
  16894. /**
  16895. * Starting point for using downloder. Prompts user to save or open file
  16896. */
  16897. doDownload: function doDownload() {
  16898. if (this.url) {
  16899. this._removeContainers();
  16900. if (this._useHtml5Download()) {
  16901. this._html5Download();
  16902. } else {
  16903. this._iFrameDownload();
  16904. }
  16905. return Promise.resolve();
  16906. } else {
  16907. if (this.logger) {
  16908. this.logger.error('Downloader url is undefined.');
  16909. }
  16910. return Promise.reject(new Error('Downloader url is undefined.'));
  16911. }
  16912. },
  16913. _useHtml5Download: function _useHtml5Download() {
  16914. if (!this.fallback) {
  16915. return true;
  16916. }
  16917. var downloadAttrSupported = 'download' in document.createElement('a');
  16918. return downloadAttrSupported;
  16919. },
  16920. _html5Download: function _html5Download() {
  16921. Downloader.container = $('<div>').hide().on('click', function (evt) {
  16922. evt.stopPropagation();
  16923. }).appendTo('body');
  16924. var $hyperlink = $('<a>', {
  16925. 'target': '_blank',
  16926. 'href': this.url,
  16927. 'download': this.name ? this.name : true
  16928. }).appendTo(Downloader.container);
  16929. this._fireDownload($hyperlink);
  16930. },
  16931. _iFrameDownload: function _iFrameDownload() {
  16932. Downloader.container = $('<iframe>').hide().attr('src', this.url).appendTo('body');
  16933. },
  16934. _removeContainers: function _removeContainers() {
  16935. if (Downloader.container) {
  16936. Downloader.container.remove();
  16937. Downloader.container = null;
  16938. }
  16939. },
  16940. _fireDownload: function _fireDownload($hyperlink) {
  16941. if ($hyperlink.length) {
  16942. $hyperlink[0].click();
  16943. }
  16944. }
  16945. });
  16946. return Downloader;
  16947. });
  16948. //# sourceMappingURL=Downloader.js.map
  16949. ;
  16950. /**
  16951. * Licensed Materials - Property of IBM
  16952. * IBM Cognos Products: BI
  16953. * (C) Copyright IBM Corp. 2016
  16954. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  16955. */
  16956. define('baglass/core-client/js/core-client/utils/PromptCapabilities',[], function () {
  16957. return {
  16958. BOUND_RANGE: 'boundRange',
  16959. DEFAULT_VALUE_NOT_ACCEPTABLE: 'defaultValueNotAcceptable',
  16960. DISCRETE_VALUE: 'discreteValue',
  16961. EXCLUDE_VALUE: 'excludeValues',
  16962. MULTIVALUED: 'multivalued',
  16963. OPTIONAL: 'optional',
  16964. UNBOUNDED_RANGE: 'unboundedRange'
  16965. };
  16966. });
  16967. //# sourceMappingURL=PromptCapabilities.js.map
  16968. ;
  16969. /*
  16970. *+------------------------------------------------------------------------+
  16971. *| Licensed Materials - Property of IBM
  16972. *| IBM Cognos Products: Content Explorer
  16973. *| (C) Copyright IBM Corp. 2015, 2016
  16974. *|
  16975. *| US Government Users Restricted Rights - Use, duplication or disclosure
  16976. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  16977. *+------------------------------------------------------------------------+
  16978. */
  16979. define('baglass/core-client/js/core-client/utils/PromptManager',['../ui/core/Class', '../utils/ClassFactory', 'underscore', 'jquery'], function (BaseClass, ClassFactory, _, $) {
  16980. 'use strict';
  16981. /**
  16982. * This class is the framework to handle queries that need to prompt user for parameters.
  16983. * It makes sure that only one prompting dialog is displayed at a time and if many queries wait for the same parameters, user doesn't get prompted
  16984. * many times for the same parameters.
  16985. */
  16986. var PromptManager = BaseClass.extend({
  16987. init: function init() {
  16988. PromptManager.inherited('init', arguments);
  16989. this.inProgressMap = {};
  16990. this.pendingPrompts = [];
  16991. },
  16992. /**
  16993. * Function to handle the sign on prompting dialog when the query involves a data source with prompted sign on.
  16994. * @param {Object} options - mandatory : set of passed in properties
  16995. * @param {String} options.dataSourceName - mandatory : CM data source name
  16996. * @param {String} options.dataSourceConnectionName - mandatory : data source connection name (used to create the credential in CM when user submits)
  16997. * @param {Object} options.glassContext - mandatory : used to send UPS request to save credential in CM
  16998. * @param {Object} dfd - optional : deferred object, used to control only one sign on dialog is displayed at a time
  16999. * @param {boolean} options.promptForPasswordOnly - optional : if passed, only the password will be shown in the sign on dialog (not the username)
  17000. * @param {boolean} options.isPowerCube - optional : if passed, the UPS credential password key will use cubePassword instead of password
  17001. * @example
  17002. * PromptManager.promptForDataSourceSignon({
  17003. * 'dataSourceName' : My data source,
  17004. * 'dataSourceConnectionName' : My connection,
  17005. * 'glassContext' : Glass context object
  17006. * });
  17007. *
  17008. */
  17009. promptForDataSourceSignon: function promptForDataSourceSignon(options, dfd) {
  17010. var key = 'promptForSignon' + options.dataSourceName;
  17011. var deferred = this.inProgressMap[key];
  17012. if (!deferred) {
  17013. deferred = dfd || $.Deferred();
  17014. if (this._isPrompting()) {
  17015. var pending = this._getPendingPrompt(key);
  17016. if (pending) {
  17017. deferred = pending.deferred;
  17018. } else {
  17019. this.pendingPrompts.push({
  17020. promptFunction: this.promptForDataSourceSignon.bind(this, options, deferred),
  17021. id: key,
  17022. deferred: deferred
  17023. });
  17024. }
  17025. } else {
  17026. this.inProgressMap[key] = deferred;
  17027. this._getSignOnDialog(options, key, deferred);
  17028. }
  17029. }
  17030. return deferred.promise();
  17031. },
  17032. _getSignOnDialog: function _getSignOnDialog(options, key, deferred) {
  17033. var opts = {
  17034. 'dataSourceName': options.dataSourceName,
  17035. 'dataSourceConnectionName': options.dataSourceConnectionName,
  17036. 'glassContext': options.glassContext,
  17037. 'displayErrMsg': true,
  17038. 'promptForPasswordOnly': options.promptForPasswordOnly,
  17039. 'isPowerCube': options.isPowerCube,
  17040. 'onSubmit': function () {
  17041. this._removeInProgress(key);
  17042. deferred.resolve();
  17043. }.bind(this),
  17044. 'onCancel': function () {
  17045. this._removeInProgress(key);
  17046. deferred.reject();
  17047. }.bind(this)
  17048. };
  17049. return ClassFactory.instantiate('../ui/content/dialog/SignOnDialog', opts).then(function (signOnDialog) {
  17050. signOnDialog.open();
  17051. return signOnDialog;
  17052. });
  17053. },
  17054. _getPendingPrompt: function _getPendingPrompt(id) {
  17055. var pending = null;
  17056. for (var i = 0; i < this.pendingPrompts.length; i++) {
  17057. if (this.pendingPrompts[i].id === id) {
  17058. pending = this.pendingPrompts[i];
  17059. break;
  17060. }
  17061. }
  17062. return pending;
  17063. },
  17064. _executeNextPrompt: function _executeNextPrompt() {
  17065. if (this.pendingPrompts.length > 0) {
  17066. this.pendingPrompts[0].promptFunction();
  17067. this.pendingPrompts.splice(0, 1);
  17068. }
  17069. },
  17070. _removeInProgress: function _removeInProgress(id) {
  17071. delete this.inProgressMap[id];
  17072. this._executeNextPrompt();
  17073. },
  17074. _isPrompting: function _isPrompting() {
  17075. return Object.keys(this.inProgressMap).length > 0;
  17076. }
  17077. });
  17078. return new PromptManager();
  17079. });
  17080. //# sourceMappingURL=PromptManager.js.map
  17081. ;
  17082. /**
  17083. * Licensed Materials - Property of IBM
  17084. * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2018
  17085. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  17086. */
  17087. /**
  17088. * Pulls locales out of requirejs config. This config is set via config.js on the index page.
  17089. */
  17090. define('baglass/core-client/js/core-client/i18n/Locales',['require','exports','module'],function (require, exports, module) {
  17091. return module.config() && module.config().locales || [];
  17092. });
  17093. //# sourceMappingURL=Locales.js.map
  17094. ;
  17095. /**
  17096. * Licensed Materials - Property of IBM
  17097. * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2018
  17098. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  17099. */
  17100. define('baglass/core-client/js/core-client/i18n/Utils',[], function () {
  17101. return {
  17102. /**
  17103. * Splits a locale tag into its potential parts (language, script and region).
  17104. * Make sure part is capitalized correctly.
  17105. *
  17106. * Some example tags:
  17107. * en (language)
  17108. * en-SG (language, region)
  17109. * zh-Hant-HK (language, script, region)
  17110. *
  17111. * @param locale {string}
  17112. * @returns {Array[lang, region]}
  17113. * @private
  17114. */
  17115. parseLocale: function parseLocale(locale) {
  17116. var separator = locale.indexOf('-') != -1 ? '-' : '_';
  17117. var split = locale.split(separator);
  17118. var lang = null,
  17119. script = null,
  17120. region = null;
  17121. function capitalize(str) {
  17122. return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
  17123. }
  17124. lang = split[0].toLowerCase();
  17125. if (split.length === 3) {
  17126. script = capitalize(split[1]);
  17127. region = split[2].toUpperCase();
  17128. } else if (split.length === 2) {
  17129. if (split[1].length <= 2) {
  17130. region = split[1].toUpperCase();
  17131. } else {
  17132. script = capitalize(split[1]);
  17133. }
  17134. }
  17135. return {
  17136. lang: lang,
  17137. script: script,
  17138. region: region,
  17139. toString: function toString() {
  17140. var result = [lang];
  17141. if (script) {
  17142. result.push(script);
  17143. }
  17144. if (region) {
  17145. result.push(region);
  17146. }
  17147. return result.join('-');
  17148. }
  17149. };
  17150. }
  17151. };
  17152. });
  17153. //# sourceMappingURL=Utils.js.map
  17154. ;
  17155. function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
  17156. /**
  17157. * Licensed Materials - Property of IBM
  17158. * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2014, 2016
  17159. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  17160. */
  17161. //Object.entries polyfill
  17162. if (!Object.entries) {
  17163. Object.entries = function (obj) {
  17164. var ownProps = Object.keys(obj),
  17165. i = ownProps.length,
  17166. resArray = new Array(i); // preallocate the Array
  17167. while (i--) {
  17168. resArray[i] = [ownProps[i], obj[ownProps[i]]];
  17169. }return resArray;
  17170. };
  17171. }
  17172. define('baglass/core-client/js/core-client/i18n/Load',['require', 'text!ecma402/cldr/config/availableLocales.json', 'underscore', 'module', './Locales', './Utils', 'text'], function (require, availableLocalesRes, _, module, localesConfig, i18nUtils) {
  17173. return {
  17174. id: module.id,
  17175. load: function load(name, req, onload, config) {
  17176. var _this = this;
  17177. if (config && config.isBuild) {
  17178. onload();
  17179. } else {
  17180. var baseLocales = localesConfig.map(function (locale) {
  17181. return _this._resolveLocale(locale);
  17182. });
  17183. var parentLocales = [];
  17184. baseLocales.forEach(function (locale) {
  17185. var _i18nUtils$parseLocal = i18nUtils.parseLocale(locale),
  17186. lang = _i18nUtils$parseLocal.lang,
  17187. region = _i18nUtils$parseLocal.region;
  17188. if (region && !_.contains(baseLocales, lang)) {
  17189. parentLocales.push(lang);
  17190. }
  17191. });
  17192. var locales = ['root'].concat(parentLocales, _toConsumableArray(baseLocales));
  17193. var dependencies = [];
  17194. locales.forEach(function (locale) {
  17195. dependencies.push('text!ecma402/cldr/' + locale + '/custom_numbers.json');
  17196. dependencies.push('text!ecma402/cldr/' + locale + '/ca-gregorian.json');
  17197. });
  17198. var cldrData = null;
  17199. Promise.all(this._loadDependencies(req, dependencies)).then(function (data) {
  17200. data.forEach(function (record) {
  17201. if (record) {
  17202. var currentLocale = Object.entries(record.data.main)[0][0];
  17203. if (cldrData === null) {
  17204. cldrData = record.data.main;
  17205. } else if (cldrData[currentLocale]) {
  17206. Object.assign(cldrData[currentLocale], record.data.main[currentLocale]);
  17207. } else {
  17208. Object.assign(cldrData, record.data.main);
  17209. }
  17210. }
  17211. });
  17212. onload(cldrData);
  17213. }).catch(function (err) {
  17214. console.error('Failed to load cldr data.', err);
  17215. onload(cldrData);
  17216. });
  17217. }
  17218. },
  17219. /**
  17220. * Requirejs does not hit the success callback if any one of the dependencies fail.
  17221. * This method will create a promise for each dependency which is guaranteed to resolve.
  17222. * Failed promises will resolve empty.
  17223. *
  17224. * @param req - requirejs
  17225. * @param dependencies - array of dependency paths.
  17226. * @returns {Array} of promises
  17227. * @private
  17228. */
  17229. _loadDependencies: function _loadDependencies(req, dependencies) {
  17230. var promises = [];
  17231. var localRegEx = /cldr\/([a-zA-z-]+)\//;
  17232. dependencies.forEach(function (dependency) {
  17233. var locale = dependency.match(localRegEx)[1];
  17234. promises.push(new Promise(function (resolve) {
  17235. req([dependency], function (data) {
  17236. resolve({
  17237. data: JSON.parse(data),
  17238. locale: locale,
  17239. path: dependency
  17240. });
  17241. }, function () {
  17242. resolve();
  17243. console.warn('Unable to load formatting resource: \'' + dependency + '\'');
  17244. });
  17245. }));
  17246. });
  17247. return promises;
  17248. },
  17249. _resolveLocale: function _resolveLocale(locale) {
  17250. if (locale) {
  17251. var indDash = locale.indexOf('-');
  17252. var availableLocales = JSON.parse(availableLocalesRes).availableLocales;
  17253. var normLocale = locale;
  17254. if (indDash > 0) {
  17255. var localeTag = i18nUtils.parseLocale(locale);
  17256. normLocale = localeTag.toString();
  17257. if (!_.contains(availableLocales, normLocale)) {
  17258. if (_.contains(availableLocales, localeTag.lang)) {
  17259. normLocale = localeTag.lang;
  17260. } else {
  17261. normLocale = 'en';
  17262. }
  17263. }
  17264. }
  17265. if (!_.contains(availableLocales, normLocale)) {
  17266. normLocale = 'en';
  17267. }
  17268. return normLocale;
  17269. }
  17270. return 'en';
  17271. }
  17272. };
  17273. });
  17274. //# sourceMappingURL=Load.js.map
  17275. ;
  17276. /**
  17277. * Licensed Materials - Property of IBM
  17278. * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2014, 2018
  17279. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  17280. */
  17281. define('baglass/core-client/js/core-client/i18n/Const',[],function () {
  17282. var TOKENS = {
  17283. DOW: 'dddd',
  17284. FULL_M: 'MMMM',
  17285. LONG_M: 'MMM',
  17286. MEDIUM_M: 'MM',
  17287. MO: 'Mo',
  17288. SHORT_M: 'M',
  17289. D: 'D',
  17290. DO: 'Do',
  17291. DD: 'DD',
  17292. Y: 'Y',
  17293. Y_SHORT: 'YY',
  17294. A: 'A',
  17295. ZZ: 'zz'
  17296. };
  17297. var SIZES = ['full', 'long', 'medium', 'short'];
  17298. var TYPES = {
  17299. numbers: 'numbers',
  17300. dates: 'dates'
  17301. };
  17302. return { TOKENS: TOKENS, SIZES: SIZES, TYPES: TYPES };
  17303. });
  17304. //# sourceMappingURL=Const.js.map
  17305. ;
  17306. /**
  17307. * Licensed Materials - Property of IBM
  17308. * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2014, 2016
  17309. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  17310. */
  17311. /**
  17312. * This class provides locale specific formatting resources such as list separator.
  17313. */
  17314. define('baglass/core-client/js/core-client/i18n/FormatResources',['../ui/core/Class', './Load!', './Const', './Locales', './Utils'], function (Class, resources, Const, locales, i18nUtils) {
  17315. var FormatResources = null;
  17316. FormatResources = Class.extend({
  17317. init: function init() {},
  17318. /**
  17319. * @param required locale
  17320. * @returns locale specific list separator symbol
  17321. */
  17322. getListSeparatorSymbol: function getListSeparatorSymbol(locale) {
  17323. return this._lookupResource(locale, 'numbers.symbols-numberSystem-latn.list');
  17324. },
  17325. getShortNumberFormatPatterns: function getShortNumberFormatPatterns(locale) {
  17326. return this._lookupResource(locale, 'numbers.decimalFormats-numberSystem-latn.short.decimalFormat');
  17327. },
  17328. getDateFormatPatterns: function getDateFormatPatterns(locale) {
  17329. var formats = this._lookupResource(locale, 'dates.calendars.gregorian.dateFormats');
  17330. formats.short = formats.short.replace(/yy/, 'y');
  17331. return formats;
  17332. },
  17333. getTimeFormatPatterns: function getTimeFormatPatterns(locale) {
  17334. return this._lookupResource(locale, 'dates.calendars.gregorian.timeFormats');
  17335. },
  17336. getDateTimeFormatPatterns: function getDateTimeFormatPatterns(locale) {
  17337. var _this = this;
  17338. var resources = this._lookupResource(locale, 'dates.calendars.gregorian.dateTimeFormats');
  17339. var sizes = Const.SIZES;
  17340. var dateRegx = /\{1\}/;
  17341. var timeRegx = /\{0\}/;
  17342. var result = {};
  17343. sizes.forEach(function (size) {
  17344. var datePattern = _this.getDateFormatPatterns(locale)[size];
  17345. var timePattern = _this.getTimeFormatPatterns(locale)[size];
  17346. var dateTimePattern = resources[size];
  17347. result[size] = dateTimePattern.replace(dateRegx, datePattern).replace(timeRegx, timePattern);
  17348. });
  17349. return result;
  17350. },
  17351. /**
  17352. * CLDR data is represented in a hierarchy for a locale
  17353. * <root>
  17354. * <lang (e.g zh)>
  17355. * <lang-script (e.g. zh-Hant)>
  17356. * <lang-script-region (e.g. zh-Hant-HK)>
  17357. * <lang-region (e.g. zh-HK)>
  17358. *
  17359. * This method will build a prototype tree representing this hierarchy for a specified locale with a given path
  17360. *
  17361. * @param locale {string}
  17362. * @param path {string} - object path to navigate
  17363. * @returns {object} - cldr data
  17364. * @private
  17365. */
  17366. _lookupResource: function _lookupResource() {
  17367. var locale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'root';
  17368. var path = arguments[1];
  17369. var parsedLocal = i18nUtils.parseLocale(locale);
  17370. var lang = parsedLocal.lang,
  17371. script = parsedLocal.script,
  17372. region = parsedLocal.region;
  17373. var resource = this._getResource(lang + '.' + path);
  17374. if (resource === null) {
  17375. resource = this._getResource('root.' + path);
  17376. }
  17377. if (script) {
  17378. resource = this._extendResource(resource, lang + '-' + script + '.' + path);
  17379. }
  17380. if (script && region) {
  17381. resource = this._extendResource(resource, lang + '-' + script + '-' + region + '.' + path);
  17382. }
  17383. if (!script && region) {
  17384. resource = this._extendResource(resource, lang + '-' + region + '.' + path);
  17385. }
  17386. return resource;
  17387. },
  17388. /**
  17389. * Extend a cldr data object with a child object retrieved by the supplied path (e.g. extending 'en' with 'en-US')
  17390. *
  17391. * @param resource - cldr data
  17392. * @param childPath - path to child cldr object (e.g. "en-US.numbers.decimalFormats-numberSystem-latn.short.decimalFormat")
  17393. * @returns {*}
  17394. * @private
  17395. */
  17396. _extendResource: function _extendResource(resource, childPath) {
  17397. var childResource = this._getResource(childPath);
  17398. if (childResource !== null) {
  17399. return typeof resource === 'string' ? childResource : Object.assign(Object.create(resource), childResource);
  17400. }
  17401. return resource;
  17402. },
  17403. /**
  17404. * Traverse object by path
  17405. * @param path {string} - e.g. 'root.childObject.property
  17406. * @returns {object || null}
  17407. * @private
  17408. */
  17409. _getResource: function _getResource(path) {
  17410. var result = path.split('.').reduce(function (obj, prop) {
  17411. return obj ? obj[prop] : null;
  17412. }, resources);
  17413. return result === undefined ? null : result;
  17414. }
  17415. });
  17416. return new FormatResources();
  17417. });
  17418. //# sourceMappingURL=FormatResources.js.map
  17419. ;
  17420. /**
  17421. * Licensed Materials - Property of IBM
  17422. * IBM Cognos Products: BI
  17423. * (C) Copyright IBM Corp. 2018
  17424. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  17425. */
  17426. define('baglass/core-client/js/core-client/i18n/CurrencySymbols',[], function () {
  17427. // Util for ecma402/IntlShim; returns a mapping of international currency code mapped to currency symbol,
  17428. // and a replacement string for cases that ecma402/IntlShim uses an incorrect currency symbol for a currency code.
  17429. return {
  17430. 'AED': { symbol: 'د.إ.' },
  17431. 'ARS': { symbol: '$' },
  17432. 'AUD': { symbol: '$', replace: 'A$' },
  17433. 'BDT': { symbol: '৳' },
  17434. 'BRL': { symbol: 'R$' },
  17435. 'CAD': { symbol: '$', replace: 'CA$' },
  17436. 'CHF': { symbol: 'Fr.' },
  17437. 'CLP': { symbol: '$' },
  17438. 'CNY': { symbol: '¥', replace: 'CN¥' },
  17439. 'COP': { symbol: '$' },
  17440. 'CZK': { symbol: 'Kč' },
  17441. 'DKK': { symbol: 'kr' },
  17442. 'DZD': { symbol: 'د.ج.‏' },
  17443. 'EGP': { symbol: 'ج.م.‏' },
  17444. 'EUR': { symbol: '€' },
  17445. 'GBP': { symbol: '£' },
  17446. 'HKD': { symbol: 'HK$' },
  17447. 'HUF': { symbol: 'Ft' },
  17448. 'IDR': { symbol: 'Rp' },
  17449. 'ILS': { symbol: '₪' },
  17450. 'INR': { symbol: '₹' },
  17451. 'IRR': { symbol: '﷼' },
  17452. 'JPY': { symbol: '¥' },
  17453. 'KRW': { symbol: '₩' },
  17454. 'KZT': { symbol: '₸' },
  17455. 'MXN': { symbol: '$' },
  17456. 'MYR': { symbol: 'RM' },
  17457. 'NGN': { symbol: '₦' },
  17458. 'NOK': { symbol: 'kr' },
  17459. 'PEN': { symbol: 'S/.' },
  17460. 'PHP': { symbol: '₱' },
  17461. 'PKR': { symbol: '₨' },
  17462. 'PLN': { symbol: 'zł' },
  17463. 'RON': { symbol: 'lei' },
  17464. 'RUB': { symbol: 'руб.' },
  17465. 'SAR': { symbol: '﷼' },
  17466. 'SEK': { symbol: 'kr' },
  17467. 'SGD': { symbol: 'S$' },
  17468. 'THB': { symbol: '฿' },
  17469. 'TRY': { symbol: 'TL' },
  17470. 'TWD': { symbol: 'NT$' },
  17471. 'UAH': { symbol: '₴' },
  17472. 'USD': { symbol: '$', replace: 'US$' },
  17473. 'VEF': { symbol: 'Bs.F.' },
  17474. 'VND': { symbol: '₫' },
  17475. 'ZAR': { symbol: 'R' }
  17476. };
  17477. });
  17478. //# sourceMappingURL=CurrencySymbols.js.map
  17479. ;
  17480. define('text!baglass/core-client/js/core-client/i18n/custom/locale/ar.json',[],function () { return '{\n\t"defaultOrder": [1,1,1,1],\n\t"dateFormats": {\n "full": [\n "dddd، MMMM[ ]D[، ]Y",\n "dddd، D[ ]MMMM[، ]Y",\n "dddd، Y[ ]MMMM[ ]D"\n ],\n "long": [\n "MMMM[ ]D[، ]Y",\n "D[ ]MMMM[، ]Y",\n "Y[ ]MMMM[ ]D"\n ],\n "medium": [\n "MM[‏/]DD[‏/]Y",\n "DD[‏/]MM[‏/]Y",\n "Y[‏/]MM[‏/]DD"\n ],\n "short": [\n "M[‏/]D[‏/]Y",\n "D[‏/]M[‏/]Y",\n "Y[‏/]M[‏/]D"\n ]\n}\n}\n';});
  17481. define('text!baglass/core-client/js/core-client/i18n/custom/locale/zh-cn.json',[],function () { return '{\n\t"defaultOrder": [2,2,2,2],\n\t"dateFormats": {\n "full": [\n "M[月]D[日]Y年dddd",\n "D[日]M[月]Y年dddd",\n "Y[年]M[月]D日dddd"\n ],\n "long": [\n "M[月]D[日]Y[年]",\n "D[日]M[月]Y[年]",\n "Y[年]M[月]D[日]"\n ],\n "medium": [\n "M[月]D[日]Y[年]",\n "D[日]M[月]Y[年]",\n "Y[年]M[月]D[日]"\n ],\n "short": [\n "M[/]D[/]Y",\n "D[/]M[/]Y",\n "Y[/]M[/]D"\n ]\n}\n}\n';});
  17482. define('text!baglass/core-client/js/core-client/i18n/custom/locale/cs.json',[],function () { return '{\n\t"defaultOrder": [1,1,1,1],\n\t"dateFormats": {\n "full": [\n "dddd, MMMM[. ]D[ ]Y",\n "dddd, D[. ]MMMM[ ]Y",\n "dddd, Y[. ]MMMM[. ]D"\n ],\n "long": [\n "MMMM[. ]D[ ]Y",\n "D[. ]MMMM[ ]Y",\n "Y[. ]MMMM[. ]D"\n ],\n "medium": [\n "M[. ]D[. ]Y",\n "D[. ]M[. ]Y",\n "Y[. ]M[. ]D"\n ],\n "short": [\n "MM[.]DD[.]YY",\n "DD[.]MM[.]YY",\n "YY[.]MM[.]DD"\n ]\n}\n}\n';});
  17483. define('text!baglass/core-client/js/core-client/i18n/custom/locale/da.json',[],function () { return '{\n\t"defaultOrder": [1,1,1,1],\n\t"dateFormats": {\n "full": [\n "dddd d. MMMM[ ]D[. ]Y",\n "dddd d. D[. ]MMMM[ ]Y",\n "dddd d. Y[ ]MMMM[ ]D[.]"\n ],\n "long": [\n "MMMM[ ]D[. ]Y",\n "D[. ]MMMM[ ]Y",\n "Y[. ]MMMM[ ]D"\n ],\n "medium": [\n "MMM[ ]D[. ]Y",\n "D[. ]MMM[ ]Y",\n "Y[ ]MMM[ ]D[.]"\n ],\n "short": [\n "MM[/]DD[/]Y",\n "DD[/]MM[/]Y",\n "Y[/]MM[/]DD"\n ]\n}\n}\n';});
  17484. define('text!baglass/core-client/js/core-client/i18n/custom/locale/nl.json',[],function () { return '{\n\t"defaultOrder": [1,1,1,1],\n\t"dateFormats": {\n "full": [\n "dddd MMMM[ ]D[ ]Y",\n "dddd D[ ]MMMM[ ]Y",\n "dddd Y[ ]MMMM[ ]D"\n ],\n "long": [\n "MMMM[ ]D[ ]Y",\n "D[ ]MMMM[ ]Y",\n "Y[ ]MMMM[ ]D"\n ],\n "medium": [\n "MMM[-]D[-]Y",\n "D[-]MMM[-]Y",\n "Y[-]MMM[-]D"\n ],\n "short": [\n "M[-]D[-]YY",\n "D[-]M[-]YY",\n "YY[-]M[-]D"\n ]\n}\n}\n';});
  17485. define('text!baglass/core-client/js/core-client/i18n/custom/locale/en.json',[],function () { return '{\n\t"defaultOrder": [0,0,0,0],\n\t"dateFormats": {\n "full": [\n "dddd, MMMM[ ]D[, ]Y",\n "dddd, D[ ]MMMM[, ]Y",\n "dddd, Y[ ]MMMM[ ]D"\n ],\n "long": [\n "MMMM[ ]D[, ]Y",\n "D[ ]MMMM[, ]Y",\n "Y[ ]MMMM[ ]D"\n ],\n "medium": [\n "MMM[ ]D[, ]Y",\n "D[ ]MMM[, ]Y",\n "Y[ ]MMM[ ]D"\n ],\n "short": [\n "M[/]D[/]Y",\n "D[/]M[/]Y",\n "Y[/]M[/]D"\n ]\n}\n}\n';});
  17486. define('text!baglass/core-client/js/core-client/i18n/custom/locale/en-au.json',[],function () { return '{\n\t"defaultOrder": [1,1,1,1],\n\t"dateFormats": {\n "full": [\n "dddd, MMMM[ ]D[ ]Y",\n "dddd, D[ ]MMMM[ ]Y",\n "dddd, Y[ ]MMMM[ ]D"\n ],\n "long": [\n "MMMM[ ]D[ ]Y",\n "D[ ]MMMM[ ]Y",\n "Y[ ]MMMM[ ]D"\n ],\n "medium": [\n "MMM[ ]D[ ]Y",\n "D[ ]MMM[ ]Y",\n "Y[ ]MMM[ ]D"\n ],\n "short": [\n "M[/]D[/]YY",\n "D[/]M[/]YY",\n "YY[/]M[/]D"\n ]\n}\n}\n';});
  17487. define('text!baglass/core-client/js/core-client/i18n/custom/locale/en-ie.json',[],function () { return '{\n\t"defaultOrder": [1,1,1,1],\n\t"dateFormats": {\n "full": [\n "dddd MMMM[ ]D[ ]Y",\n "dddd D[ ]MMMM[ ]Y",\n "dddd Y[ ]MMMM[ ]D"\n ],\n "long": [\n "MMMM[ ]D[ ]Y",\n "D[ ]MMMM[ ]Y",\n "Y[ ]MMMM[ ]D"\n ],\n "medium": [\n "MMM[ ]D[ ]Y",\n "D[ ]MMM[ ]Y",\n "Y[ ]MMM[ ]D"\n ],\n "short": [\n "MM[/]DD[/]Y",\n "DD[/]MM[/]Y",\n "Y[/]MM[/]DD"\n ]\n}\n}\n';});
  17488. define('text!baglass/core-client/js/core-client/i18n/custom/locale/fo.json',[],function () { return '{\n\t"defaultOrder": [1,1,1,1],\n\t"dateFormats": {\n "full": [\n "dddd, MMMM D[.] Y",\n "dddd, D[.] MMMM Y",\n "dddd, Y MMMM D[.]"\n ],\n "long": [\n "MMMM[. ]D[ ]Y",\n "D[. ]MMMM[ ]Y",\n "Y[. ]MMMM[ ]D"\n ],\n "medium": [\n "MM[.]DD[.]Y",\n "DD[.]MM[.]Y",\n "Y[.]MM[.]DD"\n ],\n "short": [\n "MM[.]DD[.]YY",\n "DD[.]MM[.]YY",\n "YY[.]MM[.]DD"\n ]\n}\n}\n';});
  17489. define('text!baglass/core-client/js/core-client/i18n/custom/locale/fi.json',[],function () { return '{\n\t"defaultOrder": [1,1,1,1],\n\t"dateFormats": {\n "full": [\n "dddd, MMMM[ta ]D[ta ]Y",\n "dddd, D[. ]MMMM[ta ]Y",\n "dddd, Y[. ]MMMM[ta ]D"\n ],\n "long": [\n "MMMM[. ]D[ta ]Y",\n "D[. ]MMMM[ta ]Y",\n "Y[. ]MMMM[. ]D"\n ],\n "medium": [\n "M[.]D[.]Y",\n "D[.]M[.]Y",\n "Y[.]M[.]D"\n ],\n "short": [\n "M[.]D[.]Y",\n "D[.]M[.]Y",\n "Y[.]M[.]D"\n ]\n}\n}\n';});
  17490. define('text!baglass/core-client/js/core-client/i18n/custom/locale/fr-ch.json',[],function () { return '{\n\t"defaultOrder": [1,1,1,1],\n\t"dateFormats": {\n "full": [\n "dddd, MMMM[ ]D[ ]Y",\n "dddd, D[ ]MMMM[ ]Y",\n "dddd, Y[ ]MMMM[ ]D"\n ],\n "long": [\n "MMMM[ ]D[ ]Y",\n "D[ ]MMMM[ ]Y",\n "Y[ ]MMMM[ ]D"\n ],\n "medium": [\n "MMM[ ]D[ ]YY",\n "D[ ]MMM[ ]YY",\n "YY[ ]MMM[ ]D"\n ],\n "short": [\n "MM[.]DD[.]YY",\n "DD[.]MM[.]YY",\n "MM[.]DD[.]YY"\n ]\n}\n}\n';});
  17491. define('text!baglass/core-client/js/core-client/i18n/custom/locale/hu.json',[],function () { return '{\n\t"defaultOrder": [2,2,2,2],\n\t"dateFormats": {\n "full": [\n "MMMM[ ]D[. ]Y., dddd",\n "D[. ]MMMM[. ]Y., dddd",\n "Y[. ]MMMM[ ]D., dddd"\n ],\n "long": [\n "MMMM[ ]D[. ]Y[.]",\n "D[. ]MMMM[. ]Y[.]",\n "Y[. ]MMMM[ ]D[.]"\n ],\n "medium": [\n "MMM[ ]D[. ]Y[.]",\n "D[. ]MMM[ ]Y[.]",\n "Y[. ]MMM[ ]D[.]"\n ],\n "short": [\n "MM[. ]DD[. ]Y[.]",\n "DD[. ]MM[. ]Y[.]",\n "Y[. ]MM[. ]DD[.]"\n ]\n}\n}\n';});
  17492. define('text!baglass/core-client/js/core-client/i18n/custom/locale/it.json',[],function () { return '{\n\t"defaultOrder": [1,1,1,1],\n\t"dateFormats": {\n "full": [\n "dddd MMMM[ ]D[ ]Y",\n "dddd D[ ]MMMM[ ]Y",\n "dddd Y[ ]MMMM[ ]D"\n ],\n "long": [\n "MMMM[ ]DD[ ]Y",\n "DD[ ]MMMM[ ]Y",\n "Y[ ]MMMM[ ]DD"\n ],\n "medium": [\n "MMM[/]DD[/]Y[/]",\n "DD[/]MMM[/]Y",\n "Y[/]MMM[/]DD"\n ],\n "short": [\n "MM[/]DD[/]YY",\n "DD[/]MM[/]YY",\n "YY[/]MM[/]DD"\n ]\n}\n}\n';});
  17493. define('text!baglass/core-client/js/core-client/i18n/custom/locale/ja.json',[],function () { return '{\n\t"defaultOrder": [2,2,2,2],\n\t"dateFormats": {\n "full": [\n "M[月]D[日]Y年dddd",\n "D[日]M[月]Y年dddd",\n "Y[年]M[月]D日dddd"\n ],\n "long": [\n "M[月]D[日]Y[年]",\n "D[月]M[日]Y[年]",\n "Y[年]M[月]D[日]"\n ],\n "medium": [\n "MM[/]DD[/]Y",\n "DD[/]MM[/]Y",\n "Y[/]MM[/]DD"\n ],\n "short": [\n "MM[/]DD[/]YY",\n "DD[/]MM[/]YY",\n "YY[/]MM[/]DD"\n ]\n}\n}\n';});
  17494. define('text!baglass/core-client/js/core-client/i18n/custom/locale/ko.json',[],function () { return '{\n\t"defaultOrder": [2,2,2,2],\n\t"dateFormats": {\n "full": [\n "M[월 ]D[일 ]Y년 dddd",\n "D[일]M[월 ]Y년 dddd",\n "Y[년 ]M[월 ]D일 dddd"\n ],\n "long": [\n "M[월 ]D[일]Y[년]",\n "D[일]M[월 ]Y[년]",\n "Y[년 ]M[월 ]D[일]"\n ],\n "medium": [\n "M[. ]D[. ]Y[.]",\n "D[. ]M[. ]Y[.]",\n "Y[. ]M[. ]D[.]"\n ],\n "short": [\n "M[. ]D[. ]YY[.]",\n "D[. ]M[. ]YY[.]",\n "YY[. ]M[. ]D[.]"\n ]\n}\n}\n';});
  17495. define('text!baglass/core-client/js/core-client/i18n/custom/locale/nb.json',[],function () { return '{\n\t"defaultOrder": [1,1,1,1],\n\t"dateFormats": {\n "full": [\n "dddd MMMM[. ]D[ ]Y",\n "dddd D[. ]MMMM[ ]Y",\n "dddd Y[. ]MMMM[. ]D"\n ],\n "long": [\n "MMMM[. ]D[ ]Y",\n "D[. ]MMMM[ ]Y",\n "Y[. ]MMMM[. ]D"\n ],\n "medium": [\n "MMM[ ]D[. ]Y",\n "D[. ]MMM[ ]Y",\n "Y[. ]MMM[ ]D"\n ],\n "short": [\n "MM[.]DD[.]YY",\n "DD[.]MM[.]YY",\n "YY[.]MM[.]DD"\n ]\n}\n}\n';});
  17496. define('text!baglass/core-client/js/core-client/i18n/custom/locale/pl.json',[],function () { return '{\n\t"defaultOrder": [1,1,1,1],\n\t"dateFormats": {\n "full": [\n "dddd, MMMM[ ]D[ ]Y",\n "dddd, D[ ]MMMM[ ]Y",\n "dddd, Y[ ]MMMM[ ]D"\n ],\n "long": [\n "MMMM[ ]D[ ]Y",\n "D[ ]MMMM[ ]Y",\n "Y[ ]MMMM[ ]D"\n ],\n "medium": [\n "MM[-]DD[-]Y",\n "DD[-]MM[-]Y",\n "Y[-]MM[-]DD"\n ],\n "short": [\n "MM[-]DD[-]YY",\n "DD[-]MM[-]YY",\n "YY[-]MM[-]DD"\n ]\n}\n}\n';});
  17497. define('text!baglass/core-client/js/core-client/i18n/custom/locale/pt.json',[],function () { return '{\n\t"defaultOrder": [1,1,1,1],\n\t"dateFormats": {\n "full": [\n "dddd, MMMM[ de ]D[ de ]Y",\n "dddd, D[ de ]MMMM[ de ]Y",\n "dddd, Y[ de ]MMMM[ de ]D"\n ],\n "long": [\n "MMMM[ de ]D[ de ]Y",\n "D[ de ]MMMM[ de ]Y",\n "Y[ de ]MMMM[ de ]D"\n ],\n "medium": [\n "MMM[ de ]D[ de ]Y",\n "D[ de ]MMM[ de ]Y",\n "Y[ de ]MMM[ de ]D"\n ],\n "short": [\n "MM[/]DD[/]Y",\n "DD[/]MM[/]Y",\n "Y[/]MM[/]DD"\n ]\n}\n}\n';});
  17498. define('text!baglass/core-client/js/core-client/i18n/custom/locale/ru.json',[],function () { return '{\n\t"defaultOrder": [1,1,1,1],\n\t"dateFormats": {\n "full": [\n "dddd, MMMM[ ]D[ ]Y[ г.]",\n "dddd, D[ ]MMMM[ ]Y[ г.]",\n "dddd, Y[ ]MMMM[ ]D[ г.]"\n ],\n "long": [\n "MMMM[ ]D[ ]Y[ г.]",\n "D[ ]MMMM[ ]Y[ г.]",\n "Y[ ]MMMM[ ]D[ г.]"\n ],\n "medium": [\n "MMM[ ]D[ ]Y[ г.]",\n "D[ ]MMM[ ]Y[ г.]",\n "Y[ ]MMM[ ]D[ г.]"\n ],\n "short": [\n "MM[.]DD[.]YY",\n "DD[.]MM[.]YY",\n "YY[.]MM[.]DD"\n ]\n}\n}\n';});
  17499. define('text!baglass/core-client/js/core-client/i18n/custom/locale/sk.json',[],function () { return '{\n\t"defaultOrder": [1,1,1,1],\n\t"dateFormats": {\n "full": [\n "dddd MMMM[. ]D[ ]Y",\n "dddd D[. ]MMMM[ ]Y",\n "dddd Y[. ]MMMM[. ]D"\n ],\n "long": [\n "MMMM[. ]D[ ]Y",\n "D[. ]MMMM[ ]Y",\n "Y[. ]MMMM[. ]D"\n ],\n "medium": [\n "M[. ]D[. ]Y",\n "D[. ]M[. ]Y",\n "Y[. ]M[. ]D"\n ],\n "short": [\n "M[. ]D[. ]Y",\n "D[. ]M[. ]Y",\n "Y[. ]M[. ]D"\n ]\n}\n}\n';});
  17500. define('text!baglass/core-client/js/core-client/i18n/custom/locale/es.json',[],function () { return '{\n\t"defaultOrder": [1,1,1,1],\n\t"dateFormats": {\n "full": [\n "dddd, MMMM[ de ]D[ de ]Y",\n "dddd, D[ de ]MMMM[ de ]Y",\n "dddd, Y[ de ]MMMM[ de ]D"\n ],\n "long": [\n "MMMM[ de ]D[ de ]Y",\n "D[ de ]MMMM[ de ]Y",\n "Y[ de ]MMMM[ de ]D"\n ],\n "medium": [\n "MM[/]DD[/]Y",\n "DD[/]MM[/]Y",\n "Y[/]MM[/]DD"\n ],\n "short": [\n "MM[/]DD[/]YY",\n "DD[/]MM[/]YY",\n "YY[/]MM[/]DD"\n ]\n}\n}\n';});
  17501. define('text!baglass/core-client/js/core-client/i18n/custom/locale/sv.json',[],function () { return '{\n\t"defaultOrder": [1,1,1,2],\n\t"dateFormats": {\n "full": [\n "dddd MMMM[ ]D[ ]Y",\n "dddd D[ ]MMMM[ ]Y",\n "dddd Y[ ]MMMM[ ]D"\n ],\n "long": [\n "MMM[ ]D[ ]Y",\n "D[ ]MMM[ ]Y",\n "Y[ ]MMM[ ]D"\n ],\n "medium": [\n "MM[-]DD[-]Y",\n "DD[-]MM[-]Y",\n "Y[-]MM[-]DD"\n ],\n "short": [\n "MM[-]DD[-]Y",\n "DD[-]MM[-]Y",\n "Y[-]MM[-]DD"\n ]\n}\n}\n';});
  17502. define('text!baglass/core-client/js/core-client/i18n/custom/locale/tr.json',[],function () { return '{\n\t"defaultOrder": [1,1,1,1],\n\t"dateFormats": {\n "full": [\n "MMMM[ ]DD[ ]Y dddd",\n "DD[ ]MMMM[ ]Y dddd",\n "Y[ ]MMMM[ ]DD dddd"\n ],\n "long": [\n "MMMM[ ]D[ ]Y",\n "D[ ]MMMM[ ]Y",\n "Y[ ]MMMM[ ]D"\n ],\n "medium": [\n "MMM[ ]D[ ]Y",\n "D[ ]MMM[ ]Y",\n "Y[ ]MMM[ ]D"\n ],\n "short": [\n "MM[.]D[.]Y",\n "D[.]MM[.]Y",\n "Y[.]MM[.]D"\n ]\n}\n}\n';});
  17503. /**
  17504. * Note this is an autogenerated file from the ba-locale-config project.
  17505. */
  17506. /**
  17507. * Licensed Materials - Property of IBM
  17508. * IBM Cognos Products: BI
  17509. * (C) Copyright IBM Corp. 2018
  17510. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  17511. */
  17512. define('baglass/core-client/js/core-client/i18n/custom/locale/all',['text!./ar.json', 'text!./zh-cn.json', 'text!./cs.json', 'text!./da.json', 'text!./nl.json', 'text!./en.json', 'text!./en-au.json', 'text!./en-ie.json', 'text!./fo.json', 'text!./fi.json', 'text!./fr-ch.json', 'text!./hu.json', 'text!./it.json', 'text!./ja.json', 'text!./ko.json', 'text!./nb.json', 'text!./pl.json', 'text!./pt.json', 'text!./ru.json', 'text!./sk.json', 'text!./es.json', 'text!./sv.json', 'text!./tr.json'], function (ar, zhcn, cs, da, nl, en, enau, enie, fo, fi, frch, hu, it, ja, ko, nb, pl, pt, ru, sk, es, sv, tr) {
  17513. return {
  17514. no: JSON.parse(nb),
  17515. nono: JSON.parse(nb),
  17516. ar: JSON.parse(ar),
  17517. ardz: JSON.parse(ar),
  17518. arbh: JSON.parse(ar),
  17519. areg: JSON.parse(ar),
  17520. ariq: JSON.parse(ar),
  17521. arjo: JSON.parse(ar),
  17522. arkw: JSON.parse(ar),
  17523. arlb: JSON.parse(ar),
  17524. arly: JSON.parse(ar),
  17525. arma: JSON.parse(ar),
  17526. arom: JSON.parse(ar),
  17527. arqa: JSON.parse(ar),
  17528. arsa: JSON.parse(ar),
  17529. arsy: JSON.parse(ar),
  17530. artn: JSON.parse(ar),
  17531. arae: JSON.parse(ar),
  17532. arye: JSON.parse(ar),
  17533. zhcn: JSON.parse(zhcn),
  17534. zhhk: JSON.parse(zhcn),
  17535. zhmo: JSON.parse(zhcn),
  17536. zhsg: JSON.parse(zhcn),
  17537. zhtw: JSON.parse(zhcn),
  17538. zh: JSON.parse(zhcn),
  17539. cs: JSON.parse(cs),
  17540. cscz: JSON.parse(cs),
  17541. da: JSON.parse(da),
  17542. dadk: JSON.parse(da),
  17543. nl: JSON.parse(nl),
  17544. nlnl: JSON.parse(nl),
  17545. en: JSON.parse(en),
  17546. envi: JSON.parse(en),
  17547. enus: JSON.parse(en),
  17548. or: JSON.parse(en),
  17549. orin: JSON.parse(en),
  17550. zu: JSON.parse(en),
  17551. zuza: JSON.parse(en),
  17552. enau: JSON.parse(enau),
  17553. ensg: JSON.parse(enau),
  17554. el: JSON.parse(enau),
  17555. elgr: JSON.parse(enau),
  17556. hi: JSON.parse(enau),
  17557. hiin: JSON.parse(enau),
  17558. pa: JSON.parse(enau),
  17559. pain: JSON.parse(enau),
  17560. enie: JSON.parse(enie),
  17561. fr: JSON.parse(enie),
  17562. frfr: JSON.parse(enie),
  17563. frlu: JSON.parse(enie),
  17564. ga: JSON.parse(enie),
  17565. gaie: JSON.parse(enie),
  17566. fo: JSON.parse(fo),
  17567. fofo: JSON.parse(fo),
  17568. de: JSON.parse(fo),
  17569. deat: JSON.parse(fo),
  17570. debe: JSON.parse(fo),
  17571. dede: JSON.parse(fo),
  17572. delu: JSON.parse(fo),
  17573. dech: JSON.parse(fo),
  17574. fi: JSON.parse(fi),
  17575. fifi: JSON.parse(fi),
  17576. frch: JSON.parse(frch),
  17577. itch: JSON.parse(frch),
  17578. hu: JSON.parse(hu),
  17579. huhu: JSON.parse(hu),
  17580. it: JSON.parse(it),
  17581. itit: JSON.parse(it),
  17582. ja: JSON.parse(ja),
  17583. jajp: JSON.parse(ja),
  17584. ko: JSON.parse(ko),
  17585. kokr: JSON.parse(ko),
  17586. nb: JSON.parse(nb),
  17587. nbno: JSON.parse(nb),
  17588. nn: JSON.parse(nb),
  17589. nnno: JSON.parse(nb),
  17590. pl: JSON.parse(pl),
  17591. plpl: JSON.parse(pl),
  17592. ro: JSON.parse(pl),
  17593. roro: JSON.parse(pl),
  17594. pt: JSON.parse(pt),
  17595. ptbr: JSON.parse(pt),
  17596. ru: JSON.parse(ru),
  17597. ruru: JSON.parse(ru),
  17598. ruua: JSON.parse(ru),
  17599. sk: JSON.parse(sk),
  17600. sksk: JSON.parse(sk),
  17601. es: JSON.parse(es),
  17602. esar: JSON.parse(es),
  17603. escr: JSON.parse(es),
  17604. esdo: JSON.parse(es),
  17605. esec: JSON.parse(es),
  17606. essv: JSON.parse(es),
  17607. esni: JSON.parse(es),
  17608. espy: JSON.parse(es),
  17609. eses: JSON.parse(es),
  17610. esus: JSON.parse(es),
  17611. esuy: JSON.parse(es),
  17612. esve: JSON.parse(es),
  17613. sv: JSON.parse(sv),
  17614. svse: JSON.parse(sv),
  17615. tr: JSON.parse(tr),
  17616. trtr: JSON.parse(tr)
  17617. };
  17618. });
  17619. //# sourceMappingURL=all.js.map
  17620. ;
  17621. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  17622. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  17623. /**
  17624. * Licensed Materials - Property of IBM
  17625. * IBM Cognos Products: BI
  17626. * (C) Copyright IBM Corp. 2018
  17627. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  17628. */
  17629. define('baglass/core-client/js/core-client/i18n/custom/Date',['./locale/all'], function (customLocaleData) {
  17630. var DISPLAY_ORDER = {
  17631. MDY: 0,
  17632. DMY: 1,
  17633. YMD: 2
  17634. };
  17635. var FORMAT_LENGTH = {
  17636. SHORT: 'short'
  17637. };
  17638. var FORMAT_LENGTH_INDEX = {
  17639. 'full': 0,
  17640. 'long': 1,
  17641. 'medium': 2,
  17642. 'short': 3
  17643. };
  17644. var REGEX_META_CHARS = '[\\^$.|?*+(){}';
  17645. /**
  17646. * Class to customize dates
  17647. *
  17648. */
  17649. var CustomDateUtil = function () {
  17650. function CustomDateUtil() {
  17651. _classCallCheck(this, CustomDateUtil);
  17652. }
  17653. _createClass(CustomDateUtil, null, [{
  17654. key: 'getDateFormat',
  17655. value: function getDateFormat(locale, customSettings) {
  17656. var formatLength = customSettings.formatLength,
  17657. separator = customSettings.separator,
  17658. displayOrder = customSettings.displayOrder;
  17659. formatLength = formatLength || FORMAT_LENGTH.SHORT;
  17660. var localeData = customLocaleData[locale] || customLocaleData['en'];
  17661. var sFormat = '';
  17662. displayOrder = displayOrder ? DISPLAY_ORDER[displayOrder] : localeData.defaultOrder[FORMAT_LENGTH_INDEX[formatLength]];
  17663. sFormat = localeData.dateFormats[formatLength][displayOrder];
  17664. if (separator) {
  17665. //Find a match that starts with '[' and ends with ']'' but don't contain
  17666. //[ or ]
  17667. sFormat = sFormat.replace(/\[[^[\]]*\]/g, function () {
  17668. return separator;
  17669. });
  17670. //Delete separators at the beginning and end
  17671. separator = REGEX_META_CHARS.includes(separator) ? '\\\\' + separator : separator;
  17672. var startEndSeparators = new RegExp('(' + separator + '$|^' + separator + ')', 'g');
  17673. sFormat = sFormat.replace(startEndSeparators, function () {
  17674. return '';
  17675. });
  17676. }
  17677. return sFormat;
  17678. }
  17679. }]);
  17680. return CustomDateUtil;
  17681. }();
  17682. return {
  17683. getDateFormat: CustomDateUtil.getDateFormat
  17684. };
  17685. });
  17686. //# sourceMappingURL=Date.js.map
  17687. ;
  17688. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  17689. /**
  17690. * Licensed Materials - Property of IBM
  17691. * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2014, 2019
  17692. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  17693. */
  17694. /**
  17695. * This class implements formatting functionality
  17696. *
  17697. * Supported formatSpec for numbers
  17698. * formatSpec: {
  17699. * type: 'number | currency | percent', // default - number, scientific - NOT SUPPORTED YET
  17700. * currencyCode: 'e.g. CAD | USD | EUR', // optional, ISO 4217 currency code http://en.wikipedia.org/wiki/ISO_4217
  17701. * minimumFractionDigits: see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat
  17702. * decimalFormatLength: 'short' // supported for 'number' type only, abbreviates numbers to short format 1,000 -> 1K
  17703. * }
  17704. *
  17705. * Supported formatSpec for dates
  17706. * formatSpec: {
  17707. * type: 'date | time | datetime | year',
  17708. * formatLength: 'short | medium | long | full', // default short
  17709. * timeZone: 'local | UTC', // optional, format to local or utc timezone
  17710. * }
  17711. */
  17712. define('baglass/core-client/js/core-client/i18n/Formatter',['../ui/core/Class', 'moment-timezone', 'ecma402/IntlShim', './FormatResources', './CurrencySymbols', 'underscore', './Const', '../i18n/custom/Date'], function (Class, moment, IntlPolyfill, formatResources, CurrencySymbols, _, Const, DateCustomizer) {
  17713. var Formatter = null;
  17714. var FORMATTER_TYPE = {
  17715. NumberFormat: 'NumberFormat'
  17716. };
  17717. var FRACTION_DIGITS = {
  17718. MIN: 0,
  17719. MAX: 20
  17720. };
  17721. Formatter = Class.extend({
  17722. init: function init() {
  17723. this.formatterCache = {};
  17724. },
  17725. /**
  17726. * Parses the decimal number for different locales
  17727. * @param value string representation of the localized decimal
  17728. * @returns the number representation of the decimal
  17729. */
  17730. parseDecimal: function parseDecimal(value, locale) {
  17731. /**
  17732. * escape any regex characters
  17733. * change ' ' to \s to handle all space types
  17734. *
  17735. * @param text
  17736. * @returns {*}
  17737. */
  17738. function escapeRegexString(text) {
  17739. var escStr = text.replace(/[-[\]{}()*+?.,\\^$|]/g, '\\$&');
  17740. return escStr.replace(/[\s]/g, '\\s');
  17741. }
  17742. var decimalSeparator = this.formatNumber(0.1, locale ? { locale: locale } : null).substring(1, 2);
  17743. var decimalSepRe = new RegExp('[' + escapeRegexString(decimalSeparator) + ']');
  17744. //remove all chars that are not a digit or a decimalSeparator
  17745. var invalidCharsRe = new RegExp('[^\\d' + escapeRegexString(decimalSeparator) + ']', 'g');
  17746. var cleanedValue = value.replace(invalidCharsRe, '');
  17747. return Number(cleanedValue.replace(decimalSepRe, '.'));
  17748. },
  17749. /**
  17750. * Formats the value based on the given formatSpec
  17751. * @param value input value
  17752. * @param spec format spec that follow the syntax above
  17753. * @returns string value formatted to the formatSpec and rules of the dojo locale
  17754. */
  17755. format: function format(value, spec) {
  17756. if (!spec) {
  17757. return this.formatNumber(value, { type: 'decimal' });
  17758. } else {
  17759. if ((value === undefined || value === null || value === '') && spec.defaultValue) {
  17760. return spec.defaultValue;
  17761. } else if (spec.type === 'date' || spec.type === 'datetime' || spec.type === 'time' || spec.type === 'lastModified') {
  17762. return this.formatDateTime(value, spec);
  17763. } else if (spec.type === 'year') {
  17764. return this.formatYear(value, spec);
  17765. } else if (spec.type === 'text') {
  17766. return this.formatText(value, spec);
  17767. } else {
  17768. return this.formatNumber(value, spec);
  17769. }
  17770. }
  17771. },
  17772. /**
  17773. * Formats the value based on the given number formatSpec
  17774. * @param value input value
  17775. * @param spec format spec that follow the syntax above
  17776. * @returns string value formatted to the formatSpec and rules of the requirejs locale
  17777. */
  17778. formatNumber: function formatNumber(value, spec) {
  17779. if (_.isNaN(value)) {
  17780. return 'NaN';
  17781. }
  17782. var result = value;
  17783. var options = { style: 'decimal' };
  17784. var locale = spec && spec.locale || this._getUserLocale();
  17785. if (spec) {
  17786. if (spec.type === 'currency') {
  17787. if (spec.currencyCode) {
  17788. options.style = spec.type;
  17789. options.currency = spec.currencyCode;
  17790. options.currencyDisplay = spec.currencyDisplay;
  17791. }
  17792. options.useGrouping = spec.useGrouping;
  17793. // minimum/maximumFractionDefaults should be undefined if not explicitly set in the spec.
  17794. // This allows JP/KR to use their proper default (0)
  17795. var minFractionDigit = 0;
  17796. if (_.isNumber(spec.minimumFractionDigits)) {
  17797. minFractionDigit = spec.minimumFractionDigits;
  17798. options.minimumFractionDigits = spec.minimumFractionDigits;
  17799. }
  17800. if (_.isNumber(spec.maximumFractionDigits)) {
  17801. options.maximumFractionDigits = Math.max(spec.maximumFractionDigits, minFractionDigit);
  17802. }
  17803. options.pattern = spec.pattern;
  17804. //Adding support for Abbreviation if type is Currency.
  17805. if (spec.decimalFormatLength && spec.decimalFormatLength === 'short') {
  17806. return this._formatShortNumber(value, locale, spec);
  17807. }
  17808. } else if (spec.type === 'percent') {
  17809. if (spec.convertPercent === false) {
  17810. value = value / 100;
  17811. }
  17812. options.style = spec.type;
  17813. if (_.isNumber(spec.minimumFractionDigits)) {
  17814. options.minimumFractionDigits = spec.minimumFractionDigits;
  17815. }
  17816. if (_.isNumber(spec.maximumFractionDigits)) {
  17817. options.maximumFractionDigits = spec.maximumFractionDigits;
  17818. }
  17819. options.useGrouping = spec.useGrouping;
  17820. } else {
  17821. _.extend(options, spec);
  17822. if (spec.decimalFormatLength && spec.decimalFormatLength === 'short') {
  17823. return this._formatShortNumber(value, locale, spec);
  17824. }
  17825. }
  17826. }
  17827. var nf = this._getFormatter(locale, options, FORMATTER_TYPE.NumberFormat);
  17828. if (spec && spec.pattern) {
  17829. nf.resolved.pattern = spec.pattern;
  17830. }
  17831. result = nf.format(value);
  17832. // ecma402/IntlShim is dependent on locale for showing the currency symbol (ie: if the currency is not supported by the locale,
  17833. // the formatter uses the international currency code instead of the symbol). Here, we ensure that the symbol is used for that case
  17834. if (options.currency && spec.currencyDisplay !== 'code' && CurrencySymbols[options.currency]) {
  17835. var replace = CurrencySymbols[options.currency].replace ? CurrencySymbols[options.currency].replace : options.currency;
  17836. result = result.replace(replace, CurrencySymbols[options.currency].symbol);
  17837. }
  17838. // if currencySymbol is set, replace any existing currency with custom symbol
  17839. if (spec && spec.currencySymbol && spec.currencyDisplay !== 'code') {
  17840. var symbol = options.currency && CurrencySymbols[options.currency] && CurrencySymbols[options.currency].symbol;
  17841. if (symbol) {
  17842. result = result.replace(symbol, spec.currencySymbol);
  17843. } else {
  17844. result = spec.currencySymbol + result;
  17845. }
  17846. }
  17847. result = this._addNumberLabel(result, spec);
  17848. return !result || result === 'NaN' || result === '-NaN' ? value : result;
  17849. },
  17850. /**
  17851. * Formats the value based on the given date/time formatSpec
  17852. * @param value a Date object
  17853. * @param spec format spec that follow the syntax above
  17854. * @returns string value formatted to the formatSpec and rules of the requirejs locale
  17855. */
  17856. formatDateTime: function formatDateTime(value, spec) {
  17857. var result = null;
  17858. var locale = this._getUserLocale();
  17859. var timezone = moment.tz.guess();
  17860. var momentDatetimeFormat = 'l';
  17861. var type = '';
  17862. if (spec) {
  17863. type = spec.type || '';
  17864. if (type === 'lastModified') {
  17865. spec.type = 'datetime';
  17866. }
  17867. locale = spec.locale || locale;
  17868. momentDatetimeFormat = this._getDateTimeFormat(locale, spec);
  17869. timezone = spec.timezone || timezone;
  17870. }
  17871. try {
  17872. if (this.isTimeOnly(value)) {
  17873. result = moment.utc('1970-01-01T' + value).locale(locale).format(momentDatetimeFormat);
  17874. } else if (type === 'lastModified') {
  17875. result = moment.utc(value, 'ddd, DD MMM YYYY HH:mm:ss [GMT]').tz(timezone).format(momentDatetimeFormat);
  17876. } else {
  17877. //Date or DateTime
  17878. if (type === 'year') {
  17879. momentDatetimeFormat = this._getMomentDateTimeFormatOption(value, spec);
  17880. }
  17881. /*
  17882. * Value needs to be created into a new Date because UTC date strings ie(Thu ,14 Jul 2016 14:43:00 GMT) are returned as invalid date.
  17883. */
  17884. if (moment.tz(value, timezone).locale(locale).tz(timezone).format(momentDatetimeFormat) === 'Invalid Date') {
  17885. result = moment.tz(new Date(value), timezone).locale(locale).tz(timezone).format(momentDatetimeFormat);
  17886. } else {
  17887. var sFormat = '';
  17888. if (spec.displayOrder || spec.separator) {
  17889. //return non-locale format
  17890. sFormat = this._getCustomDateFormat(locale, spec);
  17891. result = moment.tz(value, timezone).locale(locale).format(sFormat);
  17892. } else {
  17893. result = moment.tz(value, timezone).locale(locale).format(momentDatetimeFormat);
  17894. }
  17895. }
  17896. }
  17897. } catch (e) {
  17898. result = value;
  17899. }
  17900. return !result ? value : result;
  17901. },
  17902. formatYear: function formatYear(value, spec) {
  17903. var result = '';
  17904. var momentDatetimeFormat = 'l';
  17905. if (spec) {
  17906. momentDatetimeFormat = this._getMomentDateTimeFormatOption(value, spec);
  17907. }
  17908. result = moment(value + '010').format(momentDatetimeFormat);
  17909. return result;
  17910. },
  17911. /**
  17912. * Formats the value based on the given text formatSpec
  17913. * @param value a string
  17914. * @param spec format spec that follow the syntax above
  17915. * @returns string value formatted to the formatSpec
  17916. */
  17917. formatText: function formatText(value, spec) {
  17918. // currently no text-specific formatting
  17919. void spec;
  17920. return value;
  17921. },
  17922. _getUserLocale: function _getUserLocale() {
  17923. return requirejs.s.contexts._.config.locale || 'en-us';
  17924. },
  17925. _getCustomDateFormat: function _getCustomDateFormat(locale, spec) {
  17926. var _spec = {
  17927. formatLength: spec.formatLength || spec.dateStyle,
  17928. displayOrder: spec.displayOrder,
  17929. separator: spec.separator
  17930. };
  17931. return this.getCustomDateFormat(locale, _spec);
  17932. },
  17933. /**
  17934. * Determines if the value parameter has only the time component of an ISO timestamp
  17935. * A full ISO timestamp is : YYYY-MM-DDTHH:mm:ssZ
  17936. * Time only would be HH:mm:ssZ
  17937. */
  17938. isTimeOnly: function isTimeOnly(value) {
  17939. var d = new Date(value); //eg '12:01:01' or '12:01:01Z' or '1989-01-01T12:01:01Z'
  17940. var t = d.getTime();
  17941. if (isNaN(t)) {
  17942. d = new Date('1970-01-01T' + value);
  17943. t = d.getTime();
  17944. if (isNaN(t)) {
  17945. d = new Date('1970-01-01T' + value + 'Z');
  17946. t = d.getTime();
  17947. if (isNaN(t)) {
  17948. return false;
  17949. }
  17950. return true;
  17951. }
  17952. return true;
  17953. }
  17954. return false;
  17955. },
  17956. _formatShortNumber: function _formatShortNumber(value, locale, spec) {
  17957. var strValue = String(Math.round(Math.abs(value)));
  17958. var numOfDigits = strValue.length;
  17959. var nf;
  17960. if (numOfDigits <= 3) {
  17961. var _options2 = {};
  17962. if (spec.currencyCode) {
  17963. _options2.style = 'currency';
  17964. _options2.currency = spec.currencyCode;
  17965. }
  17966. nf = this._getFormatter(locale, _options2, FORMATTER_TYPE.NumberFormat);
  17967. return nf.format(value);
  17968. }
  17969. var patterns = formatResources.getShortNumberFormatPatterns(locale);
  17970. var patternKeys = Object.keys(patterns);
  17971. var lastKey = patternKeys[patternKeys.length - 1];
  17972. var maxNumOfDigits = lastKey.substring(0, lastKey.indexOf('-')).length;
  17973. if (strValue.length > maxNumOfDigits) {
  17974. numOfDigits = maxNumOfDigits;
  17975. }
  17976. var maximumSignificantDigits = spec.maximumSignificantDigits ? spec.maximumSignificantDigits : strValue.length > 15 ? strValue.length - 15 + 3 : 3;
  17977. var pattern = patterns[this._generatePatternKey(numOfDigits)];
  17978. var numberOfZeros = pattern.lastIndexOf('0') - pattern.indexOf('0') + 1;
  17979. if (maximumSignificantDigits < numberOfZeros) {
  17980. maximumSignificantDigits = numberOfZeros;
  17981. }
  17982. var options = {
  17983. maximumFractionDigits: 2,
  17984. maximumSignificantDigits: maximumSignificantDigits
  17985. };
  17986. // apply applicable currency options
  17987. if (spec.currencyCode) {
  17988. options.style = 'currency';
  17989. options.currency = spec.currencyCode;
  17990. options.currencyDisplay = spec.currencyDisplay;
  17991. }
  17992. nf = this._getFormatter(locale, options, FORMATTER_TYPE.NumberFormat);
  17993. var formatResult = nf.format(value / this._getDevisionFactor(numOfDigits, numberOfZeros));
  17994. var result;
  17995. //handle case where currency symbol is at the end (e.g. 500 k $CA)
  17996. if (spec.currencyCode && !isNaN(parseInt(formatResult.charAt(0)))) {
  17997. var _formatResult$split = formatResult.split(/\s/),
  17998. _formatResult$split2 = _slicedToArray(_formatResult$split, 2),
  17999. num = _formatResult$split2[0],
  18000. currencySymbol = _formatResult$split2[1];
  18001. result = pattern.replace(/0+/g, num) + ' ' + currencySymbol;
  18002. } else {
  18003. result = pattern.replace(/0+/g, formatResult);
  18004. }
  18005. // Set label if set
  18006. result = this._addNumberLabel(result, spec);
  18007. return result.replace(/'/g, '');
  18008. },
  18009. _addNumberLabel: function _addNumberLabel(result, spec) {
  18010. if (spec && spec.numberLabel) {
  18011. result = spec.numberLabelPosition && spec.numberLabelPosition === 'left' ? spec.numberLabel + result : result + spec.numberLabel;
  18012. }
  18013. return result;
  18014. },
  18015. _getDevisionFactor: function _getDevisionFactor(numOfDigits, numberOfZeros) {
  18016. return Math.pow(10, numOfDigits - numberOfZeros);
  18017. },
  18018. _generatePatternKey: function _generatePatternKey(digits) {
  18019. var zeros = new Array(digits).join('0');
  18020. return '1' + zeros + '-count-other';
  18021. },
  18022. _getFormatter: function _getFormatter(locale, options, type) {
  18023. var _options = this._getFormatTypeValidOptions(options, type);
  18024. var key = this._createCacheKey(locale, _options, type);
  18025. var formatter = this.formatterCache[key];
  18026. if (!formatter) {
  18027. formatter = new IntlPolyfill[type](locale, _options);
  18028. this.formatterCache[key] = formatter;
  18029. }
  18030. return formatter;
  18031. },
  18032. _getFormatTypeValidOptions: function _getFormatTypeValidOptions(options, type) {
  18033. var opt = options;
  18034. switch (type) {
  18035. case FORMATTER_TYPE.NumberFormat:
  18036. opt = this._getValidNumberOptions(opt);
  18037. break;
  18038. }
  18039. return opt;
  18040. },
  18041. _getValidNumberOptions: function _getValidNumberOptions(options) {
  18042. var opt = _.extend(options);
  18043. var _assignValidFractionDigits = function _assignValidFractionDigits(fractionDigits) {
  18044. if (!_.isUndefined(opt[fractionDigits])) {
  18045. if (opt[fractionDigits] > FRACTION_DIGITS.MAX) {
  18046. opt[fractionDigits] = FRACTION_DIGITS.MAX;
  18047. } else if (opt[fractionDigits] < FRACTION_DIGITS.MIN) {
  18048. opt[fractionDigits] = FRACTION_DIGITS.MIN;
  18049. }
  18050. }
  18051. };
  18052. _assignValidFractionDigits('minimumFractionDigits');
  18053. _assignValidFractionDigits('maximumFractionDigits');
  18054. return opt;
  18055. },
  18056. _createCacheKey: function _createCacheKey(locale, options, type) {
  18057. var names = Object.keys(options).sort();
  18058. var output = [type, locale];
  18059. var name;
  18060. for (var i = 0; i < names.length; i++) {
  18061. name = names[i];
  18062. output.push(name, options[name]);
  18063. }
  18064. return output.join();
  18065. },
  18066. isInt: function isInt(value) {
  18067. return typeof value === 'number' && value % 1 === 0;
  18068. },
  18069. _hasTime: function _hasTime(value) {
  18070. return value instanceof Date || this.isInt(value) || value.indexOf('T') > 0 || value.indexOf(':') > 0;
  18071. },
  18072. _getMomentDateTimeFormatOption: function _getMomentDateTimeFormatOption(value, spec) {
  18073. /*jshint maxcomplexity:26 */
  18074. // This formatter for date/time handles these types as defined in the header
  18075. // date || time || datetime || year
  18076. var sFormat = 'l';
  18077. var format;
  18078. if (spec.type === 'time' || this.isTimeOnly(value)) {
  18079. format = spec.formatLength || spec.timeStyle;
  18080. // Time formats
  18081. switch (format) {
  18082. case 'full':
  18083. sFormat = 'HH:mm:ss A'; // 24 hours
  18084. break;
  18085. case 'long':
  18086. sFormat = 'hh:mm:ss A';
  18087. break;
  18088. case 'medium':
  18089. sFormat = 'h:m:s A';
  18090. break;
  18091. case 'short':
  18092. sFormat = 'LT';
  18093. break;
  18094. default:
  18095. sFormat = 'LT';
  18096. break;
  18097. }
  18098. } else if (spec.type === 'year') {
  18099. // Year type
  18100. switch (spec.formatLength) {
  18101. case 'full':
  18102. case 'long':
  18103. case 'medium':
  18104. sFormat = 'YYYY';
  18105. break;
  18106. case 'short':
  18107. sFormat = 'YY';
  18108. break;
  18109. default:
  18110. sFormat = 'YYYY';
  18111. break;
  18112. }
  18113. } else if (spec.type === 'date') {
  18114. format = spec.formatLength || spec.dateStyle;
  18115. switch (format) {
  18116. case 'full':
  18117. sFormat = 'LLLL';
  18118. break;
  18119. case 'long':
  18120. sFormat = 'LLL';
  18121. break;
  18122. case 'medium':
  18123. sFormat = 'll';
  18124. break;
  18125. case 'short':
  18126. sFormat = 'l';
  18127. break;
  18128. default:
  18129. sFormat = 'l';
  18130. break;
  18131. }
  18132. } else if (spec.type === 'datetime' || this._hasTime(value)) {
  18133. format = spec.formatLength || spec.dateStyle;
  18134. switch (format) {
  18135. case 'full':
  18136. sFormat = 'LLLL';
  18137. break;
  18138. case 'long':
  18139. sFormat = 'LLL';
  18140. break;
  18141. case 'medium':
  18142. sFormat = 'lll';
  18143. break;
  18144. case 'short':
  18145. sFormat = 'l LT';
  18146. break;
  18147. default:
  18148. sFormat = 'l LT';
  18149. break;
  18150. }
  18151. }
  18152. return sFormat;
  18153. },
  18154. _getDateTimeFormat: function _getDateTimeFormat(locale, spec) {
  18155. var cldr2MomentFormat = function cldr2MomentFormat(sFormat) {
  18156. var TOKENS = Const.TOKENS;
  18157. // replace comments
  18158. sFormat = sFormat.replace(/'[^']+'/g, function (m) {
  18159. m = m.replace(/'/g, '');
  18160. return '[' + m + ']';
  18161. });
  18162. sFormat = sFormat.replace(/\bEEEE\b/, TOKENS.DOW);
  18163. sFormat = sFormat.replace(/\bcccc\b/, TOKENS.DOW);
  18164. sFormat = sFormat.replace(/\bdd\b/, TOKENS.DD);
  18165. sFormat = sFormat.replace(/\bd\b/, TOKENS.D);
  18166. sFormat = sFormat.replace(/\byy\b/, TOKENS.Y_SHORT);
  18167. sFormat = sFormat.replace(/\by\b/, TOKENS.Y);
  18168. sFormat = sFormat.replace(/\ba\b/, TOKENS.A);
  18169. sFormat = sFormat.replace(/\bzzzz\b/, TOKENS.ZZ);
  18170. return sFormat;
  18171. };
  18172. var formatLength = spec.formatLength || spec.dateStyle || spec.timeStyle || 'short';
  18173. if (Const.SIZES.indexOf(formatLength) === -1) {
  18174. formatLength = 'short';
  18175. }
  18176. var getter = void 0;
  18177. switch (spec.type) {
  18178. case 'time':
  18179. getter = formatResources.getTimeFormatPatterns;
  18180. break;
  18181. case 'date':
  18182. getter = formatResources.getDateFormatPatterns;
  18183. break;
  18184. case 'datetime':
  18185. getter = formatResources.getDateTimeFormatPatterns;
  18186. break;
  18187. default:
  18188. getter = formatResources.getDateTimeFormatPatterns;
  18189. }
  18190. return cldr2MomentFormat(getter.call(formatResources, locale)[formatLength]);
  18191. },
  18192. /**
  18193. * Returns a custom moment format based on spec and locale
  18194. */
  18195. getCustomDateFormat: function getCustomDateFormat(locale, spec) {
  18196. return DateCustomizer.getDateFormat(locale, spec);
  18197. }
  18198. });
  18199. return new Formatter();
  18200. });
  18201. //# sourceMappingURL=Formatter.js.map
  18202. ;
  18203. /**
  18204. * Licensed Materials - Property of IBM
  18205. * IBM Cognos Products: BI UI_Commons
  18206. * (C) Copyright IBM Corp. 2017
  18207. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  18208. */
  18209. define('baglass/core-client/js/core-client/utils/DateTimeUtils',['moment-timezone', '../i18n/Formatter', 'baglass/services/LogService'], function (moment, Formatter, LogService) {
  18210. return {
  18211. //maps the formatLength to the string used for localized formats of date used by momentjs
  18212. LOCALIZED_DATE_FORMAT: {
  18213. 'long': 'ddd LL',
  18214. 'medium': 'll',
  18215. 'short': 'l'
  18216. },
  18217. //maps the formatLength to the string used for localized formats of datetime used by momentjs
  18218. LOCALIZED_DATETIME_FORMAT: {
  18219. 'long': 'llll',
  18220. 'medium': 'lll',
  18221. 'short': 'l LT'
  18222. },
  18223. //maps the formatLength to the string used for localized formats of time used by momentjs
  18224. LOCALIZED_TIME_FORMAT: {
  18225. 'long': 'LTS',
  18226. 'short': 'LT'
  18227. },
  18228. LOCALE_MOMENT_MAP: {
  18229. 'zh-hans': 'zh-cn',
  18230. 'zh-hans-sg': 'zh-cn',
  18231. 'zh-sg': 'zh-cn',
  18232. 'zh-hant': 'zh-tw',
  18233. 'zh-hant-hk': 'zh-tw',
  18234. 'zh-hk': 'zh-tw',
  18235. 'zh-mo': 'zh-tw'
  18236. },
  18237. _userTimeLocale: function _userTimeLocale(timeLocale) {
  18238. var userTimeLocale = timeLocale ? timeLocale : {};
  18239. var _userTime = {
  18240. contentLocale: userTimeLocale.contentLocale || 'en',
  18241. timeZone: userTimeLocale.timeZone || 'America/New_York'
  18242. };
  18243. var momentMap;
  18244. // See https://github.com/moment/moment/issues/3099, there is no default "zh" language
  18245. if ((momentMap = this.LOCALE_MOMENT_MAP[_userTime.contentLocale.toLowerCase()]) !== undefined) {
  18246. _userTime.contentLocale = momentMap;
  18247. }
  18248. return _userTime;
  18249. },
  18250. /**
  18251. * Use Formatter class to do all formatting
  18252. * @param type {string} what we are formatting ie. 'date', 'time', 'datetime'
  18253. * @param value
  18254. * @param format {string} - format ie. 'short', 'medium', 'long', 'full'
  18255. * @param timeLocale {object} - locale info
  18256. * @returns {*|string}
  18257. */
  18258. format: function format(type, value, formatLength, timeLocale) {
  18259. timeLocale = this._userTimeLocale(timeLocale);
  18260. var spec = {
  18261. type: type,
  18262. locale: timeLocale.contentLocale,
  18263. timezone: timeLocale.timeZone,
  18264. formatLength: formatLength
  18265. };
  18266. return Formatter.format(value, spec);
  18267. },
  18268. /*
  18269. * Returns localized-formatted date for the timezone specified in the user's preferences.
  18270. * Default timezone if none found - America/New_York
  18271. * Default formatLength - short
  18272. *
  18273. * long - September 4, 1989
  18274. * medium - Sep 4, 1989
  18275. * short - 09/04/1989
  18276. */
  18277. formatDate: function formatDate() {
  18278. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  18279. args[_key] = arguments[_key];
  18280. }
  18281. return this.format.apply(this, ['date'].concat(args));
  18282. },
  18283. /*
  18284. * Returns localized-formatted datetime for the timezone specified in the user's preferences
  18285. * Default timezone if none found - America/New_York
  18286. * Default formatLength - short
  18287. *
  18288. * long - September 4, 1989 8:30 PM
  18289. * medium - Sep 4, 1989 8:30 PM
  18290. * short - 09/04/1989 8:30PM
  18291. */
  18292. formatDateTime: function formatDateTime() {
  18293. for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  18294. args[_key2] = arguments[_key2];
  18295. }
  18296. return this.format.apply(this, ['datetime'].concat(args));
  18297. },
  18298. /*
  18299. * Returns localized-formatted time for the timezone specified in the user's preferences
  18300. * Default timezone if none found - America/New_York
  18301. * Default formatLength - short
  18302. *
  18303. * long - 8:30:30 PM
  18304. * short - 8:30 PM
  18305. */
  18306. formatTime: function formatTime() {
  18307. for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  18308. args[_key3] = arguments[_key3];
  18309. }
  18310. return this.format.apply(this, ['time'].concat(args));
  18311. },
  18312. /**
  18313. * @public
  18314. * Return true if a given locale uses 24hr time format, and false if it uses 12hr.
  18315. * Uses Moment's built in locale information.
  18316. * Throws an exception if no locale is provided.
  18317. *
  18318. * @param {string} contentLocale - the locale to check, eg. 'en'
  18319. * @returns {boolean} true if the locale uses 24hr time format. False if the locale uses 12hr time format or no locale data is found.
  18320. * @throws {Error} if no contentLocale is provided
  18321. */
  18322. is24HrFormat: function is24HrFormat(contentLocale) {
  18323. if (!contentLocale) {
  18324. var logger = new LogService();
  18325. logger.error('No locale provided');
  18326. }
  18327. var localeData = moment.localeData(contentLocale) || moment.localeData('en');
  18328. var timeFormat = localeData.longDateFormat('LT');
  18329. return timeFormat.indexOf('H') > -1;
  18330. },
  18331. /**
  18332. * Returns a custom moment format based on spec and locale
  18333. */
  18334. getCustomDateFormat: function getCustomDateFormat(locale, spec) {
  18335. return Formatter.getCustomDateFormat(locale, spec);
  18336. }
  18337. };
  18338. });
  18339. //# sourceMappingURL=DateTimeUtils.js.map
  18340. ;
  18341. /**
  18342. * Licensed Materials - Property of IBM
  18343. * IBM Cognos Products: BI
  18344. * Copyright IBM Corp. 2017
  18345. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  18346. */
  18347. define('baglass/core-client/js/core-client/utils/all',['./Promise', './DatasetExecutionManager', './dom-utils', './Downloader', './PromptCapabilities', './PromptManager', './DateTimeUtils', './PerfUtils'], function () {});
  18348. //# sourceMappingURL=all.js.map
  18349. ;
  18350. /**
  18351. * Licensed Materials - Property of IBM
  18352. *
  18353. * IBM Cognos Products: BI UI Commons
  18354. *
  18355. * Copyright IBM Corp. 2015, 2016
  18356. *
  18357. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  18358. */
  18359. define('baglass/core-client/js/core-client/ui/dialogs/BaseShareAndEmbedDialog',['./GenericViewDialog', 'jquery', '../../nls/StringResources', '../../utils/BrowserUtils'], function (BaseDialog, $, StringResources, BrowserUtils) {
  18360. /**
  18361. * Base class for the Share and Embed Modal dialogs.
  18362. * It is not meant to be used as is but rather extended.
  18363. *
  18364. * @param - options // anything that you want to keep as part of the dialog instance.
  18365. *
  18366. */
  18367. var BaseShareAndEmbedDialog = BaseDialog.extend({
  18368. init: function init(options) {
  18369. var dialogOptions = {
  18370. 'buttons': [{
  18371. 'text': StringResources.get('copyText'),
  18372. 'handler': this.copyToClipboard.bind(this),
  18373. 'type': 'primary',
  18374. 'defaultId': 'copy_button'
  18375. }, 'cancel'],
  18376. 'blockerClass': 'newModalDialog'
  18377. };
  18378. $.extend(true, dialogOptions, options);
  18379. BaseShareAndEmbedDialog.inherited('init', this, [dialogOptions]);
  18380. },
  18381. setFocus: function setFocus() {
  18382. var container = this._container();
  18383. var textField = container.find('.displayedURLOrCode')[0];
  18384. // if iPad disable readonly so text selection options appear
  18385. if (BrowserUtils.isIPad()) {
  18386. $(textField).attr('readonly', false);
  18387. }
  18388. $(textField).on('focus', function () {
  18389. // select() fails on iOS Safari, use setSelectionRange()
  18390. textField.setSelectionRange(0, textField.value.length);
  18391. //disable mouseup event so text isn't deselected
  18392. $(textField).mouseup(function (e) {
  18393. e.preventDefault();
  18394. });
  18395. });
  18396. $(textField).focus();
  18397. },
  18398. copyToClipboard: function copyToClipboard() {
  18399. this.setFocus();
  18400. document.execCommand('copy');
  18401. },
  18402. destroy: function destroy() {
  18403. BaseShareAndEmbedDialog.inherited('destroy', this, arguments);
  18404. }
  18405. });
  18406. return BaseShareAndEmbedDialog;
  18407. });
  18408. //# sourceMappingURL=BaseShareAndEmbedDialog.js.map
  18409. ;
  18410. /**
  18411. * Licensed Materials - Property of IBM
  18412. * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2016
  18413. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  18414. */
  18415. define('baglass/core-client/js/core-client/ui/dialogs/MessageBox',['./BaseDialog', 'jquery', 'underscore'], function (BaseDialog, $, _) {
  18416. var Dialog = null;
  18417. Dialog = BaseDialog.extend({
  18418. _buttons: ['ok'],
  18419. init: function init(sType, sTitle, sMessage) {
  18420. this._props = {
  18421. 'type': sType,
  18422. 'title': sTitle,
  18423. 'msg': sMessage
  18424. };
  18425. this.id = 'com-ibm-ca-messageBoxTitle';
  18426. this.contentId = 'com-ibm-ca-messageBoxContent';
  18427. Dialog.inherited('init', this, [this._props]);
  18428. },
  18429. renderContent: function renderContent(n) {
  18430. n.append($('<div>', {
  18431. 'class': 'messageBox ' + this._props.type,
  18432. 'html': _.escape(this._props.msg)
  18433. }));
  18434. return n;
  18435. },
  18436. renderTitle: function renderTitle(n) {
  18437. n.text(this._props.title);
  18438. return n;
  18439. }
  18440. });
  18441. return Dialog;
  18442. });
  18443. //# sourceMappingURL=MessageBox.js.map
  18444. ;
  18445. /**
  18446. * An extension of a MessageBox to provide a confirmation dialog
  18447. *
  18448. * Licensed Materials - Property of IBM
  18449. * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2016
  18450. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  18451. */
  18452. define('baglass/core-client/js/core-client/ui/dialogs/ConfirmationDialog',['./MessageBox'], function (MessageBox) {
  18453. var ConfirmationDialog = null;
  18454. ConfirmationDialog = MessageBox.extend(
  18455. /**
  18456. * @lends ConfirmationDialog.prototype
  18457. */
  18458. {
  18459. _buttons: ['ok', 'cancel'],
  18460. _confirmCallback: null,
  18461. _cancelCallback: null,
  18462. /**
  18463. * Opens the Confirmation dialog
  18464. * @param {function} confirm - A callback to use when the user clicks OK
  18465. * @param {function} cancel - A callback to use when the user clicks Cancel
  18466. */
  18467. confirm: function confirm(_confirm, cancel) {
  18468. this._confirmCallback = _confirm;
  18469. this._cancelCallback = cancel;
  18470. ConfirmationDialog.inherited('open', this);
  18471. },
  18472. ok: function ok() {
  18473. ConfirmationDialog.inherited('ok', this, arguments);
  18474. if (this._confirmCallback) {
  18475. this._confirmCallback();
  18476. }
  18477. },
  18478. cancel: function cancel() {
  18479. ConfirmationDialog.inherited('cancel', this, arguments);
  18480. if (this._cancelCallback) {
  18481. this._cancelCallback();
  18482. }
  18483. }
  18484. });
  18485. return ConfirmationDialog;
  18486. });
  18487. //# sourceMappingURL=ConfirmationDialog.js.map
  18488. ;
  18489. /**
  18490. * Licensed Materials - Property of IBM
  18491. * IBM Cognos Products: BI
  18492. * Copyright IBM Corp. 2017, 2018
  18493. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  18494. */
  18495. define('baglass/core-client/js/core-client/ui/dialogs/all',['./BaseDialog', './BaseShareAndEmbedDialog', './ConfirmationDialog', './GenericViewDialog', './MessageBox'], function () {});
  18496. //# sourceMappingURL=all.js.map
  18497. ;
  18498. /**
  18499. * Licensed Materials - Property of IBM
  18500. * IBM Cognos Products: BI
  18501. * Copyright IBM Corp. 2017
  18502. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  18503. */
  18504. define('baglass/core-client/js/core-client/ui/all',['./dialogs/all', './ProgressToast'], function () {});
  18505. //# sourceMappingURL=all.js.map
  18506. ;
  18507. /**
  18508. * Licensed Materials - Property of IBM
  18509. * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2016, 2018
  18510. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  18511. */
  18512. define('baglass/core-client/js/core-client/i18n/V5Formatter',['../ui/core/Class', 'underscore', './Formatter'], function (Class, _, formatter) {
  18513. var FormatUtils = null;
  18514. // Map the model format type to our format type
  18515. var TYPE_MAP = {
  18516. numberFormat: 'number',
  18517. currencyFormat: 'currency',
  18518. percentFormat: 'percent',
  18519. dateFormat: 'date',
  18520. dateTimeFormat: 'datetime',
  18521. timeFormat: 'time',
  18522. stringFormat: 'text'
  18523. };
  18524. // Map our property names to the model format property names
  18525. var V5_PROP_MAP = {
  18526. decimalSize: function decimalSize(modelSpec) {
  18527. if (modelSpec.decimalSize) {
  18528. return { minimumFractionDigits: parseInt(modelSpec.decimalSize), maximumFractionDigits: parseInt(modelSpec.decimalSize) };
  18529. }
  18530. },
  18531. useGrouping: function useGrouping(modelSpec) {
  18532. return _.isUndefined(modelSpec.useGrouping) ? {} : { useGrouping: modelSpec.useGrouping === 'true' };
  18533. },
  18534. currencyCode: 'currencyCode',
  18535. currencySymbol: 'currencySymbol',
  18536. useIntlSymbol: function useIntlSymbol(modelSpec) {
  18537. return { currencyDisplay: modelSpec.useIntlSymbol === 'true' ? 'code' : 'symbol' };
  18538. },
  18539. dateStyle: 'dateStyle',
  18540. dateSeparator: 'separator',
  18541. displayOrder: 'displayOrder',
  18542. timeStyle: 'timeStyle',
  18543. numberLabel: 'numberLabel',
  18544. numberLabelPosition: 'numberLabelPosition',
  18545. whenMissing: function whenMissing(modelSpec) {
  18546. if (modelSpec.whenMissing) {
  18547. return { defaultValue: modelSpec.whenMissing };
  18548. }
  18549. }
  18550. };
  18551. // Map that contains the list of supported v5 model properties for each format type that we support
  18552. var SUPPORTED_V5_PROPS_MAP = {
  18553. number: ['decimalSize', 'useGrouping', 'numberLabel', 'numberLabelPosition', 'whenMissing'],
  18554. currency: ['decimalSize', 'currencyCode', 'currencySymbol', 'useIntlSymbol', 'useGrouping', 'numberLabel', 'numberLabelPosition', 'whenMissing'],
  18555. percent: ['decimalSize', 'useGrouping', 'whenMissing'],
  18556. date: ['dateStyle', 'dateSeparator', 'displayOrder', 'whenMissing'],
  18557. datetime: ['dateStyle', 'timeStyle'],
  18558. time: ['timeStyle', 'whenMissing'],
  18559. text: ['whenMissing']
  18560. };
  18561. var SUPPORTED_V5_PROPS = ['decimalSize', 'currencyCode', 'currencySymbol', 'useIntlSymbol', 'useGrouping', 'dateStyle', 'timeStyle', 'numberLabel', 'numberLabelPosition', 'whenMissing'];
  18562. var SUPPORTED_V5_TYPES = ['numberFormat', 'currencyFormat', 'percentFormat', 'dateFormat', 'dateTimeFormat', 'timeFormat', 'stringFormat'];
  18563. /**
  18564. * Convert an ICU format json spec into a format spec that our formatter understands
  18565. *
  18566. */
  18567. FormatUtils = Class.extend({
  18568. /**
  18569. * Get the formatted value of a raw value, based on a V5 format spec
  18570. *
  18571. * @param value - raw value
  18572. * @param moserObject - MoserObject corresponding to where the value is from
  18573. * @param spec - model v5 format spec (optional)
  18574. *
  18575. */
  18576. format: function format(value, moserObject, spec) {
  18577. var formatSpec = spec ? spec : moserObject.getFormat();
  18578. if (!formatSpec) {
  18579. return value;
  18580. }
  18581. var finalSpec = this.getFormatSpec(formatSpec);
  18582. // Dev flag for testing new formatter currently being implemented:
  18583. // if (devFlag) { return newFormatter(value, moserObject, spec); }
  18584. if (finalSpec) {
  18585. return formatter.format(value, this.getFormatSpec(spec));
  18586. }
  18587. return value;
  18588. },
  18589. getFormatSpec: function getFormatSpec(specString) {
  18590. var formatSpec = null;
  18591. if (specString) {
  18592. try {
  18593. var spec = _.isObject(specString) ? specString : JSON.parse(specString);
  18594. formatSpec = this._getFormatSpec(spec);
  18595. } catch (e) {
  18596. // TODO: log when the glass logging is available
  18597. console.error('Invalid format spec: ' + specString);
  18598. }
  18599. }
  18600. return formatSpec;
  18601. },
  18602. /**
  18603. * Get the equivalen format spec from a model format spec
  18604. *
  18605. * @param modelSpec - model format spec
  18606. *
  18607. */
  18608. _getFormatSpec: function _getFormatSpec(modelSpec) {
  18609. var formatGroup = this._getFormatGroup(modelSpec);
  18610. // Pick the first property
  18611. var modelSpecSection = null;
  18612. var name;
  18613. if (formatGroup) {
  18614. for (name in formatGroup) {
  18615. if (formatGroup.hasOwnProperty(name)) {
  18616. modelSpecSection = formatGroup[name];
  18617. break;
  18618. }
  18619. }
  18620. }
  18621. var spec = null;
  18622. if (modelSpecSection && name in TYPE_MAP) {
  18623. spec = {
  18624. type: TYPE_MAP[name]
  18625. };
  18626. this._fillInSpecProperties(spec, formatGroup);
  18627. }
  18628. return spec;
  18629. },
  18630. /**
  18631. * Add all properties from a model spec to the format spec
  18632. *
  18633. * @param spec - format spec
  18634. * @param modelSpec - model format spec
  18635. */
  18636. _fillInSpecProperties: function _fillInSpecProperties(spec, modelSpec) {
  18637. var flatSpec = {};
  18638. _.each(modelSpec, function (group) {
  18639. for (var key in group) {
  18640. flatSpec[key] = group[key];
  18641. }
  18642. });
  18643. var supportedV5Props = SUPPORTED_V5_PROPS_MAP[spec.type];
  18644. _.each(supportedV5Props, function (prop) {
  18645. var propName = V5_PROP_MAP[prop];
  18646. if (_.isObject(propName)) {
  18647. _.extend(spec, propName(flatSpec));
  18648. } else {
  18649. var value = flatSpec[prop];
  18650. if (value !== undefined) {
  18651. spec[propName] = value;
  18652. }
  18653. }
  18654. });
  18655. },
  18656. /**
  18657. * Get the value of a given format spec property from the model format spec
  18658. *
  18659. * @param name - format spec property name
  18660. * @param modelSpec - model spec
  18661. */
  18662. _getPropValue: function _getPropValue(name, modelSpec) {
  18663. var value;
  18664. var modelSpecName = V5_PROP_MAP[name];
  18665. if (modelSpecName && _.isFunction(modelSpecName)) {
  18666. value = modelSpecName(modelSpec);
  18667. } else {
  18668. value = modelSpec[modelSpecName];
  18669. }
  18670. return value;
  18671. },
  18672. _getFormatGroup: function _getFormatGroup(spec) {
  18673. return spec.formatGroup || spec.format && spec.format.formatGroup;
  18674. },
  18675. /**
  18676. * Get the V5 properties supported by the formatter
  18677. * @return {String[]}
  18678. */
  18679. getSupportedV5Props: function getSupportedV5Props() {
  18680. return SUPPORTED_V5_PROPS;
  18681. },
  18682. /**
  18683. * Get the formatter supported format type from the model format type (V5 spec format type)
  18684. * @param type - The model format type (V5 spec format type)
  18685. */
  18686. getFormatType: function getFormatType(type) {
  18687. return TYPE_MAP[type];
  18688. },
  18689. /**
  18690. * Get the V5 types supported by the formatter
  18691. * @return {String[]}
  18692. */
  18693. getSupportedV5Types: function getSupportedV5Types() {
  18694. return SUPPORTED_V5_TYPES;
  18695. }
  18696. });
  18697. return new FormatUtils();
  18698. });
  18699. //# sourceMappingURL=V5Formatter.js.map
  18700. ;
  18701. define("js/glass/bundle", function(){});